From be22b37ebe6b6808e8ad88f5bf955eb600082665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otakar=20Mare=C4=8Dek?= Date: Fri, 7 Aug 2015 15:36:47 +0300 Subject: [PATCH 0001/3232] Add cache of configuration files list --- lib/internal/Magento/Framework/Module/Dir/Reader.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Module/Dir/Reader.php b/lib/internal/Magento/Framework/Module/Dir/Reader.php index 5f5167f88efa7..36073670ca790 100644 --- a/lib/internal/Magento/Framework/Module/Dir/Reader.php +++ b/lib/internal/Magento/Framework/Module/Dir/Reader.php @@ -48,6 +48,13 @@ class Reader */ protected $fileIteratorFactory; + /** + * Cache storage + * + * @var array + */ + protected $cache = []; + /** * @param Dir $moduleDirs * @param ModuleListInterface $moduleList @@ -74,6 +81,9 @@ public function __construct( */ public function getConfigurationFiles($filename) { + if (isset($this->cache[$filename])) { + return $this->cache[$filename]; + } $result = []; foreach ($this->modulesList->getNames() as $moduleName) { $file = $this->getModuleDir('etc', $moduleName) . '/' . $filename; @@ -82,7 +92,7 @@ public function getConfigurationFiles($filename) $result[] = $path; } } - return $this->fileIteratorFactory->create($this->modulesDirectory, $result); + return $this->cache[$filename] = $this->fileIteratorFactory->create($this->modulesDirectory, $result); } /** From 30a49aabb35f1f57ae4452b7da3bb78c57976ccd Mon Sep 17 00:00:00 2001 From: Laura Kishimoto Date: Wed, 30 Sep 2015 14:46:03 +0100 Subject: [PATCH 0002/3232] Inline link template correction Use inline `span` elements instead of divs for inline link templates. --- .../Cms/view/frontend/templates/widget/link/link_inline.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/view/frontend/templates/widget/link/link_inline.phtml b/app/code/Magento/Cms/view/frontend/templates/widget/link/link_inline.phtml index 3004d3191f7c5..aa288cc38fb2d 100644 --- a/app/code/Magento/Cms/view/frontend/templates/widget/link/link_inline.phtml +++ b/app/code/Magento/Cms/view/frontend/templates/widget/link/link_inline.phtml @@ -4,8 +4,8 @@ * See COPYING.txt for license details. */ ?> - + From 93990b90bf6400cc8b1329ad6c02de049b97fb7a Mon Sep 17 00:00:00 2001 From: Laura Kishimoto Date: Wed, 30 Sep 2015 14:46:29 +0100 Subject: [PATCH 0003/3232] Inline link template correction Use inline `span` elements. --- .../frontend/templates/product/widget/link/link_inline.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml index e977e14e25f1e..e2e0f397f4401 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/link/link_inline.phtml @@ -4,6 +4,6 @@ * See COPYING.txt for license details. */ ?> - + From 4afef6302fb5067b0ffbc85bf5adb023a11d1826 Mon Sep 17 00:00:00 2001 From: Alessandro Ronchi Date: Mon, 14 Mar 2016 22:14:14 +0100 Subject: [PATCH 0004/3232] Add view_block_abstract_to_html_after event to toHtml() method --- .../Unit/Block/Adminhtml/Product/Options/AjaxTest.php | 2 +- .../Test/Unit/Block/Product/Widget/NewWidgetTest.php | 2 +- .../Paypal/Test/Unit/Block/Billing/AgreementsTest.php | 7 ++++++- .../Persistent/Test/Unit/Block/Header/AdditionalTest.php | 6 +++++- .../Widget/Instance/Edit/Chooser/ContainerTest.php | 8 ++++---- .../Magento/Framework/View/Element/AbstractBlock.php | 9 +++++++++ 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Options/AjaxTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Options/AjaxTest.php index 64a4a55f1e1b2..2af0784413c5f 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Options/AjaxTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Options/AjaxTest.php @@ -50,7 +50,7 @@ public function testToHtml() ->disableOriginalConstructor() ->setMethods(['dispatch']) ->getMock(); - $eventManager->expects($this->once())->method('dispatch')->will($this->returnValue(true)); + $eventManager->expects($this->exactly(2))->method('dispatch')->will($this->returnValue(true)); $scopeConfig = $this->getMockBuilder('\Magento\Framework\App\Config') ->setMethods(['getValue']) diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/Widget/NewWidgetTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/Widget/NewWidgetTest.php index 9cd7790436de6..dc787d28d5f61 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/Widget/NewWidgetTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/Widget/NewWidgetTest.php @@ -170,7 +170,7 @@ public function testGetProductsCount() protected function generalGetProductCollection() { - $this->eventManager->expects($this->once())->method('dispatch') + $this->eventManager->expects($this->exactly(2))->method('dispatch') ->will($this->returnValue(true)); $this->scopeConfig->expects($this->once())->method('getValue')->withAnyParameters() ->willReturn(false); diff --git a/app/code/Magento/Paypal/Test/Unit/Block/Billing/AgreementsTest.php b/app/code/Magento/Paypal/Test/Unit/Block/Billing/AgreementsTest.php index 88a0c737fc440..82ffa14736435 100644 --- a/app/code/Magento/Paypal/Test/Unit/Block/Billing/AgreementsTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Block/Billing/AgreementsTest.php @@ -227,9 +227,14 @@ public function testGetWizardPaymentMethodOptions() public function testToHtml() { $this->eventManager - ->expects($this->once()) + ->expects($this->at(0)) ->method('dispatch') ->with('view_block_abstract_to_html_before', ['block' => $this->block]); + $transport = new \Magento\Framework\DataObject(['html' => '']); + $this->eventManager + ->expects($this->at(1)) + ->method('dispatch') + ->with('view_block_abstract_to_html_after', ['block' => $this->block, 'transport' => $transport]); $this->scopeConfig ->expects($this->once()) ->method('getValue') diff --git a/app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php b/app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php index 0b4a58788749e..1220a42652d0a 100644 --- a/app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php @@ -261,9 +261,13 @@ public function testToHtml($customerId) $this->additional->setData('cache_lifetime', 789); $this->additional->setData('cache_key', 'cache-key'); - $this->eventManagerMock->expects($this->once()) + $this->eventManagerMock->expects($this->at(0)) ->method('dispatch') ->with('view_block_abstract_to_html_before', ['block' => $this->additional]); + $transport = new \Magento\Framework\DataObject(['html' => '']); + $this->eventManagerMock->expects($this->at(1)) + ->method('dispatch') + ->with('view_block_abstract_to_html_after'); $this->scopeConfigMock->expects($this->once()) ->method('getValue') ->with( diff --git a/app/code/Magento/Widget/Test/Unit/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php b/app/code/Magento/Widget/Test/Unit/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php index 9316be68fa739..f767391e53ab8 100644 --- a/app/code/Magento/Widget/Test/Unit/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php +++ b/app/code/Magento/Widget/Test/Unit/Block/Adminhtml/Widget/Instance/Edit/Chooser/ContainerTest.php @@ -66,7 +66,7 @@ public function testToHtmlCatalogProductsListGroupedProduct() . 'Main Content Area' . ''; - $this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true); + $this->eventManagerMock->expects($this->exactly(2))->method('dispatch')->willReturn(true); $this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false); $this->themeCollectionFactoryMock->expects($this->once()) @@ -153,7 +153,7 @@ public function testToHtmlCatalogCategoryLinkSimpleProduct() . '' . ''; - $this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true); + $this->eventManagerMock->expects($this->exactly(2))->method('dispatch')->willReturn(true); $this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false); $this->themeCollectionFactoryMock->expects($this->once()) @@ -284,7 +284,7 @@ public function testToHtmlCmsStaticBlockAllProductTypes() . '' . ''; - $this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true); + $this->eventManagerMock->expects($this->exactly(2))->method('dispatch')->willReturn(true); $this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false); $this->themeCollectionFactoryMock->expects($this->once()) @@ -402,7 +402,7 @@ public function testToHtmlOrderBySkuAllPages() . ''; - $this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true); + $this->eventManagerMock->expects($this->exactly(2))->method('dispatch')->willReturn(true); $this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false); $this->themeCollectionFactoryMock->expects($this->once()) diff --git a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php index 2a48f91117cc1..9ccf07b61b745 100644 --- a/lib/internal/Magento/Framework/View/Element/AbstractBlock.php +++ b/lib/internal/Magento/Framework/View/Element/AbstractBlock.php @@ -665,6 +665,15 @@ public function toHtml() } $html = $this->_afterToHtml($html); + /** @var \Magento\Framework\DataObject */ + $transportObject = new \Magento\Framework\DataObject( + [ + 'html' => $html, + ] + ); + $this->_eventManager->dispatch('view_block_abstract_to_html_after', ['block' => $this, 'transport' => $transportObject]); + $html = $transportObject->getHtml(); + return $html; } From 05b40d143a5e2e397cc79df6fa135169efb04d2d Mon Sep 17 00:00:00 2001 From: Alessandro Ronchi Date: Mon, 14 Mar 2016 22:18:22 +0100 Subject: [PATCH 0005/3232] Remove unused variable --- .../Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php b/app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php index 1220a42652d0a..c75c8a7164ff2 100644 --- a/app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Block/Header/AdditionalTest.php @@ -264,7 +264,6 @@ public function testToHtml($customerId) $this->eventManagerMock->expects($this->at(0)) ->method('dispatch') ->with('view_block_abstract_to_html_before', ['block' => $this->additional]); - $transport = new \Magento\Framework\DataObject(['html' => '']); $this->eventManagerMock->expects($this->at(1)) ->method('dispatch') ->with('view_block_abstract_to_html_after'); From 01d907a9e0928d69ecb647746108fe45cbcc26e7 Mon Sep 17 00:00:00 2001 From: Dariusz Maciejewski Date: Mon, 11 Apr 2016 10:43:44 +0200 Subject: [PATCH 0006/3232] Fix queue subscribers adding performance --- .../Magento/Newsletter/Model/ResourceModel/Queue.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Newsletter/Model/ResourceModel/Queue.php b/app/code/Magento/Newsletter/Model/ResourceModel/Queue.php index 12375a5a6ca07..01cbd61b2dd83 100644 --- a/app/code/Magento/Newsletter/Model/ResourceModel/Queue.php +++ b/app/code/Magento/Newsletter/Model/ResourceModel/Queue.php @@ -80,13 +80,13 @@ public function addSubscribersToQueue(ModelQueue $queue, array $subscriberIds) $subscriberIds ); - $usedIds = $connection->fetchCol($select); + $usedIds = array_flip($connection->fetchCol($select)); + $subscriberIds = array_flip($subscriberIds); + $newIds = array_diff_key($subscriberIds, $usedIds); + $connection->beginTransaction(); try { - foreach ($subscriberIds as $subscriberId) { - if (in_array($subscriberId, $usedIds)) { - continue; - } + foreach ($newIds as $subscriberId) { $data = []; $data['queue_id'] = $queue->getId(); $data['subscriber_id'] = $subscriberId; From 7f864ddb3474f305a090a853c7aa97e2398ecbd1 Mon Sep 17 00:00:00 2001 From: Sam Marcus Date: Wed, 13 Apr 2016 03:51:35 -0400 Subject: [PATCH 0007/3232] Added call to action to compile command error The original informational message stated the situation but did not suggest how to resolve it. By suggesting how to rectify the situation, it is far more useful than sending the user on a goose chase. --- setup/src/Magento/Setup/Console/Command/UpgradeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php b/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php index 44064e4b9409f..b5a15bc87ee0f 100644 --- a/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php +++ b/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php @@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $installer->installSchema(); $installer->installDataFixtures(); if (!$keepGenerated) { - $output->writeln('Please re-run Magento compile command'); + $output->writeln('Please re-run Magento compile command. This may be done with setup:di:compile'); } } } From 2056e4bc854fae5f19b1d6d2909caab0e0c38d67 Mon Sep 17 00:00:00 2001 From: Facundo Capua Date: Wed, 23 Sep 2015 09:49:00 -0300 Subject: [PATCH 0008/3232] Added 'target' attribute to the allowed attributes array for link block --- lib/internal/Magento/Framework/View/Element/Html/Link.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/internal/Magento/Framework/View/Element/Html/Link.php b/lib/internal/Magento/Framework/View/Element/Html/Link.php index c4e5460c7de0b..e6f22f14784e0 100644 --- a/lib/internal/Magento/Framework/View/Element/Html/Link.php +++ b/lib/internal/Magento/Framework/View/Element/Html/Link.php @@ -22,6 +22,7 @@ class Link extends \Magento\Framework\View\Element\Template 'title', 'charset', 'name', + 'target', 'hreflang', 'rel', 'rev', From 6dd36ba23b15586e14954c1439537fa5fa8d11b0 Mon Sep 17 00:00:00 2001 From: dank00 Date: Tue, 12 Apr 2016 16:25:04 +0100 Subject: [PATCH 0009/3232] Ensure composer.json exists Before json encoding suggests. The current implementation forces all modules to have a composer.json file or they cannot install sample data. --- app/code/Magento/SampleData/Model/Dependency.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index 09f0c16aac848..2a1849364bd77 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -88,6 +88,10 @@ protected function getSuggestsFromModules() foreach ($this->componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleDir) { $file = $moduleDir . '/composer.json'; + if (!file_exists($file) || !is_readable($file)) { + continue; + } + /** @var Package $package */ $package = $this->getModuleComposerPackage($file); $suggest = json_decode(json_encode($package->get('suggest')), true); From c34bd624a7b742a19bc277cf4d8dac85c76edb40 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Tue, 17 May 2016 13:39:07 +0300 Subject: [PATCH 0010/3232] MAGETWO-52788: [UI Component] Dynamic Rows: support status being changed - and fix dnd --- .../Ui/view/base/web/js/dynamic-rows/dnd.js | 5 +- .../web/js/dynamic-rows/dynamic-rows-grid.js | 2 +- .../base/web/js/dynamic-rows/dynamic-rows.js | 111 +++++++++++++++++- 3 files changed, 112 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js index e52177f74e461..594e300145b3a 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js @@ -131,7 +131,8 @@ define([ drEl.instance = recordNode = this.processingStyles(recordNode, elem); drEl.instanceCtx = this.getRecord(originRecord[0]); drEl.eventMousedownY = isTouchDevice ? event.originalEvent.touches[0].pageY : event.pageY; - drEl.minYpos = $table.offset().top - originRecord.offset().top + $table.find('thead').outerHeight(); + drEl.minYpos = + $table.offset().top - originRecord.offset().top + $table.find('thead').outerHeight(); drEl.maxYpos = drEl.minYpos + $table.find('tbody').outerHeight() - originRecord.outerHeight(); $tableWrapper.append(recordNode); @@ -189,7 +190,7 @@ define([ pageY = isTouchDevice ? event.originalEvent.touches[0].pageY : event.pageY, positionY = pageY - drEl.eventMousedownY; - drEl.depElement = this.getDepElement(drEl.instance, positionY); + drEl.depElement = this.getDepElement(drEl.instance, positionY, this.draggableElement.originRow); if (drEl.depElement) { depElementCtx = this.getRecord(drEl.depElement.elem[0]); diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js index bbc6033df0041..90e12a2bce357 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js @@ -22,7 +22,7 @@ define([ identificationDRProperty: 'id', listens: { 'insertData': 'processingInsertData', - 'recordData': 'initElements setToInsertData' + 'recordData': 'initElements setToInsertData, checkDefaultState' } }, diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 37df101b208fb..7c7b57b48df74 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -36,6 +36,8 @@ define([ deleteValue: true, showSpinner: true, isDifferedFromDefault: false, + defaultState: [], + isDefaultState: true, fallbackResetTpl: 'ui/form/element/helper/fallback-reset-link', dndConfig: { name: '${ $.name }_dnd', @@ -60,9 +62,10 @@ define([ disabled: 'setDisabled', childTemplate: 'initHeader', recordTemplate: 'onUpdateRecordTemplate', - recordData: 'setDifferedFromDefault parsePagesData', + recordData: 'setDifferedFromDefault parsePagesData checkDefaultState', currentPage: 'changePage', - elems: 'checkSpinner' + elems: 'checkSpinner', + isDefaultState: 'updateTrigger' }, modules: { dnd: '${ $.dndConfig.name }' @@ -83,6 +86,7 @@ define([ */ initialize: function () { this._super() + .initDefaultState() .initChildren() .initDnd() .setColumnsHeaderListener() @@ -109,7 +113,8 @@ define([ 'disabled', 'labels', 'showSpinner', - 'isDifferedFromDefault' + 'isDifferedFromDefault', + 'isDefaultState' ]); return this; @@ -142,6 +147,106 @@ define([ return this; }, + /** + * Check default component state or not + * + * @param {Array} data - records data + */ + checkDefaultState: function (data) { + var result = true, + recordsData = utils.copy(this.recordData()) || data, + i = 0, + length = this.defaultState.length, + currentData = this.deleteProperty ? + _.filter(recordsData, function (elem) { + return elem[this.deleteProperty] !== this.deleteValue; + }, this) : recordsData; + + if (length !== currentData.length) { + this.isDefaultState(false); + + return; + } + + for (i; i < length; i++) { + if (!this._compareObject(this.defaultState[i], currentData[i])) { + result = false; + break; + } + } + + this.isDefaultState(result); + }, + + /** + * Compare objects. Compared only properties from origin object, + * if current object has more properties - they are not considered + * + * @param {Object} origin - first object + * @param {Object} current - second object + * + * @returns {Boolean} result - is equal this objects or not + */ + _compareObject: function (origin, current) { + var prop, + result = true; + + for (prop in origin) { + if (this._castValue(origin[prop]) != this._castValue(current[prop])) { + result = false; + break; + } + } + + return result; + }, + + /** + * Check value type and cast to boolean if needed + * + * @param {*} value + * + * @returns {Boolean|*} casted or origin value + */ + _castValue: function (value) { + if (_.isUndefined(value) || value === '' || _.isNull(value)) { + return false; + } else { + return value; + } + }, + + /** + * Init default component state + * + * @param {Array} data + * + * @returns Chainable. + */ + initDefaultState: function (data) { + var defaultState = data || utils.copy(this.recordData()); + + this.defaultState = defaultState; + + return this; + }, + + /** + * Triggered update event + * + * @param {Boolean} val + */ + updateTrigger: function (val) { + this.trigger('update', !val); + }, + + /** + * Was changes or not + */ + hasChanged: function () { + return !this.isDefaultState(); + }, + /** * Render column header */ From 2490db2e3c5315dbdd97b41a55cb553fc721ffef Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Tue, 17 May 2016 14:29:04 +0300 Subject: [PATCH 0011/3232] MAGETWO-52788: [UI Component] Dynamic Rows: support status being changed --- .../Ui/view/base/web/js/dynamic-rows/dynamic-rows.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 7c7b57b48df74..d3c468895e800 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -148,7 +148,7 @@ define([ }, /** - * Check default component state or not + * Checks whether component's state is default or not * * @param {Array} data - records data */ @@ -192,7 +192,11 @@ define([ result = true; for (prop in origin) { - if (this._castValue(origin[prop]) != this._castValue(current[prop])) { + if (_.isObject(origin[prop]) && _.isObject(current[prop])) { + if (!this._compareObject(origin[prop], current[prop])) { + return false; + } + } else if (this._castValue(origin[prop]) != this._castValue(current[prop])) { result = false; break; } From 04364c7ad8913a129e21595c18cea84f2a43a752 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Tue, 17 May 2016 14:33:28 +0300 Subject: [PATCH 0012/3232] MAGETWO-52788: [UI Component] Dynamic Rows: support status being changed --- .../Ui/view/base/web/js/dynamic-rows/dynamic-rows.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index d3c468895e800..0e9d354109106 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -188,8 +188,7 @@ define([ * @returns {Boolean} result - is equal this objects or not */ _compareObject: function (origin, current) { - var prop, - result = true; + var prop; for (prop in origin) { if (_.isObject(origin[prop]) && _.isObject(current[prop])) { @@ -197,12 +196,11 @@ define([ return false; } } else if (this._castValue(origin[prop]) != this._castValue(current[prop])) { - result = false; - break; + return false; } } - return result; + return true; }, /** From 3a53abee9d82990757bc3881d56ee6365c958405 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Tue, 17 May 2016 16:30:36 +0300 Subject: [PATCH 0013/3232] MAGETWO-52788: [UI Component] Dynamic Rows: support status being changed --- .../base/web/js/dynamic-rows/dynamic-rows.js | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 0e9d354109106..dc8dd0ee42f89 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -121,7 +121,7 @@ define([ }, /** - * Init DND module + * Inits DND module * * @returns {Object} Chainable. */ @@ -134,7 +134,7 @@ define([ }, /** - * Check columnsHeaderAfterRender property, + * Checks columnsHeaderAfterRender property, * and set listener on elems if needed * * @returns {Object} Chainable. @@ -149,12 +149,10 @@ define([ /** * Checks whether component's state is default or not - * - * @param {Array} data - records data */ - checkDefaultState: function (data) { + checkDefaultState: function () { var result = true, - recordsData = utils.copy(this.recordData()) || data, + recordsData = utils.copy(this.recordData()), i = 0, length = this.defaultState.length, currentData = this.deleteProperty ? @@ -179,7 +177,7 @@ define([ }, /** - * Compare objects. Compared only properties from origin object, + * Compares objects. Compares only properties from origin object, * if current object has more properties - they are not considered * * @param {Object} origin - first object @@ -204,7 +202,7 @@ define([ }, /** - * Check value type and cast to boolean if needed + * Checks value type and cast to boolean if needed * * @param {*} value * @@ -219,7 +217,7 @@ define([ }, /** - * Init default component state + * Inits default component state * * @param {Array} data * @@ -234,7 +232,7 @@ define([ }, /** - * Triggered update event + * Triggers update event * * @param {Boolean} val */ @@ -243,7 +241,7 @@ define([ }, /** - * Was changes or not + * Returns component state */ hasChanged: function () { return !this.isDefaultState(); From 1d663b2a8030f8a253e719d5186eb59083dcaa84 Mon Sep 17 00:00:00 2001 From: Maddesto Date: Thu, 19 May 2016 10:58:04 +0300 Subject: [PATCH 0014/3232] Update Container.php get block group from data array --- app/code/Magento/Backend/Block/Widget/Form/Container.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/code/Magento/Backend/Block/Widget/Form/Container.php b/app/code/Magento/Backend/Block/Widget/Form/Container.php index 52c5525db17eb..d697795424dd3 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Container.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Container.php @@ -37,6 +37,11 @@ class Container extends \Magento\Backend\Block\Widget\Container * @var string */ protected $_blockGroup = 'Magento_Backend'; + + /** + * @var string + * / + const PARAM_BLOCK_GROUP = 'block_group'; /** * @var string @@ -49,6 +54,10 @@ class Container extends \Magento\Backend\Block\Widget\Container protected function _construct() { parent::_construct(); + + if ($this->hasData(self::PARAM_BLOCK_GROUP)) { + $this->_blockGroup = $this->_getData(self::PARAM_BLOCK_GROUP); + } $this->addButton( 'back', From 8b4500055c69c62b02a23be664b06174d34d0ba0 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Mon, 23 May 2016 10:36:07 +0300 Subject: [PATCH 0015/3232] MAGETWO-52788: [UI Component] Dynamic Rows: support status being changed --- .../base/web/js/dynamic-rows/dynamic-rows.js | 52 ++++++++++++++----- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index dc8dd0ee42f89..2446b124ab254 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -153,27 +153,49 @@ define([ checkDefaultState: function () { var result = true, recordsData = utils.copy(this.recordData()), - i = 0, - length = this.defaultState.length, currentData = this.deleteProperty ? _.filter(recordsData, function (elem) { return elem[this.deleteProperty] !== this.deleteValue; }, this) : recordsData; - if (length !== currentData.length) { - this.isDefaultState(false); + if (_.isArray(this.defaultState)) { + result = this._compareArrays(this.defaultState, currentData); + } + + this.isDefaultState(result); + }, + + /** + * Compares arrays. + * + * @param {Object} origin - first array + * @param {Object} current - second array + * + * @returns {Boolean} result - is equal this arrays or not + */ + _compareArrays: function (origin, current) { + var index = 0, + length = origin.length; - return; + if (origin.length !== current.length) { + return false; } - for (i; i < length; i++) { - if (!this._compareObject(this.defaultState[i], currentData[i])) { - result = false; - break; + for (index; index < length; index++) { + if (_.isArray(origin[index]) && _.isArray(current[index])) { + if (!this._compareArrays(origin[index], current[index])) { + return false; + } + } else if (typeof origin[index] === 'object' && typeof current[index] === 'object') { + if (!this._compareObject(origin[index], current[index])) { + return false; + } + } else if (this._castValue(origin[index]) != this._castValue(current[index])){ + return false } } - this.isDefaultState(result); + return true; }, /** @@ -189,12 +211,16 @@ define([ var prop; for (prop in origin) { - if (_.isObject(origin[prop]) && _.isObject(current[prop])) { + if (_.isArray(origin[prop]) && _.isArray(current[prop])) { + if (!this._compareArrays(origin[prop], current[prop])) { + return false; + } + } else if (typeof origin[prop] === 'object' && typeof current[prop] === 'object') { if (!this._compareObject(origin[prop], current[prop])) { return false; } - } else if (this._castValue(origin[prop]) != this._castValue(current[prop])) { - return false; + } else if (this._castValue(origin[prop]) != this._castValue(current[prop])){ + return false } } From 65e7a6dd2b0eb2a598fb109b5d4fff89dbb1ea79 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Mon, 23 May 2016 11:37:13 +0300 Subject: [PATCH 0016/3232] MAGETWO-52788: [UI Component] Dynamic Rows: support status being changed - fix codestyle --- .../base/web/js/dynamic-rows/dynamic-rows.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 2446b124ab254..e7fbf182f0866 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -181,6 +181,7 @@ define([ return false; } + /*eslint-disable max-depth, eqeqeq */ for (index; index < length; index++) { if (_.isArray(origin[index]) && _.isArray(current[index])) { if (!this._compareArrays(origin[index], current[index])) { @@ -190,10 +191,10 @@ define([ if (!this._compareObject(origin[index], current[index])) { return false; } - } else if (this._castValue(origin[index]) != this._castValue(current[index])){ - return false + } else if (this._castValue(origin[index]) != this._castValue(current[index])) { + return false; } - } + }/*eslint-enable max-depth, eqeqeq */ return true; }, @@ -210,6 +211,7 @@ define([ _compareObject: function (origin, current) { var prop; + /*eslint-disable max-depth, eqeqeq*/ for (prop in origin) { if (_.isArray(origin[prop]) && _.isArray(current[prop])) { if (!this._compareArrays(origin[prop], current[prop])) { @@ -219,10 +221,10 @@ define([ if (!this._compareObject(origin[prop], current[prop])) { return false; } - } else if (this._castValue(origin[prop]) != this._castValue(current[prop])){ - return false + } else if (this._castValue(origin[prop]) != this._castValue(current[prop])) { + return false; } - } + }/*eslint-enable max-depth, eqeqeq */ return true; }, @@ -237,9 +239,9 @@ define([ _castValue: function (value) { if (_.isUndefined(value) || value === '' || _.isNull(value)) { return false; - } else { - return value; } + + return value; }, /** @@ -251,7 +253,7 @@ define([ */ initDefaultState: function (data) { var defaultState = data || utils.copy(this.recordData()); - + this.defaultState = defaultState; return this; @@ -270,7 +272,7 @@ define([ * Returns component state */ hasChanged: function () { - return !this.isDefaultState(); + return !this.isDefaultState(); }, /** From 5e00e7695d3e27ad8dce3c65a68f01277df14399 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Tue, 24 May 2016 15:30:42 +0300 Subject: [PATCH 0017/3232] MAGETWO-52788: [UI Component] Dynamic Rows: support status being changed --- .../base/web/js/dynamic-rows/dynamic-rows.js | 157 +++++++++--------- 1 file changed, 78 insertions(+), 79 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index e7fbf182f0866..324e429e67f58 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -14,6 +14,83 @@ define([ ], function (ko, utils, _, layout, uiCollection, registry, $t) { 'use strict'; + /** + * Compares arrays. + * + * @param {Array} base - array as method bases its decision on first argument. + * @param {Array} current - second array + * + * @returns {Boolean} result - is current array equal to base array + */ + function compareArrays(base, current) { + var index = 0, + length = base.length; + + if (base.length !== current.length) { + return false; + } + + /*eslint-disable max-depth, eqeqeq */ + for (index; index < length; index++) { + if (_.isArray(base[index]) && _.isArray(current[index])) { + if (!compareArrays(base[index], current[index])) { + return false; + } + } else if (typeof base[index] === 'object' && typeof current[index] === 'object') { + if (!compareObjects(base[index], current[index])) { + return false; + } + } else if (castValue(base[index]) != castValue(current[index])) { + return false; + } + }/*eslint-enable max-depth, eqeqeq */ + + return true; + } + + /** + * Compares objects. Compares only properties from origin object, + * if current object has more properties - they are not considered + * + * @param {Object} base - first object + * @param {Object} current - second object + * + * @returns {Boolean} result - is current object equal to base object + */ + function compareObjects(base, current) { + var prop; + + /*eslint-disable max-depth, eqeqeq*/ + for (prop in base) { + if (_.isArray(base[prop]) && _.isArray(current[prop])) { + if (!compareArrays(base[prop], current[prop])) { + return false; + } + } else if (typeof base[prop] === 'object' && typeof current[prop] === 'object') { + if (!compareObjects(base[prop], current[prop])) { + return false; + } + } else if (castValue(base[prop]) != castValue(current[prop])) { + return false; + } + }/*eslint-enable max-depth, eqeqeq */ + } + + /** + * Checks value type and cast to boolean if needed + * + * @param {*} value + * + * @returns {Boolean|*} casted or origin value + */ + function castValue(value) { + if (_.isUndefined(value) || value === '' || _.isNull(value)) { + return false; + } + + return value; + } + return uiCollection.extend({ defaults: { defaultRecord: false, @@ -159,90 +236,12 @@ define([ }, this) : recordsData; if (_.isArray(this.defaultState)) { - result = this._compareArrays(this.defaultState, currentData); + result = compareArrays(this.defaultState, currentData); } this.isDefaultState(result); }, - /** - * Compares arrays. - * - * @param {Object} origin - first array - * @param {Object} current - second array - * - * @returns {Boolean} result - is equal this arrays or not - */ - _compareArrays: function (origin, current) { - var index = 0, - length = origin.length; - - if (origin.length !== current.length) { - return false; - } - - /*eslint-disable max-depth, eqeqeq */ - for (index; index < length; index++) { - if (_.isArray(origin[index]) && _.isArray(current[index])) { - if (!this._compareArrays(origin[index], current[index])) { - return false; - } - } else if (typeof origin[index] === 'object' && typeof current[index] === 'object') { - if (!this._compareObject(origin[index], current[index])) { - return false; - } - } else if (this._castValue(origin[index]) != this._castValue(current[index])) { - return false; - } - }/*eslint-enable max-depth, eqeqeq */ - - return true; - }, - - /** - * Compares objects. Compares only properties from origin object, - * if current object has more properties - they are not considered - * - * @param {Object} origin - first object - * @param {Object} current - second object - * - * @returns {Boolean} result - is equal this objects or not - */ - _compareObject: function (origin, current) { - var prop; - - /*eslint-disable max-depth, eqeqeq*/ - for (prop in origin) { - if (_.isArray(origin[prop]) && _.isArray(current[prop])) { - if (!this._compareArrays(origin[prop], current[prop])) { - return false; - } - } else if (typeof origin[prop] === 'object' && typeof current[prop] === 'object') { - if (!this._compareObject(origin[prop], current[prop])) { - return false; - } - } else if (this._castValue(origin[prop]) != this._castValue(current[prop])) { - return false; - } - }/*eslint-enable max-depth, eqeqeq */ - - return true; - }, - - /** - * Checks value type and cast to boolean if needed - * - * @param {*} value - * - * @returns {Boolean|*} casted or origin value - */ - _castValue: function (value) { - if (_.isUndefined(value) || value === '' || _.isNull(value)) { - return false; - } - - return value; - }, /** * Inits default component state From 0812f6f8f4f3af957168bc9f8ec527e4eb0ab529 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Tue, 24 May 2016 16:51:59 +0300 Subject: [PATCH 0018/3232] MAGETWO-52788: [UI Component] Dynamic Rows: support status being changed --- .../Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js | 4 ++-- .../Ui/view/base/web/js/dynamic-rows/dynamic-rows.js | 6 ++++++ .../base/web/templates/dynamic-rows/templates/default.html | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js index 90e12a2bce357..16ce4e1620f7c 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js @@ -22,7 +22,7 @@ define([ identificationDRProperty: 'id', listens: { 'insertData': 'processingInsertData', - 'recordData': 'initElements setToInsertData, checkDefaultState' + 'recordData': 'initElements setToInsertData checkDefaultState' } }, @@ -46,7 +46,7 @@ define([ setToInsertData: function () { var insertData = [], obj; - + if (this.recordData().length && !this.update) { this.recordData.each(function (recordData) { obj = {}; diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 324e429e67f58..4412388596eaa 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -74,6 +74,8 @@ define([ return false; } }/*eslint-enable max-depth, eqeqeq */ + + return true; } /** @@ -210,6 +212,10 @@ define([ return this; }, + compareArrays: function (o, r) { + return compareArrays(o,r); + }, + /** * Checks columnsHeaderAfterRender property, * and set listener on elems if needed diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html index b69c6b0de652a..b5f4541b64882 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html @@ -51,7 +51,8 @@ - + diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 7c312d0745206..62aef71a4e428 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -420,6 +420,17 @@ define([ return this.relatedData.slice(this.startIndex, this.startIndex + this.pageSize); }, + /** + * Get record count with filtered delete property. + * + * @returns {Number} count + */ + getRecordCount: function () { + return _.filter(this.recordData(), function (record) { + return record[this.deleteProperty] !== this.deleteValue; + }, this).length; + }, + /** * Get number of columns * diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js b/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js index c400fcac43a9a..b7031f1df85c2 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js @@ -85,6 +85,7 @@ define([ hasChanged = _.some(this.delegate('hasChanged')); } + this.bubble('update', hasChanged); this.changed(hasChanged); }, diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html index 84a4114254830..bfe935086e5bb 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html @@ -10,7 +10,7 @@
-
+
diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html index b5f4541b64882..52e8988e66ddf 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html @@ -60,7 +60,7 @@ -
+
diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html index 13f1bed36d297..450a49ba04052 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html @@ -15,7 +15,7 @@
-
+
From 363e8325d8c747562ea7c5aa6eabe809e59764d4 Mon Sep 17 00:00:00 2001 From: Anton Ohorodnyk Date: Fri, 3 Jun 2016 16:07:15 +0300 Subject: [PATCH 0042/3232] MAGETWO-53041: 'Yes/No' attribute shown in Advanced Search result even it not used in filtration --- app/code/Magento/CatalogSearch/Model/Advanced.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Model/Advanced.php b/app/code/Magento/CatalogSearch/Model/Advanced.php index ef332a675e8a8..f469820b3bb2d 100644 --- a/app/code/Magento/CatalogSearch/Model/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Advanced.php @@ -368,9 +368,11 @@ protected function getPreparedSearchCriteria($attribute, $value) $value = $value['label']; } } elseif ($attribute->getFrontendInput() == 'boolean') { - $value = $value == 1 - ? __('Yes') - : __('No'); + if (is_numeric($value)) { + $value = $value == 1 ? __('Yes') : __('No'); + } else { + $value = false; + } } return $value; From 851a5c1183291215795537e66db2884776c9f42b Mon Sep 17 00:00:00 2001 From: Anton Ohorodnyk Date: Mon, 6 Jun 2016 14:10:26 +0300 Subject: [PATCH 0043/3232] MAGETWO-53041: 'Yes/No' attribute shown in Advanced Search result even it not used in filtration - Fixed unit test --- app/code/Magento/CatalogSearch/Test/Unit/Model/AdvancedTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/AdvancedTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/AdvancedTest.php index 4bf4df410fde8..cf70778432b92 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/AdvancedTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/AdvancedTest.php @@ -162,7 +162,7 @@ public function addFiltersDataProvider() 'static' ) ], - 'values' => ['is_active' => false], + 'values' => ['is_active' => 0], 'currentCurrencyCode' => 'GBP', 'baseCurrencyCode' => 'USD' ], From 3e7c489e776d2199ed6bfca679fec5243470a3d2 Mon Sep 17 00:00:00 2001 From: Olga Nakonechna Date: Mon, 6 Jun 2016 14:20:28 +0300 Subject: [PATCH 0044/3232] MAGETWO-53852: Event update works incorrectly --- .../js/components/custom-options-price-type.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js index 107fa05af1d3d..49fb47b0a6057 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js @@ -15,7 +15,10 @@ define([ isFiltered: null, defaultOptions: null, filteredOptions: null, - bannedOptions: [] + bannedOptions: [], + listens: { + 'visible': 'updateValue' + } }, /** @@ -71,6 +74,18 @@ define([ } return this.filteredOptions; + }, + + /** + * Clears value of hidden select + * @param {Boolean} visible + */ + updateValue: function (visible) { + if (visible) { + this.updateOptions(); + } else { + this.value(null); + } } }); }); From 1a004029ec5f4060d9312bd5dcd6431b66f4f900 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Tue, 7 Jun 2016 10:00:28 +0300 Subject: [PATCH 0045/3232] MAGETWO-53852: Event update works incorrectly --- .../Ui/view/base/web/js/dynamic-rows/dnd.js | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js index 594e300145b3a..2e0cbff3c21e0 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js @@ -58,8 +58,12 @@ define([ recordsCache: [], draggableElement: {}, draggableElementClass: '_dragged', + elemPositions: [], listens: { '${ $.recordsProvider }:elems': 'setCacheRecords' + }, + modules: { + parentComponent: '${ $.recordsProvider }' } }, @@ -192,6 +196,8 @@ define([ drEl.depElement = this.getDepElement(drEl.instance, positionY, this.draggableElement.originRow); + drEl.instance.remove(); + if (drEl.depElement) { depElementCtx = this.getRecord(drEl.depElement.elem[0]); drEl.depElement.elem.removeClass(drEl.depElement.className); @@ -211,7 +217,6 @@ define([ this.body.unbind('mouseup', this.mouseupHandler); } - drEl.instance.remove(); this.draggableElement = {}; }, @@ -225,11 +230,34 @@ define([ setPosition: function (depElem, depElementCtx, dragData) { var depElemPosition = ~~depElementCtx.position; + this.cacheElementsPosition(); + if (dragData.depElement.insert === 'after') { dragData.instanceCtx.position = depElemPosition + 1; } else if (dragData.depElement.insert === 'before') { dragData.instanceCtx.position = depElemPosition; } + + this.normalizePositions(); + }, + + /** + * Saves elements position from current elements + */ + cacheElementsPosition: function () { + this.elemPositions = []; + this.parentComponent().elems.each(function (elem) { + this.elemPositions.push(elem.position); + }, this); + }, + + /** + * Normalize position, uses start elements position + */ + normalizePositions: function () { + this.parentComponent().elems.each(function (item, index) { + item.position = this.elemPositions[index]; + }, this); }, /** From 4c74b6112bc5119a62045469ff36f769dc679181 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Wed, 8 Jun 2016 10:32:46 +0300 Subject: [PATCH 0046/3232] MAGETWO-53852: Event update works incorrectly --- .../view/base/ui_component/etc/definition.xml | 3 +- .../base/web/js/dynamic-rows/action-delete.js | 28 +++++++++++++++++++ .../base/web/js/dynamic-rows/dynamic-rows.js | 24 ++++++++++++++++ .../dynamic-rows/cells/action-delete.html | 2 +- 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/Ui/view/base/web/js/dynamic-rows/action-delete.js diff --git a/app/code/Magento/Ui/view/base/ui_component/etc/definition.xml b/app/code/Magento/Ui/view/base/ui_component/etc/definition.xml index 105f6dd8dcd3b..7426ce9ddf21e 100755 --- a/app/code/Magento/Ui/view/base/ui_component/etc/definition.xml +++ b/app/code/Magento/Ui/view/base/ui_component/etc/definition.xml @@ -211,8 +211,7 @@ - Magento_Ui/js/form/element/abstract - ui/dynamic-rows/cells/action-delete + Magento_Ui/js/dynamic-rows/action-delete ui/dynamic-rows/cells/action-delete diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/action-delete.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/action-delete.js new file mode 100644 index 0000000000000..6643639f59961 --- /dev/null +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/action-delete.js @@ -0,0 +1,28 @@ +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'Magento_Ui/js/form/element/abstract' +], function (Abstract) { + 'use strict'; + + return Abstract.extend({ + defaults: { + links: { + value: false + } + }, + + /** + * Delete record handler. + * + * @param {Number} index + * @param {Number} id + */ + deleteRecord: function (index, id) { + this.bubble('deleteRecord', index, id); + } + }); +}); diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 62aef71a4e428..5abfdf6f5a74e 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -164,6 +164,7 @@ define([ * @returns {Object} Chainable. */ initialize: function () { + _.bindAll(this, 'processingDeleteRecord'); this._super() .initDefaultState() .initChildren() @@ -199,6 +200,29 @@ define([ return this; }, + /** + * @inheritdoc + */ + initElement: function (elem) { + this._super(); + elem.on({ + 'deleteRecord': this.processingDeleteRecord + }); + + return this; + }, + + /** + * @inheritdoc + */ + bubble: function (event) { + if (event === 'deleteRecord') { + return false; + } + + return this._super(); + }, + /** * Inits DND module * diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/action-delete.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/action-delete.html index a8a77d593fe98..7d4c5373aed8f 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/action-delete.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/action-delete.html @@ -7,7 +7,7 @@ From 129b2758ac97834296a6dfb8d3008260aee166cb Mon Sep 17 00:00:00 2001 From: Felix Delval Date: Wed, 22 Jun 2016 16:10:48 +0200 Subject: [PATCH 0058/3232] Updating file to fit the coding standard --- app/code/Magento/CatalogInventory/Model/Stock/Status.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Stock/Status.php index 51a3d41d90e6d..405d91d4f5268 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Status.php @@ -78,6 +78,7 @@ protected function _construct() } //@codeCoverageIgnoreStart + /** * @return int */ @@ -128,6 +129,7 @@ public function getStockItem() } //@codeCoverageIgnoreStart + /** * @param int $productId * @return $this From aa2840ce1a099b51c878243fa1462dba641d8e70 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Thu, 23 Jun 2016 12:41:25 +0300 Subject: [PATCH 0059/3232] MAGETWO-53852: Event update works incorrectly --- .../web/template/dynamic-rows/grid.html | 2 +- .../base/web/js/dynamic-rows/dynamic-rows.js | 217 +++++++++++------- .../dynamic-rows/templates/default.html | 6 +- .../dynamic-rows/templates/grid.html | 2 +- 4 files changed, 135 insertions(+), 92 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html b/app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html index f3642eedf6fc9..d1830f5d7e22a 100644 --- a/app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html +++ b/app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html @@ -51,10 +51,10 @@ + diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 2279503e57df6..63904800b3fcc 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -117,7 +117,6 @@ define([ isDifferedFromDefault: false, defaultState: [], changed: false, - isDefaultState: true, fallbackResetTpl: 'ui/form/element/helper/fallback-reset-link', dndConfig: { name: '${ $.name }_dnd', @@ -151,7 +150,7 @@ define([ dnd: '${ $.dndConfig.name }' }, pages: 1, - pageSize: 20, + pageSize: 5, relatedData: [], currentPage: 1, startIndex: 0 @@ -165,22 +164,46 @@ define([ * @returns {Object} Chainable. */ initialize: function () { - _.bindAll(this, 'processingDeleteRecord', 'onChildrenUpdate'); + _.bindAll(this, + 'processingDeleteRecord', + 'onChildrenUpdate', + 'checkDefaultState', + 'renderColumnsHeader' + ); + this._super() .initChildren() .initDnd() - .setColumnsHeaderListener() .initDefaultRecord() + .setInitialProperty() + .setColumnsHeaderListener() .checkSpinner(); - if (_.isArray(this.recordData())) { - this.recordData.each(function (data, index) { - this.source.set(this.dataScope + '.' + this.index + '.' + index + '.initialize', true); - }, this); + this.on('recordData', this.checkDefaultState); - } + return this; + }, + + /** + * @inheritdoc + */ + bubble: function (event) { + if (event === 'deleteRecord' || event === 'update') { + return false; + } + + return this._super(); + }, - this.on('recordData', this.checkDefaultState.bind(this)); + /** + * Inits DND module + * + * @returns {Object} Chainable. + */ + initDnd: function () { + if (this.dndConfig.enabled) { + layout([this.dndConfig]); + } return this; }, @@ -215,7 +238,7 @@ define([ initElement: function (elem) { this._super(); elem.on({ - 'deleteRecord': function(index, id){ + 'deleteRecord': function (index, id) { this.deleteHandler(index, id); }.bind(this), 'update': function (state) { @@ -226,45 +249,77 @@ define([ return this; }, + /** + * Handler for deleteRecord event + * + * @param {Number|String} index - element index + * @param {Number|String} id + */ deleteHandler: function (index, id) { - this.getDefaultState(); + this.setDefaultState(); this.processingDeleteRecord(index, id); - this.changed(!compareArrays(this.defaultState, this.arrFilter(this.relatedData))); + this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); }, - compare: function(ar1, ar2) { - return compareArrays(ar1, ar2) + /** + * Set initial property to records data + * + * @returns {Object} Chainable. + */ + setInitialProperty: function () { + if (_.isArray(this.recordData())) { + this.recordData.each(function (data, index) { + this.source.set(this.dataScope + '.' + this.index + '.' + index + '.initialize', true); + }, this); + } + + return this; }, + /** + * Handler for update event + * + * @param {Boolean} state + */ onChildrenUpdate: function (state) { var changed, dataScope, - elemDataScope; - - if (state && !this.initialState) { - this.initialState = true; - this.defaultState = utils.copy(this.recordData()); + changedElemDataScope; - changed = this.findChangedElems(this.elems()); + if (state && !this.hasInitialState) { + this.setDefaultState(); + changed = this.getChangedElems(this.elems()); dataScope = this.elems()[0].dataScope.split('.'); dataScope.splice(dataScope.length - 1, 1); - changed.forEach(function (elem) { - elemDataScope = elem.dataScope.split('.'); - elemDataScope.splice(0, dataScope.length); - - this.setValueByPath(this.defaultState, elemDataScope, elem.initialValue); + changedElemDataScope = elem.dataScope.split('.'); + changedElemDataScope.splice(0, dataScope.length); + this.setValueByPath(this.defaultState, changedElemDataScope, elem.initialValue); }, this); } + + this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); }, - getDefaultState: function () { - if (!this.initialState) { - this.initialState = true; - this.defaultState = utils.copy(this.arrFilter(this.recordData())); + /** + * Set default dynamic-rows state + * + * @param {Array} data - defaultState data + */ + setDefaultState: function (data) { + if (!this.hasInitialState) { + this.hasInitialState = true; + this.defaultState = data ? data : utils.copy(this.arrayFilter(this.recordData())); } }, + /** + * Sets value to object by string path + * + * @param {Object} obj + * @param {Array|String} path + * @param {*} value + */ setValueByPath: function (obj, path, value) { var prop; @@ -274,21 +329,26 @@ define([ if (path.length - 1) { prop = obj[path[0]]; - path.splice(0,1); - - this.setValueByPath(prop, path , value); + path.splice(0, 1); + this.setValueByPath(prop, path, value); } else if (path.length) { obj[path[0]] = value; } - }, - findChangedElems: function (array, changed) { + /** + * Returns elements which changed self state + * + * @param {Array} array - data array + * @param {Array} changed - array with changed elements + * @returns {Array} changed - array with changed elements + */ + getChangedElems: function (array, changed) { changed = changed || []; array.forEach(function (elem) { if (_.isFunction(elem.elems)) { - this.findChangedElems(elem.elems(), changed) + this.getChangedElems(elem.elems(), changed); } else if (elem.hasChanged()) { changed.push(elem); } @@ -297,30 +357,6 @@ define([ return changed; }, - /** - * @inheritdoc - */ - bubble: function (event) { - if (event === 'deleteRecord') { - return false; - } - - return this._super(); - }, - - /** - * Inits DND module - * - * @returns {Object} Chainable. - */ - initDnd: function () { - if (this.dndConfig.enabled) { - layout([this.dndConfig]); - } - - return this; - }, - /** * Checks columnsHeaderAfterRender property, * and set listener on elems if needed @@ -329,7 +365,11 @@ define([ */ setColumnsHeaderListener: function () { if (this.columnsHeaderAfterRender) { - this.on('recordData', this.renderColumnsHeader.bind(this)); + this.on('recordData', this.renderColumnsHeader); + + if (_.isArray(this.recordData()) && this.recordData().length) { + this.renderColumnsHeader(); + } } return this; @@ -339,35 +379,37 @@ define([ * Checks whether component's state is default or not */ checkDefaultState: function () { - if ( - !this.initialState && - _.isArray(this.recordData()) && - !this.recordData().filter(function (data) { + var isRecordDataArray = _.isArray(this.recordData()), + initialize, + hasNotDefaultRecords = isRecordDataArray ? !!this.recordData().filter(function (data) { return !data.initialize; - }).length - ) { - this.initialState = true; - this.defaultState = utils.copy(this.recordData().filter(function (data) { - return data.initialize; - })); + }).length : false; - this.defaultState.forEach(function(data){ + if (!this.hasInitialState && isRecordDataArray && !hasNotDefaultRecords) { + this.hasInitialState = true; + this.defaultState = utils.copy(this.recordData().filter(function (data) { + initialize = data.initialize; delete data.initialize; - }) - } else if ( !this.initialState && - _.isArray(this.recordData()) && - this.recordData().filter(function (data) { - return !data.initialize; - }).length - ) { - this.initialState = true; + + return initialize; + })); + } else if (!this.hasInitialState && isRecordDataArray && hasNotDefaultRecords) { + this.hasInitialState = true; } - this.changed(!compareArrays(this.defaultState, this.arrFilter(this.relatedData))); + + this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); }, - arrFilter: function (data) { + /** + * Filters out deleted items from array + * + * @param {Array} data + * @returns {Array} filtered array + */ + arrayFilter: function (data) { var prop; + /*eslint-disable no-loop-func*/ data.forEach(function (elem) { for (prop in elem) { if (_.isArray(elem[prop])) { @@ -377,13 +419,15 @@ define([ elem[prop].forEach(function (elemProp) { if (_.isArray(elemProp)) { - elem[prop] = this.arrFilter(elemProp); + elem[prop] = this.arrayFilter(elemProp); } - }, this) + }, this); } } }, this); + /*eslint-enable no-loop-func*/ + return data; }, @@ -449,12 +493,11 @@ define([ if (!this.labels().length) { _.each(this.childTemplate.children, function (cell) { data = this.createHeaderTemplate(cell.config); - cell.config.labelVisible = false; _.extend(data, { label: cell.config.label, name: cell.name, - required: cell.required, + required: !!cell.config.validation, columnsHeaderClasses: cell.config.columnsHeaderClasses }); @@ -609,7 +652,7 @@ define([ * @param {Number} page - current page */ changePage: function (page) { - this.getDefaultState() + this.setDefaultState(); if (page === 1 && !this.recordData().length) { return false; diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html index 52e8988e66ddf..d25a107e82177 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html @@ -24,11 +24,11 @@ + disable="$label().disabled"> + diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html index 450a49ba04052..5b09d5fca407b 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html @@ -40,10 +40,10 @@ + From 8509cef36df413c11aa783a1e7d5f04e3f04ab12 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Thu, 23 Jun 2016 18:28:39 +0300 Subject: [PATCH 0060/3232] MAGETWO-53852: Event update works incorrectly --- .../dynamic-rows-import-custom-options.js | 6 ++++++ .../js/components/custom-options-price-type.js | 17 +---------------- .../base/web/js/dynamic-rows/dynamic-rows.js | 5 +++-- .../dynamic-rows/templates/default.html | 4 ++-- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js index 7c5fd3bcb9742..10e498ff47497 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js @@ -91,7 +91,13 @@ define([ processingAddChild: function (ctx, index, prop) { if (ctx && !_.isNumber(ctx['option_id'])) { ctx['option_id'] = ++maxId; + } else if (!ctx) { + this.showSpinner(true); + this.addChild(ctx, index, prop); + + return; } + this._super(ctx, index, prop); }, diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js index 49fb47b0a6057..107fa05af1d3d 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js @@ -15,10 +15,7 @@ define([ isFiltered: null, defaultOptions: null, filteredOptions: null, - bannedOptions: [], - listens: { - 'visible': 'updateValue' - } + bannedOptions: [] }, /** @@ -74,18 +71,6 @@ define([ } return this.filteredOptions; - }, - - /** - * Clears value of hidden select - * @param {Boolean} visible - */ - updateValue: function (visible) { - if (visible) { - this.updateOptions(); - } else { - this.value(null); - } } }); }); diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 63904800b3fcc..9635f9046bcb0 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -385,7 +385,7 @@ define([ return !data.initialize; }).length : false; - if (!this.hasInitialState && isRecordDataArray && !hasNotDefaultRecords) { + if (!this.hasInitialState && isRecordDataArray && hasNotDefaultRecords) { this.hasInitialState = true; this.defaultState = utils.copy(this.recordData().filter(function (data) { initialize = data.initialize; @@ -393,11 +393,12 @@ define([ return initialize; })); + + this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); } else if (!this.hasInitialState && isRecordDataArray && hasNotDefaultRecords) { this.hasInitialState = true; } - this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); }, /** diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html index d25a107e82177..6492e5cee9d81 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html @@ -52,7 +52,7 @@ + visible="element.addButton || pages() > 1"> -
+
From e4154987c7dd070ebaf8adbb6748bbf4cd6e537d Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Fri, 24 Jun 2016 12:01:08 +0300 Subject: [PATCH 0061/3232] MAGETWO-53852: Event update works incorrectly --- .../base/web/js/dynamic-rows/dynamic-rows.js | 5 +---- .../view/base/web/js/dynamic-rows/record.js | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 9635f9046bcb0..d07711b28a75d 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -349,7 +349,7 @@ define([ array.forEach(function (elem) { if (_.isFunction(elem.elems)) { this.getChangedElems(elem.elems(), changed); - } else if (elem.hasChanged()) { + } else if (elem.hasOwnProperty('hasChanged') && elem.hasChanged()) { changed.push(elem); } }, this); @@ -395,10 +395,7 @@ define([ })); this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); - } else if (!this.hasInitialState && isRecordDataArray && hasNotDefaultRecords) { - this.hasInitialState = true; } - }, /** diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js index 305de77d47dd8..cdb74f39c7034 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js @@ -5,8 +5,9 @@ define([ 'underscore', - 'uiCollection' -], function (_, uiCollection) { + 'uiCollection', + 'uiRegistry' +], function (_, uiCollection, registry) { 'use strict'; return uiCollection.extend({ @@ -34,6 +35,23 @@ define([ } }, + initialize: function () { + this._super(); + + registry.async(this.name + '.' + this.positionProvider)(function(component){ + component.hasChanged = function () { + return this.value().toString() != this.initialValue.toString(); + }; + + if (!component.initialValue) { + component.initialValue = self.parentComponent().maxPosition; + component.bubble('update', component.hasChanged()); + } + }); + + return this; + }, + /** * Init config * From 66e095566dce1971dc0bcb2bbbed6d39d84554a2 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Fri, 24 Jun 2016 13:14:16 +0300 Subject: [PATCH 0062/3232] MAGETWO-53852: Event update works incorrectly --- app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js index cdb74f39c7034..5c9a51e43427a 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js @@ -36,6 +36,8 @@ define([ }, initialize: function () { + var self = this; + this._super(); registry.async(this.name + '.' + this.positionProvider)(function(component){ From f51b382f7017c85b7e317516f4ad2f2ce6cc69b2 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Fri, 24 Jun 2016 16:06:03 +0300 Subject: [PATCH 0063/3232] MAGETWO-53852: Event update works incorrectly --- .../Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index d07711b28a75d..dce3c6d1517fa 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -394,6 +394,8 @@ define([ return initialize; })); + this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); + } else if (this.hasInitialState) { this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); } }, From deaee8b1d0af68af17a5dcf15182dbc85ef59fb7 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Fri, 24 Jun 2016 16:57:45 +0300 Subject: [PATCH 0064/3232] MAGETWO-53852: Event update works incorrectly --- .../Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index dce3c6d1517fa..0c520c2e624d1 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -349,7 +349,7 @@ define([ array.forEach(function (elem) { if (_.isFunction(elem.elems)) { this.getChangedElems(elem.elems(), changed); - } else if (elem.hasOwnProperty('hasChanged') && elem.hasChanged()) { + } else if (_.isFunction(elem.hasChanged) && elem.hasChanged()) { changed.push(elem); } }, this); From f9197e909f578dde486252732db3b40a48e4120a Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Mon, 27 Jun 2016 11:52:37 +0300 Subject: [PATCH 0065/3232] MAGETWO-53852: Event update works incorrectly --- .../view/base/web/js/dynamic-rows/dynamic-rows.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 0c520c2e624d1..cc712cb6a74db 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -141,7 +141,7 @@ define([ disabled: 'setDisabled', childTemplate: 'initHeader', recordTemplate: 'onUpdateRecordTemplate', - recordData: 'setDifferedFromDefault parsePagesData', + recordData: 'setDifferedFromDefault parsePagesData setRecordDataToCache', currentPage: 'changePage', elems: 'checkSpinner', changed: 'updateTrigger' @@ -153,9 +153,15 @@ define([ pageSize: 5, relatedData: [], currentPage: 1, + recordDataCache: [], startIndex: 0 }, + setRecordDataToCache: function (data) { + this.recordDataCache = this.recordDataCache && data.length > this.recordDataCache.length ? + data : this.recordDataCache; + }, + /** * Extends instance with default config, calls initialize of parent * class, calls initChildren method, set observe variable. @@ -307,9 +313,11 @@ define([ * @param {Array} data - defaultState data */ setDefaultState: function (data) { + var componentData = this.recordData().length ? this.recordData() : this.recordDataCache; + if (!this.hasInitialState) { this.hasInitialState = true; - this.defaultState = data ? data : utils.copy(this.arrayFilter(this.recordData())); + this.defaultState = data ? data : utils.copy(this.arrayFilter(componentData)); } }, @@ -574,7 +582,7 @@ define([ this.relatedData = this.deleteProperty ? _.filter(data, function (elem) { - return elem[this.deleteProperty] !== this.deleteValue; + return elem && elem[this.deleteProperty] !== this.deleteValue; }, this) : data; pages = Math.ceil(this.relatedData.length / this.pageSize) || 1; From 9e9e16acda67e31eed9db09a17105f3f40736d27 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Wed, 29 Jun 2016 15:31:57 +0300 Subject: [PATCH 0066/3232] MAGETWO-53852: Event update works incorrectly --- .../base/web/js/dynamic-rows/dynamic-rows.js | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index cc712cb6a74db..e8c3b143c0957 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -116,6 +116,9 @@ define([ showSpinner: true, isDifferedFromDefault: false, defaultState: [], + defaultPagesState: {}, + pagesChanged: {}, + hasInitialPagesState: {}, changed: false, fallbackResetTpl: 'ui/form/element/helper/fallback-reset-link', dndConfig: { @@ -158,7 +161,7 @@ define([ }, setRecordDataToCache: function (data) { - this.recordDataCache = this.recordDataCache && data.length > this.recordDataCache.length ? + this.recordDataCache = this.recordDataCache && data.length > this.recordDataCache.length ? data : this.recordDataCache; }, @@ -264,7 +267,8 @@ define([ deleteHandler: function (index, id) { this.setDefaultState(); this.processingDeleteRecord(index, id); - this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); + this.pagesChanged[this.currentPage()] = !compareArrays(this.defaultPagesState[this.currentPage()], this.arrayFilter(this.getChildItems())); + this.changed(_.some(this.pagesChanged)); }, /** @@ -292,7 +296,7 @@ define([ dataScope, changedElemDataScope; - if (state && !this.hasInitialState) { + if (state && !this.hasInitialPagesState[this.currentPage()]) { this.setDefaultState(); changed = this.getChangedElems(this.elems()); dataScope = this.elems()[0].dataScope.split('.'); @@ -300,11 +304,17 @@ define([ changed.forEach(function (elem) { changedElemDataScope = elem.dataScope.split('.'); changedElemDataScope.splice(0, dataScope.length); - this.setValueByPath(this.defaultState, changedElemDataScope, elem.initialValue); + changedElemDataScope[0] = (parseInt(changedElemDataScope[0], 10) - this.pageSize * (this.currentPage() - 1)).toString(); + this.setValueByPath(this.defaultPagesState[this.currentPage()], changedElemDataScope, elem.initialValue); }, this); } - this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); + this.pagesChanged[this.currentPage()] = !compareArrays(this.defaultPagesState[this.currentPage()], this.arrayFilter(this.getChildItems())); + this.changed(_.some(this.pagesChanged)); + }, + + compare: function (a1,a2) { + return compareArrays(a1,a2) }, /** @@ -313,11 +323,11 @@ define([ * @param {Array} data - defaultState data */ setDefaultState: function (data) { - var componentData = this.recordData().length ? this.recordData() : this.recordDataCache; + var componentData = this.getChildItems().length ? this.getChildItems() : this.recordDataCache; - if (!this.hasInitialState) { - this.hasInitialState = true; - this.defaultState = data ? data : utils.copy(this.arrayFilter(componentData)); + if (!this.hasInitialPagesState[this.currentPage()]) { + this.hasInitialPagesState[this.currentPage()] = true; + this.defaultPagesState[this.currentPage()] = data ? data : utils.copy(this.arrayFilter(componentData)); } }, @@ -393,18 +403,19 @@ define([ return !data.initialize; }).length : false; - if (!this.hasInitialState && isRecordDataArray && hasNotDefaultRecords) { - this.hasInitialState = true; - this.defaultState = utils.copy(this.recordData().filter(function (data) { + if (!this.hasInitialPagesState[this.currentPage()] && isRecordDataArray && hasNotDefaultRecords) { + this.hasInitialPagesState[this.currentPage()] = true; + this.defaultPagesState[this.currentPage()] = utils.copy(this.getChildItems().filter(function (data) { initialize = data.initialize; delete data.initialize; return initialize; })); - this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); - } else if (this.hasInitialState) { - this.changed(!compareArrays(this.defaultState, this.arrayFilter(this.relatedData))); + this.pagesChanged[this.currentPage()] = !compareArrays(this.defaultPagesState[this.currentPage()], this.arrayFilter(this.getChildItems())); + this.changed(_.some(this.pagesChanged)); + } else if (this.hasInitialPagesState[this.currentPage()]) { + this.changed(_.some(this.pagesChanged)); } }, @@ -660,8 +671,6 @@ define([ * @param {Number} page - current page */ changePage: function (page) { - this.setDefaultState(); - if (page === 1 && !this.recordData().length) { return false; } From f37bf56048311ec3c96be1afeb3a58121009a2d0 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Mon, 4 Jul 2016 12:51:29 +0300 Subject: [PATCH 0067/3232] MAGETWO-53852: Event update works incorrectly --- .../base/web/js/dynamic-rows/dynamic-rows.js | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index e8c3b143c0957..4534f78ba3198 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -252,6 +252,9 @@ define([ }.bind(this), 'update': function (state) { this.onChildrenUpdate(state); + }.bind(this), + 'addChild': function () { + this.setDefaultState(); }.bind(this) }); @@ -323,11 +326,22 @@ define([ * @param {Array} data - defaultState data */ setDefaultState: function (data) { - var componentData = this.getChildItems().length ? this.getChildItems() : this.recordDataCache; + var componentData, + childItems; if (!this.hasInitialPagesState[this.currentPage()]) { + childItems = this.getChildItems(); + componentData = childItems.length ? + utils.copy(childItems) : + utils.copy(this.getChildItems(this.recordDataCache)); + componentData.forEach(function (dataObj) { + if (dataObj.hasOwnProperty('initialize')) { + delete dataObj.initialize; + } + }); + this.hasInitialPagesState[this.currentPage()] = true; - this.defaultPagesState[this.currentPage()] = data ? data : utils.copy(this.arrayFilter(componentData)); + this.defaultPagesState[this.currentPage()] = data ? data : this.arrayFilter(componentData); } }, @@ -349,7 +363,7 @@ define([ prop = obj[path[0]]; path.splice(0, 1); this.setValueByPath(prop, path, value); - } else if (path.length) { + } else if (path.length && obj) { obj[path[0]] = value; } }, @@ -415,6 +429,7 @@ define([ this.pagesChanged[this.currentPage()] = !compareArrays(this.defaultPagesState[this.currentPage()], this.arrayFilter(this.getChildItems())); this.changed(_.some(this.pagesChanged)); } else if (this.hasInitialPagesState[this.currentPage()]) { + this.pagesChanged[this.currentPage()] = !compareArrays(this.defaultPagesState[this.currentPage()], this.arrayFilter(this.getChildItems())); this.changed(_.some(this.pagesChanged)); } }, @@ -605,10 +620,15 @@ define([ * * @returns {Array} data */ - getChildItems: function () { + getChildItems: function (data, page) { + var dataRecord = data || this.relatedData, + startIndex; + this.startIndex = (~~this.currentPage() - 1) * this.pageSize; - return this.relatedData.slice(this.startIndex, this.startIndex + this.pageSize); + startIndex = page || this.startIndex; + + return dataRecord.slice(startIndex, this.startIndex + this.pageSize); }, /** @@ -639,6 +659,10 @@ define([ * @param {Number|String} prop - additional property to element */ processingAddChild: function (ctx, index, prop) { + console.log('3', this.name); + + this.bubble('addChild', false); + if (this.relatedData.length && this.relatedData.length % this.pageSize === 0) { this.clear(); this.pages(this.pages() + 1); From 30dd1d9f393b76890acb0e5a19b34134f0ba5d1e Mon Sep 17 00:00:00 2001 From: adragus-inviqa Date: Tue, 5 Jul 2016 10:57:05 +0100 Subject: [PATCH 0068/3232] Fix Magento\Review\Model\ResourceModel\Rating\Option not instantiable in setup scripts `Magento\Review\Model\ResourceModel\Rating\Option` depends on `\Magento\Customer\Model\Session` and this makes it not instantiable in setup scripts. By making it a proxy, we're postponing its instantiation. ```php // some setup script $optionModel = $objectManager->create(Magento\Review\Model\Rating\Option::class); ``` Below is the exceptions triggered when trying to run a `setup:upgrade` ``` [Magento\Framework\Exception\SessionException] Area code not set: Area code must be set before starting a session. Exception trace: () at /vagrant/vendor/magento/framework/Session/SessionManager.php:175 Magento\Framework\Session\SessionManager->start() at /vagrant/vendor/magento/framework/Session/SessionManager.php:130 Magento\Framework\Session\SessionManager->__construct() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:115 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:236 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:53 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:82 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:236 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:53 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:82 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:461 Magento\Framework\Model\AbstractModel->_getResource() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:214 Magento\Framework\Model\AbstractModel->_init() at /vagrant/vendor/magento/module-review/Model/Rating/Option.php:32 Magento\Review\Model\Rating\Option->_construct() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:193 Magento\Framework\Model\AbstractModel->__construct() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:105 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:57 Magento\Framework\ObjectManager\ObjectManager->create() at /vagrant/src/Project/Catalog/Setup/data-upgrade/1.1.25.php:56 include() at /vagrant/src/Project/ModuleSetup/Spi/Updater/SequentialFiles.php:96 Project\ModuleSetup\Spi\Updater\includeFile() at /vagrant/src/Project/ModuleSetup/Spi/Updater/SequentialFiles.php:88 Project\ModuleSetup\Spi\Updater\SequentialFiles->update() at /vagrant/src/Project/Catalog/Setup/UpgradeData.php:46 Project\Catalog\Setup\UpgradeData->upgrade() at /vagrant/setup/src/Magento/Setup/Model/Installer.php:809 Magento\Setup\Model\Installer->handleDBSchemaData() at /vagrant/setup/src/Magento/Setup/Model/Installer.php:772 Magento\Setup\Model\Installer->installDataFixtures() at /vagrant/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php:72 Magento\Setup\Console\Command\UpgradeCommand->execute() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at /vagrant/vendor/magento/framework/Console/Cli.php:49 Magento\Framework\Console\Cli->doRun() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at /vagrant/bin/magento:25 [Magento\Framework\Exception\LocalizedException] Area code is not set Exception trace: () at /vagrant/vendor/magento/framework/App/State.php:139 Magento\Framework\App\State->getAreaCode() at /vagrant/vendor/magento/framework/Session/SessionManager.php:173 Magento\Framework\Session\SessionManager->start() at /vagrant/vendor/magento/framework/Session/SessionManager.php:130 Magento\Framework\Session\SessionManager->__construct() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:115 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:236 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:53 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:82 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:236 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:53 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:82 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:461 Magento\Framework\Model\AbstractModel->_getResource() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:214 Magento\Framework\Model\AbstractModel->_init() at /vagrant/vendor/magento/module-review/Model/Rating/Option.php:32 Magento\Review\Model\Rating\Option->_construct() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:193 Magento\Framework\Model\AbstractModel->__construct() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:105 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:57 Magento\Framework\ObjectManager\ObjectManager->create() at /vagrant/src/Project/Catalog/Setup/data-upgrade/1.1.25.php:56 include() at /vagrant/src/Project/ModuleSetup/Spi/Updater/SequentialFiles.php:96 Project\ModuleSetup\Spi\Updater\includeFile() at /vagrant/src/Project/ModuleSetup/Spi/Updater/SequentialFiles.php:88 Project\ModuleSetup\Spi\Updater\SequentialFiles->update() at /vagrant/src/Project/Catalog/Setup/UpgradeData.php:46 Project\Catalog\Setup\UpgradeData->upgrade() at /vagrant/setup/src/Magento/Setup/Model/Installer.php:809 Magento\Setup\Model\Installer->handleDBSchemaData() at /vagrant/setup/src/Magento/Setup/Model/Installer.php:772 Magento\Setup\Model\Installer->installDataFixtures() at /vagrant/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php:72 Magento\Setup\Console\Command\UpgradeCommand->execute() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at /vagrant/vendor/magento/framework/Console/Cli.php:49 Magento\Framework\Console\Cli->doRun() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at /vagrant/bin/magento:25 ``` --- app/code/Magento/Review/etc/di.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/Magento/Review/etc/di.xml b/app/code/Magento/Review/etc/di.xml index d42d3e3330c67..13f7d0b84bc50 100644 --- a/app/code/Magento/Review/etc/di.xml +++ b/app/code/Magento/Review/etc/di.xml @@ -26,4 +26,9 @@ Magento\Framework\Url + + + Magento\Customer\Model\Session\Proxy + + From 803871799a50d10a39f376880da886e21886daa3 Mon Sep 17 00:00:00 2001 From: Athanasios Date: Fri, 8 Jul 2016 21:38:11 +0300 Subject: [PATCH 0069/3232] Fix error with the WYSIWYG and Greek characters This commit aims to be a fix to the error with the WYSIWYG editor (TinyMCE) that not store properly non latin character (i.e. Greek letters). Solution comes from http://stackoverflow.com/questions/33043516/magento-greek-characters-as-html-entities --- lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js index 94de561da986d..79a1dd0daedbe 100755 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js @@ -78,6 +78,7 @@ define([ } var settings = { + entity_encoding: 'raw', mode: (mode != undefined ? mode : 'none'), elements: this.id, theme: 'advanced', From e5bee153d67f4104d818de85177d29d9e3fe11f8 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Wed, 20 Jul 2016 16:56:12 +0300 Subject: [PATCH 0070/3232] MAGETWO-55393: [Github #5636] Many store views break the page --- .../templates/catalog/product/attribute/labels.phtml | 2 +- .../templates/catalog/product/attribute/options.phtml | 4 ++-- .../templates/catalog/product/attribute/visual.phtml | 4 ++-- .../backend/web/css/source/forms/fields/_control-table.less | 1 + app/design/adminhtml/Magento/backend/web/css/styles-old.less | 5 +++++ 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml index 712db49e53073..dd90b3b57de7c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml @@ -16,7 +16,7 @@
-
+
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index 3552d78f8665a..f64183b7cf9eb 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -10,9 +10,9 @@ $stores = $block->getStoresSortedBySortOrder(); ?> -
+
-
+
diff --git a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml index dd6f4b26ecf12..7b5211be8aef7 100644 --- a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml +++ b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml @@ -10,9 +10,9 @@ $stores = $block->getStoresSortedBySortOrder(); ?> -
+
-
+
diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less index 38bf5130b54f0..7ac7669596965 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less @@ -131,6 +131,7 @@ &._required { span { &:after { + .lib-css(margin, @form-field-label-asterisk__margin); color: @field-label__required__color; content: '*'; } 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 166baeb788a4a..46b7966b31759 100644 --- a/app/design/adminhtml/Magento/backend/web/css/styles-old.less +++ b/app/design/adminhtml/Magento/backend/web/css/styles-old.less @@ -744,6 +744,7 @@ // -------------------------------------- fieldset { + min-width: 0; padding: 20px; } @@ -5049,6 +5050,10 @@ } } } + + .admin__control-table-wrapper { + clear: both; + } } .catalog-product-set-index { From bdf62301f6e5d58bc1d53de0f471de54ec04e9e4 Mon Sep 17 00:00:00 2001 From: vivek201 Date: Thu, 21 Jul 2016 22:22:48 +0545 Subject: [PATCH 0071/3232] Update AbstractTemplate.php Added strict comparison for $storeID --- app/code/Magento/Email/Model/AbstractTemplate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index 4ce6f0d90a6cc..e74a6187ba207 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -669,7 +669,7 @@ public function getTemplateFilter() */ public function emulateDesign($storeId, $area = self::DEFAULT_DESIGN_AREA) { - if ($storeId) { + if ($storeId !== false) { // save current design settings $this->emulatedDesignConfig = clone $this->getDesignConfig(); if ( From e6342cbbc572c29d5d12dcba8a77ec0fef740420 Mon Sep 17 00:00:00 2001 From: Volodymyr Sevostianov Date: Fri, 22 Jul 2016 16:56:36 +0300 Subject: [PATCH 0072/3232] MAGETWO-55327: [FT] Filter not applied on current page in test. --- .../Review/Test/Block/Adminhtml/Product/Grid.php | 11 +++++++++-- .../Review/Test/Block/Adminhtml/ReviewForm.xml | 2 +- .../TestCase/CreateProductReviewBackendEntityTest.php | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Product/Grid.php b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Product/Grid.php index 55060e7a85db9..e1aa3b9d5a9a5 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Product/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Product/Grid.php @@ -6,13 +6,20 @@ namespace Magento\Review\Test\Block\Adminhtml\Product; -use Magento\Ui\Test\Block\Adminhtml\DataGrid; +use Magento\Backend\Test\Block\Widget\Grid as AbstractGrid; /** * Review catalog product grid. */ -class Grid extends DataGrid +class Grid extends AbstractGrid { + /** + * First row selector + * + * @var string + */ + protected $firstRowSelector = './/tbody/tr[1]'; + /** * Grid filter selectors * diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.xml index 1832618a7da64..348cd3429149a 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/ReviewForm.xml @@ -20,7 +20,7 @@ textarea - #detailed_rating + #rating_detail Magento\Review\Test\Block\Adminhtml\Edit\RatingElement diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php index d7de5f52103d8..aa8e9d5dc8146 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php @@ -110,13 +110,14 @@ public function test(Review $review) { // Precondition: $product = $review->getDataFieldConfig('entity_id')['source']->getEntity(); - $filter = ['id' => $product->getId()]; + $filter = ['sku' => $product->getSku()]; $this->review = $review; // Steps: $this->reviewIndex->open(); $this->reviewIndex->getReviewActions()->addNew(); - $this->reviewEdit->getProductGrid()->searchAndOpen($filter); + $this->reviewEdit->getProductGrid()->search($filter); + $this->reviewEdit->getProductGrid()->openFirstRow(); $this->reviewEdit->getReviewForm()->fill($this->review); $this->reviewEdit->getPageActions()->save(); From 0c06f250dee25056e48b327d60282d1fdb3764d3 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Fri, 22 Jul 2016 19:06:55 +0300 Subject: [PATCH 0073/3232] MAGETWO-55394: [WCAG 2.0] Add role="alert" to All Messages Appearing On the Storefront --- .../view/frontend/templates/messages.phtml | 8 +++++-- .../view/base/web/js/form/element/abstract.js | 21 ++++++++++++++++++- .../grid/editing/header-buttons.html | 18 +++++++++------- .../web/templates/form/element/checkbox.html | 13 +++++++++++- .../web/templates/form/element/date.html | 3 ++- .../web/templates/form/element/email.html | 3 ++- .../web/templates/form/element/input.html | 6 ++++-- .../web/templates/form/element/password.html | 3 ++- .../web/templates/form/element/select.html | 3 ++- .../frontend/web/templates/form/field.html | 4 ++-- 10 files changed, 62 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/Theme/view/frontend/templates/messages.phtml b/app/code/Magento/Theme/view/frontend/templates/messages.phtml index 2bd2357a27e1a..7ef534ab5d65c 100644 --- a/app/code/Magento/Theme/view/frontend/templates/messages.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/messages.phtml @@ -5,7 +5,8 @@ */ ?>
-
+ +
-
+ + +
+
', + 'expected' => 'Some test text in span tag <strong>text in strong tag</strong> Click here<script>alert(1)</script>', + 'allowedTags' => ['a', 'span'], + ], ]; } From 55a4d4770381ef01214f641be6a909745b677843 Mon Sep 17 00:00:00 2001 From: Joan He Date: Wed, 24 Aug 2016 09:43:08 -0500 Subject: [PATCH 0265/3232] MAGETWO-57233: Eliminate @escapeNotVerified in Captcha, Contact, Cookie, Persistent, Rss, Sendfriend Module - Static test problem --- .../view/type/bundle/option/checkbox.phtml | 2 +- .../Utility/XssOutputValidator.php | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml index 44cc1ac97e622..96db376bc2205 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml @@ -29,7 +29,7 @@ getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^="bundle_option[' . $_option->getId() . ']"]:checked\'}"'?> + getRequired()) /* @escapeNotVerified */ echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^="bundle_option[' . $_option->getId() . ']"]:checked\'}"'?> name="bundle_option[getId() ?>][getId() ?>]" data-selector="bundle_option[getId() ?>][getId() ?>]" isSelected($_selection)) echo ' checked="checked"' ?> diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/XssOutputValidator.php b/dev/tests/static/framework/Magento/TestFramework/Utility/XssOutputValidator.php index 1e0d684c1242d..5deda15ed7dce 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/XssOutputValidator.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/XssOutputValidator.php @@ -309,7 +309,18 @@ private function replacePhpQuoteWithPlaceholders($fileContent) $phpBlock ); - $this->addQuoteOriginsReplacements($phpBlockQuoteReplaced); + $this->addQuoteOriginsReplacements( + $phpBlockQuoteReplaced, + [ + '/([^\\\\])([\'])(.*?)([^\\\\])([\'])/sim' + ] + ); + $this->addQuoteOriginsReplacements( + $phpBlockQuoteReplaced, + [ + '/([^\\\\])(["])(.*?)([^\\\\])(["])/sim', + ] + ); $origins[] = $phpBlock; $replacements[] = str_replace( @@ -354,15 +365,11 @@ private function replacePhpCommentsWithPlaceholders($fileContent) * Add replacements for expressions in single and double quotes * * @param string $phpBlock + * @param string[] $patterns * @return void */ - private function addQuoteOriginsReplacements($phpBlock) + private function addQuoteOriginsReplacements($phpBlock, $patterns) { - $patterns = [ - '/([^\\\\])(["])(.*?)([^\\\\])(["])/sim', - '/([^\\\\])([\'])(.*?)([^\\\\])([\'])/sim' - ]; - foreach ($patterns as $pattern) { if (preg_match_all($pattern, $phpBlock, $quoteMatches, PREG_SET_ORDER)) { foreach ($quoteMatches as $quoteMatch) { From 97f814fc865b1ab08ac21334e6a0816c7e167e1a Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 24 Aug 2016 09:58:57 -0500 Subject: [PATCH 0266/3232] MAGETWO-57271: Modify escapeHtml function to filter not allowed attributes and tags Modifying function to filter not allowed tags and attributes --- lib/internal/Magento/Framework/Escaper.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index b10874252a8bd..14cab9eefe4a6 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -15,6 +15,11 @@ class Escaper */ private $escaper; + /** + * @var string[] + */ + private $allowedAttributes = ['id', 'class', 'href', 'target']; + /** * Escape HTML entities * @@ -50,10 +55,8 @@ public function escapeHtml($data, $allowedTags = []) */ private function escapeHtmlTagsAndAttributes($string, $allowedTags) { - $allowedAttributes = ['id', 'class', 'href']; - $allowedTags = implode('|', $allowedTags); - $allowedAttributes = implode('|', $allowedAttributes); + $allowedAttributes = implode('|', $this->allowedAttributes); $attributeReplacements = []; From ba9176c191927f061d0a76777e236baa08230a5b Mon Sep 17 00:00:00 2001 From: Joan He Date: Wed, 24 Aug 2016 10:51:20 -0500 Subject: [PATCH 0267/3232] MAGETWO-57233: Eliminate @escapeNotVerified in Captcha, Contact, Cookie, Persistent, Rss, Sendfriend Module - Static test problem --- .../Magento/TestFramework/Utility/XssOutputValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/XssOutputValidator.php b/dev/tests/static/framework/Magento/TestFramework/Utility/XssOutputValidator.php index 5deda15ed7dce..48acb58019a78 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/XssOutputValidator.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/XssOutputValidator.php @@ -365,10 +365,10 @@ private function replacePhpCommentsWithPlaceholders($fileContent) * Add replacements for expressions in single and double quotes * * @param string $phpBlock - * @param string[] $patterns + * @param array $patterns * @return void */ - private function addQuoteOriginsReplacements($phpBlock, $patterns) + private function addQuoteOriginsReplacements($phpBlock, array $patterns) { foreach ($patterns as $pattern) { if (preg_match_all($pattern, $phpBlock, $quoteMatches, PREG_SET_ORDER)) { From 29333a41b1c96097c113ffa873a995b18b8f28b5 Mon Sep 17 00:00:00 2001 From: Joan He Date: Wed, 24 Aug 2016 11:21:47 -0500 Subject: [PATCH 0268/3232] MAGETWO-57234: Eliminate @escapeNotVerified in Customer Module --- .../Customer/view/frontend/templates/form/edit.phtml | 6 +++--- .../testsuite/Magento/Customer/Block/Widget/TaxvatTest.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml index 0dddf76d722b3..716378f4fc1ca 100644 --- a/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/form/edit.phtml @@ -122,9 +122,9 @@ { "[data-role=change-email], [data-role=change-password]": { "changeEmailPassword": { - "titleChangeEmail": "escapeJs(__('Change Email')) ?>", - "titleChangePassword": "escapeJs(__('Change Password')) ?>", - "titleChangeEmailAndPassword": "escapeJs(__('Change Email and Password')) ?>" + "titleChangeEmail": "escapeJs($block->escapeHtml(__('Change Email'))) ?>", + "titleChangePassword": "escapeJs($block->escapeHtml(__('Change Password'))) ?>", + "titleChangeEmailAndPassword": "escapeJs($block->escapeHtml(__('Change Email and Password'))) ?>" } } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php index 33ecb2532e52a..f8d0df661d3e0 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php @@ -22,7 +22,7 @@ public function testToHtml() \Magento\Customer\Block\Widget\Taxvat::class ); - $this->assertContains('title="Tax/VAT number"', $block->toHtml()); + $this->assertContains('title="Tax/VAT number"', $block->toHtml()); $this->assertNotContains('required', $block->toHtml()); } @@ -44,7 +44,7 @@ public function testToHtmlRequired() \Magento\Customer\Block\Widget\Taxvat::class ); - $this->assertContains('title="Tax/VAT number"', $block->toHtml()); + $this->assertContains('title="Tax/VAT number"', $block->toHtml()); $this->assertContains('required', $block->toHtml()); } From f7be9716cfa9995599fb5fdaca49a0c7e6000053 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 24 Aug 2016 11:17:06 -0500 Subject: [PATCH 0269/3232] MAGETWO-57235: Eliminate @escapeNotVerified in Newsletter Module - updated templates --- .../view/adminhtml/templates/preview/iframeswitcher.phtml | 3 ++- .../view/adminhtml/templates/preview/store.phtml | 2 +- .../view/adminhtml/templates/queue/preview.phtml | 4 +++- .../view/adminhtml/templates/subscriber/list.phtml | 2 +- .../view/adminhtml/templates/template/edit.phtml | 8 ++++---- .../view/adminhtml/templates/template/preview.phtml | 4 +++- .../Newsletter/view/frontend/templates/subscribe.phtml | 8 ++++---- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml index aa5679047a593..c8674986cbedc 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/iframeswitcher.phtml @@ -6,6 +6,7 @@ // @codingStandardsIgnoreFile +/** @var \Magento\Backend\Block\Page $block */ ?>
@@ -15,7 +16,7 @@
- + getChildHtml('preview_form'); ?> diff --git a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/store.phtml b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/store.phtml index 7383a8ece33db..9574092d4e0df 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/templates/preview/store.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/templates/preview/store.phtml @@ -10,7 +10,7 @@ getWebsites()): ?>
- +
- +
- + escapeHtml(__("Rating isn't Available")) ?> diff --git a/app/code/Magento/Review/view/adminhtml/templates/rating/form.phtml b/app/code/Magento/Review/view/adminhtml/templates/rating/form.phtml index a46dcad3b7b90..019cbec2944b9 100644 --- a/app/code/Magento/Review/view/adminhtml/templates/rating/form.phtml +++ b/app/code/Magento/Review/view/adminhtml/templates/rating/form.phtml @@ -6,10 +6,11 @@ // @codingStandardsIgnoreFile +/** @var \Magento\Review\Block\Adminhtml\Rating\Edit\Tab\Form $block */ ?>
-
+
escapeHtml(__('Please specify a rating title for a store, or we\'ll just use the default value.')); ?>
diff --git a/app/code/Magento/Review/view/adminhtml/templates/rating/options.phtml b/app/code/Magento/Review/view/adminhtml/templates/rating/options.phtml index 8fe776fb345fb..f267d8e995768 100644 --- a/app/code/Magento/Review/view/adminhtml/templates/rating/options.phtml +++ b/app/code/Magento/Review/view/adminhtml/templates/rating/options.phtml @@ -5,22 +5,23 @@ */ // @codingStandardsIgnoreFile +// @deprecated ?>
-

+

escapeHtml(__('Assigned Options')) ?>

- + getSize() > 0): ?> getItems() as $_item): ?> - + diff --git a/app/code/Magento/Review/view/adminhtml/templates/rating/stars/detailed.phtml b/app/code/Magento/Review/view/adminhtml/templates/rating/stars/detailed.phtml index 86ae33dae3e6a..930ddcc6cceef 100644 --- a/app/code/Magento/Review/view/adminhtml/templates/rating/stars/detailed.phtml +++ b/app/code/Magento/Review/view/adminhtml/templates/rating/stars/detailed.phtml @@ -5,6 +5,7 @@ */ // @codingStandardsIgnoreFile +// @deprecated ?> getRating() && $block->getRating()->getSize()): ?>
@@ -20,5 +21,5 @@
- + escapeHtml(__("Rating isn't Available")) ?> diff --git a/app/code/Magento/Review/view/adminhtml/templates/rating/stars/summary.phtml b/app/code/Magento/Review/view/adminhtml/templates/rating/stars/summary.phtml index 1badd86990758..8c4ea6a02c17f 100644 --- a/app/code/Magento/Review/view/adminhtml/templates/rating/stars/summary.phtml +++ b/app/code/Magento/Review/view/adminhtml/templates/rating/stars/summary.phtml @@ -13,5 +13,5 @@
- + escapeHtml(__("Rating isn't Available")) ?> diff --git a/app/code/Magento/Review/view/frontend/templates/customer/list.phtml b/app/code/Magento/Review/view/frontend/templates/customer/list.phtml index 578f8d19c22b5..9a17e0ff33f99 100644 --- a/app/code/Magento/Review/view/frontend/templates/customer/list.phtml +++ b/app/code/Magento/Review/view/frontend/templates/customer/list.phtml @@ -11,13 +11,13 @@ getReviews() && count($block->getReviews())): ?>
- + - - - - + + + + @@ -33,19 +33,19 @@ - - @@ -59,12 +59,12 @@ -
+
escapeHtml(__('You have submitted no reviews.')) ?>
diff --git a/app/code/Magento/Review/view/frontend/templates/customer/recent.phtml b/app/code/Magento/Review/view/frontend/templates/customer/recent.phtml index b232b832b86ac..1807096b31573 100644 --- a/app/code/Magento/Review/view/frontend/templates/customer/recent.phtml +++ b/app/code/Magento/Review/view/frontend/templates/customer/recent.phtml @@ -11,8 +11,8 @@ getReviews() && count($block->getReviews())): ?>
- - + escapeHtml(__('My Recent Reviews')) ?> + escapeHtml(__('View All')) ?>
    @@ -22,7 +22,7 @@ getSum()): ?> getSum() / $_review->getCount() ?>
    - : + escapeHtml(__('Rating')) ?>:
    escapeHtml($rating); ?>%
    diff --git a/app/code/Magento/Review/view/frontend/templates/customer/view.phtml b/app/code/Magento/Review/view/frontend/templates/customer/view.phtml index 9937fce922f54..638d53da64efc 100644 --- a/app/code/Magento/Review/view/frontend/templates/customer/view.phtml +++ b/app/code/Magento/Review/view/frontend/templates/customer/view.phtml @@ -22,7 +22,7 @@ $product = $block->getProductData();

    escapeHtml($product->getName()) ?>

    getRating() && $block->getRating()->getSize()): ?> - + escapeHtml(__('Average Customer Rating:')) ?> getReviewsSummaryHtml($product) ?>
    @@ -31,7 +31,7 @@ $product = $block->getProductData();
    getRating() && $block->getRating()->getSize()): ?>
    - + escapeHtml(__('Your Review')); ?>
    getRating() as $_rating): ?> @@ -53,13 +53,13 @@ $product = $block->getProductData();
    escapeHtml($block->getReviewData()->getTitle()) ?>
    escapeHtml($block->getReviewData()->getDetail())) ?>
    - ' . $block->dateFormat($block->getReviewData()->getCreatedAt()) . '') ?> + escapeHtml(__('Submitted on %1', ''), ['time']) ?>
    diff --git a/app/code/Magento/Review/view/frontend/templates/detailed.phtml b/app/code/Magento/Review/view/frontend/templates/detailed.phtml index 72bd4fcaca377..46d7b34a75717 100644 --- a/app/code/Magento/Review/view/frontend/templates/detailed.phtml +++ b/app/code/Magento/Review/view/frontend/templates/detailed.phtml @@ -11,12 +11,12 @@ getSize()): ?>
escapeHtml(__('Product Reviews')) ?>
escapeHtml(__('Created')) ?>escapeHtml(__('Product Name')) ?>escapeHtml(__('Rating')) ?>escapeHtml(__('Review')) ?>  
getSum()): ?>
- : -
- getSum() / $_review->getCount()) ?>% + escapeHtml(__('Rating')) ?>: +
+ getSum() / (int)$_review->getCount()) ?>%
+ helper('Magento\Review\Helper\Data')->getDetailHtml($_review->getDetail()) ?> + - + escapeHtml(__('See Details')) ?>
- + getSummary()): ?> - + '+ diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml index 699bfce3acd1a..510a3d3fcc8d7 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml @@ -63,7 +63,8 @@ require([ 'uiRegistry', 'mage/template', 'jquery/file-uploader', - 'prototype' + 'prototype', + 'mage/translate' ], function (jQuery, registry, mageTemplate) { registry.get('downloadable', function (Downloadable) { var sampleTemplate = ''+ diff --git a/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js b/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js index e859a03491cba..4a733dd155a22 100644 --- a/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js +++ b/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js @@ -12,7 +12,8 @@ 'Magento_Payment/js/model/credit-card-validation/credit-card-number-validator', 'Magento_Payment/js/model/credit-card-validation/expiration-date-validator/expiration-year-validator', 'Magento_Payment/js/model/credit-card-validation/expiration-date-validator/expiration-month-validator', - 'Magento_Payment/js/model/credit-card-validation/credit-card-data' + 'Magento_Payment/js/model/credit-card-validation/credit-card-data', + 'mage/translate' ], factory); } else { factory(jQuery); @@ -40,7 +41,7 @@ return false; } }, - 'Please enter a valid credit card type number.' + $.mage.__('Please enter a valid credit card type number.') ], 'validate-card-number': [ /** @@ -51,7 +52,7 @@ function (number) { return creditCardNumberValidator(number).isValid; }, - 'Please enter a valid credit card number.' + $.mage.__('Please enter a valid credit card number.') ], 'validate-card-date': [ /** @@ -62,7 +63,7 @@ function (date) { return monthValidator(date).isValid; }, - 'Incorrect credit card expiration month.' + $.mage.__('Incorrect credit card expiration month.') ], 'validate-card-cvv': [ /** @@ -74,7 +75,7 @@ var maxLength = creditCardData.creditCard ? creditCardData.creditCard.code.size : 3; return cvvValidator(cvv, maxLength).isValid; }, - 'Please enter a valid credit card verification number.' + $.mage.__('Please enter a valid credit card verification number.') ], 'validate-card-year': [ /** @@ -85,7 +86,7 @@ function (date) { return monthValidator(date).isValid; }, - 'Incorrect credit card expiration year.' + $.mage.__('Incorrect credit card expiration year.') ] }, function (i, rule) { diff --git a/app/code/Magento/Paypal/view/frontend/web/order-review.js b/app/code/Magento/Paypal/view/frontend/web/order-review.js index dc389493e46cc..4ce2d5a1b8f2f 100644 --- a/app/code/Magento/Paypal/view/frontend/web/order-review.js +++ b/app/code/Magento/Paypal/view/frontend/web/order-review.js @@ -132,7 +132,7 @@ define([ } } alert({ - content: $.mage.__(msg) + content: msg }); return false; } diff --git a/app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js b/app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js index cd175bed11106..5885c157927bc 100644 --- a/app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js +++ b/app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js @@ -6,7 +6,8 @@ define([ 'jquery', 'Magento_Ui/js/modal/alert', - 'jquery/ui' + 'jquery/ui', + 'mage/translate' ], function ($, alert) { 'use strict'; diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js b/app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js index c2f95f85b311d..8172d6d9a5f30 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js @@ -3,7 +3,8 @@ * See COPYING.txt for license details. */ require([ - 'jquery' + 'jquery', + 'mage/translate' ], function ($) { 'use strict'; diff --git a/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml index 8bfeda24a0d2a..2dacb6b70c1d9 100644 --- a/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml @@ -33,7 +33,8 @@ require([ 'jquery', 'mage/template', 'jquery/file-uploader', - 'domReady!' + 'domReady!', + 'mage/translate' ], function ($, mageTemplate) { $('#fileupload').fileupload({ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js index 32247e03baa04..f4bde3969e006 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js @@ -7,7 +7,8 @@ define([ 'jquery', 'mage/template', 'text!Magento_Ui/templates/grid/cells/thumbnail/preview.html', - 'Magento_Ui/js/modal/modal' + 'Magento_Ui/js/modal/modal', + 'mage/translate' ], function (Column, $, mageTemplate, thumbnailPreviewTemplate) { 'use strict'; diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js index 71f2834190436..95aa116e0084b 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js @@ -430,10 +430,10 @@ define([ var pass = $.trim(v); var result = pass.length >= passwordMinLength; if (result == false) { - validator.passwordErrorMessage = $.mage.__( - "Minimum length of this field must be equal or greater than %1 symbols." + - " Leading and trailing spaces will be ignored." - ).replace('%1', passwordMinLength); + /*eslint-disable max-len*/ + validator.passwordErrorMessage = $.mage.__('Minimum length of this field must be equal or greater than %1 symbols. Leading and trailing spaces will be ignored.').replace('%1', passwordMinLength); + + /*eslint-enable max-len*/ return result; } if (pass.match(/\d+/)) { @@ -450,10 +450,11 @@ define([ } if (counter < passwordMinCharacterSets) { result = false; - validator.passwordErrorMessage = $.mage.__( - "Minimum of different classes of characters in password is %1." + - " Classes of characters: Lower Case, Upper Case, Digits, Special Characters." - ).replace('%1', passwordMinCharacterSets); + + /*eslint-disable max-len*/ + validator.passwordErrorMessage = $.mage.__('Minimum of different classes of characters in password is %1. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.').replace('%1', passwordMinCharacterSets); + + /*eslint-enable max-len*/ } return result; }, function () { @@ -741,7 +742,8 @@ define([ } } return true; - }, "Please enter valid email addresses, separated by commas. For example, johndoe@domain.com, johnsmith@domain.com." + }, + $.mage.__('Please enter valid email addresses, separated by commas. For example, johndoe@domain.com, johnsmith@domain.com.') ], "validate-cc-number": [ /** diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index 9fab793b70b6c..3041a177185cf 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -545,10 +545,10 @@ var pass = $.trim(v); var result = pass.length >= passwordMinLength; if (result == false) { - validator.passwordErrorMessage = $.mage.__( - "Minimum length of this field must be equal or greater than %1 symbols." + - " Leading and trailing spaces will be ignored." - ).replace('%1', passwordMinLength); + /*eslint-disable max-len*/ + validator.passwordErrorMessage = $.mage.__('Minimum length of this field must be equal or greater than %1 symbols. Leading and trailing spaces will be ignored.').replace('%1', passwordMinLength); + + /*eslint-enable max-len*/ return result; } if (pass.match(/\d+/)) { @@ -565,10 +565,11 @@ } if (counter < passwordMinCharacterSets) { result = false; - validator.passwordErrorMessage = $.mage.__( - "Minimum of different classes of characters in password is %1." + - " Classes of characters: Lower Case, Upper Case, Digits, Special Characters." - ).replace('%1', passwordMinCharacterSets); + + /*eslint-disable max-len*/ + validator.passwordErrorMessage = $.mage.__('Minimum of different classes of characters in password is %1. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.').replace('%1', passwordMinCharacterSets); + + /*eslint-enable max-len*/ } return result; }, function () { @@ -984,7 +985,7 @@ return !!container.querySelectorAll(selector).length; }, - 'Please select one of the options.' + $.mage.__('Please select one of the options.') ], "less-than-equals-to": [ function (value, element, params) { @@ -1145,16 +1146,12 @@ if (name.match(reMax) && result) { length = name.split('-')[2]; result = (v.length <= length); - validator.validateMessage = $.mage.__( - "Please enter less or equal than %1 symbols." - ).replace('%1', length); + validator.validateMessage = $.mage.__('Please enter less or equal than %1 symbols.').replace('%1', length); } if (name.match(reMin) && result && !$.mage.isEmpty(v)) { length = name.split('-')[2]; result = v.length >= length; - validator.validateMessage = $.mage.__( - "Please enter more or equal than %1 symbols." - ).replace('%1', length); + validator.validateMessage = $.mage.__('Please enter more or equal than %1 symbols.').replace('%1', length); } }); return result; From ce596a2190959332585a4b92e467beaf3840052b Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Tue, 20 Sep 2016 15:06:12 +0300 Subject: [PATCH 0827/3232] MAGETWO-58242: Issue with an Import Export when Attribute Changes --- app/code/Magento/CatalogImportExport/Model/Import/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 6658faf5de9d4..e002c91a82024 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -273,7 +273,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity ValidatorInterface::ERROR_MEDIA_PATH_NOT_ACCESSIBLE => 'Imported resource (image) does not exist in the local media storage', ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE => 'Imported resource (image) could not be downloaded from external resource due to timeout or access permissions', ValidatorInterface::ERROR_INVALID_WEIGHT => 'Product weight is invalid', - ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'URL key: \'%s\' was already generated for item with SKU: \'%s\' You will need to specify an unique URL key manually.' + ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Url key: \'%s\' was already generated for item with SKU: \'%s\'. You need to specify a unique URL key manually' ]; /** From e7088a6794f1229302c4bb5c9e1057bc4416dd70 Mon Sep 17 00:00:00 2001 From: Andrey Konosov Date: Tue, 20 Sep 2016 15:12:56 +0300 Subject: [PATCH 0828/3232] MAGETWO-58265: [Github][Cloud][Customer]Fix Varnish X-Header - CR fixes --- .../Observer/InvalidateVarnishObserver.php | 2 +- .../PageCache/Observer/FlushCacheByTags.php | 4 ++-- .../App/Cache/Tag/Strategy/Dummy.php | 4 ++++ .../App/Cache/Tag/Strategy/Factory.php | 5 ++-- .../Unit/Cache/Tag/Strategy/DummyTest.php | 23 ++++++++++++++----- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/CacheInvalidate/Observer/InvalidateVarnishObserver.php b/app/code/Magento/CacheInvalidate/Observer/InvalidateVarnishObserver.php index fd0e9e31af938..7be03928bec0c 100644 --- a/app/code/Magento/CacheInvalidate/Observer/InvalidateVarnishObserver.php +++ b/app/code/Magento/CacheInvalidate/Observer/InvalidateVarnishObserver.php @@ -73,6 +73,6 @@ public function execute(\Magento\Framework\Event\Observer $observer) */ private function getTagResolver() { - return ObjectManager::getInstance()->get('\Magento\Framework\App\Cache\Tag\Resolver'); + return ObjectManager::getInstance()->get(\Magento\Framework\App\Cache\Tag\Resolver::class); } } diff --git a/app/code/Magento/PageCache/Observer/FlushCacheByTags.php b/app/code/Magento/PageCache/Observer/FlushCacheByTags.php index 57b2c6f549276..6e3d74bcb7354 100644 --- a/app/code/Magento/PageCache/Observer/FlushCacheByTags.php +++ b/app/code/Magento/PageCache/Observer/FlushCacheByTags.php @@ -74,10 +74,10 @@ private function getCache() /** * @deprecated - * @return \Magento\PageCache\Model\Cache\Tag\Resolver + * @return \Magento\Framework\App\Cache\Tag\Resolver */ private function getTagResolver() { - return ObjectManager::getInstance()->get('\Magento\PageCache\Model\Cache\Tag\Resolver'); + return ObjectManager::getInstance()->get(\Magento\Framework\App\Cache\Tag\Resolver::class); } } diff --git a/lib/internal/Magento/Framework/App/Cache/Tag/Strategy/Dummy.php b/lib/internal/Magento/Framework/App/Cache/Tag/Strategy/Dummy.php index f2cdeeec5efd0..84f448149991c 100644 --- a/lib/internal/Magento/Framework/App/Cache/Tag/Strategy/Dummy.php +++ b/lib/internal/Magento/Framework/App/Cache/Tag/Strategy/Dummy.php @@ -17,6 +17,10 @@ class Dummy implements StrategyInterface */ public function getTags($object) { + if (!is_object($object)) { + throw new \InvalidArgumentException('Provided argument is not an object'); + } + return []; } } diff --git a/lib/internal/Magento/Framework/App/Cache/Tag/Strategy/Factory.php b/lib/internal/Magento/Framework/App/Cache/Tag/Strategy/Factory.php index 4b71c14f0318b..3dc56ad290c93 100644 --- a/lib/internal/Magento/Framework/App/Cache/Tag/Strategy/Factory.php +++ b/lib/internal/Magento/Framework/App/Cache/Tag/Strategy/Factory.php @@ -48,7 +48,7 @@ public function __construct( * * @param object $object * @throws \InvalidArgumentException - * @return \Magento\Framework\App\Cache\Tag\StrategyInterface|null + * @return \Magento\Framework\App\Cache\Tag\StrategyInterface */ public function getStrategy($object) { @@ -62,7 +62,8 @@ class_parents($object), class_implements($object) ); - if ($result = array_intersect(array_keys($this->customStrategies), $classHierarchy)) { + $result = array_intersect(array_keys($this->customStrategies), $classHierarchy); + if ($result) { return $this->customStrategies[array_shift($result)]; } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php index f721ec934c400..4bc2bf1294760 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php @@ -10,16 +10,27 @@ class DummyTest extends \PHPUnit_Framework_TestCase { - public function testGetTags() + + private $model; + + protected function setUp() { - $model = new Dummy(); - $emptyArray = []; + $this->model = new Dummy(); + } - $this->assertEquals($emptyArray, $model->getTags('scalar')); + public function testGetTagsWithScalar() + { + $this->setExpectedException(\InvalidArgumentException::class, 'Provided argument is not an object'); + $this->model->getTags('scalar'); + } + + public function testGetTagsWithObject() + { + $emptyArray = []; - $this->assertEquals($emptyArray, $model->getTags(new \StdClass)); + $this->assertEquals($emptyArray, $this->model->getTags(new \StdClass)); $identityInterface = $this->getMockForAbstractClass(\Magento\Framework\DataObject\IdentityInterface::class); - $this->assertEquals($emptyArray, $model->getTags($identityInterface)); + $this->assertEquals($emptyArray, $this->model->getTags($identityInterface)); } } From ad80e9ce2166bf4cc11625722e2fece8edf37069 Mon Sep 17 00:00:00 2001 From: Oleksandr Radchenko Date: Tue, 20 Sep 2016 15:31:54 +0300 Subject: [PATCH 0829/3232] MAGETWO-54693: Ability to return the product to the stock after Creditmemo API --- .../Plugin/Order/ReturnToStockInvoice.php | 4 +- .../Model/Plugin/Order/ReturnToStockOrder.php | 3 +- .../Unit/Model/Order/ReturnProcessorTest.php | 207 ++++++++++++++++++ .../Plugin/Order/ReturnToStockInvoiceTest.php | 173 +++++++++++++++ .../Plugin/Order/ReturnToStockOrderTest.php | 142 ++++++++++++ 5 files changed, 526 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/CatalogInventory/Test/Unit/Model/Order/ReturnProcessorTest.php create mode 100644 app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/Order/ReturnToStockInvoiceTest.php create mode 100644 app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/Order/ReturnToStockOrderTest.php diff --git a/app/code/Magento/CatalogInventory/Model/Plugin/Order/ReturnToStockInvoice.php b/app/code/Magento/CatalogInventory/Model/Plugin/Order/ReturnToStockInvoice.php index ae8713f4c621a..14b30aa3a8eec 100644 --- a/app/code/Magento/CatalogInventory/Model/Plugin/Order/ReturnToStockInvoice.php +++ b/app/code/Magento/CatalogInventory/Model/Plugin/Order/ReturnToStockInvoice.php @@ -1,5 +1,4 @@ stockConfigurationMock = $this->getMockBuilder(StockConfigurationInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->stockManagementMock = $this->getMockBuilder(StockManagementInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->stockIndexerProcessorMock = $this->getMockBuilder( + \Magento\CatalogInventory\Model\Indexer\Stock\Processor::class + )->disableOriginalConstructor() + ->getMock(); + $this->priceIndexerMock = $this->getMockBuilder(\Magento\Catalog\Model\Indexer\Product\Price\Processor::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoRepositoryMock = $this->getMockBuilder(CreditmemoRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderRepositoryMock = $this->getMockBuilder(OrderRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderItemRepositoryMock = $this->getMockBuilder(OrderItemRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderMock = $this->getMockBuilder(OrderInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoMock = $this->getMockBuilder(CreditmemoInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoItemMock = $this->getMockBuilder(CreditmemoItemInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderItemMock = $this->getMockBuilder(OrderItemInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->storeMock = $this->getMockBuilder(StoreInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->returnProcessor = New ReturnProcessor( + $this->stockConfigurationMock, + $this->stockManagementMock, + $this->stockIndexerProcessorMock, + $this->priceIndexerMock, + $this->creditmemoRepositoryMock, + $this->storeManagerMock, + $this->orderRepositoryMock, + $this->orderItemRepositoryMock + ); + } + + public function testExecute() + { + $orderItemId = 99; + $productId = 50; + $returnToStockItems = [$orderItemId]; + $qty = 1; + $storeId = 0; + $webSiteId = 10; + + $this->stockConfigurationMock->expects($this->once()) + ->method('isAutoReturnEnabled') + ->willReturn(false); + + $this->creditmemoMock->expects($this->once()) + ->method('getItems') + ->willReturn([$this->creditmemoItemMock]); + + $this->creditmemoItemMock->expects($this->once()) + ->method('getQty') + ->willReturn($qty); + + $this->creditmemoItemMock->expects($this->exactly(2)) + ->method('getOrderItemId') + ->willReturn($orderItemId); + + $this->creditmemoItemMock->expects($this->once()) + ->method('getProductId') + ->willReturn($productId); + + $this->orderItemRepositoryMock->expects($this->once()) + ->method('get') + ->with($orderItemId) + ->willReturn($this->orderItemMock); + + $this->orderMock->expects($this->once()) + ->method('getStoreId') + ->willReturn($storeId); + + $this->storeManagerMock->expects($this->once()) + ->method('getStore') + ->with($storeId) + ->willReturn($this->storeMock); + + $this->storeMock->expects($this->once()) + ->method('getWebsiteId') + ->willReturn($webSiteId); + + $this->stockManagementMock->expects($this->once()) + ->method('backItemQty') + ->with($productId, $qty, $webSiteId) + ->willReturn(true); + + $this->stockIndexerProcessorMock->expects($this->once()) + ->method('reindexList') + ->with([$productId]); + + $this->priceIndexerMock->expects($this->once()) + ->method('reindexList') + ->with([$productId]); + + $this->returnProcessor->execute($this->creditmemoMock, $this->orderMock, $returnToStockItems); + } +} diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/Order/ReturnToStockInvoiceTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/Order/ReturnToStockInvoiceTest.php new file mode 100644 index 0000000000000..6730e3e0074c1 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/Order/ReturnToStockInvoiceTest.php @@ -0,0 +1,173 @@ +returnProcessorMock = $this->getMockBuilder(ReturnProcessor::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoRepositoryMock = $this->getMockBuilder(CreditmemoRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderRepositoryMock = $this->getMockBuilder(OrderRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->invoiceRepositoryMock = $this->getMockBuilder(InvoiceRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->refundInvoiceMock = $this->getMockBuilder(RefundInvoiceInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoCreationArgumentsMock = $this->getMockBuilder(CreditmemoCreationArgumentsInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->extencionAttributesMock = $this->getMockBuilder(CreditmemoCreationArgumentsExtensionInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getReturnToStockItems']) + ->getMock(); + $this->orderMock = $this->getMockBuilder(OrderInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoMock = $this->getMockBuilder(CreditmemoInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->invoiceMock = $this->getMockBuilder(InvoiceInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->returnTOStock = new ReturnToStockInvoice($this->returnProcessorMock, + $this->creditmemoRepositoryMock, + $this->orderRepositoryMock, + $this->invoiceRepositoryMock); + } + + public function testAfterExecute() + { + $orderId = 1; + $creditmemoId = 99; + $items = []; + $returnToStockItems = [1]; + $invoiceId = 98; + $this->creditmemoCreationArgumentsMock->expects($this->exactly(3)) + ->method('getExtensionAttributes') + ->willReturn($this->extencionAttributesMock); + + $this->invoiceRepositoryMock->expects($this->once()) + ->method('get') + ->with($invoiceId) + ->willReturn($this->invoiceMock); + + $this->extencionAttributesMock->expects($this->exactly(2)) + ->method('getReturnToStockItems') + ->willReturn($returnToStockItems); + + $this->orderRepositoryMock->expects($this->once()) + ->method('get') + ->with($orderId) + ->willReturn($this->orderMock); + + $this->creditmemoRepositoryMock->expects($this->once()) + ->method('get') + ->with($creditmemoId) + ->willReturn($this->creditmemoMock); + + $this->returnProcessorMock->expects($this->once()) + ->method('execute') + ->with($this->creditmemoMock, $this->orderMock, $returnToStockItems); + + $this->invoiceMock->expects($this->once()) + ->method('getOrderId') + ->willReturn($orderId); + + $this->assertEquals( + $this->returnTOStock->afterExecute( + $this->refundInvoiceMock, + $creditmemoId, + $invoiceId, + $items, + false, + false, + false, + null, + $this->creditmemoCreationArgumentsMock + ), + $creditmemoId + ); + } +} diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/Order/ReturnToStockOrderTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/Order/ReturnToStockOrderTest.php new file mode 100644 index 0000000000000..0f77f2556a75b --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/Order/ReturnToStockOrderTest.php @@ -0,0 +1,142 @@ +returnProcessorMock = $this->getMockBuilder(ReturnProcessor::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoRepositoryMock = $this->getMockBuilder(CreditmemoRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderRepositoryMock = $this->getMockBuilder(OrderRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->refundOrderMock = $this->getMockBuilder(RefundOrderInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoCreationArgumentsMock = $this->getMockBuilder(CreditmemoCreationArgumentsInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->extencionAttributesMock = $this->getMockBuilder(CreditmemoCreationArgumentsExtensionInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getReturnToStockItems']) + ->getMock(); + $this->orderMock = $this->getMockBuilder(OrderInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoMock = $this->getMockBuilder(CreditmemoInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->returnTOStock = new ReturnToStockOrder($this->returnProcessorMock, + $this->creditmemoRepositoryMock, + $this->orderRepositoryMock); + } + + public function testAfterExecute() + { + $orderId = 1; + $creditmemoId = 99; + $items = []; + $returnToStockItems = [1]; + $this->creditmemoCreationArgumentsMock->expects($this->exactly(3)) + ->method('getExtensionAttributes') + ->willReturn($this->extencionAttributesMock); + + $this->extencionAttributesMock->expects($this->exactly(2)) + ->method('getReturnToStockItems') + ->willReturn($returnToStockItems); + + $this->orderRepositoryMock->expects($this->once()) + ->method('get') + ->with($orderId) + ->willReturn($this->orderMock); + + $this->creditmemoRepositoryMock->expects($this->once()) + ->method('get') + ->with($creditmemoId) + ->willReturn($this->creditmemoMock); + + $this->returnProcessorMock->expects($this->once()) + ->method('execute') + ->with($this->creditmemoMock, $this->orderMock, $returnToStockItems); + + $this->assertEquals( + $this->returnTOStock->afterExecute( + $this->refundOrderMock, + $creditmemoId, + $orderId, + $items, + false, + false, + null, + $this->creditmemoCreationArgumentsMock + ), + $creditmemoId + ); + } +} From 95d17ee6a5ec5375dd2ef7934d1b4f501ba29080 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Tue, 20 Sep 2016 05:44:06 -0700 Subject: [PATCH 0830/3232] MAGETWO-56512: Products created via REST API are not visible after enabling the product via scope = All Store Views --- .../Catalog/Model/ProductRepository.php | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 9ceaa8bc9d049..2a5811f8e60a0 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -303,6 +303,7 @@ protected function initializeProductData(array $productData, $createNew) $product->setData($key, $value); } $this->assignProductToWebsites($product); + $this->assignAdminWebsiteToProduct($product); return $product; } @@ -314,16 +315,25 @@ protected function initializeProductData(array $productData, $createNew) private function assignProductToWebsites(\Magento\Catalog\Model\Product $product) { if (!$this->storeManager->hasSingleStore()) { - if ($this->storeManager->getStore()->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) { - $websiteIds = array_keys($this->storeManager->getWebsites()); - } else { - $websiteIds = [$this->storeManager->getStore()->getWebsiteId()]; - } - + $websiteIds = [$this->storeManager->getStore()->getWebsiteId()]; $product->setWebsiteIds(array_unique(array_merge($product->getWebsiteIds(), $websiteIds))); } } + /** + * Assign all websites to product if current product is admin + * + * @param Product $product + * @return void + */ + private function assignAdminWebsiteToProduct(\Magento\Catalog\Model\Product $product) + { + if ($this->storeManager->getStore(true)->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) { + $websiteIds = array_keys($this->storeManager->getWebsites()); + $product->setWebsiteIds($websiteIds); + } + } + /** * @param ProductInterface $product * @param array $newEntry From 6fef16c88e51ab421d696d6c9071ed5dafa5c32d Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Tue, 20 Sep 2016 05:50:23 -0700 Subject: [PATCH 0831/3232] MAGETWO-56512: Products created via REST API are not visible after enabling the product via scope = All Store Views --- app/code/Magento/Catalog/Model/ProductRepository.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 2a5811f8e60a0..ccfcbc03c0f7a 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -303,7 +303,6 @@ protected function initializeProductData(array $productData, $createNew) $product->setData($key, $value); } $this->assignProductToWebsites($product); - $this->assignAdminWebsiteToProduct($product); return $product; } @@ -318,16 +317,7 @@ private function assignProductToWebsites(\Magento\Catalog\Model\Product $product $websiteIds = [$this->storeManager->getStore()->getWebsiteId()]; $product->setWebsiteIds(array_unique(array_merge($product->getWebsiteIds(), $websiteIds))); } - } - /** - * Assign all websites to product if current product is admin - * - * @param Product $product - * @return void - */ - private function assignAdminWebsiteToProduct(\Magento\Catalog\Model\Product $product) - { if ($this->storeManager->getStore(true)->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) { $websiteIds = array_keys($this->storeManager->getWebsites()); $product->setWebsiteIds($websiteIds); From 70dde951969d08aa43e2c981622cadd3049bfb62 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Tue, 20 Sep 2016 06:24:05 -0700 Subject: [PATCH 0832/3232] MAGETWO-56512: Products created via REST API are not visible after enabling the product via scope = All Store Views --- .../Catalog/Model/ProductRepository.php | 13 +++-- .../Test/Unit/Model/ProductRepositoryTest.php | 51 ++++++++++++++++++- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index ccfcbc03c0f7a..3db0892ad1c59 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -313,15 +313,22 @@ protected function initializeProductData(array $productData, $createNew) */ private function assignProductToWebsites(\Magento\Catalog\Model\Product $product) { + $websiteIds = []; + if (!$this->storeManager->hasSingleStore()) { - $websiteIds = [$this->storeManager->getStore()->getWebsiteId()]; - $product->setWebsiteIds(array_unique(array_merge($product->getWebsiteIds(), $websiteIds))); + $websiteIds = array_unique( + array_merge( + $product->getWebsiteIds(), + [$this->storeManager->getStore()->getWebsiteId()] + ) + ); } if ($this->storeManager->getStore(true)->getCode() == \Magento\Store\Model\Store::ADMIN_CODE) { $websiteIds = array_keys($this->storeManager->getWebsites()); - $product->setWebsiteIds($websiteIds); } + + $product->setWebsiteIds($websiteIds); } /** diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index 5042ac1b745cf..e91bb469eb112 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -14,6 +14,7 @@ use Magento\Framework\DB\Adapter\ConnectionException; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; +use Magento\Store\Api\Data\StoreInterface; /** * Class ProductRepositoryTest @@ -284,7 +285,6 @@ protected function setUp() $storeMock->expects($this->any())->method('getWebsiteId')->willReturn('1'); $storeMock->expects($this->any())->method('getCode')->willReturn(\Magento\Store\Model\Store::ADMIN_CODE); $this->storeManagerMock->expects($this->any())->method('getStore')->willReturn($storeMock); - $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $this->mediaGalleryProcessor = $this->getMock( \Magento\Catalog\Model\Product\Gallery\Processor::class, @@ -495,6 +495,7 @@ public function testGetBySkuFromCacheInitializedInGetById() public function testSaveExisting() { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $this->resourceModelMock->expects($this->any())->method('getIdBySku')->will($this->returnValue(100)); $this->productFactoryMock->expects($this->any()) ->method('create') @@ -514,6 +515,7 @@ public function testSaveExisting() public function testSaveNew() { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $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()) @@ -538,6 +540,7 @@ public function testSaveNew() */ public function testSaveUnableToSaveException() { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $this->resourceModelMock->expects($this->exactly(1))->method('getIdBySku')->will($this->returnValue(null)); $this->productFactoryMock->expects($this->exactly(2)) ->method('create') @@ -562,6 +565,7 @@ public function testSaveUnableToSaveException() */ public function testSaveException() { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $this->resourceModelMock->expects($this->exactly(1))->method('getIdBySku')->will($this->returnValue(null)); $this->productFactoryMock->expects($this->exactly(2)) ->method('create') @@ -587,6 +591,7 @@ public function testSaveException() */ public function testSaveInvalidProductException() { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $this->resourceModelMock->expects($this->exactly(1))->method('getIdBySku')->will($this->returnValue(null)); $this->productFactoryMock->expects($this->exactly(2)) ->method('create') @@ -610,6 +615,7 @@ public function testSaveInvalidProductException() */ public function testSaveThrowsTemporaryStateExceptionIfDatabaseConnectionErrorOccurred() { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $this->productFactoryMock->expects($this->any()) ->method('create') ->will($this->returnValue($this->productMock)); @@ -796,6 +802,7 @@ public function cacheKeyDataProvider() */ public function testSaveExistingWithOptions(array $newOptions, array $existingOptions, array $expectedData) { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $this->resourceModelMock->expects($this->any())->method('getIdBySku')->will($this->returnValue(100)); $this->productFactoryMock->expects($this->any()) ->method('create') @@ -964,6 +971,7 @@ public function saveExistingWithOptionsDataProvider() */ public function testSaveWithLinks(array $newLinks, array $existingLinks, array $expectedData) { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $this->resourceModelMock->expects($this->any())->method('getIdBySku')->will($this->returnValue(100)); $this->productFactoryMock->expects($this->any()) ->method('create') @@ -1143,6 +1151,7 @@ protected function setupProductMocksForSave() public function testSaveExistingWithNewMediaGalleryEntries() { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); $newEntriesData = [ [ "label" => "label_text", @@ -1222,8 +1231,48 @@ public function testSaveExistingWithNewMediaGalleryEntries() $this->model->save($this->productMock); } + public function websitesProvider() + { + return [ + [[1,2,3]] + ]; + } + + public function testSaveWithDifferentWebsites() + { + $storeMock = $this->getMock(StoreInterface::class); + $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'); + $this->resourceModelMock->expects($this->once())->method('validate')->with($this->productMock) + ->willReturn(true); + $this->resourceModelMock->expects($this->once())->method('save')->with($this->productMock)->willReturn(true); + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->willReturn($storeMock); + $this->storeManagerMock->expects($this->once()) + ->method('getWebsites') + ->willReturn([ + 1 => ['first'], + 2 => ['second'], + 3 => ['third'] + ]); + $this->productMock->expects($this->once())->method('getWebsiteIds')->willReturn([1,2,3]); + $this->productMock->expects($this->once())->method('setWebsiteIds')->willReturn([2,3]); + + $this->assertEquals($this->productMock, $this->model->save($this->productMock)); + } + public function testSaveExistingWithMediaGalleryEntries() { + $this->storeManagerMock->expects($this->any())->method('getWebsites')->willReturn([1 => 'default']); //update one entry, delete one entry $newEntries = [ [ From 3c3e093143a42f2b21719cc61a54a401ec687b17 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Tue, 20 Sep 2016 10:33:26 +0300 Subject: [PATCH 0833/3232] MAGETWO-57866: [Firefox] No JS validation for Credit card and expiration date on backend --- .../adminhtml/templates/directpost/info.phtml | 50 ++++++++--- .../Payment/view/adminhtml/web/transparent.js | 86 ++++++++++++------- .../credit-card-data.js | 0 .../credit-card-number-validator.js | 0 .../credit-card-type.js | 0 .../luhn10-validator.js | 0 .../credit-card-validation/cvv-validator.js | 0 .../expiration-date-validator.js | 0 .../expiration-month-validator.js | 0 .../expiration-year-validator.js | 0 .../expiration-date-validator/parse-date.js | 0 .../model/credit-card-validation/validator.js | 13 +-- .../templates/transparent/form.phtml | 4 +- 13 files changed, 103 insertions(+), 50 deletions(-) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/credit-card-data.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/credit-card-number-validator.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/credit-card-number-validator/luhn10-validator.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/cvv-validator.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/expiration-date-validator.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/expiration-date-validator/expiration-month-validator.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/expiration-date-validator/expiration-year-validator.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/expiration-date-validator/parse-date.js (100%) rename app/code/Magento/Payment/view/{frontend => base}/web/js/model/credit-card-validation/validator.js (88%) diff --git a/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml b/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml index bf674f8d5f3b4..cb7200cad183c 100644 --- a/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml +++ b/app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml @@ -35,8 +35,12 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
+
-
-
+ +
@@ -66,7 +76,11 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
+ hasVerification()): ?> -
-
+ canRemoveItems()): ?> From 306c01898f5baa078c490f64f0993f6a0e17be65 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Wed, 26 Oct 2016 15:45:39 +0300 Subject: [PATCH 1466/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60106: Bundle from-to price calculation is wrong --- app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index e8d09144a42c5..b64494ab40000 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -202,7 +202,7 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR $priceList[] = $this->selectionFactory->create( $bundleProduct, $selection, - $bundleProduct->getSelectionQty(), + $selection->getSelectionQty(), [ 'useRegularPrice' => $useRegularPrice, ] @@ -218,11 +218,11 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR $selectionsCollection->addAttributeToSelect('tax_class_id'); $selectionsCollection->addTierPriceData(); } - $selection = $selectionsCollection->getFirstItem(); + $selection = $selectionsCollection->fetchItem(); $priceList[] = $this->selectionFactory->create( $bundleProduct, $selection, - $bundleProduct->getSelectionQty(), + $selection->getSelectionQty(), [ 'useRegularPrice' => $useRegularPrice, ] From fa48626da39303e38ee90abb4df3be65829ebc5f Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Wed, 26 Oct 2016 16:41:53 +0300 Subject: [PATCH 1467/3232] MAGETWO-59159: State/Province dropdown is broken in frontend --- .../Checkout/view/frontend/web/js/region-updater.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index e06b8922b2252..eba77927be79e 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -7,9 +7,10 @@ define([ 'jquery', 'mage/template', + 'underscore', 'jquery/ui', 'mage/validation' -], function ($, mageTemplate) { +], function ($, mageTemplate, _) { 'use strict'; $.widget('mage.regionUpdater', { @@ -124,6 +125,8 @@ define([ * @private */ _clearError: function () { + var args = ['clearError', this.options.regionListId, this.options.regionInputId, this.options.postcodeId]; + if (this.options.clearError && typeof this.options.clearError === 'function') { this.options.clearError.call(this); } else { @@ -133,8 +136,8 @@ define([ this.options.form = $(this.options.form); - this.options.form && this.options.form.data('validator') && this.options.form.validation('clearError', - this.options.regionListId, this.options.regionInputId, this.options.postcodeId); + this.options.form && this.options.form.data('validator') && + this.options.form.validation.apply(this.options.form, _.compact(args)); // Clean up errors on region & zip fix $(this.options.regionInputId).removeClass('mage-error').parent().find('[generated]').remove(); From bae442397c723230d1eeea4a87ac5d923b521d8c Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 26 Oct 2016 08:57:25 -0500 Subject: [PATCH 1468/3232] MAGETWO-57253: Eliminate @escapeNotVerified in Cms Module Escaping translation in templates --- .../Cms/view/adminhtml/templates/browser/content/files.phtml | 4 ++-- .../view/adminhtml/templates/browser/content/uploader.phtml | 2 +- .../Magento/Cms/view/adminhtml/templates/browser/tree.phtml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml index 94980b3cd42fa..827f2ee938e41 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml @@ -21,11 +21,11 @@ $_height = $block->getImagesHeight();

getFileWidth($file)): ?> - escapeHtml($block->getFileWidth($file)) ?>xescapeHtml($block->getFileHeight($file)) ?> escapeHtml(__('px.')) ?>
+ escapeHtml($block->getFileWidth($file)) ?>xescapeHtml($block->getFileHeight($file)) ?> escapeHtml(__('px.')) ?>
escapeHtml($block->getFileShortName($file)); ?> -
escapeHtml(__('No files found')) ?>
+
escapeHtml(__('No files found')) ?>
diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index 23a8bf8f5976a..3233bb17c09a3 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -11,7 +11,7 @@
- escapeHtml(__('Browse Files...')) ?> + escapeHtml(__('Browse Files...')) ?>
diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml index 405881496fa9a..2e6204496eba4 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml @@ -11,9 +11,9 @@
jsonEncode($block->getTreeWidgetOptions())); ?>'> From 106f76de1a4d3fa91ab31f3027a7deefa0cb0ede Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 26 Oct 2016 08:58:22 -0500 Subject: [PATCH 1469/3232] MAGETWO-57252: Eliminate @escapeNotVerified in CatalogWidget Module Escaping translation in templates --- .../product/widget/content/grid.phtml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml b/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml index bdd7d9119ec59..212846aaa01d7 100644 --- a/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml +++ b/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml @@ -63,23 +63,23 @@
isSaleable()): ?> getTypeInstance()->hasRequiredOptions($_item)): ?> - helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> - getIsSalable()): ?> -
escapeHtml(__('In stock')) ?>
+
escapeHtml(__('In stock')) ?>
-
escapeHtml(__('Out of stock')) ?>
+
escapeHtml(__('Out of stock')) ?>
@@ -88,14 +88,14 @@ From 7d3848378d829d04ef0602ec1bcfa7308e381a2a Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Wed, 26 Oct 2016 17:33:57 +0300 Subject: [PATCH 1470/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60106: Bundle from-to price calculation is wrong --- .../Magento/Bundle/Model/ResourceModel/Selection/Collection.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index 024ed090efe4b..4aff7c14c7efa 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -274,6 +274,7 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) $orderByValue = new \Zend_Db_Expr('('. $price. ' * '. 'selection.selection_qty)'); } + $this->getSelect()->reset(Select::ORDER); $this->getSelect()->order($orderByValue . ($searchMin ? Select::SQL_ASC : Select::SQL_DESC)); $this->getSelect()->limit(1); return $this; From e99c4a2a76d2f7ac325527bf972366765e11a40e Mon Sep 17 00:00:00 2001 From: Joan He Date: Wed, 26 Oct 2016 10:45:31 -0500 Subject: [PATCH 1471/3232] MAGETWO-59876: Eliminate mockObjectManager and restoreObjectManager methods in \Magento\Framework\TestFramework\Unit\Helper\ObjectManager --- .../ResourceModel/Product/Collection.php | 14 ++++++- .../Product/Link/Product/Collection.php | 6 +-- .../ResourceModel/Advanced/Collection.php | 4 +- .../Type/Configurable/Product/Collection.php | 2 +- .../SalesRule/Model/ResourceModel/Rule.php | 31 ++++++-------- .../Unit/Model/ResourceModel/RuleTest.php | 41 ++++--------------- 6 files changed, 39 insertions(+), 59 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index 3be5e3afdc86e..645901829eee5 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -259,7 +259,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac /** * @var MetadataPool */ - protected $metadataPool; + private $metadataPool; /** * Collection constructor @@ -2192,7 +2192,7 @@ public function addMediaGalleryData() ); $mediaGalleries = []; - $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); + $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField(); $items = $this->getItems(); $select->where('entity.' . $linkField . ' IN (?)', array_map(function ($item) { @@ -2212,6 +2212,16 @@ public function addMediaGalleryData() return $this; } + /** + * Get MetadataPool instance + * + * @return MetadataPool + */ + public function getMetadataPool() + { + return $this->metadataPool; + } + /** * Retrieve GalleryReadHandler * diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 6c9dfb6ce635a..0759eaae264a4 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -142,7 +142,7 @@ public function addProductFilter($products) if (!is_array($products)) { $products = [$products]; } - $identifierField = $this->metadataPool->getMetadata(ProductInterface::class)->getIdentifierField(); + $identifierField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getIdentifierField(); $this->getSelect()->where("product_entity_table.$identifierField IN (?)", $products); $this->_hasLinkFilter = true; } @@ -202,7 +202,7 @@ protected function _joinLinks() $connection->quoteInto('links.link_type_id = ?', $this->_linkTypeId), ]; $joinType = 'join'; - $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField(); + $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField(); if ($this->getProduct() && $this->getProduct()->getId()) { $linkFieldId = $this->getProduct()->getData( $linkField @@ -352,7 +352,7 @@ public function addLinkAttributeToFilter($code, $condition) private function joinProductsToLinks() { if ($this->_hasLinkFilter) { - $metaDataPool = $this->metadataPool->getMetadata(ProductInterface::class); + $metaDataPool = $this->getMetadataPool()->getMetadata(ProductInterface::class); $linkField = $metaDataPool->getLinkField(); $entityTable = $metaDataPool->getEntityTable(); $this->getSelect() diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php index 6b5db58acfd89..f63e06efc18d5 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php @@ -80,7 +80,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection * @param \Magento\CatalogSearch\Model\Advanced\Request\Builder $requestBuilder * @param \Magento\Search\Model\SearchEngine $searchEngine * @param \Magento\Framework\Search\Adapter\Mysql\TemporaryStorageFactory $temporaryStorageFactory - * @param null $connection + * @param \Magento\Framework\DB\Adapter\AdapterInterface|null $connection * @param SearchResultFactory|null $searchResultFactory * @param ProductLimitationFactory|null $productLimitationFactory * @param MetadataPool|null $metadataPool @@ -110,7 +110,7 @@ public function __construct( \Magento\CatalogSearch\Model\Advanced\Request\Builder $requestBuilder, \Magento\Search\Model\SearchEngine $searchEngine, \Magento\Framework\Search\Adapter\Mysql\TemporaryStorageFactory $temporaryStorageFactory, - $connection = null, + \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, SearchResultFactory $searchResultFactory = null, ProductLimitationFactory $productLimitationFactory = null, MetadataPool $metadataPool = null diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php index e512c511a871a..c60b1e0d0e9e4 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php @@ -61,7 +61,7 @@ protected function _initSelect() */ public function setProductFilter($product) { - $metadata = $this->metadataPool->getMetadata(ProductInterface::class); + $metadata = $this->getMetadataPool()->getMetadata(ProductInterface::class); $this->getSelect()->where('link_table.parent_id = ?', $product->getData($metadata->getLinkField())); return $this; diff --git a/app/code/Magento/SalesRule/Model/ResourceModel/Rule.php b/app/code/Magento/SalesRule/Model/ResourceModel/Rule.php index 78cc3e1c39c27..789a29e2f7d77 100644 --- a/app/code/Magento/SalesRule/Model/ResourceModel/Rule.php +++ b/app/code/Magento/SalesRule/Model/ResourceModel/Rule.php @@ -5,12 +5,11 @@ */ namespace Magento\SalesRule\Model\ResourceModel; +use Magento\Framework\App\ObjectManager; use \Magento\SalesRule\Model\Rule as SalesRule; use Magento\Framework\Model\AbstractModel; -use Magento\Framework\DB\Select; use Magento\Rule\Model\ResourceModel\AbstractResource; use Magento\Framework\EntityManager\EntityManager; -use Magento\SalesRule\Api\Data\RuleInterface; /** * Sales Rule resource model @@ -51,21 +50,31 @@ class Rule extends AbstractResource */ protected $entityManager; + /** + * @var \Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap + */ + private $associatedEntitiesMapInstance; + /** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\SalesRule\Model\ResourceModel\Coupon $resourceCoupon * @param string $connectionName + * @param \Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap|null $associatedEntityMapInstance */ public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Framework\Stdlib\StringUtils $string, \Magento\SalesRule\Model\ResourceModel\Coupon $resourceCoupon, - $connectionName = null + $connectionName = null, + \Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap $associatedEntityMapInstance = null ) { $this->string = $string; $this->_resourceCoupon = $resourceCoupon; - $this->_associatedEntitiesMap = $this->getAssociatedEntitiesMap(); + $this->associatedEntitiesMapInstance = $associatedEntityMapInstance ?: ObjectManager::getInstance()->get( + \Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap::class + ); + $this->_associatedEntitiesMap = $this->associatedEntitiesMapInstance->getData(); parent::__construct($context, $connectionName); } @@ -380,20 +389,6 @@ public function delete(AbstractModel $object) return $this; } - /** - * @return array - * @deprecated - */ - private function getAssociatedEntitiesMap() - { - if (!$this->_associatedEntitiesMap) { - $this->_associatedEntitiesMap = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap::class) - ->getData(); - } - return $this->_associatedEntitiesMap; - } - /** * @return \Magento\Framework\EntityManager\EntityManager * @deprecated diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/ResourceModel/RuleTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/ResourceModel/RuleTest.php index c0de06df83087..fa3fa2c69fc70 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/ResourceModel/RuleTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/ResourceModel/RuleTest.php @@ -5,8 +5,6 @@ */ namespace Magento\SalesRule\Test\Unit\Model\ResourceModel; -use Magento\SalesRule\Api\Data\RuleInterface; - /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -121,7 +119,13 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $associatedEntitiesMap = $this->getMock(\Magento\Framework\DataObject::class, [], [], '', false); + $associatedEntitiesMap = $this->getMock( + \Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap::class, + ['getData'], + [], + '', + false + ); $associatedEntitiesMap->expects($this->once()) ->method('getData') ->willReturn( @@ -139,46 +143,17 @@ protected function setUp() ] ); - $this->mockObjectManager([ - \Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap::class => $associatedEntitiesMap - ]); - $this->model = $this->objectManager->getObject( \Magento\SalesRule\Model\ResourceModel\Rule::class, [ 'context' => $context, 'connectionName' => $connectionName, 'entityManager' => $this->entityManager, + 'associatedEntityMapInstance' => $associatedEntitiesMap ] ); } - protected function tearDown() - { - $reflectionProperty = new \ReflectionProperty(\Magento\Framework\App\ObjectManager::class, '_instance'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue(null); - } - - /** - * Mock application object manager to return configured dependencies. - * - * @param array $dependencies - * @return void - */ - private function mockObjectManager($dependencies) - { - $dependencyMap = []; - foreach ($dependencies as $type => $instance) { - $dependencyMap[] = [$type, $instance]; - } - $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); - $objectManagerMock->expects($this->any()) - ->method('get') - ->will($this->returnValueMap($dependencyMap)); - \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock); - } - /** * test load */ From 80b0c1b45a6307be27de994ba8380512f05ff692 Mon Sep 17 00:00:00 2001 From: Joan He Date: Wed, 26 Oct 2016 11:25:45 -0500 Subject: [PATCH 1472/3232] MAGETWO-59876: Eliminate mockObjectManager and restoreObjectManager methods in \Magento\Framework\TestFramework\Unit\Helper\ObjectManager --- .../Catalog/Model/ResourceModel/Product/Collection.php | 10 +++++----- .../ResourceModel/Product/Link/Product/Collection.php | 8 +++----- .../Product/Type/Configurable/Product/Collection.php | 6 +----- .../Magento/SalesRule/Model/ResourceModel/Rule.php | 9 ++------- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index 645901829eee5..1cf18fc998ef9 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -2192,7 +2192,7 @@ public function addMediaGalleryData() ); $mediaGalleries = []; - $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField(); + $linkField = $this->getProductEntityMetadata()->getLinkField(); $items = $this->getItems(); $select->where('entity.' . $linkField . ' IN (?)', array_map(function ($item) { @@ -2213,13 +2213,13 @@ public function addMediaGalleryData() } /** - * Get MetadataPool instance + * Get product entity metadata * - * @return MetadataPool + * @return \Magento\Framework\EntityManager\EntityMetadataInterface */ - public function getMetadataPool() + public function getProductEntityMetadata() { - return $this->metadataPool; + return $this->metadataPool->getMetadata(ProductInterface::class); } /** diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 0759eaae264a4..116f454cd5e75 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -5,8 +5,6 @@ */ namespace Magento\Catalog\Model\ResourceModel\Product\Link\Product; -use Magento\Catalog\Api\Data\ProductInterface; - /** * Catalog product linked products collection * @@ -142,7 +140,7 @@ public function addProductFilter($products) if (!is_array($products)) { $products = [$products]; } - $identifierField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getIdentifierField(); + $identifierField = $this->getProductEntityMetadata()->getIdentifierField(); $this->getSelect()->where("product_entity_table.$identifierField IN (?)", $products); $this->_hasLinkFilter = true; } @@ -202,7 +200,7 @@ protected function _joinLinks() $connection->quoteInto('links.link_type_id = ?', $this->_linkTypeId), ]; $joinType = 'join'; - $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField(); + $linkField = $this->getProductEntityMetadata()->getLinkField(); if ($this->getProduct() && $this->getProduct()->getId()) { $linkFieldId = $this->getProduct()->getData( $linkField @@ -352,7 +350,7 @@ public function addLinkAttributeToFilter($code, $condition) private function joinProductsToLinks() { if ($this->_hasLinkFilter) { - $metaDataPool = $this->getMetadataPool()->getMetadata(ProductInterface::class); + $metaDataPool = $this->getProductEntityMetadata(); $linkField = $metaDataPool->getLinkField(); $entityTable = $metaDataPool->getEntityTable(); $this->getSelect() diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php index c60b1e0d0e9e4..44a4d468cd097 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php @@ -7,10 +7,6 @@ */ namespace Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product; -use Magento\Customer\Api\GroupManagementInterface; -use Magento\Framework\EntityManager\MetadataPool; -use Magento\Catalog\Api\Data\ProductInterface; - /** * Class Collection * @@ -61,7 +57,7 @@ protected function _initSelect() */ public function setProductFilter($product) { - $metadata = $this->getMetadataPool()->getMetadata(ProductInterface::class); + $metadata = $this->getProductEntityMetadata(); $this->getSelect()->where('link_table.parent_id = ?', $product->getData($metadata->getLinkField())); return $this; diff --git a/app/code/Magento/SalesRule/Model/ResourceModel/Rule.php b/app/code/Magento/SalesRule/Model/ResourceModel/Rule.php index 789a29e2f7d77..1aabdbd65317e 100644 --- a/app/code/Magento/SalesRule/Model/ResourceModel/Rule.php +++ b/app/code/Magento/SalesRule/Model/ResourceModel/Rule.php @@ -50,11 +50,6 @@ class Rule extends AbstractResource */ protected $entityManager; - /** - * @var \Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap - */ - private $associatedEntitiesMapInstance; - /** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Framework\Stdlib\StringUtils $string @@ -71,10 +66,10 @@ public function __construct( ) { $this->string = $string; $this->_resourceCoupon = $resourceCoupon; - $this->associatedEntitiesMapInstance = $associatedEntityMapInstance ?: ObjectManager::getInstance()->get( + $associatedEntitiesMapInstance = $associatedEntityMapInstance ?: ObjectManager::getInstance()->get( \Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap::class ); - $this->_associatedEntitiesMap = $this->associatedEntitiesMapInstance->getData(); + $this->_associatedEntitiesMap = $associatedEntitiesMapInstance->getData(); parent::__construct($context, $connectionName); } From 6e13b01d44acba0f7039f3b71269ea38b1dfc371 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 26 Oct 2016 11:25:46 -0500 Subject: [PATCH 1473/3232] MAGETWO-57254: Eliminate @escapeNotVerified in UrlRewrite Module - updated the template --- .../UrlRewrite/view/adminhtml/templates/categories.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/UrlRewrite/view/adminhtml/templates/categories.phtml b/app/code/Magento/UrlRewrite/view/adminhtml/templates/categories.phtml index 7aa02ab019c46..d0f9678602707 100644 --- a/app/code/Magento/UrlRewrite/view/adminhtml/templates/categories.phtml +++ b/app/code/Magento/UrlRewrite/view/adminhtml/templates/categories.phtml @@ -9,7 +9,7 @@ /** @var \Magento\UrlRewrite\Block\Catalog\Category\Tree $block */ ?>
- + escapeHtml(__('Select Category')) ?> - From 00ad9ac5fb8a0abfb854b5d493bb771821864467 Mon Sep 17 00:00:00 2001 From: Vitaliy Goncharenko Date: Thu, 27 Oct 2016 18:50:56 +0300 Subject: [PATCH 1491/3232] MAGETWO-53583: "Use Default" checkbox is checked again after saving empty fields (description, name, etc) - fixed static --- .../Entity/Attribute/AbstractAttribute.php | 198 +++---- .../Eav/Model/ResourceModel/UpdateHandler.php | 110 ++-- .../Catalog/_files/dropdown_attribute.php | 86 +-- .../Model/ResourceModel/UpdateHandlerTest.php | 490 +++++++++--------- 4 files changed, 452 insertions(+), 432 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index cad428b2820f4..2804250a35c6e 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -111,12 +111,12 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens */ protected $dataObjectHelper; - /** - * Array of attribute types that have empty string as a possible value. - * - * @var array - */ - private $emptyStringTypes = ['int', 'decimal', 'datetime', 'varchar', 'text', 'static']; + /** + * Array of attribute types that have empty string as a possible value. + * + * @var array + */ + private $emptyStringTypes = ['int', 'decimal', 'datetime', 'varchar', 'text', 'static']; /** * @param \Magento\Framework\Model\Context $context @@ -209,6 +209,7 @@ public function loadByCode($entityType, $code) $this->_getResource()->loadByCode($this, $entityTypeId, $code); $this->_afterLoad(); \Magento\Framework\Profiler::stop('load_by_code'); + return $this; } @@ -233,6 +234,7 @@ public function getName() public function setAttributeId($data) { $this->_data['attribute_id'] = $data; + return $this; } @@ -379,6 +381,7 @@ public function getAttributeSetId() public function setAttributeSetId($id) { $this->_data['attribute_set_id'] = $id; + return $this; } @@ -399,6 +402,7 @@ public function getEntityTypeId() public function setEntityTypeId($id) { $this->_data['entity_type_id'] = $id; + return $this; } @@ -410,6 +414,7 @@ public function setEntityTypeId($id) public function setEntityType($type) { $this->setData('entity_type', $type); + return $this; } @@ -463,6 +468,7 @@ public function getEntityType() public function setEntity($entity) { $this->_entity = $entity; + return $this; } @@ -476,6 +482,7 @@ public function getEntity() if (!$this->_entity) { $this->_entity = $this->getEntityType(); } + return $this->_entity; } @@ -553,6 +560,7 @@ public function getSource() } $this->_source = $source->setAttribute($this); } + return $this->_source; } @@ -564,6 +572,7 @@ public function getSource() public function usesSource() { $input = $this->getFrontendInput(); + return $input === 'select' || $input === 'multiselect' || $this->_getData('source_model') != ''; } @@ -594,44 +603,44 @@ protected function _getDefaultSourceModel() return $this->getEntityType()->getEntity()->getDefaultAttributeSourceModel(); } - /** - * Check if Value is empty. - * - * @param array|null|bool|int|float|string $value - * @param bool $strictEmptyStringType [optional] Flag for allow empty string as a possible value for String. - * By default set to TRUE = disallow empty string. - * @return bool - */ - public function isValueEmpty($value, $strictEmptyStringType = true) - { - $isInEmptyStringTypes = $strictEmptyStringType ? $this->isInEmptyStringTypes() : !$this->isInEmptyStringTypes(); - - return (is_array($value) && count($value) == 0) - || $value === null - || ($value === false && $this->getBackend()->getType() != 'int') - || ($value === '' && $isInEmptyStringTypes); - } - - /** - * Check if attribute empty value is valid. - * - * @param array|null|bool|int|float|string $value - * @return bool - */ - public function isAllowedEmptyTextValue($value) - { - return $this->isInEmptyStringTypes() && $value === ''; - } - - /** - * Check is attribute type in allowed empty string types. - * - * @return bool - */ - private function isInEmptyStringTypes() - { - return in_array($this->getBackendType(), $this->emptyStringTypes); - } + /** + * Check if Value is empty. + * + * @param array|null|bool|int|float|string $value + * @param bool $strictEmptyStringType [optional] Flag for allow empty string as a possible value for String. + * By default set to TRUE = disallow empty string. + * @return bool + */ + public function isValueEmpty($value, $strictEmptyStringType = true) + { + $isInEmptyStringTypes = $strictEmptyStringType ? $this->isInEmptyStringTypes() : !$this->isInEmptyStringTypes(); + + return (is_array($value) && count($value) == 0) + || $value === null + || ($value === false && $this->getBackend()->getType() != 'int') + || ($value === '' && $isInEmptyStringTypes); + } + + /** + * Check if attribute empty value is valid. + * + * @param array|null|bool|int|float|string $value + * @return bool + */ + public function isAllowedEmptyTextValue($value) + { + return $this->isInEmptyStringTypes() && $value === ''; + } + + /** + * Check is attribute type in allowed empty string types. + * + * @return bool + */ + private function isInEmptyStringTypes() + { + return in_array($this->getBackend()->getType(), $this->emptyStringTypes); + } /** * Check if attribute in specified set @@ -686,6 +695,7 @@ public function getIdByCode($entityType, $code) if (!isset($this->_attributeIdCache[$cacheKey])) { $this->_attributeIdCache[$cacheKey] = $this->getResource()->getIdByCode($entityType, $code); } + return $this->_attributeIdCache[$cacheKey]; } @@ -718,6 +728,7 @@ public function getBackendTable() $this->_dataTable = $backendTable; } } + return $this->_dataTable; } @@ -732,6 +743,7 @@ public function getFlatColumns() if ($this->usesSource() && $this->getBackendType() != self::TYPE_STATIC) { return $this->getSource()->getFlatColumns(); } + return $this->_getFlatColumnsDdlDefinition(); } @@ -755,60 +767,60 @@ public function _getFlatColumnsDdlDefinition() $size = $prop['LENGTH'] ? $prop['LENGTH'] : null; $columns[$this->getAttributeCode()] = [ - 'type' => $this->_resourceHelper->getDdlTypeByColumnType($type), - 'length' => $size, + 'type' => $this->_resourceHelper->getDdlTypeByColumnType($type), + 'length' => $size, 'unsigned' => $prop['UNSIGNED'] ? true : false, 'nullable' => $prop['NULLABLE'], - 'default' => $prop['DEFAULT'], - 'extra' => null, + 'default' => $prop['DEFAULT'], + 'extra' => null, ]; break; case 'datetime': $columns[$this->getAttributeCode()] = [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, 'unsigned' => false, 'nullable' => true, - 'default' => null, - 'extra' => null, + 'default' => null, + 'extra' => null, ]; break; case 'decimal': $columns[$this->getAttributeCode()] = [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - 'length' => '12,4', + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + 'length' => '12,4', 'unsigned' => false, 'nullable' => true, - 'default' => null, - 'extra' => null, + 'default' => null, + 'extra' => null, ]; break; case 'int': $columns[$this->getAttributeCode()] = [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'unsigned' => false, 'nullable' => true, - 'default' => null, - 'extra' => null, + 'default' => null, + 'extra' => null, ]; break; case 'text': $columns[$this->getAttributeCode()] = [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'unsigned' => false, 'nullable' => true, - 'default' => null, - 'extra' => null, - 'length' => \Magento\Framework\DB\Ddl\Table::MAX_TEXT_SIZE, + 'default' => null, + 'extra' => null, + 'length' => \Magento\Framework\DB\Ddl\Table::MAX_TEXT_SIZE, ]; break; case 'varchar': $columns[$this->getAttributeCode()] = [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'length' => '255', + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'length' => '255', 'unsigned' => false, 'nullable' => true, - 'default' => null, - 'extra' => null, + 'default' => null, + 'extra' => null, ]; break; default: @@ -836,61 +848,62 @@ protected function _getFlatColumnsOldDefinition() } $prop = $describe[$this->getAttributeCode()]; $columns[$this->getAttributeCode()] = [ - 'type' => $prop['DATA_TYPE'] . ($prop['LENGTH'] ? "({$prop['LENGTH']})" : ""), + 'type' => $prop['DATA_TYPE'] . ($prop['LENGTH'] ? "({$prop['LENGTH']})" : ""), 'unsigned' => $prop['UNSIGNED'] ? true : false, - 'is_null' => $prop['NULLABLE'], - 'default' => $prop['DEFAULT'], - 'extra' => null, + 'is_null' => $prop['NULLABLE'], + 'default' => $prop['DEFAULT'], + 'extra' => null, ]; break; case 'datetime': $columns[$this->getAttributeCode()] = [ - 'type' => 'datetime', + 'type' => 'datetime', 'unsigned' => false, - 'is_null' => true, - 'default' => null, - 'extra' => null, + 'is_null' => true, + 'default' => null, + 'extra' => null, ]; break; case 'decimal': $columns[$this->getAttributeCode()] = [ - 'type' => 'decimal(12,4)', + 'type' => 'decimal(12,4)', 'unsigned' => false, - 'is_null' => true, - 'default' => null, - 'extra' => null, + 'is_null' => true, + 'default' => null, + 'extra' => null, ]; break; case 'int': $columns[$this->getAttributeCode()] = [ - 'type' => 'int', + 'type' => 'int', 'unsigned' => false, - 'is_null' => true, - 'default' => null, - 'extra' => null, + 'is_null' => true, + 'default' => null, + 'extra' => null, ]; break; case 'text': $columns[$this->getAttributeCode()] = [ - 'type' => 'text', + 'type' => 'text', 'unsigned' => false, - 'is_null' => true, - 'default' => null, - 'extra' => null, + 'is_null' => true, + 'default' => null, + 'extra' => null, ]; break; case 'varchar': $columns[$this->getAttributeCode()] = [ - 'type' => 'varchar(255)', + 'type' => 'varchar(255)', 'unsigned' => false, - 'is_null' => true, - 'default' => null, - 'extra' => null, + 'is_null' => true, + 'default' => null, + 'extra' => null, ]; break; default: break; } + return $columns; } @@ -977,6 +990,7 @@ public function getFlatUpdateSelect($store = null) foreach ($this->_storeManager->getStores() as $store) { $this->getFlatUpdateSelect($store->getId()); } + return $this; } @@ -987,6 +1001,7 @@ public function getFlatUpdateSelect($store = null) if ($this->usesSource()) { return $this->getSource()->getFlatUpdateSelect($store); } + return $this->_getResource()->getFlatUpdateSelect($this, $store); } @@ -1096,6 +1111,7 @@ public function setOptions(array $options = null) } else { $this->setData(self::OPTIONS, $options); } + return $this; } @@ -1118,6 +1134,7 @@ protected function convertToObjects(array $options) ); $dataObjects[] = $optionDataObject; } + return $dataObjects; } @@ -1229,6 +1246,7 @@ public function getValidationRules() } elseif (!empty($rules)) { return unserialize($rules); } + return []; } diff --git a/app/code/Magento/Eav/Model/ResourceModel/UpdateHandler.php b/app/code/Magento/Eav/Model/ResourceModel/UpdateHandler.php index f974760b7b14b..4494d66b42fc6 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/UpdateHandler.php +++ b/app/code/Magento/Eav/Model/ResourceModel/UpdateHandler.php @@ -128,63 +128,64 @@ public function execute($entityType, $entityData, $arguments = []) if ($attribute->isStatic()) { continue; } - $code = $attribute->getAttributeCode(); - /** - * Only scalar values can be stored in generic tables - */ - if (isset($entityData[$code]) && !is_scalar($entityData[$code])) { - continue; - } - /** - * Only changed attributes need to handle update process - */ - if (!array_key_exists($code, $entityData)) { - continue; - } - - $newValue = $entityData[$code]; - $isValueEmpty = $attribute->isValueEmpty($newValue, false); - $isAllowedEmptyTextValue = $attribute->isAllowedEmptyTextValue($newValue); - - if (array_key_exists($code, $snapshot)) { - $snapshotValue = $snapshot[$code]; - /** - * 'FALSE' value for attributes can't be update or delete - */ - if ($snapshotValue === false) { - continue; - } - - if ($isValueEmpty && !$isAllowedEmptyTextValue) { - $this->attributePersistor->registerDelete( - $entityType, - $entityData[$metadata->getLinkField()], - $code - ); - } elseif ((!$isValueEmpty || $isAllowedEmptyTextValue) && $snapshotValue !== $newValue) { - $this->attributePersistor->registerUpdate( - $entityType, - $entityData[$metadata->getLinkField()], - $code, - $newValue - ); - } - } else { - /** - * Only not empty value of attribute is insertable - */ - if (!$isValueEmpty || $isAllowedEmptyTextValue) { - $this->attributePersistor->registerInsert( - $entityType, - $entityData[$metadata->getLinkField()], - $code, - $newValue - ); - } - } + $code = $attribute->getAttributeCode(); + /** + * Only scalar values can be stored in generic tables + */ + if (isset($entityData[$code]) && !is_scalar($entityData[$code])) { + continue; + } + /** + * Only changed attributes need to handle update process + */ + if (!array_key_exists($code, $entityData)) { + continue; + } + + $newValue = $entityData[$code]; + $isValueEmpty = $attribute->isValueEmpty($newValue, false); + $isAllowedEmptyTextValue = $attribute->isAllowedEmptyTextValue($newValue); + + if (array_key_exists($code, $snapshot)) { + $snapshotValue = $snapshot[$code]; + /** + * 'FALSE' value for attributes can't be update or delete + */ + if ($snapshotValue === false) { + continue; + } + + if ($isValueEmpty && !$isAllowedEmptyTextValue) { + $this->attributePersistor->registerDelete( + $entityType, + $entityData[$metadata->getLinkField()], + $code + ); + } elseif ((!$isValueEmpty || $isAllowedEmptyTextValue) && $snapshotValue !== $newValue) { + $this->attributePersistor->registerUpdate( + $entityType, + $entityData[$metadata->getLinkField()], + $code, + $newValue + ); + } + } else { + /** + * Only not empty value of attribute is insertable + */ + if (!$isValueEmpty || $isAllowedEmptyTextValue) { + $this->attributePersistor->registerInsert( + $entityType, + $entityData[$metadata->getLinkField()], + $code, + $newValue + ); + } + } } $this->attributePersistor->flush($entityType, $context); } + return $this->getReadHandler()->execute($entityType, $entityData, $arguments); } @@ -200,6 +201,7 @@ protected function getReadHandler() if (!$this->readHandler) { $this->readHandler = ObjectManager::getInstance()->get(ReadHandler::class); } + return $this->readHandler; } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php index fcd770f4418ae..56e84046b255b 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php @@ -11,49 +11,49 @@ ); if (!$attribute->loadByCode(4, 'dropdown_attribute')->getId()) { - /** @var $installer \Magento\Catalog\Setup\CategorySetup */ - $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Setup\CategorySetup::class - ); + /** @var $installer \Magento\Catalog\Setup\CategorySetup */ + $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Catalog\Setup\CategorySetup::class + ); - $attribute->setData( - [ - 'attribute_code' => 'dropdown_attribute', - 'entity_type_id' => $installer->getEntityTypeId('catalog_product'), - 'is_global' => 0, - 'is_user_defined' => 1, - 'frontend_input' => 'select', - 'is_unique' => 0, - 'is_required' => 0, - 'is_searchable' => 0, - 'is_visible_in_advanced_search' => 0, - 'is_comparable' => 0, - 'is_filterable' => 0, - 'is_filterable_in_search' => 0, - 'is_used_for_promo_rules' => 0, - 'is_html_allowed_on_front' => 1, - 'is_visible_on_front' => 0, - 'used_in_product_listing' => 0, - 'used_for_sort_by' => 0, - 'frontend_label' => ['Drop-Down Attribute'], - 'backend_type' => 'varchar', - 'backend_model' => \Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend::class, - 'option' => [ - 'value' => [ - 'option_1' => ['Option 1'], - 'option_2' => ['Option 2'], - 'option_3' => ['Option 3'], - ], - 'order' => [ - 'option_1' => 1, - 'option_2' => 2, - 'option_3' => 3, - ], - ], - ] - ); - $attribute->save(); + $attribute->setData( + [ + 'attribute_code' => 'dropdown_attribute', + 'entity_type_id' => $installer->getEntityTypeId('catalog_product'), + 'is_global' => 0, + 'is_user_defined' => 1, + 'frontend_input' => 'select', + 'is_unique' => 0, + 'is_required' => 0, + 'is_searchable' => 0, + 'is_visible_in_advanced_search' => 0, + 'is_comparable' => 0, + 'is_filterable' => 0, + 'is_filterable_in_search' => 0, + 'is_used_for_promo_rules' => 0, + 'is_html_allowed_on_front' => 1, + 'is_visible_on_front' => 0, + 'used_in_product_listing' => 0, + 'used_for_sort_by' => 0, + 'frontend_label' => ['Drop-Down Attribute'], + 'backend_type' => 'varchar', + 'backend_model' => \Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend::class, + 'option' => [ + 'value' => [ + 'option_1' => ['Option 1'], + 'option_2' => ['Option 2'], + 'option_3' => ['Option 3'], + ], + 'order' => [ + 'option_1' => 1, + 'option_2' => 2, + 'option_3' => 3, + ], + ], + ] + ); + $attribute->save(); - /* Assign attribute to attribute set */ - $installer->addAttributeToGroup('catalog_product', 'Default', 'Attributes', $attribute->getId()); + /* Assign attribute to attribute set */ + $installer->addAttributeToGroup('catalog_product', 'Default', 'Attributes', $attribute->getId()); } diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php index ce5d348134be0..8851ab0c71eb9 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php @@ -13,249 +13,249 @@ */ class UpdateHandlerTest extends \PHPUnit_Framework_TestCase { - /** - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled - * @covers \Magento\Eav\Model\ResourceModel\UpdateHandlerTest::execute - * @magentoDataFixture Magento/Catalog/_files/product_simple.php - * @dataProvider getAllStoresDataProvider - * @param $code - * @param $snapshotValue - * @param $newValue - * @param $expected - */ - public function testExecuteProcessForAllStores($code, $snapshotValue, $newValue, $expected) - { - if ($snapshotValue !== '-') { - $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $entity->setStoreId(0); - $entity->load(1); - $entity->setData($code, $snapshotValue); - $entity->save(); - } - - $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $entity->setStoreId(0); - $entity->load(1); - - $updateHandler = Bootstrap::getObjectManager()->create(UpdateHandler::class); - $entityData = array_merge($entity->getData(), [$code => $newValue]); - $updateHandler->execute('Magento\Catalog\Api\Data\ProductInterface', $entityData); - - $resultEntity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $resultEntity->setStoreId(0); - $resultEntity->load(1); - - $this->assertTrue($expected === $resultEntity->getData($code)); - } - - /** - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled - * @covers \Magento\Eav\Model\ResourceModel\UpdateHandlerTest::execute - * @magentoDataFixture Magento/Catalog/_files/product_simple.php - * @magentoDataFixture Magento/Store/_files/second_store.php - * @dataProvider getCustomStoreDataProvider - * @param $code - * @param $snapshotValue - * @param $newValue - * @param $expected - */ - public function testExecuteProcessForCustomStore($code, $snapshotValue, $newValue, $expected) - { - $store = Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); - $store->load('fixture_second_store', 'code'); - - Bootstrap::getObjectManager() - ->create(\Magento\CatalogSearch\Model\Indexer\Fulltext\Processor::class) - ->reindexAll(); - - if ($snapshotValue !== '-') { - $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $entity->setStoreId($store->getId()); - $entity->load(1); - $entity->setData($code, $snapshotValue); - $entity->save(); - } - - $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $entity->setStoreId($store->getId()); - $entity->load(1); - - $updateHandler = Bootstrap::getObjectManager()->create(UpdateHandler::class); - $entityData = array_merge($entity->getData(), [$code => $newValue]); - $updateHandler->execute('Magento\Catalog\Api\Data\ProductInterface', $entityData); - - $resultEntity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $resultEntity->setStoreId($store->getId()); - $resultEntity->load(1); - - $this->assertTrue($expected === $resultEntity->getData($code)); - } - - /** - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled - * @covers \Magento\Eav\Model\ResourceModel\UpdateHandlerTest::execute - * @magentoDataFixture Magento/Catalog/_files/product_simple.php - * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php - * @magentoDataFixture Magento/Store/_files/second_store.php - * @dataProvider getCustomAttributeDataProvider - * @param $code - * @param $defaultStoreValue - * @param $snapshotValue - * @param $newValue - * @param $expected - */ - public function testExecuteProcessForCustomAttributeInCustomStore( - $code, - $defaultStoreValue, - $snapshotValue, - $newValue, - $expected - ) { - $store = Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); - $store->load('fixture_second_store', 'code'); - - Bootstrap::getObjectManager() - ->create(\Magento\CatalogSearch\Model\Indexer\Fulltext\Processor::class) - ->reindexAll(); - - $attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class - ); - $attribute->loadByCode(4, $code); - - $options = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection::class - ); - $options->setAttributeFilter($attribute->getId()); - $optionIds = $options->getAllIds(); - - $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $entity->setStoreId(0); - $entity->load(1); - $entity->setData($code, $optionIds[$defaultStoreValue]); - $entity->save(); - - if ($snapshotValue !== '-') { - /** @var $options \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection */ - $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $entity->setStoreId($store->getId()); - $entity->load(1); - - if ($snapshotValue) { - $snapshotValue = $optionIds[$snapshotValue]; - } - - $entity->setData($code, $snapshotValue); - $entity->save(); - } - - $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $entity->setStoreId($store->getId()); - $entity->load(1); - - $updateHandler = Bootstrap::getObjectManager()->create(UpdateHandler::class); - - if ($newValue) { - $newValue = $optionIds[$newValue]; - } - - $entityData = array_merge($entity->getData(), [$code => $newValue]); - $updateHandler->execute('Magento\Catalog\Api\Data\ProductInterface', $entityData); - - $resultEntity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); - $resultEntity->setStoreId($store->getId()); - $resultEntity->load(1); - - if ($expected !== null) { - $expected = $optionIds[$expected]; - } - - $this->assertTrue($expected === $resultEntity->getData($code)); - } - - /** - * @return array - */ - public function getAllStoresDataProvider() - { - return [ - ['description', '', 'not_empty_value', 'not_empty_value'], //0 - ['description', '', '', null], //1 - ['description', '', null, null], //2 - ['description', '', false, null], //3 - - ['description', 'not_empty_value', 'not_empty_value2', 'not_empty_value2'],//4 - ['description', 'not_empty_value', '', null], //5 - ['description', 'not_empty_value', null, null], //6 - ['description', 'not_empty_value', false, null], //7 - - ['description', null, 'not_empty_value', 'not_empty_value'], //8 - ['description', null, '', null], //9 - ['description', null, false, null], //10 - - ['description', false, 'not_empty_value', 'not_empty_value'], //11 - ['description', false, '', null], //12 - ['description', false, null, null], //13 - ]; - } - - /** - * @return array - */ - public function getCustomStoreDataProvider() - { - return [ - ['description', '', 'not_empty_value', 'not_empty_value'], //0 - ['description', '', '', null], //1 - ['description', '', null, 'Description with html tag'], //2 - ['description', '', false, 'Description with html tag'], //3 - - ['description', 'not_empty_value', 'not_empty_value2', 'not_empty_value2'], //4 - ['description', 'not_empty_value', '', null], //5 - ['description', 'not_empty_value', null, 'Description with html tag'], //6 - ['description', 'not_empty_value', false, 'Description with html tag'], //7 - - ['description', null, 'not_empty_value', 'not_empty_value'], //8 - ['description', null, '', null], //9 - ['description', null, false, 'Description with html tag'], //10 - - ['description', false, 'not_empty_value', 'not_empty_value'], //11 - ['description', false, '', null], //12 - ['description', false, null, 'Description with html tag'], //13 - ]; - } - - /** - * @return array - */ - public function getCustomAttributeDataProvider() - { - return [ - ['dropdown_attribute', 0, '', 1, 1], //0 - ['dropdown_attribute', 0, '', '', null], //1 - ['dropdown_attribute', 0, '', null, 0], //2 - ['dropdown_attribute', 0, '', false, 0], //3 - - ['dropdown_attribute', 0, 1, 2, 2], //4 - ['dropdown_attribute', 0, 1, '', null], //5 - ['dropdown_attribute', 0, 1, null, 0], //6 - ['dropdown_attribute', 0, 1, false, 0], //7 - - ['dropdown_attribute', 0, null, 1, 1], //8 - ['dropdown_attribute', 0, null, '', null], //9 - ['dropdown_attribute', 0, null, false, 0], //10 - - ['dropdown_attribute', 0, false, 1, 1], //11 - ['dropdown_attribute', 0, false, '', null], //12 - ['dropdown_attribute', 0, false, null, 0], //13 - - ['dropdown_attribute', 0, '-', 1, 1], //14 - ['dropdown_attribute', 0, '-', '', null], //15 - ['dropdown_attribute', 0, '-', null, 0], //16 - ['dropdown_attribute', 0, '-', false, 0], //17 - ]; - } + /** + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + * @covers \Magento\Eav\Model\ResourceModel\UpdateHandler::execute + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @dataProvider getAllStoresDataProvider + * @param $code + * @param $snapshotValue + * @param $newValue + * @param $expected + */ + public function testExecuteProcessForAllStores($code, $snapshotValue, $newValue, $expected) + { + if ($snapshotValue !== '-') { + $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $entity->setStoreId(0); + $entity->load(1); + $entity->setData($code, $snapshotValue); + $entity->save(); + } + + $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $entity->setStoreId(0); + $entity->load(1); + + $updateHandler = Bootstrap::getObjectManager()->create(UpdateHandler::class); + $entityData = array_merge($entity->getData(), [$code => $newValue]); + $updateHandler->execute(\Magento\Catalog\Api\Data\ProductInterface::class, $entityData); + + $resultEntity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $resultEntity->setStoreId(0); + $resultEntity->load(1); + + $this->assertTrue($expected === $resultEntity->getData($code)); + } + + /** + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + * @covers \Magento\Eav\Model\ResourceModel\UpdateHandlerTest::execute + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Store/_files/second_store.php + * @dataProvider getCustomStoreDataProvider + * @param $code + * @param $snapshotValue + * @param $newValue + * @param $expected + */ + public function testExecuteProcessForCustomStore($code, $snapshotValue, $newValue, $expected) + { + $store = Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); + $store->load('fixture_second_store', 'code'); + + Bootstrap::getObjectManager() + ->create(\Magento\CatalogSearch\Model\Indexer\Fulltext\Processor::class) + ->reindexAll(); + + if ($snapshotValue !== '-') { + $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $entity->setStoreId($store->getId()); + $entity->load(1); + $entity->setData($code, $snapshotValue); + $entity->save(); + } + + $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $entity->setStoreId($store->getId()); + $entity->load(1); + + $updateHandler = Bootstrap::getObjectManager()->create(UpdateHandler::class); + $entityData = array_merge($entity->getData(), [$code => $newValue]); + $updateHandler->execute(\Magento\Catalog\Api\Data\ProductInterface::class, $entityData); + + $resultEntity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $resultEntity->setStoreId($store->getId()); + $resultEntity->load(1); + + $this->assertTrue($expected === $resultEntity->getData($code)); + } + + /** + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + * @covers \Magento\Eav\Model\ResourceModel\UpdateHandlerTest::execute + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * @magentoDataFixture Magento/Store/_files/second_store.php + * @dataProvider getCustomAttributeDataProvider + * @param $code + * @param $defaultStoreValue + * @param $snapshotValue + * @param $newValue + * @param $expected + */ + public function testExecuteProcessForCustomAttributeInCustomStore( + $code, + $defaultStoreValue, + $snapshotValue, + $newValue, + $expected + ) { + $store = Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); + $store->load('fixture_second_store', 'code'); + + Bootstrap::getObjectManager() + ->create(\Magento\CatalogSearch\Model\Indexer\Fulltext\Processor::class) + ->reindexAll(); + + $attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class + ); + $attribute->loadByCode(4, $code); + + $options = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection::class + ); + $options->setAttributeFilter($attribute->getId()); + $optionIds = $options->getAllIds(); + + $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $entity->setStoreId(0); + $entity->load(1); + $entity->setData($code, $optionIds[$defaultStoreValue]); + $entity->save(); + + if ($snapshotValue !== '-') { + /** @var $options \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection */ + $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $entity->setStoreId($store->getId()); + $entity->load(1); + + if ($snapshotValue) { + $snapshotValue = $optionIds[$snapshotValue]; + } + + $entity->setData($code, $snapshotValue); + $entity->save(); + } + + $entity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $entity->setStoreId($store->getId()); + $entity->load(1); + + $updateHandler = Bootstrap::getObjectManager()->create(UpdateHandler::class); + + if ($newValue) { + $newValue = $optionIds[$newValue]; + } + + $entityData = array_merge($entity->getData(), [$code => $newValue]); + $updateHandler->execute(\Magento\Catalog\Api\Data\ProductInterface::class, $entityData); + + $resultEntity = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); + $resultEntity->setStoreId($store->getId()); + $resultEntity->load(1); + + if ($expected !== null) { + $expected = $optionIds[$expected]; + } + + $this->assertTrue($expected === $resultEntity->getData($code)); + } + + /** + * @return array + */ + public function getAllStoresDataProvider() + { + return [ + ['description', '', 'not_empty_value', 'not_empty_value'], //0 + ['description', '', '', null], //1 + ['description', '', null, null], //2 + ['description', '', false, null], //3 + + ['description', 'not_empty_value', 'not_empty_value2', 'not_empty_value2'], //4 + ['description', 'not_empty_value', '', null], //5 + ['description', 'not_empty_value', null, null], //6 + ['description', 'not_empty_value', false, null], //7 + + ['description', null, 'not_empty_value', 'not_empty_value'], //8 + ['description', null, '', null], //9 + ['description', null, false, null], //10 + + ['description', false, 'not_empty_value', 'not_empty_value'], //11 + ['description', false, '', null], //12 + ['description', false, null, null], //13 + ]; + } + + /** + * @return array + */ + public function getCustomStoreDataProvider() + { + return [ + ['description', '', 'not_empty_value', 'not_empty_value'], //0 + ['description', '', '', null], //1 + ['description', '', null, 'Description with html tag'], //2 + ['description', '', false, 'Description with html tag'], //3 + + ['description', 'not_empty_value', 'not_empty_value2', 'not_empty_value2'], //4 + ['description', 'not_empty_value', '', null], //5 + ['description', 'not_empty_value', null, 'Description with html tag'], //6 + ['description', 'not_empty_value', false, 'Description with html tag'], //7 + + ['description', null, 'not_empty_value', 'not_empty_value'], //8 + ['description', null, '', null], //9 + ['description', null, false, 'Description with html tag'], //10 + + ['description', false, 'not_empty_value', 'not_empty_value'], //11 + ['description', false, '', null], //12 + ['description', false, null, 'Description with html tag'], //13 + ]; + } + + /** + * @return array + */ + public function getCustomAttributeDataProvider() + { + return [ + ['dropdown_attribute', 0, '', 1, 1], //0 + ['dropdown_attribute', 0, '', '', null], //1 + ['dropdown_attribute', 0, '', null, 0], //2 + ['dropdown_attribute', 0, '', false, 0], //3 + + ['dropdown_attribute', 0, 1, 2, 2], //4 + ['dropdown_attribute', 0, 1, '', null], //5 + ['dropdown_attribute', 0, 1, null, 0], //6 + ['dropdown_attribute', 0, 1, false, 0], //7 + + ['dropdown_attribute', 0, null, 1, 1], //8 + ['dropdown_attribute', 0, null, '', null], //9 + ['dropdown_attribute', 0, null, false, 0], //10 + + ['dropdown_attribute', 0, false, 1, 1], //11 + ['dropdown_attribute', 0, false, '', null], //12 + ['dropdown_attribute', 0, false, null, 0], //13 + + ['dropdown_attribute', 0, '-', 1, 1], //14 + ['dropdown_attribute', 0, '-', '', null], //15 + ['dropdown_attribute', 0, '-', null, 0], //16 + ['dropdown_attribute', 0, '-', false, 0], //17 + ]; + } } From ab2aa429ebc344b8c66e073ca54540889aa87845 Mon Sep 17 00:00:00 2001 From: Andrii Dimov Date: Thu, 27 Oct 2016 19:05:13 +0300 Subject: [PATCH 1492/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - base integration tests for bundle price --- .../DynamicBundlePriceCalculatorTest.php | 243 ++++++++++++ .../FixedBundlePriceCalculatorTest.php | 355 ++++++++++++++++++ .../PriceCalculator/fixed_bundle_product.php | 2 +- .../fixed_bundle_product_rollback.php | 2 +- 4 files changed, 600 insertions(+), 2 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php new file mode 100644 index 0000000000000..8106e17d4c9b8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php @@ -0,0 +1,243 @@ + 'Some title', + 'required' => true, + 'type' => 'checkbox' + ]; + + protected $fixtureForProductOptionSelection = [ + 'sku' => null, // need to set this + 'option_id' => null, // need to set this + 'qty' => 1, + 'is_default' => true, + 'can_change_quantity' => 0 + ]; + + protected function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + } + + /** + * @param $strategyModifiers array + * @param $expectedResults array + * @dataProvider getTestCases + * @magentoAppIsolation enabled + */ + public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) + { + $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); + + foreach ($strategyModifiers as $modifier) { + if (method_exists($this, $modifier['modifierName'])) { + array_unshift($modifier['data'], $bundleProduct); + $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); + } + } + + $this->productRepository->save($bundleProduct); + $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + + /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ + $priceInfo = $bundleProduct->getPriceInfo(); + $priceCode = \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE; + + $this->assertEquals( + $expectedResults['minimalPrice'], + $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(), + 'Failed to check minimal price on product' + ); + + $this->assertEquals( + $expectedResults['maximalPrice'], + $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(), + 'Failed to check maximal price on product' + ); + } + + public function getTestCases() + { + return [ + 'Testing price for dynamic bundle product with one simple' => [ + 'strategy' => $this->getProductWithOneSimple(), + 'expectedResults' => [ + // just price from simple1 + 'minimalPrice' => 10, + // just price from simple1 + 'maximalPrice' => 10 + ] + ], + 'Testing price for dynamic bundle product with three simples and differnt qty' => [ + 'strategy' => $this->getProductWithDifferentQty(), + 'expectedResults' => [ + // min price from simples 3*10 or 30 + 'minimalPrice' => 30, + // (3 * 10) + (2 * 20) + 30 + 'maximalPrice' => 100 + ] + ], + 'Testing price for dynamic bundle product with four simples and differnt price' => [ + 'strategy' => $this->getProductWithDifferentPrice(), + 'expectedResults' => [ + // 10 + 'minimalPrice' => 10, + // 10 + 20 + 30 + 'maximalPrice' => 60 + ] + ] + ]; + } + + public function getProductWithOneSimple() + { + $optionsData = [ + [ + 'links' => [ + [ + 'sku' => 'simple1', + 'option_id' => 1, + 'price' => 10, + ], + ] + ], + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } + + public function getProductWithDifferentQty() + { + $optionsData = [ + [ + 'links' => [ + [ + 'sku' => 'simple1', + 'option_id' => 1, + 'qty' => 3, + ], + [ + 'sku' => 'simple2', + 'option_id' => 1, + 'qty' => 2, + ], + [ + 'sku' => 'simple3', + 'option_id' => 1, + 'qty' => 1, + ], + ] + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } + + public function getProductWithDifferentPrice() + { + $optionsData = [ + [ + 'links' => [ + [ + 'sku' => 'simple1', + 'option_id' => 1, + 'qty' => 1, + ], + [ + 'sku' => 'simple2', + 'option_id' => 1, + 'qty' => 1, + ], + [ + 'sku' => 'simple3', + 'option_id' => 1, + 'qty' => 1, + ] + ] + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } + + protected function getFixtureForProductOption(array $data = []) + { + $fixture = $this->fixtureForProductOption; + + // make title different for each call + $fixture['title'] .= ' ' . microtime(true); + + return array_merge($fixture, $data); + } + + protected function getFixtureForProductOptionSelection($data) + { + $fixture = $this->fixtureForProductOptionSelection; + + return array_merge($fixture, $data); + } + + protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) + { + $options = []; + + foreach ($optionsData as $optionData) { + $links = []; + $linksData = $optionData['links']; + unset($optionData['links']); + + $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) + ->create(['data' => $this->getFixtureForProductOption($optionData)]) + ->setSku($bundleProduct->getSku()) + ->setOptionid(null); + + foreach ($linksData as $linkData) { + $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) + ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); + } + + $option->setProductLinks($links); + $options[] = $option; + } + + $extension = $bundleProduct->getExtensionAttributes(); + $extension->setBundleProductOptions($options); + $bundleProduct->setExtensionAttributes($extension); + + return $bundleProduct; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php new file mode 100644 index 0000000000000..45b9031b3d26e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -0,0 +1,355 @@ + 'Some title', + 'required' => true, + 'type' => 'checkbox' + ]; + + protected $fixtureForProductOptionSelection = [ + 'sku' => null, // need to set this + 'option_id' => null, // need to set this + 'qty' => 1, + 'is_default' => true, + 'price' => null, // need to set this + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, + 'can_change_quantity' => 0 + ]; + + protected $fixtureForProductCustomOption = [ + 'option_id' => null, + 'previous_group' => 'text', + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'sort_order' => 0, + 'price' => 100, + 'price_type' => 'fixed', + 'sku' => '1-text', + 'max_characters' => 100, + ]; + + protected function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + } + + /** + * @param $strategyModifiers array + * @param $expectedResults array + * @dataProvider getTestCases + * @magentoAppIsolation enabled + */ + public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) + { + $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); + + foreach ($strategyModifiers as $modifier) { + if (method_exists($this, $modifier['modifierName'])) { + array_unshift($modifier['data'], $bundleProduct); + $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); + } + } + + $this->productRepository->save($bundleProduct); + $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + + /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ + $priceInfo = $bundleProduct->getPriceInfo(); + $priceCode = \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE; + + $this->assertEquals( + $expectedResults['minimalPrice'], + $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(), + 'Failed to check minimal price on product' + ); + + $this->assertEquals( + $expectedResults['maximalPrice'], + $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(), + 'Failed to check maximal price on product' + ); + } + + + public function getTestCases() + { + return [ + 'Testing price for fixed bundle product with one simple' => [ + 'strategy' => $this->getProductWithOneSimple(), + 'expectedResults' => [ + // 110 + 10 (price from simple1) + 'minimalPrice' => 120, + // 110 + 10 (sum of simple price) + 'maximalPrice' => 120 + ] + ], + 'Testing price for fixed bundle product with three simples and differnt qty' => [ + 'strategy' => $this->getProductWithDifferentQty(), + 'expectedResults' => [ + // 110 + 10 (min price from simples) + 'minimalPrice' => 120, + // 110 + (3 * 10) + (2 * 10) + 10 + 'maximalPrice' => 170 + ] + ], + 'Testing price for fixed bundle product with three simples and differnt price' => [ + 'strategy' => $this->getProductWithDifferentPrice(), + 'expectedResults' => [ + // 110 + 10 + 'minimalPrice' => 120, + // 110 + 60 + 'maximalPrice' => 170 + ] + ], + 'Testing price for fixed bundle product with three simples' => [ + 'strategy' => $this->getProductWithSamePrice(), + 'expectedResults' => [ + // 110 + 10 + 'minimalPrice' => 120, + // 110 + 30 + 'maximalPrice' => 140 + ] + ] + ]; + } + + public function getProductWithOneSimple() + { + $optionsData = [ + [ + 'links' => [ + [ + 'sku' => 'simple1', + 'option_id' => 1, + 'price' => 10, + ], + ] + ], + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } + + public function getProductWithDifferentQty() + { + $optionsData = [ + [ + 'links' => [ + [ + 'sku' => 'simple1', + 'option_id' => 1, + 'price' => 10, + 'qty' => 3, + ], + [ + 'sku' => 'simple2', + 'option_id' => 1, + 'price' => 10, + 'qty' => 2, + ], + [ + 'sku' => 'simple3', + 'option_id' => 1, + 'price' => 10, + 'qty' => 1, + ], + ] + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } + + public function getProductWithSamePrice() + { + $optionsData = [ + [ + 'links' => [ + [ + 'sku' => 'simple1', + 'option_id' => 1, + 'price' => 10, + 'qty' => 1, + ], + [ + 'sku' => 'simple2', + 'option_id' => 1, + 'price' => 10, + 'qty' => 1, + ], + [ + 'sku' => 'simple3', + 'option_id' => 1, + 'price' => 10, + 'qty' => 1, + ] + ] + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } + + public function getProductWithDifferentPrice() + { + $optionsData = [ + [ + 'links' => [ + [ + 'sku' => 'simple1', + 'option_id' => 1, + 'price' => 10, + 'qty' => 1, + ], + [ + 'sku' => 'simple2', + 'option_id' => 1, + 'price' => 20, + 'qty' => 1, + ], + [ + 'sku' => 'simple3', + 'option_id' => 1, + 'price' => 30, + 'qty' => 1, + ] + ] + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } + + protected function getFixtureForProductOption(array $data = []) + { + $fixture = $this->fixtureForProductOption; + + // make title different for each call + $fixture['title'] .= ' ' . microtime(true); + + return array_merge($fixture, $data); + } + + protected function getFixtureForProductOptionSelection($data) + { + $fixture = $this->fixtureForProductOptionSelection; + + return array_merge($fixture, $data); + } + + protected function getFixtureForProductCustomOption(array $data = []) + { + $fixture = $this->fixtureForProductCustomOption; + + // make title and sku different for each call + $fixture['title'] .= ' ' . microtime(true); + $fixture['sku'] .= ' ' . microtime(true); + + return array_merge($fixture, $data); + } + + protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) + { + $bundleProduct->setSpecialPrice($discount); + + return $bundleProduct; + } + + protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) + { + $options = []; + + foreach ($optionsData as $optionData) { + $links = []; + $linksData = $optionData['links']; + unset($optionData['links']); + + $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) + ->create(['data' => $this->getFixtureForProductOption($optionData)]) + ->setSku($bundleProduct->getSku()) + ->setOptionid(null); + + foreach ($linksData as $linkData) { + $linkData['option_id'] = $option->getId(); // ??? looks like needed + $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) + ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); + } + + $option->setProductLinks($links); + $options[] = $option; + } + + $extension = $bundleProduct->getExtensionAttributes(); + $extension->setBundleProductOptions($options); + $bundleProduct->setExtensionAttributes($extension); + + return $bundleProduct; + } + + protected function addCustomOption(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) + { + /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ + $customOptionFactory = $this->objectManager + ->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); + + $options = []; + foreach ($optionsData as $optionData) { + $customOption = $customOptionFactory->create( + [ + 'data' => $this->getFixtureForProductCustomOption($optionData) + ] + ); + $customOption->setProductSku($bundleProduct->getSku()); + $customOption->setOptionId(null); + + $options[] = $customOption; + } + + $bundleProduct->setOptions($options); + $bundleProduct->setCanSaveCustomOptions(true); + + return $bundleProduct; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php index f77d7dc8bd5bc..7b501db8e89a4 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -require __DIR__ . '/../../../../Magento/Catalog/_files/multiple_products.php'; +require __DIR__ . '/../../../../Magento/Bundle/_files/multiple_products.php'; $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_rollback.php index 4f42bba96c177..bb41cddb8e0a4 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_rollback.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -require __DIR__ . '/../../../../Magento/Catalog/_files/multiple_products_rollback.php'; +require __DIR__ . '/../../../../Magento/Bundle/_files/multiple_products_rollback.php'; /** @var \Magento\Framework\Registry $registry */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); From 611838d5680371e3249d97fa3411b3d6ae699ec5 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Thu, 27 Oct 2016 19:22:53 +0300 Subject: [PATCH 1493/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60106: Bundle from-to price calculation is wrong --- .../ResourceModel/Selection/Collection.php | 10 ++++++++++ .../Bundle/Pricing/Adjustment/Calculator.php | 17 +++++++++++++++-- .../PriceCalculator/dynamic_bundle_product.php | 2 +- .../dynamic_bundle_product_rollback.php | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index 4aff7c14c7efa..83a2664ec70f3 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -279,4 +279,14 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) $this->getSelect()->limit(1); return $this; } + + /** + * Clear collection data after clone + */ + public function __clone() + { + parent::__clone(); + $this->removeAttributeToSelect(); + $this->clear(); + } } diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index b64494ab40000..2048b3eaaa8ba 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -216,9 +216,9 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR $selectionsCollection->addAttributeToSelect('special_price_from'); $selectionsCollection->addAttributeToSelect('special_price_to'); $selectionsCollection->addAttributeToSelect('tax_class_id'); - $selectionsCollection->addTierPriceData(); } - $selection = $selectionsCollection->fetchItem(); + + $selection = $selectionsCollection->getFirstItem(); $priceList[] = $this->selectionFactory->create( $bundleProduct, $selection, @@ -230,6 +230,19 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR } } + + if ($searchMin && $bundleProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC && !$productHasRequiredOption) { + $minPrice = null; + $priceSelection = null; + foreach ($priceList as $price) { + $minPriceTmp = $price->getAmount()->getValue() * $price->getQuantity(); + if (!$minPrice || $minPriceTmp < $minPrice) { + $priceSelection = $price; + } + } + $priceList = [$priceSelection]; + } + return $priceList; } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php index 726b8a36fb301..218ae90d4509f 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -require __DIR__ . '/../../../../Magento/Catalog/_files/multiple_products.php'; +require __DIR__ . '/../../../../Magento/Bundle/_files/multiple_products.php'; $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_rollback.php index 4f42bba96c177..bb41cddb8e0a4 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_rollback.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -require __DIR__ . '/../../../../Magento/Catalog/_files/multiple_products_rollback.php'; +require __DIR__ . '/../../../../Magento/Bundle/_files/multiple_products_rollback.php'; /** @var \Magento\Framework\Registry $registry */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); From 57a5fb57670f2d3d2fbd6b4d25e4028143bdeb73 Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Thu, 27 Oct 2016 19:30:13 +0300 Subject: [PATCH 1494/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - updates for isSaleable test --- .../Bundle/Model/Product/IsSaleableTest.php | 81 +++++-------------- 1 file changed, 18 insertions(+), 63 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php index 20d0fb2e21f1f..aa222e4f9f1a4 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php @@ -8,6 +8,8 @@ /** * Test class for \Magento\Bundle\Model\Product\Type (bundle product type) + * + * @magentoDataFixtureBeforeTransaction Magento/Bundle/_files/issaleable_product.php */ class IsSaleableTest extends \PHPUnit_Framework_TestCase { @@ -30,13 +32,11 @@ protected function setUp() /** * check bundle product is saleable if his status is enabled * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ public function testIsSaleableOnEnabledStatus() { - $bundleProduct = $this->productRepository->get('bundle-product'); $bundleProduct->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED); @@ -49,7 +49,6 @@ public function testIsSaleableOnEnabledStatus() /** * check bundle product is NOT saleable if his status is disabled * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -68,7 +67,6 @@ public function testIsSaleableOnDisabledStatus() * check bundle product is saleable if his status is enabled * and it has internal data is_salable = true * - * @magentoDataFixtureBeforeTransaction Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -88,7 +86,6 @@ public function testIsSaleableOnEnabledStatusAndIsSalableIsTrue() * check bundle product is NOT saleable if * his status is enabled but his data is_salable = false * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -107,7 +104,6 @@ public function testIsSaleableOnEnabledStatusAndIsSalableIsFalse() /** * check bundle product is saleable if it has all_items_salable = true * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -125,7 +121,6 @@ public function testIsSaleableOnAllItemsSalableIsTrue() /** * check bundle product is NOT saleable if it has all_items_salable = false * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -143,14 +138,12 @@ public function testIsSaleableOnAllItemsSalableIsFalse() /** * check bundle product is NOT saleable if it has no options * - * @magentoDataFixtureBeforeTransaction Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ public function testIsSaleableOnBundleWithoutOptions() { $optionRepository = $this->objectManager->create(\Magento\Bundle\Api\ProductOptionRepositoryInterface::class); - $bundleProduct = $this->productRepository->get('bundle-product'); // TODO: make cleaner option deletion after fix MAGETWO-59465 @@ -160,8 +153,8 @@ public function testIsSaleableOnBundleWithoutOptions() } $ea->setBundleProductOptions([]); $bundleProduct->setExtensionAttributes($ea); - $bundleProduct->setBundleOptionsData([]); - $this->productRepository->save($bundleProduct); + + $bundleProduct = $this->productRepository->save($bundleProduct); $this->assertFalse( $bundleProduct->isSalable(), @@ -172,7 +165,6 @@ public function testIsSaleableOnBundleWithoutOptions() /** * check bundle product is NOT saleable if it has no selections * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -194,8 +186,6 @@ public function testIsSaleableOnBundleWithoutSelections() $linkManager->removeChild($bundleProductSku, $link->getOptionId(), $link->getSku()); } - $bundleProduct = $this->productRepository->get($bundleProductSku, true, null, true); - $this->assertFalse( $bundleProduct->isSalable(), 'Bundle product supposed to be non saleable if it has no selections' @@ -206,7 +196,6 @@ public function testIsSaleableOnBundleWithoutSelections() * check bundle product is NOT saleable if * all his selections are not saleable * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -231,7 +220,6 @@ public function testIsSaleableOnBundleWithoutSaleableSelections() * check bundle product is NOT saleable if * it has at least one required option without saleable selections * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -256,7 +244,6 @@ public function testIsSaleableOnBundleWithoutSaleableSelectionsOnRequiredOption( * check bundle product is NOT saleable if * there are not enough qty of selection on required option * - * @magentoDataFixtureBeforeTransaction Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ @@ -272,65 +259,33 @@ public function testIsSaleableOnBundleWithNotEnoughQtyOfSelection() ); } - /** - * check bundle product is saleable if - * all his selections has not selection qty - * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php - * @magentoAppIsolation enabled - * @covers \Magento\Bundle\Model\Product\Type::isSalable - */ - public function testIsSaleableOnBundleWithoutSelectionQty() - { - $this->setQtyForSelections(['simple1', 'simple2', 'simple3', 'simple4', 'simple5'], 1); - - $bundleProduct = $this->productRepository->get('bundle-product', false, null, true); - $bundleType = $bundleProduct->getTypeInstance(); - - /** @var \Magento\Bundle\Model\Product\Type $bundleType */ - $options = $bundleType->getOptionsCollection($bundleProduct); - $selections = $bundleType->getSelectionsCollection($options->getAllIds(), $bundleProduct); - - foreach ($selections as $link) { - $link->setSelectionQty(null); - } - - $bundleProduct->setBundleOptionsData([]); - $bundleProduct->setBundleSelectionsData([]); - $this->productRepository->save($bundleProduct); - - $this->assertTrue( - $bundleProduct->isSalable(), - 'Bundle product supposed to be saleable if all his selections has no selection qty' - ); - } - /** * check bundle product is saleable if * all his selections have selection_can_change_qty = 1 * - * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable */ public function testIsSaleableOnBundleWithSelectionCanChangeQty() { $this->setQtyForSelections(['simple1', 'simple2', 'simple3', 'simple4', 'simple5'], 1); + $bundleProduct = $this->productRepository->get('bundle-product'); + $options = $bundleProduct->getExtensionAttributes()->getBundleProductOptions(); - $bundleProduct = $this->productRepository->get('bundle-product', false, null, true); - $bundleType = $bundleProduct->getTypeInstance(); + foreach ($options as $productOption) { + $links = $productOption->getProductLinks(); + foreach ($links as $link) { + $link->setSelectionCanChangeQuantity(1); + } - /** @var \Magento\Bundle\Model\Product\Type $bundleType */ - $options = $bundleType->getOptionsCollection($bundleProduct); - $selections = $bundleType->getSelectionsCollection($options->getAllIds(), $bundleProduct); - - foreach ($selections as $link) { - $link->setSelectionCanChangeQty(1); + $productOption->setProductLinks($links); } - $bundleProduct->setBundleOptionsData([]); - $bundleProduct->setBundleSelectionsData([]); - $this->productRepository->save($bundleProduct); + $extension = $bundleProduct->getExtensionAttributes(); + $extension->setBundleProductOptions($options); + $bundleProduct->setExtensionAttributes($extension); + + $bundleProduct = $this->productRepository->save($bundleProduct); $this->assertTrue( $bundleProduct->isSalable(), @@ -341,7 +296,7 @@ public function testIsSaleableOnBundleWithSelectionCanChangeQty() private function setQtyForSelections($productsSku, $qty) { foreach ($productsSku as $productSku) { - $product = $this->productRepository->get($productSku, false, null, true); + $product = $this->productRepository->get($productSku); $ea = $product->getExtensionAttributes(); $ea->getStockItem()->setQty($qty); $this->productRepository->save($product); From b024f0592f0d8f4a43b1be7d1d51a38d04e97846 Mon Sep 17 00:00:00 2001 From: Vitaliy Goncharenko Date: Thu, 27 Oct 2016 19:35:30 +0300 Subject: [PATCH 1495/3232] MAGETWO-53583: "Use Default" checkbox is checked again after saving empty fields (description, name, etc) - fixed static --- .../Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php index 8851ab0c71eb9..cd110713711e0 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php @@ -9,7 +9,8 @@ use Magento\TestFramework\Helper\Bootstrap; /** - * Update handler test. + * @magentoAppArea adminhtml + * @magentoAppIsolation enabled */ class UpdateHandlerTest extends \PHPUnit_Framework_TestCase { From 3be660c3f48ed8189afc72d4f94e2e23e6ee51c6 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Thu, 27 Oct 2016 22:11:50 +0300 Subject: [PATCH 1496/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60106: Bundle from-to price calculation is wrong --- ...icBundleWithSpecialPriceCalculatorTest.php | 30 ------------------- ...dle_product_with_catalog_rule_rollback.php | 2 +- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php index 9762df3a5ddaf..e0d5273501103 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php @@ -78,15 +78,6 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec public function getTestCases() { return [ - 'Testing price for dynamic bundle product with sub items and without any discounts' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy(), - 'expectedResults' => [ - // just price from simple1 - 'minimalPrice' => 10, - // just price from simple1 - 'maximalPrice' => 10 - ] - ], 'Testing price for dynamic bundle product with special price and sub items Configuration #1' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1(), 'expectedResults' => [ @@ -180,27 +171,6 @@ public function getTestCases() ]; } - public function getProductWithSubItemsAndOptionsStrategy() - { - $optionsData = [ - [ - 'links' => [ - [ - 'sku' => 'simple1', - 'option_id' => 1, - ], - ] - ], - ]; - - return [ - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - ]; - } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1() { $optionsData = [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_catalog_rule_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_catalog_rule_rollback.php index 51d234e56ab8b..50cb07079c24f 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_catalog_rule_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_catalog_rule_rollback.php @@ -4,4 +4,4 @@ * See COPYING.txt for license details. */ -require __DIR__ . '/dynamic_bundle_product.php'; +require __DIR__ . '/dynamic_bundle_product_rollback.php'; From 4ebe9bff42f59e2766cb7f539fe3ec0fd53b4b56 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Thu, 27 Oct 2016 15:16:47 -0500 Subject: [PATCH 1497/3232] MAGETWO-57255: Eliminate @escapeNotVerified in Widget Module - updated the templates --- .../view/adminhtml/templates/catalog/category/widget/tree.phtml | 2 +- .../Widget/view/adminhtml/templates/instance/edit/layout.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Widget/view/adminhtml/templates/catalog/category/widget/tree.phtml b/app/code/Magento/Widget/view/adminhtml/templates/catalog/category/widget/tree.phtml index 4e240770b0462..94ee88698111f 100644 --- a/app/code/Magento/Widget/view/adminhtml/templates/catalog/category/widget/tree.phtml +++ b/app/code/Magento/Widget/view/adminhtml/templates/catalog/category/widget/tree.phtml @@ -79,7 +79,7 @@ jQuery(function() // Add empty node to reset category filter if(!emptyNodeAdded) { var empty = Object.clone(_node); - empty.text = ''; + empty.text = 'escapeJs($block->escapeHtml(__('None'))); ?>'; empty.children = []; empty.id = 'none'; empty.path = '1/none'; diff --git a/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml b/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml index 62d92ac38aecd..5d55ba4035873 100644 --- a/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml +++ b/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml @@ -10,7 +10,7 @@ ?>
- + escapeHtml(__('Layout Updates')); ?>
From 7997b8ccbae26ba8eefe2a8af90c14718273ebfd Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Thu, 27 Oct 2016 15:48:55 -0500 Subject: [PATCH 1498/3232] MAGETWO-57571: Update \Magento\Test\Php\XssPhtmlTemplateTest::testAbsenceOfEscapeNotVerifiedAnnotationInRefinedModules() to check translation calls - updated whitelist --- .../Magento/Test/Php/_files/whitelist/exempt_modules/ce.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php index c0316a435662e..8075f9bddc318 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php @@ -13,10 +13,8 @@ 'Magento_CatalogInventory', 'Magento_CatalogRule', 'Magento_CatalogSearch', - 'Magento_CatalogWidget', 'Magento_Checkout', 'Magento_CheckoutAgreements', - 'Magento_Cms', 'Magento_Config', 'Magento_ConfigurableProduct', 'Magento_CurrencySymbol', @@ -47,8 +45,6 @@ 'Magento_Theme', 'Magento_Translation', 'Magento_Ui', - 'Magento_UrlRewrite', 'Magento_User', 'Magento_Weee', - 'Magento_Widget', ]; From 1d72030b9420a5b5b9019dbf1e9664d431ec0b6a Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Thu, 27 Oct 2016 16:16:19 -0500 Subject: [PATCH 1499/3232] MAGETWO-57571: Update \Magento\Test\Php\XssPhtmlTemplateTest::testAbsenceOfEscapeNotVerifiedAnnotationInRefinedModules() to check translation calls - removed @escapeNotVerified --- .../view/frontend/templates/widget/link/link_block.phtml | 6 +++++- .../view/frontend/templates/widget/link/link_inline.phtml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/view/frontend/templates/widget/link/link_block.phtml b/app/code/Magento/Cms/view/frontend/templates/widget/link/link_block.phtml index 55c1b02be8797..82a27c7aa0d78 100644 --- a/app/code/Magento/Cms/view/frontend/templates/widget/link/link_block.phtml +++ b/app/code/Magento/Cms/view/frontend/templates/widget/link/link_block.phtml @@ -3,9 +3,13 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ + +/** + * @var \Magento\Cms\Block\Widget\Page\Link $block + */ ?> diff --git a/app/code/Magento/Cms/view/frontend/templates/widget/link/link_inline.phtml b/app/code/Magento/Cms/view/frontend/templates/widget/link/link_inline.phtml index 382b492db3da5..d906826507d73 100644 --- a/app/code/Magento/Cms/view/frontend/templates/widget/link/link_inline.phtml +++ b/app/code/Magento/Cms/view/frontend/templates/widget/link/link_inline.phtml @@ -3,9 +3,13 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ + +/** + * @var \Magento\Cms\Block\Widget\Page\Link $block + */ ?> - getLinkAttributes() ?>> + getLinkAttributes() ?>> escapeHtml($block->getLabel()) ?> From 8f1f08740e744a9194da1b31b6d835c98addc639 Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Fri, 28 Oct 2016 10:19:18 +0300 Subject: [PATCH 1500/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - some fixes for isSaleable --- app/code/Magento/Bundle/Model/Product/Type.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index a31a129ff5972..d62613c221528 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -554,18 +554,17 @@ public function isSalable($product) return $product->getData('all_items_salable'); } - $optionCollection = $this->getOptionsCollection($product); - - if (!count($optionCollection->getItems())) { + if (!$this->getOptionsCollection($product)->getSize()) { return false; } $isSalable = true; - foreach ($optionCollection->getItems() as $option) { + foreach ($this->getOptionsCollection($product)->getItems() as $option) { if ($option->getRequired()) { $hasSalable = false; $selectionsCollection = $this->_bundleCollection->create(); + $selectionsCollection->addAttributeToSelect('status'); $selectionsCollection->addQuantityFilter(); $selectionsCollection->addFilterByRequiredOptions(); $selectionsCollection->setOptionIdsFilter([$option->getId()]); From 4488d4c047f36fbdc0cfe4fe042a4837c8309f6e Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov Date: Wed, 26 Oct 2016 14:04:29 +0300 Subject: [PATCH 1501/3232] MAGETWO-59579: [Github #6943] grunt exec: doesn't work with @import --- .../Css/PreProcessor/Instruction/Import.php | 13 ++-- .../PreProcessor/Instruction/ImportTest.php | 66 +++++++++++++------ 2 files changed, 52 insertions(+), 27 deletions(-) diff --git a/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/Import.php b/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/Import.php index 524ccc8c11fe3..260f6216b09bd 100644 --- a/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/Import.php +++ b/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/Import.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Css\PreProcessor\Instruction; use Magento\Framework\View\Asset\LocalInterface; @@ -22,7 +20,10 @@ class Import implements PreProcessorInterface * Pattern of @import instruction */ const REPLACE_PATTERN = - '#@import\s+(\((?P\w+)\)\s+)?[\'\"](?P(?![/\\\]|\w:[/\\\])[^\"\']+)[\'\"]\s*?(?P.*?);#'; + '#@import(?!.*?\surl\(.*?)' + . '(?P[\(\),\w\s]*?[\'\"])' + . '(?P(?![/\\\]|\w*?:[/\\\])[^\"\']+)' + . '(?P[\'\"][\s\w\(\)]*?);#'; /** * @var \Magento\Framework\View\Asset\NotationResolver\Module @@ -133,9 +134,9 @@ protected function replace(array $matchedContent, LocalInterface $asset, $conten $matchedFileId = $this->fixFileExtension($matchedContent['path'], $contentType); $this->recordRelatedFile($matchedFileId, $asset); $resolvedPath = $this->notationResolver->convertModuleNotationToPath($asset, $matchedFileId); - $typeString = empty($matchedContent['type']) ? '' : '(' . $matchedContent['type'] . ') '; - $mediaString = empty($matchedContent['media']) ? '' : ' ' . trim($matchedContent['media']); - return "@import {$typeString}'{$resolvedPath}'{$mediaString};"; + $start = $matchedContent['start']; + $end = $matchedContent['end']; + return "@import{$start}{$resolvedPath}{$end};"; } /** diff --git a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php index 2441422bb1821..dc45ea75e0eb8 100644 --- a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php +++ b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php @@ -39,7 +39,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->notationResolver = $this->getMock( + $this->notationResolver = $this->getMock( \Magento\Framework\View\Asset\NotationResolver\Module::class, [], [], '', false ); $this->asset = $this->getMock(\Magento\Framework\View\Asset\File::class, [], [], '', false); @@ -63,7 +63,11 @@ protected function setUp() public function testProcess($originalContent, $foundPath, $resolvedPath, $expectedContent) { $chain = new \Magento\Framework\View\Asset\PreProcessor\Chain($this->asset, $originalContent, 'less', 'path'); - $this->notationResolver->expects($this->once()) + $invoke = $this->once(); + if (preg_match('/^(http:|https:|\/+)/', $foundPath)) { + $invoke = $this->never(); + } + $this->notationResolver->expects($invoke) ->method('convertModuleNotationToPath') ->with($this->asset, $foundPath) ->will($this->returnValue($resolvedPath)); @@ -78,50 +82,70 @@ public function testProcess($originalContent, $foundPath, $resolvedPath, $expect public function processDataProvider() { return [ - 'non-modular notation' => [ - '@import (type) "some/file.css" media;', - 'some/file.css', - 'some/file.css', - "@import (type) 'some/file.css' media;", + 'non-modular notation, no extension' => [ + '@import (type) \'some/file\' media;', + 'some/file.less', + 'some/file.less', + '@import (type) \'some/file.less\' media;', ], 'modular, with extension' => [ '@import (type) "Magento_Module::something.css" media;', 'Magento_Module::something.css', 'Magento_Module/something.css', - "@import (type) 'Magento_Module/something.css' media;", + '@import (type) "Magento_Module/something.css" media;', + ], + 'remote file import url()' => [ + '@import (type) url("http://example.com/css/some.css") media;', + 'http://example.com/css/some.css', + null, + '@import (type) url("http://example.com/css/some.css") media;', + ], + 'invalid path' => [ + '@import (type) url("/example.com/css/some.css") media;', + '/example.com/css/some.css', + null, + '@import (type) url("/example.com/css/some.css") media;', ], 'modular, no extension' => [ '@import (type) "Magento_Module::something" media;', 'Magento_Module::something.less', 'Magento_Module/something.less', - "@import (type) 'Magento_Module/something.less' media;", + '@import (type) "Magento_Module/something.less" media;', ], 'no type' => [ '@import "Magento_Module::something.css" media;', 'Magento_Module::something.css', 'Magento_Module/something.css', - "@import 'Magento_Module/something.css' media;", + '@import "Magento_Module/something.css" media;', ], 'no media' => [ '@import (type) "Magento_Module::something.css";', 'Magento_Module::something.css', 'Magento_Module/something.css', - "@import (type) 'Magento_Module/something.css';", + '@import (type) "Magento_Module/something.css";', + ], + 'with single line comment, replace' => [ + '@import (type) "some/file" media;' . PHP_EOL + . '// @import (type) "unnecessary/file.css" media;', + 'some/file.less', + 'some/file.less', + '@import (type) "some/file.less" media;' . PHP_EOL, ], - 'with single line comment' => [ - '@import (type) "some/file.css" media;' . PHP_EOL - . '// @import (type) "unnecessary/file.css" media;', - 'some/file.css', - 'some/file.css', - "@import (type) 'some/file.css' media;" . PHP_EOL, + 'with single line comment, no replace' => [ + '@import (type) "some/file.less" media;' . PHP_EOL + . '// @import (type) "unnecessary/file" media;', + 'some/file.less', + 'some/file.less', + '@import (type) "some/file.less" media;' . PHP_EOL + . '// @import (type) "unnecessary/file" media;', ], 'with multi line comment' => [ - '@import (type) "some/file.css" media;' . PHP_EOL + '@import (type) "some/file" media;' . PHP_EOL . '/* @import (type) "unnecessary/file.css" media;' . PHP_EOL . '@import (type) "another/unnecessary/file.css" media; */', - 'some/file.css', - 'some/file.css', - "@import (type) 'some/file.css' media;" . PHP_EOL, + 'some/file.less', + 'some/file.less', + '@import (type) "some/file.less" media;' . PHP_EOL, ], ]; } From 8fe89bdeb51fcee5125803ed9e7a271d1ab17da4 Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Fri, 28 Oct 2016 13:37:13 +0300 Subject: [PATCH 1502/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - updates for isSaleable test --- .../Bundle/Model/Product/IsSaleableTest.php | 83 +++++++++++++++++-- 1 file changed, 78 insertions(+), 5 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php index aa222e4f9f1a4..b1fe33e843b65 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php @@ -9,7 +9,7 @@ /** * Test class for \Magento\Bundle\Model\Product\Type (bundle product type) * - * @magentoDataFixtureBeforeTransaction Magento/Bundle/_files/issaleable_product.php + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php */ class IsSaleableTest extends \PHPUnit_Framework_TestCase { @@ -170,9 +170,7 @@ public function testIsSaleableOnBundleWithoutOptions() */ public function testIsSaleableOnBundleWithoutSelections() { - $bundleProductSku = 'bundle-product'; - - $bundleProduct = $this->productRepository->get($bundleProductSku, true, null, true); + $bundleProduct = $this->productRepository->get('bundle-product', true, null, true); $bundleType = $bundleProduct->getTypeInstance(); /** @var \Magento\Bundle\Model\LinkManagement $linkManager */ $linkManager = $this->objectManager->create(\Magento\Bundle\Model\LinkManagement::class); @@ -183,9 +181,10 @@ public function testIsSaleableOnBundleWithoutSelections() foreach ($selections as $link) { /** @var \Magento\Bundle\Model\Selection $link */ - $linkManager->removeChild($bundleProductSku, $link->getOptionId(), $link->getSku()); + $linkManager->removeChild('bundle-product', $link->getOptionId(), $link->getSku()); } + $bundleProduct = $this->productRepository->get('bundle-product', false, null, true); $this->assertFalse( $bundleProduct->isSalable(), 'Bundle product supposed to be non saleable if it has no selections' @@ -293,6 +292,80 @@ public function testIsSaleableOnBundleWithSelectionCanChangeQty() ); } + /** + * check bundle product is not saleable if + * all his options are not required and selections are not saleable + * + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithoutRequiredOptions() + { + // making selections as not saleable + $productsSku = ['simple1', 'simple2', 'simple3', 'simple4', 'simple5']; + foreach ($productsSku as $productSku) { + $product = $this->productRepository->get($productSku); + $product->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED); + $this->productRepository->save($product); + } + + $bundleProduct = $this->productRepository->get('bundle-product'); + + // setting all options as not required + $options = $bundleProduct->getExtensionAttributes()->getBundleProductOptions(); + foreach ($options as $productOption) { + $productOption->setRequired(false); + } + + $extension = $bundleProduct->getExtensionAttributes(); + $extension->setBundleProductOptions($options); + $bundleProduct->setExtensionAttributes($extension); + $bundleProduct = $this->productRepository->save($bundleProduct); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be not saleable if all his options are not required and selections are not saleable' + ); + } + + /** + * check bundle product is saleable if + * it has at least one not required option with saleable selections + * + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithOneSaleableSelection() + { + // making selections as not saleable except simple1 + $productsSku = ['simple2', 'simple3', 'simple4', 'simple5']; + + foreach ($productsSku as $productSku) { + $product = $this->productRepository->get($productSku); + $product->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED); + $this->productRepository->save($product); + } + + $bundleProduct = $this->productRepository->get('bundle-product'); + + // setting all options as not required + $options = $bundleProduct->getExtensionAttributes()->getBundleProductOptions(); + foreach ($options as $productOption) { + $productOption->setRequired(false); + } + + $extension = $bundleProduct->getExtensionAttributes(); + $extension->setBundleProductOptions($options); + $bundleProduct->setExtensionAttributes($extension); + + $bundleProduct = $this->productRepository->save($bundleProduct); + + $this->assertTrue( + $bundleProduct->isSalable(), + 'Bundle product supposed to be saleable if it has at least one not required option with saleable selection' + ); + } + private function setQtyForSelections($productsSku, $qty) { foreach ($productsSku as $productSku) { From b4a4e110be6a1dce5bd2dc136b8254b7903d45e3 Mon Sep 17 00:00:00 2001 From: Vitaliy Goncharenko Date: Fri, 28 Oct 2016 13:45:12 +0300 Subject: [PATCH 1503/3232] MAGETWO-53583: "Use Default" checkbox is checked again after saving empty fields (description, name, etc) - fixed integration save category test --- .../Magento/Catalog/Controller/Adminhtml/CategoryTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php index f84c661126b04..5db10afdee002 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php @@ -233,7 +233,7 @@ public function saveActionDataProvider() 'display_mode' => true, 'meta_title' => true, 'custom_design' => true, - 'page_layout' => false, + 'page_layout' => true, 'is_active' => true, 'include_in_menu' => true, 'landing_page' => true, @@ -242,7 +242,7 @@ public function saveActionDataProvider() 'description' => true, 'meta_keywords' => true, 'meta_description' => true, - 'custom_layout_update' => false, + 'custom_layout_update' => true, 'custom_design_from' => true, 'custom_design_to' => true, 'filter_price_range' => false From 597253f0e34d9c8d715cc39e177dce6242f50593 Mon Sep 17 00:00:00 2001 From: Sergey Semenov Date: Fri, 28 Oct 2016 14:16:00 +0300 Subject: [PATCH 1504/3232] MAGETWO-59924: File attribute doesn't have placeholder in admin --- .../Catalog/Model/Category/DataProvider.php | 34 +- .../Catalog/Model/Category/FileInfo.php | 107 ++++++ .../Unit/Model/Category/DataProviderTest.php | 320 ++++++++++++++++++ .../Test/Unit/Model/Category/FileInfoTest.php | 114 +++++++ .../adminhtml/web/template/image-preview.html | 1 + .../Customer/Model/Customer/DataProvider.php | 11 +- .../Magento/Customer/Model/FileProcessor.php | 54 ++- .../Unit/Model/Customer/DataProviderTest.php | 6 + .../Test/Unit/Model/FileProcessorTest.php | 32 ++ .../Theme/Model/Design/Backend/File.php | 40 ++- .../Config/FileUploader/FileProcessor.php | 5 +- .../Unit/Model/Design/Backend/FileTest.php | 32 ++ .../Config/FileUploader/FileProcessorTest.php | 9 +- lib/internal/Magento/Framework/File/Mime.php | 2 +- .../Framework/File/Test/Unit/MimeTest.php | 1 + .../File/Test/Unit/_files/UPPERCASE.WEIRD | 0 16 files changed, 736 insertions(+), 32 deletions(-) create mode 100644 app/code/Magento/Catalog/Model/Category/FileInfo.php create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php create mode 100644 lib/internal/Magento/Framework/File/Test/Unit/_files/UPPERCASE.WEIRD diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index aefd31e21ad62..b9b69a1a7aa6a 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -11,6 +11,8 @@ use Magento\Eav\Model\Config; use Magento\Eav\Model\Entity\Type; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Filesystem; use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; use Magento\Ui\Component\Form\Field; @@ -112,6 +114,11 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider */ private $categoryFactory; + /** + * @var Filesystem + */ + private $fileInfo; + /** * DataProvider constructor * @@ -386,8 +393,16 @@ private function convertValues($category, $categoryData) if ($attribute->getBackend() instanceof ImageBackendModel) { unset($categoryData[$attributeCode]); - $categoryData[$attributeCode][0]['name'] = $category->getData($attributeCode); - $categoryData[$attributeCode][0]['url'] = $category->getImageUrl($attributeCode); + $fileName = $category->getData($attributeCode); + if ($this->getFileInfo()->isExist($fileName)) { + $stat = $this->getFileInfo()->getStat($fileName); + $mime = $this->getFileInfo()->getMimeType($fileName); + + $categoryData[$attributeCode][0]['name'] = $fileName; + $categoryData[$attributeCode][0]['url'] = $category->getImageUrl($attributeCode); + $categoryData['image'][0]['size'] = isset($stat) ? $stat['size'] : 0; + $categoryData['image'][0]['type'] = $mime; + } } } @@ -484,4 +499,19 @@ protected function getFieldsMap() ], ]; } + + /** + * Get FileInfo instance + * + * @return FileInfo + * + * @deprecated + */ + private function getFileInfo() + { + if ($this->fileInfo === null) { + $this->fileInfo = ObjectManager::getInstance()->get(FileInfo::class); + } + return $this->fileInfo; + } } diff --git a/app/code/Magento/Catalog/Model/Category/FileInfo.php b/app/code/Magento/Catalog/Model/Category/FileInfo.php new file mode 100644 index 0000000000000..3e4d852e579af --- /dev/null +++ b/app/code/Magento/Catalog/Model/Category/FileInfo.php @@ -0,0 +1,107 @@ +filesystem = $filesystem; + $this->mime = $mime; + } + + /** + * Get WriteInterface instance + * + * @return WriteInterface + */ + private function getMediaDirectory() + { + if ($this->mediaDirectory === null) { + $this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA); + } + return $this->mediaDirectory; + } + + /** + * Retrieve MIME type of requested file + * + * @param string $fileName + * @return string + */ + public function getMimeType($fileName) + { + $filePath = self::ENTITY_MEDIA_PATH . '/' . ltrim($fileName, '/'); + $absoluteFilePath = $this->getMediaDirectory()->getAbsolutePath($filePath); + + $result = $this->mime->getMimeType($absoluteFilePath); + return $result; + } + + /** + * Get file statistics data + * + * @param string $fileName + * @return array + */ + public function getStat($fileName) + { + $filePath = self::ENTITY_MEDIA_PATH . '/' . ltrim($fileName, '/'); + + $result = $this->getMediaDirectory()->stat($filePath); + return $result; + } + + /** + * Check if the file exists + * + * @param string $fileName + * @return bool + */ + public function isExist($fileName) + { + $filePath = self::ENTITY_MEDIA_PATH . '/' . ltrim($fileName, '/'); + + $result = $this->getMediaDirectory()->isExist($filePath); + return $result; + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php new file mode 100644 index 0000000000000..a5f2a5717512e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php @@ -0,0 +1,320 @@ +eavValidationRules = $this->getMockBuilder(EavValidationRules::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->collection = $this->getMockBuilder(Collection::class) + ->disableOriginalConstructor() + ->getMock(); + $this->collection->expects($this->any()) + ->method('addAttributeToSelect') + ->with('*') + ->willReturnSelf(); + + $this->categoryCollectionFactory = $this->getMockBuilder(CollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->categoryCollectionFactory->expects($this->any()) + ->method('create') + ->willReturn($this->collection); + + $this->storeManager = $this->getMockBuilder(StoreManagerInterface::class) + ->getMockForAbstractClass(); + + $this->registry = $this->getMockBuilder(Registry::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->eavEntityMock = $this->getMockBuilder(Type::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->eavConfig = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->request = $this->getMockBuilder(RequestInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->categoryFactory = $this->getMockBuilder(CategoryFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->fileInfo = $this->getMockBuilder(FileInfo::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** + * @return DataProvider + */ + private function getModel() + { + $this->eavEntityMock->expects($this->once()) + ->method('getAttributeCollection') + ->willReturn([]); + + $this->eavConfig->expects($this->once()) + ->method('getEntityType') + ->with('catalog_category') + ->willReturn($this->eavEntityMock); + + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $model = $objectManager->getObject( + DataProvider::class, + [ + 'eavValidationRules' => $this->eavValidationRules, + 'categoryCollectionFactory' => $this->categoryCollectionFactory, + 'storeManager' => $this->storeManager, + 'registry' => $this->registry, + 'eavConfig' => $this->eavConfig, + 'request' => $this->request, + 'categoryFactory' => $this->categoryFactory, + ] + ); + + $objectManager->setBackwardCompatibleProperty( + $model, + 'fileInfo', + $this->fileInfo + ); + + return $model; + } + + public function testGetDataNoCategory() + { + $this->registry->expects($this->once()) + ->method('registry') + ->with('category') + ->willReturn(null); + + $model = $this->getModel(); + $this->assertNull($model->getData()); + } + + public function testGetDataNoFileExists() + { + $fileName = 'filename.ext1'; + $categoryId = 1; + + $categoryData = [ + 'image' => $fileName, + ]; + + $imageBackendMock = $this->getMockBuilder(\Magento\Catalog\Model\Category\Attribute\Backend\Image::class) + ->disableOriginalConstructor() + ->getMock(); + + $attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) + ->disableOriginalConstructor() + ->getMock(); + $attributeMock->expects($this->once()) + ->method('getBackend') + ->willReturn($imageBackendMock); + + $categoryMock = $this->getMockBuilder(\Magento\Catalog\Model\Category::class) + ->disableOriginalConstructor() + ->getMock(); + $categoryMock->expects($this->exactly(2)) + ->method('getData') + ->willReturnMap([ + ['', null, $categoryData], + ['image', null, $categoryData['image']], + ]); + $categoryMock->expects($this->once()) + ->method('getExistsStoreValueFlag') + ->with('url_key') + ->willReturn(false); + $categoryMock->expects($this->once()) + ->method('getStoreId') + ->willReturn(\Magento\Store\Model\Store::DEFAULT_STORE_ID); + $categoryMock->expects($this->once()) + ->method('getId') + ->willReturn($categoryId); + $categoryMock->expects($this->once()) + ->method('getAttributes') + ->willReturn(['image' => $attributeMock]); + + $this->registry->expects($this->once()) + ->method('registry') + ->with('category') + ->willReturn($categoryMock); + + $this->fileInfo->expects($this->once()) + ->method('isExist') + ->with($fileName) + ->willReturn(false); + + $model = $this->getModel(); + $result = $model->getData(); + + $this->assertTrue(is_array($result)); + $this->assertArrayHasKey($categoryId, $result); + $this->assertArrayNotHasKey('image', $result[$categoryId]); + } + + public function testGetData() + { + $fileName = 'filename.png'; + $mime = 'image/png'; + $size = 1; + + $categoryId = 1; + $categoryUrl = 'category_url'; + + $categoryData = [ + 'image' => $fileName, + ]; + + $expects = [ + [ + 'name' => $fileName, + 'url' => $categoryUrl, + 'size' => $size, + 'type' => $mime, + ], + ]; + + $imageBackendMock = $this->getMockBuilder(\Magento\Catalog\Model\Category\Attribute\Backend\Image::class) + ->disableOriginalConstructor() + ->getMock(); + + $attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) + ->disableOriginalConstructor() + ->getMock(); + $attributeMock->expects($this->once()) + ->method('getBackend') + ->willReturn($imageBackendMock); + + $categoryMock = $this->getMockBuilder(\Magento\Catalog\Model\Category::class) + ->disableOriginalConstructor() + ->getMock(); + $categoryMock->expects($this->exactly(2)) + ->method('getData') + ->willReturnMap([ + ['', null, $categoryData], + ['image', null, $categoryData['image']], + ]); + $categoryMock->expects($this->once()) + ->method('getExistsStoreValueFlag') + ->with('url_key') + ->willReturn(false); + $categoryMock->expects($this->once()) + ->method('getStoreId') + ->willReturn(\Magento\Store\Model\Store::DEFAULT_STORE_ID); + $categoryMock->expects($this->once()) + ->method('getId') + ->willReturn($categoryId); + $categoryMock->expects($this->once()) + ->method('getAttributes') + ->willReturn(['image' => $attributeMock]); + $categoryMock->expects($this->once()) + ->method('getImageUrl') + ->willReturn($categoryUrl); + + $this->registry->expects($this->once()) + ->method('registry') + ->with('category') + ->willReturn($categoryMock); + + $this->fileInfo->expects($this->once()) + ->method('isExist') + ->with($fileName) + ->willReturn(true); + $this->fileInfo->expects($this->once()) + ->method('getStat') + ->with($fileName) + ->willReturn(['size' => $size]); + $this->fileInfo->expects($this->once()) + ->method('getMimeType') + ->with($fileName) + ->willReturn($mime); + + $model = $this->getModel(); + $result = $model->getData(); + + $this->assertTrue(is_array($result)); + $this->assertArrayHasKey($categoryId, $result); + $this->assertArrayHasKey('image', $result[$categoryId]); + + $this->assertEquals($expects, $result[$categoryId]['image']); + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php new file mode 100644 index 0000000000000..abc07425a079a --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/FileInfoTest.php @@ -0,0 +1,114 @@ +mediaDirectory = $this->getMockBuilder(WriteInterface::class) + ->getMockForAbstractClass(); + + $this->filesystem = $this->getMockBuilder(Filesystem::class) + ->disableOriginalConstructor() + ->getMock(); + $this->filesystem->expects($this->any()) + ->method('getDirectoryWrite') + ->with(DirectoryList::MEDIA) + ->willReturn($this->mediaDirectory); + + $this->mime = $this->getMockBuilder(Mime::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->model = new FileInfo( + $this->filesystem, + $this->mime + ); + } + + public function testGetMimeType() + { + $mediaPath = '/catalog/category'; + + $fileName = '/filename.ext1'; + $absoluteFilePath = '/absolute_path/catalog/category/filename.ext1'; + + $expected = 'ext1'; + + $this->mediaDirectory->expects($this->once()) + ->method('getAbsolutePath') + ->with($mediaPath. '/' . ltrim($fileName, '/')) + ->willReturn($absoluteFilePath); + + $this->mime->expects($this->once()) + ->method('getMimeType') + ->with($absoluteFilePath) + ->willReturn($expected); + + $this->assertEquals($expected, $this->model->getMimeType($fileName)); + } + + public function testGetStat() + { + $mediaPath = '/catalog/category'; + + $fileName = '/filename.ext1'; + + $expected = ['size' => 1]; + + $this->mediaDirectory->expects($this->once()) + ->method('stat') + ->with($mediaPath . $fileName) + ->willReturn($expected); + + $result = $this->model->getStat($fileName); + + $this->assertTrue(is_array($result)); + $this->assertArrayHasKey('size', $result); + $this->assertEquals(1, $result['size']); + } + + public function testIsExist() + { + $mediaPath = '/catalog/category'; + + $fileName = '/filename.ext1'; + + $this->mediaDirectory->expects($this->once()) + ->method('isExist') + ->with($mediaPath . $fileName) + ->willReturn(true); + + $this->assertTrue($this->model->isExist($fileName)); + } +} diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html b/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html index fa8a4fec7cc78..3bc6e0a359c5e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html @@ -31,5 +31,6 @@
x +
diff --git a/app/code/Magento/Customer/Model/Customer/DataProvider.php b/app/code/Magento/Customer/Model/Customer/DataProvider.php index 2f46459a794ec..b01b8b7d833e2 100644 --- a/app/code/Magento/Customer/Model/Customer/DataProvider.php +++ b/app/code/Magento/Customer/Model/Customer/DataProvider.php @@ -271,23 +271,18 @@ private function getFileUploaderData( ) { $stat = $fileProcessor->getStat($file); $viewUrl = $fileProcessor->getViewUrl($file, $attribute->getFrontendInput()); - } - - $fileName = $file; - if (strrpos($fileName, '/') !== false) { - $fileName = substr($fileName, strrpos($fileName, '/') + 1); - } - if (!empty($file)) { return [ [ 'file' => $file, 'size' => isset($stat) ? $stat['size'] : 0, 'url' => isset($viewUrl) ? $viewUrl : '', - 'name' => $fileName, + 'name' => basename($file), + 'type' => $fileProcessor->getMimeType($file), ], ]; } + return []; } diff --git a/app/code/Magento/Customer/Model/FileProcessor.php b/app/code/Magento/Customer/Model/FileProcessor.php index c98a85cc18463..5c208bb1a5dab 100644 --- a/app/code/Magento/Customer/Model/FileProcessor.php +++ b/app/code/Magento/Customer/Model/FileProcessor.php @@ -5,15 +5,10 @@ */ namespace Magento\Customer\Model; -use Magento\Customer\Api\AddressMetadataInterface; -use Magento\Customer\Api\CustomerMetadataInterface; -use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\Directory\WriteInterface; use Magento\Framework\Url\EncoderInterface; use Magento\Framework\UrlInterface; -use Magento\MediaStorage\Model\File\Uploader; use Magento\MediaStorage\Model\File\UploaderFactory; class FileProcessor @@ -53,12 +48,18 @@ class FileProcessor */ private $allowedExtensions = []; + /** + * @var \Magento\Framework\File\Mime + */ + private $mime; + /** * @param Filesystem $filesystem * @param UploaderFactory $uploaderFactory * @param UrlInterface $urlBuilder * @param EncoderInterface $urlEncoder * @param string $entityTypeCode + * @param \Magento\Framework\File\Mime $mime * @param array $allowedExtensions */ public function __construct( @@ -67,13 +68,15 @@ public function __construct( UrlInterface $urlBuilder, EncoderInterface $urlEncoder, $entityTypeCode, + \Magento\Framework\File\Mime $mime, array $allowedExtensions = [] ) { - $this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); + $this->mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA); $this->uploaderFactory = $uploaderFactory; $this->urlBuilder = $urlBuilder; $this->urlEncoder = $urlEncoder; $this->entityTypeCode = $entityTypeCode; + $this->mime = $mime; $this->allowedExtensions = $allowedExtensions; } @@ -107,6 +110,21 @@ public function getStat($fileName) return $result; } + /** + * Retrieve MIME type of requested file + * + * @param string $fileName + * @return string + */ + public function getMimeType($fileName) + { + $filePath = $this->entityTypeCode . '/' . ltrim($fileName, '/'); + $absoluteFilePath = $this->mediaDirectory->getAbsolutePath($filePath); + + $result = $this->mime->getMimeType($absoluteFilePath); + return $result; + } + /** * Check if the file exists * @@ -132,13 +150,13 @@ public function getViewUrl($filePath, $type) { $viewUrl = ''; - if ($this->entityTypeCode == AddressMetadataInterface::ENTITY_TYPE_ADDRESS) { + if ($this->entityTypeCode == \Magento\Customer\Api\AddressMetadataInterface::ENTITY_TYPE_ADDRESS) { $filePath = $this->entityTypeCode . '/' . ltrim($filePath, '/'); $viewUrl = $this->urlBuilder->getBaseUrl(['_type' => UrlInterface::URL_TYPE_MEDIA]) . $this->mediaDirectory->getRelativePath($filePath); } - if ($this->entityTypeCode == CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER) { + if ($this->entityTypeCode == \Magento\Customer\Api\CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER) { $viewUrl = $this->urlBuilder->getUrl( 'customer/index/viewfile', [$type => $this->urlEncoder->encode(ltrim($filePath, '/'))] @@ -153,11 +171,11 @@ public function getViewUrl($filePath, $type) * * @param string $fileId * @return \string[] - * @throws LocalizedException + * @throws \Magento\Framework\Exception\LocalizedException */ public function saveTemporaryFile($fileId) { - /** @var Uploader $uploader */ + /** @var \Magento\MediaStorage\Model\File\Uploader $uploader */ $uploader = $this->uploaderFactory->create(['fileId' => $fileId]); $uploader->setFilesDispersion(false); $uploader->setFilenamesCaseSensitivity(false); @@ -170,7 +188,9 @@ public function saveTemporaryFile($fileId) $result = $uploader->save($path); if (!$result) { - throw new LocalizedException(__('File can not be saved to the destination folder.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('File can not be saved to the destination folder.') + ); } return $result; @@ -181,28 +201,28 @@ public function saveTemporaryFile($fileId) * * @param string $fileName * @return string - * @throws LocalizedException + * @throws \Magento\Framework\Exception\LocalizedException */ public function moveTemporaryFile($fileName) { $fileName = ltrim($fileName, '/'); - $dispersionPath = Uploader::getDispretionPath($fileName); + $dispersionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName); $destinationPath = $this->entityTypeCode . $dispersionPath; if (!$this->mediaDirectory->create($destinationPath)) { - throw new LocalizedException( + throw new \Magento\Framework\Exception\LocalizedException( __('Unable to create directory %1.', $destinationPath) ); } if (!$this->mediaDirectory->isWritable($destinationPath)) { - throw new LocalizedException( + throw new \Magento\Framework\Exception\LocalizedException( __('Destination folder is not writable or does not exists.') ); } - $destinationFileName = Uploader::getNewFileName( + $destinationFileName = \Magento\MediaStorage\Model\File\Uploader::getNewFileName( $this->mediaDirectory->getAbsolutePath($destinationPath) . '/' . $fileName ); @@ -212,7 +232,7 @@ public function moveTemporaryFile($fileName) $destinationPath . '/' . $destinationFileName ); } catch (\Exception $e) { - throw new LocalizedException( + throw new \Magento\Framework\Exception\LocalizedException( __('Something went wrong while saving the file.') ); } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php index e594432b5bd66..1077736bd4465 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php @@ -688,6 +688,7 @@ public function testGetDataWithCustomAttributeImage() $filename = '/filename.ext1'; $viewUrl = 'viewUrl'; + $mime = 'image/png'; $expectedData = [ $customerId => [ @@ -699,6 +700,7 @@ public function testGetDataWithCustomAttributeImage() 'size' => 1, 'url' => $viewUrl, 'name' => 'filename.ext1', + 'type' => $mime, ], ], ], @@ -778,6 +780,10 @@ public function testGetDataWithCustomAttributeImage() ->method('getViewUrl') ->with('/filename.ext1', 'image') ->willReturn($viewUrl); + $this->fileProcessor->expects($this->once()) + ->method('getMimeType') + ->with($filename) + ->willReturn($mime); $objectManager = new ObjectManager($this); $dataProvider = $objectManager->getObject( diff --git a/app/code/Magento/Customer/Test/Unit/Model/FileProcessorTest.php b/app/code/Magento/Customer/Test/Unit/Model/FileProcessorTest.php index 69064dbc1a420..8a0cacf02baa2 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/FileProcessorTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/FileProcessorTest.php @@ -37,6 +37,11 @@ class FileProcessorTest extends \PHPUnit_Framework_TestCase */ private $mediaDirectory; + /** + * @var \Magento\Framework\File\Mime|\PHPUnit_Framework_MockObject_MockObject + */ + private $mime; + protected function setUp() { $this->mediaDirectory = $this->getMockBuilder(\Magento\Framework\Filesystem\Directory\WriteInterface::class) @@ -60,6 +65,10 @@ protected function setUp() $this->urlEncoder = $this->getMockBuilder(\Magento\Framework\Url\EncoderInterface::class) ->getMockForAbstractClass(); + + $this->mime = $this->getMockBuilder(\Magento\Framework\File\Mime::class) + ->disableOriginalConstructor() + ->getMock(); } private function getModel($entityTypeCode, array $allowedExtensions = []) @@ -70,6 +79,7 @@ private function getModel($entityTypeCode, array $allowedExtensions = []) $this->urlBuilder, $this->urlEncoder, $entityTypeCode, + $this->mime, $allowedExtensions ); return $model; @@ -376,4 +386,26 @@ public function testMoveTemporaryFileWithException() $model = $this->getModel(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER); $model->moveTemporaryFile($filePath); } + + public function testGetMimeType() + { + $fileName = '/filename.ext1'; + $absoluteFilePath = '/absolute_path/customer/filename.ext1'; + + $expected = 'ext1'; + + $this->mediaDirectory->expects($this->once()) + ->method('getAbsolutePath') + ->with(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER . '/' . ltrim($fileName, '/')) + ->willReturn($absoluteFilePath); + + $this->mime->expects($this->once()) + ->method('getMimeType') + ->with($absoluteFilePath) + ->willReturn($expected); + + $model = $this->getModel(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER); + + $this->assertEquals($expected, $model->getMimeType($fileName)); + } } diff --git a/app/code/Magento/Theme/Model/Design/Backend/File.php b/app/code/Magento/Theme/Model/Design/Backend/File.php index e788c6892f4c8..0d93352f041ac 100644 --- a/app/code/Magento/Theme/Model/Design/Backend/File.php +++ b/app/code/Magento/Theme/Model/Design/Backend/File.php @@ -9,8 +9,10 @@ use Magento\Config\Model\Config\Backend\File as BackendFile; use Magento\Framework\App\Cache\TypeListInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Data\Collection\AbstractDb; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\File\Mime; use Magento\Framework\Filesystem; use Magento\Framework\Model\Context; use Magento\Framework\Model\ResourceModel\AbstractResource; @@ -29,6 +31,11 @@ class File extends BackendFile */ protected $urlBuilder; + /** + * @var Mime + */ + private $mime; + /** * @param Context $context * @param Registry $registry @@ -125,7 +132,9 @@ public function afterLoad() 'url' => $url, 'file' => $value, 'size' => is_array($stat) ? $stat['size'] : 0, - 'exists' => true + 'name' => basename($value), + 'type' => $this->getMimeType($fileName), + 'exists' => true, ] ]; } @@ -192,4 +201,33 @@ protected function getTmpMediaPath($filename) { return 'tmp/' . FileProcessor::FILE_DIR . '/' . $filename; } + + /** + * Retrieve MIME type of requested file + * + * @param string $fileName + * @return string + */ + private function getMimeType($fileName) + { + $absoluteFilePath = $this->_mediaDirectory->getAbsolutePath($fileName); + + $result = $this->getMime()->getMimeType($absoluteFilePath); + return $result; + } + + /** + * Get Mime instance + * + * @return Mime + * + * @deprecated + */ + private function getMime() + { + if ($this->mime === null) { + $this->mime = ObjectManager::getInstance()->get(Mime::class); + } + return $this->mime; + } } diff --git a/app/code/Magento/Theme/Model/Design/Config/FileUploader/FileProcessor.php b/app/code/Magento/Theme/Model/Design/Config/FileUploader/FileProcessor.php index 5a132b0250079..786a1820aa5b3 100644 --- a/app/code/Magento/Theme/Model/Design/Config/FileUploader/FileProcessor.php +++ b/app/code/Magento/Theme/Model/Design/Config/FileUploader/FileProcessor.php @@ -135,7 +135,6 @@ protected function getAbsoluteTmpMediaPath() */ protected function save($fileId, $destination) { - $result = ['file' => '', 'size' => '']; /** @var File $backendModel */ $backendModel = $this->getBackendModel($fileId); $uploader = $this->uploaderFactory->create(['fileId' => $fileId]); @@ -143,7 +142,9 @@ protected function save($fileId, $destination) $uploader->setFilesDispersion(false); $uploader->setAllowedExtensions($backendModel->getAllowedExtensions()); $uploader->addValidateCallback('size', $backendModel, 'validateMaxSize'); - return array_intersect_key($uploader->save($destination), $result); + + $result = $uploader->save($destination); + return $result; } /** diff --git a/app/code/Magento/Theme/Test/Unit/Model/Design/Backend/FileTest.php b/app/code/Magento/Theme/Test/Unit/Model/Design/Backend/FileTest.php index 7dd8b636210fc..7038edebac020 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Design/Backend/FileTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Design/Backend/FileTest.php @@ -23,6 +23,11 @@ class FileTest extends \PHPUnit_Framework_TestCase /** @var File */ protected $fileBackend; + /** + * @var \Magento\Framework\File\Mime|\PHPUnit_Framework_MockObject_MockObject + */ + private $mime; + public function setUp() { $context = $this->getMockObject(\Magento\Framework\Model\Context::class); @@ -46,6 +51,10 @@ public function setUp() $this->urlBuilder = $this->getMockBuilder(\Magento\Framework\UrlInterface::class) ->getMockForAbstractClass(); + $this->mime = $this->getMockBuilder(\Magento\Framework\File\Mime::class) + ->disableOriginalConstructor() + ->getMock(); + $this->fileBackend = new File( $context, $registry, @@ -56,6 +65,13 @@ public function setUp() $filesystem, $this->urlBuilder ); + + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $objectManager->setBackwardCompatibleProperty( + $this->fileBackend, + 'mime', + $this->mime + ); } public function tearDown() @@ -91,6 +107,10 @@ protected function getMockObjectForAbstractClass($class) public function testAfterLoad() { $value = 'filename.jpg'; + $mime = 'image/jpg'; + + $absoluteFilePath = '/absolute_path/' . $value; + $this->fileBackend->setValue($value); $this->fileBackend->setFieldConfig( [ @@ -109,6 +129,11 @@ public function testAfterLoad() ->method('isExist') ->with('value/' . $value) ->willReturn(true); + $this->mediaDirectory->expects($this->once()) + ->method('getAbsolutePath') + ->with('value/' . $value) + ->willReturn($absoluteFilePath); + $this->urlBuilder->expects($this->once()) ->method('getBaseUrl') ->with(['_type' => UrlInterface::URL_TYPE_MEDIA]) @@ -122,6 +147,11 @@ public function testAfterLoad() ->with('value/' . $value) ->willReturn(['size' => 234234]); + $this->mime->expects($this->once()) + ->method('getMimeType') + ->with($absoluteFilePath) + ->willReturn($mime); + $this->fileBackend->afterLoad(); $this->assertEquals( [ @@ -130,6 +160,8 @@ public function testAfterLoad() 'file' => $value, 'size' => 234234, 'exists' => true, + 'name' => $value, + 'type' => $mime, ] ], $this->fileBackend->getValue() diff --git a/app/code/Magento/Theme/Test/Unit/Model/Design/Config/FileUploader/FileProcessorTest.php b/app/code/Magento/Theme/Test/Unit/Model/Design/Config/FileUploader/FileProcessorTest.php index 1cd1072ce69f1..61e510ec25cea 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Design/Config/FileUploader/FileProcessorTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Design/Config/FileUploader/FileProcessorTest.php @@ -135,11 +135,18 @@ public function testSaveToTmp() $this->uploader->expects($this->once()) ->method('save') ->with('absolute/path/to/tmp/media') - ->willReturn(['file' => 'file.jpg', 'size' => '234234']); + ->willReturn([ + 'file' => 'file.jpg', + 'size' => '234234', + 'type' => 'image/jpg', + 'name' => 'file.jpg', + ]); $this->assertEquals( [ 'file' => 'file.jpg', + 'name' => 'file.jpg', 'size' => '234234', + 'type' => 'image/jpg', 'url' => 'http://magento2.com/pub/media/tmp/' . FileProcessor::FILE_DIR . '/file.jpg' ], $this->fileProcessor->saveToTmp($fieldCode) diff --git a/lib/internal/Magento/Framework/File/Mime.php b/lib/internal/Magento/Framework/File/Mime.php index c8fe56eaa9e68..d698f9cced06f 100644 --- a/lib/internal/Magento/Framework/File/Mime.php +++ b/lib/internal/Magento/Framework/File/Mime.php @@ -71,7 +71,7 @@ public function getMimeType($file) throw new \InvalidArgumentException("File '$file' doesn't exist"); } - $extension = pathinfo($file, PATHINFO_EXTENSION); + $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION)); if (isset($this->mimeTypes[$extension])) { $result = $this->mimeTypes[$extension]; } diff --git a/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php b/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php index 7c2a1d71279c4..90b970b7f8d8a 100644 --- a/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php +++ b/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php @@ -47,6 +47,7 @@ public function getMimeTypeDataProvider() return [ 'javascript' => [__DIR__ . '/_files/javascript.js', 'application/javascript'], 'weird extension' => [__DIR__ . '/_files/file.weird', 'application/octet-stream'], + 'weird uppercase extension' => [__DIR__ . '/_files/UPPERCASE.WEIRD', 'application/octet-stream'], ]; } } diff --git a/lib/internal/Magento/Framework/File/Test/Unit/_files/UPPERCASE.WEIRD b/lib/internal/Magento/Framework/File/Test/Unit/_files/UPPERCASE.WEIRD new file mode 100644 index 0000000000000..e69de29bb2d1d From c010dc6499ef1287a1a7c057f1ec2f2b278069e1 Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Fri, 28 Oct 2016 14:41:30 +0300 Subject: [PATCH 1505/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - fixes for checking that bundle is saleable --- .../Magento/Bundle/Model/Product/Type.php | 42 +++++++++---------- .../Bundle/Model/Product/IsSaleableTest.php | 4 +- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index d62613c221528..31789442ce63b 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -554,33 +554,31 @@ public function isSalable($product) return $product->getData('all_items_salable'); } - if (!$this->getOptionsCollection($product)->getSize()) { - return false; - } - - $isSalable = true; + $isSalable = false; foreach ($this->getOptionsCollection($product)->getItems() as $option) { - if ($option->getRequired()) { - $hasSalable = false; - - $selectionsCollection = $this->_bundleCollection->create(); - $selectionsCollection->addAttributeToSelect('status'); - $selectionsCollection->addQuantityFilter(); - $selectionsCollection->addFilterByRequiredOptions(); - $selectionsCollection->setOptionIdsFilter([$option->getId()]); - - foreach ($selectionsCollection as $selection) { - if ($selection->isSalable()) { - $hasSalable = true; - break; - } - } + $hasSalable = false; + + $selectionsCollection = $this->_bundleCollection->create(); + $selectionsCollection->addAttributeToSelect('status'); + $selectionsCollection->addQuantityFilter(); + $selectionsCollection->addFilterByRequiredOptions(); + $selectionsCollection->setOptionIdsFilter([$option->getId()]); - if (!$hasSalable) { - $isSalable = false; + foreach ($selectionsCollection as $selection) { + if ($selection->isSalable()) { + $hasSalable = true; break; } } + + if ($hasSalable) { + $isSalable = true; + } + + if (!$hasSalable && $option->getRequired()) { + $isSalable = false; + break; + } } $product->setData('all_items_salable', $isSalable); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php index b1fe33e843b65..fb04b268bfdfe 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php @@ -337,8 +337,8 @@ public function testIsSaleableOnBundleWithoutRequiredOptions() */ public function testIsSaleableOnBundleWithOneSaleableSelection() { - // making selections as not saleable except simple1 - $productsSku = ['simple2', 'simple3', 'simple4', 'simple5']; + // making selections as not saleable except simple3 + $productsSku = ['simple1', 'simple2', 'simple4', 'simple5']; foreach ($productsSku as $productSku) { $product = $this->productRepository->get($productSku); From 6b22fda3f6769dd18f482cfd255040b961c2a482 Mon Sep 17 00:00:00 2001 From: Sergey Semenov Date: Fri, 28 Oct 2016 14:58:37 +0300 Subject: [PATCH 1506/3232] MAGETWO-59924: File attribute doesn't have placeholder in admin --- .../Magento/Customer/Model/FileProcessor.php | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Customer/Model/FileProcessor.php b/app/code/Magento/Customer/Model/FileProcessor.php index 5c208bb1a5dab..3e0ae375fcff1 100644 --- a/app/code/Magento/Customer/Model/FileProcessor.php +++ b/app/code/Magento/Customer/Model/FileProcessor.php @@ -5,12 +5,6 @@ */ namespace Magento\Customer\Model; -use Magento\Framework\Filesystem; -use Magento\Framework\Filesystem\Directory\WriteInterface; -use Magento\Framework\Url\EncoderInterface; -use Magento\Framework\UrlInterface; -use Magento\MediaStorage\Model\File\UploaderFactory; - class FileProcessor { /** @@ -19,22 +13,22 @@ class FileProcessor const TMP_DIR = 'tmp'; /** - * @var WriteInterface + * @var \Magento\Framework\Filesystem\Directory\WriteInterface */ private $mediaDirectory; /** - * @var UploaderFactory + * @var \Magento\MediaStorage\Model\File\UploaderFactory */ private $uploaderFactory; /** - * @var UrlInterface + * @var \Magento\Framework\UrlInterface */ private $urlBuilder; /** - * @var EncoderInterface + * @var \Magento\Framework\Url\EncoderInterface */ private $urlEncoder; @@ -54,19 +48,19 @@ class FileProcessor private $mime; /** - * @param Filesystem $filesystem - * @param UploaderFactory $uploaderFactory - * @param UrlInterface $urlBuilder - * @param EncoderInterface $urlEncoder + * @param \Magento\Framework\Filesystem $filesystem + * @param \Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory + * @param \Magento\Framework\UrlInterface $urlBuilder + * @param \Magento\Framework\Url\EncoderInterface $urlEncoder * @param string $entityTypeCode * @param \Magento\Framework\File\Mime $mime * @param array $allowedExtensions */ public function __construct( - Filesystem $filesystem, - UploaderFactory $uploaderFactory, - UrlInterface $urlBuilder, - EncoderInterface $urlEncoder, + \Magento\Framework\Filesystem $filesystem, + \Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory, + \Magento\Framework\UrlInterface $urlBuilder, + \Magento\Framework\Url\EncoderInterface $urlEncoder, $entityTypeCode, \Magento\Framework\File\Mime $mime, array $allowedExtensions = [] @@ -152,7 +146,7 @@ public function getViewUrl($filePath, $type) if ($this->entityTypeCode == \Magento\Customer\Api\AddressMetadataInterface::ENTITY_TYPE_ADDRESS) { $filePath = $this->entityTypeCode . '/' . ltrim($filePath, '/'); - $viewUrl = $this->urlBuilder->getBaseUrl(['_type' => UrlInterface::URL_TYPE_MEDIA]) + $viewUrl = $this->urlBuilder->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]) . $this->mediaDirectory->getRelativePath($filePath); } From 0cbd3255de8d7eff980d9d4ef0db72a03693bdbe Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Fri, 28 Oct 2016 15:50:13 +0300 Subject: [PATCH 1507/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60106: Bundle from-to price calculation is wrong --- .../Bundle/Pricing/Adjustment/Calculator.php | 12 +- .../Bundle/Model/Product/BundlePrice.php | 140 ++++++++++++++ .../DynamicBundlePriceCalculatorTest.php | 106 ++--------- .../FixedBundlePriceCalculatorTest.php | 175 +++--------------- 4 files changed, 181 insertions(+), 252 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePrice.php diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index 2048b3eaaa8ba..3a83a38ba6510 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -180,8 +180,14 @@ public function getAmountWithoutOption($amount, Product $saleableItem) protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useRegularPrice = false) { // Flag shows - is it necessary to find minimal option amount in case if all options are not required - $productHasRequiredOption = $this->hasRequiredOption($bundleProduct); - $canSkipRequiredOptions = $searchMin && $productHasRequiredOption; + $shouldFindMinOption = false; + if ($searchMin + && $bundleProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC + && !$this->hasRequiredOption($bundleProduct) + ) { + $shouldFindMinOption = true; + } + $canSkipRequiredOptions = $searchMin && !$shouldFindMinOption; $priceList = []; foreach ($this->getBundleOptions($bundleProduct) as $option) { @@ -231,7 +237,7 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR } - if ($searchMin && $bundleProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC && !$productHasRequiredOption) { + if ($shouldFindMinOption) { $minPrice = null; $priceSelection = null; foreach ($priceList as $price) { diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePrice.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePrice.php new file mode 100644 index 0000000000000..f226b514c2304 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePrice.php @@ -0,0 +1,140 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + } + + /** + * Get test cases + * @return array + */ + abstract public function getTestCases(); + + /** + * @param array $strategyModifiers + * @return \Magento\Catalog\Api\Data\ProductInterface + */ + protected function prepareFixture($strategyModifiers) + { + $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); + + foreach ($strategyModifiers as $modifier) { + if (method_exists($this, $modifier['modifierName'])) { + array_unshift($modifier['data'], $bundleProduct); + $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); + } + } + + $this->productRepository->save($bundleProduct); + return $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + } + + /** + * Add simple product to bundle + * + * @param \Magento\Catalog\Model\Product $bundleProduct + * @param array $optionsData + * @return \Magento\Catalog\Model\Product + */ + protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) + { + $options = []; + + foreach ($optionsData as $optionData) { + $links = []; + $linksData = $optionData['links']; + unset($optionData['links']); + + $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) + ->create(['data' => $this->getFixtureForProductOption($optionData)]) + ->setSku($bundleProduct->getSku()); + + foreach ($linksData as $linkData) { + $linkData['option_id'] = $option->getId(); + $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) + ->create(['data' => $linkData]); + } + + $option->setProductLinks($links); + $options[] = $option; + } + + $extension = $bundleProduct->getExtensionAttributes(); + $extension->setBundleProductOptions($options); + $bundleProduct->setExtensionAttributes($extension); + + return $bundleProduct; + } + + /** + * @param array $fixture + * @return array + */ + private function getFixtureForProductCustomOption(array $fixture = []) + { + $fixture['title'] = 'Custom Option Title ' . microtime(true); + $fixture['sku'] = 'custom_option_sku_' . microtime(true); + + return $fixture; + } + + /** + * @param \Magento\Catalog\Model\Product $bundleProduct + * @param array $optionsData + * @return \Magento\Catalog\Model\Product + */ + protected function addCustomOption(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) + { + /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ + $customOptionFactory = $this->objectManager + ->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); + + $options = []; + foreach ($optionsData as $optionData) { + $customOption = $customOptionFactory->create( + [ + 'data' => $this->getFixtureForProductCustomOption($optionData) + ] + ); + $customOption->setProductSku($bundleProduct->getSku()); + $customOption->setOptionId(null); + + $options[] = $customOption; + } + + $bundleProduct->setOptions($options); + $bundleProduct->setCanSaveCustomOptions(true); + + return $bundleProduct; + } + + /** + * @param array $fixture + * @return array + */ + private function getFixtureForProductOption(array $fixture = []) + { + $fixture['title'] = 'Option title' . microtime(true); + + return $fixture; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php index 8106e17d4c9b8..fbb785b43a6e0 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php @@ -10,53 +10,17 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php * @magentoAppArea frontend */ -class DynamicBundlePriceCalculatorTest extends \PHPUnit_Framework_TestCase +class DynamicBundlePriceCalculatorTest extends BundlePrice { - /** @var \Magento\TestFramework\Helper\Bootstrap */ - protected $objectManager; - - /** @var \Magento\Catalog\Api\ProductRepositoryInterface */ - protected $productRepository; - - protected $fixtureForProductOption = [ - 'title' => 'Some title', - 'required' => true, - 'type' => 'checkbox' - ]; - - protected $fixtureForProductOptionSelection = [ - 'sku' => null, // need to set this - 'option_id' => null, // need to set this - 'qty' => 1, - 'is_default' => true, - 'can_change_quantity' => 0 - ]; - - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); - } - /** - * @param $strategyModifiers array - * @param $expectedResults array + * @param array $strategyModifiers + * @param array $expectedResults * @dataProvider getTestCases * @magentoAppIsolation enabled */ public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); - - foreach ($strategyModifiers as $modifier) { - if (method_exists($this, $modifier['modifierName'])) { - array_unshift($modifier['data'], $bundleProduct); - $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); - } - } - - $this->productRepository->save($bundleProduct); - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $bundleProduct = $this->prepareFixture($strategyModifiers); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -112,11 +76,12 @@ public function getProductWithOneSimple() { $optionsData = [ [ + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, - 'price' => 10, + 'qty' => 1, ], ] ], @@ -134,20 +99,19 @@ public function getProductWithDifferentQty() { $optionsData = [ [ + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'qty' => 3, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 2, ], [ 'sku' => 'simple3', - 'option_id' => 1, 'qty' => 1, ], ] @@ -166,20 +130,19 @@ public function getProductWithDifferentPrice() { $optionsData = [ [ + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 1, ], [ 'sku' => 'simple3', - 'option_id' => 1, 'qty' => 1, ] ] @@ -193,51 +156,4 @@ public function getProductWithDifferentPrice() ], ]; } - - protected function getFixtureForProductOption(array $data = []) - { - $fixture = $this->fixtureForProductOption; - - // make title different for each call - $fixture['title'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductOptionSelection($data) - { - $fixture = $this->fixtureForProductOptionSelection; - - return array_merge($fixture, $data); - } - - protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - $options = []; - - foreach ($optionsData as $optionData) { - $links = []; - $linksData = $optionData['links']; - unset($optionData['links']); - - $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) - ->setSku($bundleProduct->getSku()) - ->setOptionid(null); - - foreach ($linksData as $linkData) { - $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); - } - - $option->setProductLinks($links); - $options[] = $option; - } - - $extension = $bundleProduct->getExtensionAttributes(); - $extension->setBundleProductOptions($options); - $bundleProduct->setExtensionAttributes($extension); - - return $bundleProduct; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php index 45b9031b3d26e..66ae6a975a72c 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -12,49 +12,8 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php * @magentoAppArea frontend */ -class FixedBundlePriceCalculatorTest extends \PHPUnit_Framework_TestCase +class FixedBundlePriceCalculatorTest extends BundlePrice { - /** @var \Magento\TestFramework\Helper\Bootstrap */ - protected $objectManager; - - /** @var \Magento\Catalog\Api\ProductRepositoryInterface */ - protected $productRepository; - - protected $fixtureForProductOption = [ - 'title' => 'Some title', - 'required' => true, - 'type' => 'checkbox' - ]; - - protected $fixtureForProductOptionSelection = [ - 'sku' => null, // need to set this - 'option_id' => null, // need to set this - 'qty' => 1, - 'is_default' => true, - 'price' => null, // need to set this - 'price_type' => LinkInterface::PRICE_TYPE_FIXED, - 'can_change_quantity' => 0 - ]; - - protected $fixtureForProductCustomOption = [ - 'option_id' => null, - 'previous_group' => 'text', - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 100, - 'price_type' => 'fixed', - 'sku' => '1-text', - 'max_characters' => 100, - ]; - - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); - } - /** * @param $strategyModifiers array * @param $expectedResults array @@ -63,17 +22,7 @@ protected function setUp() */ public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); - - foreach ($strategyModifiers as $modifier) { - if (method_exists($this, $modifier['modifierName'])) { - array_unshift($modifier['data'], $bundleProduct); - $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); - } - } - - $this->productRepository->save($bundleProduct); - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $bundleProduct = $this->prepareFixture($strategyModifiers); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -139,11 +88,14 @@ public function getProductWithOneSimple() { $optionsData = [ [ + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'price' => 10, + 'qty' => 1, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], ] ], @@ -161,24 +113,26 @@ public function getProductWithDifferentQty() { $optionsData = [ [ + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'price' => 10, 'qty' => 3, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 10, 'qty' => 2, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], [ 'sku' => 'simple3', - 'option_id' => 1, 'price' => 10, 'qty' => 1, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], ] ] @@ -196,24 +150,26 @@ public function getProductWithSamePrice() { $optionsData = [ [ + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'price' => 10, 'qty' => 1, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 10, 'qty' => 1, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], [ 'sku' => 'simple3', - 'option_id' => 1, 'price' => 10, 'qty' => 1, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ] ] ] @@ -231,24 +187,26 @@ public function getProductWithDifferentPrice() { $optionsData = [ [ + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'price' => 10, 'qty' => 1, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 20, 'qty' => 1, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], [ 'sku' => 'simple3', - 'option_id' => 1, 'price' => 30, 'qty' => 1, + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ] ] ] @@ -261,95 +219,4 @@ public function getProductWithDifferentPrice() ], ]; } - - protected function getFixtureForProductOption(array $data = []) - { - $fixture = $this->fixtureForProductOption; - - // make title different for each call - $fixture['title'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductOptionSelection($data) - { - $fixture = $this->fixtureForProductOptionSelection; - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductCustomOption(array $data = []) - { - $fixture = $this->fixtureForProductCustomOption; - - // make title and sku different for each call - $fixture['title'] .= ' ' . microtime(true); - $fixture['sku'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) - { - $bundleProduct->setSpecialPrice($discount); - - return $bundleProduct; - } - - protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - $options = []; - - foreach ($optionsData as $optionData) { - $links = []; - $linksData = $optionData['links']; - unset($optionData['links']); - - $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) - ->setSku($bundleProduct->getSku()) - ->setOptionid(null); - - foreach ($linksData as $linkData) { - $linkData['option_id'] = $option->getId(); // ??? looks like needed - $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); - } - - $option->setProductLinks($links); - $options[] = $option; - } - - $extension = $bundleProduct->getExtensionAttributes(); - $extension->setBundleProductOptions($options); - $bundleProduct->setExtensionAttributes($extension); - - return $bundleProduct; - } - - protected function addCustomOption(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ - $customOptionFactory = $this->objectManager - ->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); - - $options = []; - foreach ($optionsData as $optionData) { - $customOption = $customOptionFactory->create( - [ - 'data' => $this->getFixtureForProductCustomOption($optionData) - ] - ); - $customOption->setProductSku($bundleProduct->getSku()); - $customOption->setOptionId(null); - - $options[] = $customOption; - } - - $bundleProduct->setOptions($options); - $bundleProduct->setCanSaveCustomOptions(true); - - return $bundleProduct; - } } From 575b5f0f9bbb6aa6b5b1922a4974d7ea75def3f6 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Fri, 28 Oct 2016 15:50:25 +0300 Subject: [PATCH 1508/3232] MAGETWO-60155: Default Billing Address and Default Shipping Address checkboxes on Customer page are saved incorrectly --- .../Controller/Adminhtml/Index/Save.php | 6 +- .../Controller/Adminhtml/Index/SaveTest.php | 118 +++++------------- 2 files changed, 33 insertions(+), 91 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php index 77bf7af2a4031..fd2ceaf09695b 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php @@ -72,6 +72,7 @@ protected function _extractData( ) { $metadataForm = $this->getMetadataForm($entityType, $formCode, $scope); $formData = $metadataForm->extractData($this->getRequest(), $scope); + $formData = $metadataForm->compactData($formData); // Initialize additional attributes /** @var \Magento\Framework\DataObject $object */ @@ -81,11 +82,6 @@ protected function _extractData( $formData[$attributeCode] = isset($requestData[$attributeCode]) ? $requestData[$attributeCode] : false; } - $result = $metadataForm->compactData($formData); - - // Re-initialize additional attributes - $formData = array_replace($formData, $result); - // Unset unused attributes $formAttributes = $metadataForm->getAttributes(); foreach ($formAttributes as $attribute) { diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php index 8fb48fe9f87e7..11fd1b5a7fc33 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php @@ -304,33 +304,28 @@ public function testExecuteWithExistentCustomer() ], 'subscription' => $subscription, ]; - $filteredData = [ + $extractedData = [ 'entity_id' => $customerId, 'code' => 'value', 'coolness' => false, 'disable_auto_group_change' => 'false', ]; - $dataToCompact = [ + $compactedData = [ 'entity_id' => $customerId, 'code' => 'value', 'coolness' => false, 'disable_auto_group_change' => 'false', - CustomerInterface::DEFAULT_BILLING => false, - CustomerInterface::DEFAULT_SHIPPING => false, - 'confirmation' => false, - 'sendemail_store_id' => false, - 'extension_attributes' => false, + CustomerInterface::DEFAULT_BILLING => 2, + CustomerInterface::DEFAULT_SHIPPING => 2 ]; - $addressFilteredData = [ + $addressExtractedData = [ 'entity_id' => $addressId, - 'default_billing' => 'true', - 'default_shipping' => 'true', 'code' => 'value', 'coolness' => false, 'region' => 'region', 'region_id' => 'region_id', ]; - $addressDataToCompact = [ + $addressCompactedData = [ 'entity_id' => $addressId, 'default_billing' => 'true', 'default_shipping' => 'true', @@ -430,11 +425,11 @@ public function testExecuteWithExistentCustomer() $customerFormMock->expects($this->once()) ->method('extractData') ->with($this->requestMock, 'customer') - ->willReturn($filteredData); + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('compactData') - ->with($dataToCompact) - ->willReturn($filteredData); + ->with($extractedData) + ->willReturn($compactedData); $customerFormMock->expects($this->once()) ->method('getAttributes') ->willReturn($attributes); @@ -445,11 +440,11 @@ public function testExecuteWithExistentCustomer() $customerAddressFormMock->expects($this->once()) ->method('extractData') ->with($this->requestMock, 'address/' . $addressId) - ->willReturn($addressFilteredData); + ->willReturn($addressExtractedData); $customerAddressFormMock->expects($this->once()) ->method('compactData') - ->with($addressDataToCompact) - ->willReturn($addressFilteredData); + ->with($addressExtractedData) + ->willReturn($addressCompactedData); $customerAddressFormMock->expects($this->once()) ->method('getAttributes') ->willReturn($attributes); @@ -625,8 +620,6 @@ public function testExecuteWithNewCustomer() '_template_' => '_template_', $addressId => [ 'entity_id' => $addressId, - 'default_billing' => 'false', - 'default_shipping' => 'false', 'code' => 'value', 'coolness' => false, 'region' => 'region', @@ -635,32 +628,12 @@ public function testExecuteWithNewCustomer() ], 'subscription' => $subscription, ]; - $filteredData = [ + $extractedData = [ 'coolness' => false, 'disable_auto_group_change' => 'false', ]; - $dataToCompact = [ - 'coolness' => false, - 'disable_auto_group_change' => 'false', - CustomerInterface::DEFAULT_BILLING => false, - CustomerInterface::DEFAULT_SHIPPING => false, - 'confirmation' => false, - 'sendemail_store_id' => false, - 'extension_attributes' => false, - ]; - $addressFilteredData = [ + $addressExtractedData = [ 'entity_id' => $addressId, - 'default_billing' => 'false', - 'default_shipping' => 'false', - 'code' => 'value', - 'coolness' => false, - 'region' => 'region', - 'region_id' => 'region_id', - ]; - $addressDataToCompact = [ - 'entity_id' => $addressId, - 'default_billing' => 'false', - 'default_shipping' => 'false', 'code' => 'value', 'coolness' => false, 'region' => 'region', @@ -739,11 +712,11 @@ public function testExecuteWithNewCustomer() $customerFormMock->expects($this->once()) ->method('extractData') ->with($this->requestMock, 'customer') - ->willReturn($filteredData); + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('compactData') - ->with($dataToCompact) - ->willReturn($filteredData); + ->with($extractedData) + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('getAttributes') ->willReturn($attributes); @@ -754,11 +727,11 @@ public function testExecuteWithNewCustomer() $customerAddressFormMock->expects($this->once()) ->method('extractData') ->with($this->requestMock, 'address/' . $addressId) - ->willReturn($addressFilteredData); + ->willReturn($addressExtractedData); $customerAddressFormMock->expects($this->once()) ->method('compactData') - ->with($addressDataToCompact) - ->willReturn($addressFilteredData); + ->with($addressExtractedData) + ->willReturn($addressExtractedData); $customerAddressFormMock->expects($this->once()) ->method('getAttributes') ->willReturn($attributes); @@ -910,19 +883,10 @@ public function testExecuteWithNewCustomerAndValidationException() ], 'subscription' => $subscription, ]; - $filteredData = [ + $extractedData = [ 'coolness' => false, 'disable_auto_group_change' => 'false', ]; - $dataToCompact = [ - 'coolness' => false, - 'disable_auto_group_change' => 'false', - CustomerInterface::DEFAULT_BILLING => false, - CustomerInterface::DEFAULT_SHIPPING => false, - 'confirmation' => false, - 'sendemail_store_id' => false, - 'extension_attributes' => false, - ]; /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */ $attributeMock = $this->getMockBuilder( @@ -971,11 +935,11 @@ public function testExecuteWithNewCustomerAndValidationException() $customerFormMock->expects($this->once()) ->method('extractData') ->with($this->requestMock, 'customer') - ->willReturn($filteredData); + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('compactData') - ->with($dataToCompact) - ->willReturn($filteredData); + ->with($extractedData) + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('getAttributes') ->willReturn($attributes); @@ -1062,19 +1026,10 @@ public function testExecuteWithNewCustomerAndLocalizedException() ], 'subscription' => $subscription, ]; - $filteredData = [ + $extractedData = [ 'coolness' => false, 'disable_auto_group_change' => 'false', ]; - $dataToCompact = [ - 'coolness' => false, - 'disable_auto_group_change' => 'false', - CustomerInterface::DEFAULT_BILLING => false, - CustomerInterface::DEFAULT_SHIPPING => false, - 'confirmation' => false, - 'sendemail_store_id' => false, - 'extension_attributes' => false, - ]; /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */ $attributeMock = $this->getMockBuilder( @@ -1124,11 +1079,11 @@ public function testExecuteWithNewCustomerAndLocalizedException() $customerFormMock->expects($this->once()) ->method('extractData') ->with($this->requestMock, 'customer') - ->willReturn($filteredData); + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('compactData') - ->with($dataToCompact) - ->willReturn($filteredData); + ->with($extractedData) + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('getAttributes') ->willReturn($attributes); @@ -1214,18 +1169,9 @@ public function testExecuteWithNewCustomerAndException() ], 'subscription' => $subscription, ]; - $filteredData = [ - 'coolness' => false, - 'disable_auto_group_change' => 'false', - ]; - $dataToCompact = [ + $extractedData = [ 'coolness' => false, 'disable_auto_group_change' => 'false', - CustomerInterface::DEFAULT_BILLING => false, - CustomerInterface::DEFAULT_SHIPPING => false, - 'confirmation' => false, - 'sendemail_store_id' => false, - 'extension_attributes' => false, ]; /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */ @@ -1275,11 +1221,11 @@ public function testExecuteWithNewCustomerAndException() $customerFormMock->expects($this->once()) ->method('extractData') ->with($this->requestMock, 'customer') - ->willReturn($filteredData); + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('compactData') - ->with($dataToCompact) - ->willReturn($filteredData); + ->with($extractedData) + ->willReturn($extractedData); $customerFormMock->expects($this->once()) ->method('getAttributes') ->willReturn($attributes); From 2ea23d47c38ae01e89fe555512e648b7c7bb7d42 Mon Sep 17 00:00:00 2001 From: Sergey Semenov Date: Fri, 28 Oct 2016 16:00:36 +0300 Subject: [PATCH 1509/3232] MAGETWO-59924: File attribute doesn't have placeholder in admin --- .../Ui/view/base/web/js/form/element/file-uploader.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js index 3b3bc1409de2f..7a8f06bcdd87b 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js @@ -245,13 +245,13 @@ define([ getFilePreviewType: function (file) { var type; - if (!file['type']) { + if (!file.type) { return 'document'; } - type = file['type'].split('/')[0]; + type = file.type.split('/')[0]; - return (type !== 'image' && type !== 'video') ? 'document' : type; + return type !== 'image' && type !== 'video' ? 'document' : type; }, /** From dadf2eb2ea5497382f14986edd97da1d9a726eca Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Fri, 28 Oct 2016 16:38:09 +0300 Subject: [PATCH 1510/3232] MAGETWO-60155: Default Billing Address and Default Shipping Address checkboxes on Customer page are saved incorrectly - Added coupling suppress; --- app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php index fd2ceaf09695b..bffbc5515183c 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php @@ -13,6 +13,9 @@ use Magento\Customer\Model\Metadata\Form; use Magento\Framework\Exception\LocalizedException; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Save extends \Magento\Customer\Controller\Adminhtml\Index { /** From 4719d15ed1a510afb48ee941bb139dba0f805329 Mon Sep 17 00:00:00 2001 From: aakimov Date: Fri, 28 Oct 2016 17:06:34 +0300 Subject: [PATCH 1511/3232] MAGETWO-60110: [Github] Shipping Estimation Address is Merged with Customer Default Address during Checkout #6869 --- .../frontend/web/js/view/cart/shipping-estimation.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-estimation.js b/app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-estimation.js index 08641f015f609..3d4612fbe9ec5 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-estimation.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-estimation.js @@ -50,9 +50,13 @@ define( if (address) { estimatedAddress = address.isEditable() ? addressConverter.quoteAddressToFormAddressData(address) : - addressConverter.quoteAddressToFormAddressData( - addressConverter.addressToEstimationAddress(address) - ); + { + // only the following fields must be used by estimation form data provider + country_id: address.countryId, + region: address.region, + region_id: address.regionId, + postcode: address.postcode + }; checkoutProvider.set( 'shippingAddress', $.extend({}, checkoutProvider.get('shippingAddress'), estimatedAddress) From fe260810330749d036e53aa6d7803ec42688847f Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Fri, 28 Oct 2016 18:25:25 +0300 Subject: [PATCH 1512/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - DynamicBundleTests refactoring --- ...undlePrice.php => BundlePriceAbstract.php} | 42 +-- .../DynamicBundlePriceCalculatorTest.php | 9 +- ...ndleWithCatalogPriceRuleCalculatorTest.php | 190 ++++------ ...icBundleWithSpecialPriceCalculatorTest.php | 204 ++++------- ...namicBundleWithTierPriceCalculatorTest.php | 331 +++++++++--------- 5 files changed, 335 insertions(+), 441 deletions(-) rename dev/tests/integration/testsuite/Magento/Bundle/Model/Product/{BundlePrice.php => BundlePriceAbstract.php} (80%) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePrice.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php similarity index 80% rename from dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePrice.php rename to dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php index f226b514c2304..b71a40cbdb561 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePrice.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php @@ -5,12 +5,17 @@ */ namespace Magento\Bundle\Model\Product; +use Zend\Console\Exception\InvalidArgumentException; /** * Abstract class for testing bundle prices */ -abstract class BundlePrice extends \PHPUnit_Framework_TestCase +abstract class BundlePriceAbstract extends \PHPUnit_Framework_TestCase { + const CUSTOM_OPTION_PRICE_TYPE_FIXED = 'fixed'; + + const CUSTOM_OPTION_PRICE_TYPE_PERCENT = 'percent'; + /** @var \Magento\TestFramework\Helper\Bootstrap */ protected $objectManager; @@ -30,7 +35,8 @@ protected function setUp() abstract public function getTestCases(); /** - * @param array $strategyModifiers + * @param $strategyModifiers + * @throws InvalidArgumentException * @return \Magento\Catalog\Api\Data\ProductInterface */ protected function prepareFixture($strategyModifiers) @@ -41,6 +47,10 @@ protected function prepareFixture($strategyModifiers) if (method_exists($this, $modifier['modifierName'])) { array_unshift($modifier['data'], $bundleProduct); $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); + } else { + throw new InvalidArgumentException( + sprintf('Modifier %s does not exists', $modifier['modifierName']) + ); } } @@ -65,11 +75,10 @@ protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduc unset($optionData['links']); $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) + ->create(['data' => $optionData]) ->setSku($bundleProduct->getSku()); foreach ($linksData as $linkData) { - $linkData['option_id'] = $option->getId(); $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) ->create(['data' => $linkData]); } @@ -85,18 +94,6 @@ protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduc return $bundleProduct; } - /** - * @param array $fixture - * @return array - */ - private function getFixtureForProductCustomOption(array $fixture = []) - { - $fixture['title'] = 'Custom Option Title ' . microtime(true); - $fixture['sku'] = 'custom_option_sku_' . microtime(true); - - return $fixture; - } - /** * @param \Magento\Catalog\Model\Product $bundleProduct * @param array $optionsData @@ -112,7 +109,7 @@ protected function addCustomOption(\Magento\Catalog\Model\Product $bundleProduct foreach ($optionsData as $optionData) { $customOption = $customOptionFactory->create( [ - 'data' => $this->getFixtureForProductCustomOption($optionData) + 'data' => $optionData ] ); $customOption->setProductSku($bundleProduct->getSku()); @@ -126,15 +123,4 @@ protected function addCustomOption(\Magento\Catalog\Model\Product $bundleProduct return $bundleProduct; } - - /** - * @param array $fixture - * @return array - */ - private function getFixtureForProductOption(array $fixture = []) - { - $fixture['title'] = 'Option title' . microtime(true); - - return $fixture; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php index fbb785b43a6e0..81052bd2cef54 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php @@ -10,7 +10,7 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php * @magentoAppArea frontend */ -class DynamicBundlePriceCalculatorTest extends BundlePrice +class DynamicBundlePriceCalculatorTest extends BundlePriceAbstract { /** * @param array $strategyModifiers @@ -51,7 +51,7 @@ public function getTestCases() 'maximalPrice' => 10 ] ], - 'Testing price for dynamic bundle product with three simples and differnt qty' => [ + 'Testing price for dynamic bundle product with three simples and different qty' => [ 'strategy' => $this->getProductWithDifferentQty(), 'expectedResults' => [ // min price from simples 3*10 or 30 @@ -60,7 +60,7 @@ public function getTestCases() 'maximalPrice' => 100 ] ], - 'Testing price for dynamic bundle product with four simples and differnt price' => [ + 'Testing price for dynamic bundle product with four simples and different price' => [ 'strategy' => $this->getProductWithDifferentPrice(), 'expectedResults' => [ // 10 @@ -76,6 +76,7 @@ public function getProductWithOneSimple() { $optionsData = [ [ + 'title' => 'op1', 'required' => true, 'type' => 'checkbox', 'links' => [ @@ -99,6 +100,7 @@ public function getProductWithDifferentQty() { $optionsData = [ [ + 'title' => 'op1', 'required' => true, 'type' => 'checkbox', 'links' => [ @@ -130,6 +132,7 @@ public function getProductWithDifferentPrice() { $optionsData = [ [ + 'title' => 'op1', 'required' => true, 'type' => 'checkbox', 'links' => [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php index 5da45a25618a7..fd6554b3b1d08 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php @@ -10,53 +10,17 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_catalog_rule.php * @magentoAppArea frontend */ -class DynamicBundleWithCatalogPriceRuleCalculatorTest extends \PHPUnit_Framework_TestCase +class DynamicBundleWithCatalogPriceRuleCalculatorTest extends BundlePriceAbstract { - /** @var \Magento\TestFramework\Helper\Bootstrap */ - protected $objectManager; - - /** @var \Magento\Catalog\Api\ProductRepositoryInterface */ - protected $productRepository; - - protected $fixtureForProductOption = [ - 'title' => 'Some title', - 'required' => true, - 'type' => 'checkbox' - ]; - - protected $fixtureForProductOptionSelection = [ - 'sku' => null, // need to set this - 'option_id' => null, // need to set this - 'qty' => 1, - 'is_default' => true, - 'can_change_quantity' => 0 - ]; - - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); - } - /** - * @param $strategyModifiers array - * @param $expectedResults array + * @param array $strategyModifiers + * @param array $expectedResults * @dataProvider getTestCases * @magentoAppIsolation enabled */ public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); - - foreach ($strategyModifiers as $modifier) { - if (method_exists($this, $modifier['modifierName'])) { - array_unshift($modifier['data'], $bundleProduct); - $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); - } - } - - $this->productRepository->save($bundleProduct); - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $bundleProduct = $this->prepareFixture($strategyModifiers); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -89,8 +53,19 @@ public function getTestCases() ] ], + 'Testing price for dynamic bundle product with special price, sub items and catalog rule price' => [ + 'strategy' => $this->getBundleProductConfiguration1(), + 'expectedResults' => [ + // 0.5 * 10 * 0.9 + 'minimalPrice' => 4.5, + + // 0.5 * 10 * 0.9 + 'maximalPrice' => 4.5 + ] + ], + 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #2' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2(), + 'strategy' => $this->getBundleProductConfiguration2(), 'expectedResults' => [ // 0.9 * 2 * 10 'minimalPrice' => 18, @@ -101,7 +76,7 @@ public function getTestCases() ], 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #3' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3(), + 'strategy' => $this->getBundleProductConfiguration3(), 'expectedResults' => [ // 0.9 * 1 * 10 'minimalPrice' => 9, @@ -112,7 +87,7 @@ public function getTestCases() ], 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #4' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4(), + 'strategy' => $this->getBundleProductConfiguration4(), 'expectedResults' => [ // 0.9 * 1 * 10 'minimalPrice' => 9, @@ -123,7 +98,7 @@ public function getTestCases() ], 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #5' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5(), + 'strategy' => $this->getBundleProductConfiguration5(), 'expectedResults' => [ // 0.9 * 1 * 10 'minimalPrice' => 9, @@ -134,7 +109,7 @@ public function getTestCases() ], 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #6' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6(), + 'strategy' => $this->getBundleProductConfiguration6(), 'expectedResults' => [ // 0.9 * 1 * 10 + 0.9 * 1 * 10 'minimalPrice' => 18, @@ -145,7 +120,7 @@ public function getTestCases() ], 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #7' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration7(), + 'strategy' => $this->getBundleProductConfiguration7(), 'expectedResults' => [ // 1 * 0.9 * 10 'minimalPrice' => 9, @@ -156,7 +131,7 @@ public function getTestCases() ], 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #8' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration8(), + 'strategy' => $this->getBundleProductConfiguration8(), 'expectedResults' => [ // 0.9 * 1 * 10 'minimalPrice' => 9, @@ -172,10 +147,13 @@ public function getProductWithSubItemsAndOptionsStrategy() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], ] ], @@ -189,14 +167,17 @@ public function getProductWithSubItemsAndOptionsStrategy() ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1() + public function getBundleProductConfiguration1() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], ] ] @@ -214,15 +195,16 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2() + public function getBundleProductConfiguration2() { $optionsData = [ [ + 'title' => 'Op1', + 'type' => 'checkbox', 'required' => false, 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'qty' => 2, ], ] @@ -237,18 +219,20 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3() + public function getBundleProductConfiguration3() { $optionsData = [ [ + 'title' => 'Op1', + 'type' => 'checkbox', + 'required' => true, 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] @@ -263,19 +247,20 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4() + public function getBundleProductConfiguration4() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'multi', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] @@ -290,19 +275,20 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5() + public function getBundleProductConfiguration5() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] @@ -317,33 +303,35 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6() + public function getBundleProductConfiguration6() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] @@ -358,34 +346,35 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration7() + public function getBundleProductConfiguration7() { $optionsData = [ [ + 'title' => 'Op1', 'required' => false, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] @@ -400,35 +389,35 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration8() + public function getBundleProductConfiguration8() { $optionsData = [ [ + 'title' => 'Op1', 'required' => false, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', 'required' => false, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] @@ -443,49 +432,14 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - protected function getFixtureForProductOption(array $data = []) - { - $fixture = $this->fixtureForProductOption; - - // make title different for each call - $fixture['title'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductOptionSelection($data) - { - $fixture = $this->fixtureForProductOptionSelection; - - return array_merge($fixture, $data); - } - - protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) + /** + * @param \Magento\Catalog\Model\Product $bundleProduct + * @param int $discount + * @return \Magento\Catalog\Model\Product + */ + protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) { - $options = []; - - foreach ($optionsData as $optionData) { - $links = []; - $linksData = $optionData['links']; - unset($optionData['links']); - - $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) - ->setSku($bundleProduct->getSku()) - ->setOptionid(null); - - foreach ($linksData as $linkData) { - $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); - } - - $option->setProductLinks($links); - $options[] = $option; - } - - $extension = $bundleProduct->getExtensionAttributes(); - $extension->setBundleProductOptions($options); - $bundleProduct->setExtensionAttributes($extension); + $bundleProduct->setSpecialPrice($discount); return $bundleProduct; } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php index e0d5273501103..8976da58d0250 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php @@ -10,53 +10,17 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php * @magentoAppArea frontend */ -class DynamicBundleWithSpecialPriceCalculatorTest extends \PHPUnit_Framework_TestCase +class DynamicBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract { - /** @var \Magento\TestFramework\Helper\Bootstrap */ - protected $objectManager; - - /** @var \Magento\Catalog\Api\ProductRepositoryInterface */ - protected $productRepository; - - protected $fixtureForProductOption = [ - 'title' => 'Some title', - 'required' => true, - 'type' => 'checkbox' - ]; - - protected $fixtureForProductOptionSelection = [ - 'sku' => null, // need to set this - 'option_id' => null, // need to set this - 'qty' => 1, - 'is_default' => true, - 'can_change_quantity' => 0 - ]; - - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); - } - /** - * @param $strategyModifiers array - * @param $expectedResults array + * @param array $strategyModifiers + * @param array $expectedResults * @dataProvider getTestCases * @magentoAppIsolation enabled */ public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); - - foreach ($strategyModifiers as $modifier) { - if (method_exists($this, $modifier['modifierName'])) { - array_unshift($modifier['data'], $bundleProduct); - $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); - } - } - - $this->productRepository->save($bundleProduct); - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $bundleProduct = $this->prepareFixture($strategyModifiers); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -79,7 +43,7 @@ public function getTestCases() { return [ 'Testing price for dynamic bundle product with special price and sub items Configuration #1' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1(), + 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 0.5 * 10 'minimalPrice' => 5, @@ -88,7 +52,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with special price and sub items Configuration #2' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2(), + 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // 0.5 * 2 * 10 'minimalPrice' => 10, @@ -97,7 +61,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with special price and sub items Configuration #3' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3(), + 'strategy' => $this->getBundleConfiguration3(), 'expectedResults' => [ // 0.5 * 1 * 10 'minimalPrice' => 5, @@ -106,7 +70,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with special price and sub items Configuration #4' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4(), + 'strategy' => $this->getBundleConfiguration4(), 'expectedResults' => [ // 0.5 * 1 * 10 'minimalPrice' => 5, @@ -115,7 +79,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with special price and sub items Configuration #5' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5(), + 'strategy' => $this->getBundleConfiguration5(), 'expectedResults' => [ // 0.5 * 1 * 10 'minimalPrice' => 5, @@ -124,7 +88,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with special price and sub items Configuration #6' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6(), + 'strategy' => $this->getBundleConfiguration6(), 'expectedResults' => [ // 0.5 * (1 * 10 + 1 * 10) 'minimalPrice' => 10, @@ -133,7 +97,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with special price and sub items Configuration #7' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration7(), + 'strategy' => $this->getBundleConfiguration7(), 'expectedResults' => [ // 0.5 * (1 * 10) 'minimalPrice' => 5, @@ -142,7 +106,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with special price and sub items Configuration #8' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration8(), + 'strategy' => $this->getBundleConfiguration8(), 'expectedResults' => [ // 0.5 * (1 * 10) 'minimalPrice' => 5, @@ -151,7 +115,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with sub item product that has special price' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration9(), + 'strategy' => $this->getBundleConfiguration9(), 'expectedResults' => [ // 1 * 3.5 'minimalPrice' => 3.5, @@ -160,7 +124,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with special price on it and on sub item' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration10(), + 'strategy' => $this->getBundleConfiguration10(), 'expectedResults' => [ // 0.5 * 1 * 3.5 'minimalPrice' => 1.75, @@ -171,14 +135,17 @@ public function getTestCases() ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1() + public function getBundleConfiguration1() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], ] ] @@ -196,15 +163,16 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2() + public function getBundleConfiguration2() { $optionsData = [ [ + 'title' => 'Op1', + 'type' => 'checkbox', 'required' => false, 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'qty' => 2, ], ] @@ -223,18 +191,20 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3() + public function getBundleConfiguration3() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] @@ -253,19 +223,20 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4() + public function getBundleConfiguration4() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'multi', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] @@ -284,19 +255,20 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5() + public function getBundleConfiguration5() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] @@ -315,33 +287,35 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6() + public function getBundleConfiguration6() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] @@ -360,34 +334,35 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration7() + public function getBundleConfiguration7() { $optionsData = [ [ + 'title' => 'Op1', 'required' => false, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] @@ -406,35 +381,35 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration8() + public function getBundleConfiguration8() { $optionsData = [ [ + 'title' => 'Op1', 'required' => false, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', 'required' => false, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] @@ -453,19 +428,21 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration9() + public function getBundleConfiguration9() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, + 'qty' => 1, ], ] ] @@ -483,19 +460,20 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration10() + public function getBundleConfiguration10() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] @@ -518,23 +496,11 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - protected function getFixtureForProductOption(array $data = []) - { - $fixture = $this->fixtureForProductOption; - - // make title different for each call - $fixture['title'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductOptionSelection($data) - { - $fixture = $this->fixtureForProductOptionSelection; - - return array_merge($fixture, $data); - } - + /** + * @param \Magento\Catalog\Model\Product $bundleProduct + * @param int $discount + * @return \Magento\Catalog\Model\Product + */ protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) { $bundleProduct->setSpecialPrice($discount); @@ -542,6 +508,12 @@ protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct return $bundleProduct; } + /** + * @param \Magento\Catalog\Model\Product $bundleProduct + * @param string $sku + * @param int $price + * @return \Magento\Catalog\Model\Product + */ protected function addSpecialPriceForSimple(\Magento\Catalog\Model\Product $bundleProduct, $sku, $price) { $simple = $this->productRepository->get($sku, false, null, true); @@ -550,34 +522,4 @@ protected function addSpecialPriceForSimple(\Magento\Catalog\Model\Product $bund return $bundleProduct; } - - protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - $options = []; - - foreach ($optionsData as $optionData) { - $links = []; - $linksData = $optionData['links']; - unset($optionData['links']); - - $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) - ->setSku($bundleProduct->getSku()) - ->setOptionid(null); - - foreach ($linksData as $linkData) { - $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); - } - - $option->setProductLinks($links); - $options[] = $option; - } - - $extension = $bundleProduct->getExtensionAttributes(); - $extension->setBundleProductOptions($options); - $bundleProduct->setExtensionAttributes($extension); - - return $bundleProduct; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php index 801dba66a8e86..9612279da292e 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php @@ -6,50 +6,20 @@ namespace Magento\Bundle\Model\Product; -use \Magento\Catalog\Api\ProductRepositoryInterface; use \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; /** * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php * @magentoAppArea frontend */ -class DynamicBundleWithTierPriceCalculatorTest extends \PHPUnit_Framework_TestCase +class DynamicBundleWithTierPriceCalculatorTest extends BundlePriceAbstract { - /** @var \Magento\TestFramework\Helper\Bootstrap */ - private $objectManager; - - /** @var ProductRepositoryInterface */ - private $productRepository; - /** @var ProductTierPriceInterfaceFactory */ private $tierPriceFactory; - private $fixtureForTierPrice = [ - 'data' => [ - 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, - 'qty' => 1, - 'value' => 50 - ] - ]; - - private $fixtureForProductOption = [ - 'title' => 'Some title', - 'required' => true, - 'type' => 'checkbox' - ]; - - private $fixtureForProductOptionSelection = [ - 'sku' => null, // need to set this - 'option_id' => null, // need to set this - 'qty' => 1, - 'is_default' => true, - 'can_change_quantity' => 0 - ]; - protected function setUp() { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + parent::setUp(); $this->tierPriceFactory = $this->objectManager->create(ProductTierPriceInterfaceFactory::class); } @@ -61,18 +31,7 @@ protected function setUp() */ public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); - $this->addTierPrice($bundleProduct); - - foreach ($strategyModifiers as $modifier) { - if (method_exists($this, $modifier['modifierName'])) { - array_unshift($modifier['data'], $bundleProduct); - $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); - } - } - - $this->productRepository->save($bundleProduct); - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $bundleProduct = $this->prepareFixture($strategyModifiers); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -95,7 +54,7 @@ public function getTestCases() { return [ 'Testing product price with tier price and sub items Configuration #1' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration1(), + 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 0.5 * 10 'minimalPrice' => 5, @@ -104,7 +63,7 @@ public function getTestCases() ] ], 'Testing product price with tier price and sub items Configuration #2' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration2(), + 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // 0.5 * 2 * 10 'minimalPrice' => 10, @@ -113,7 +72,7 @@ public function getTestCases() ] ], 'Testing product price with tier price and sub items Configuration #3' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration3(), + 'strategy' => $this->getBundleConfiguration3(), 'expectedResults' => [ // 0.5 * 1 * 10 'minimalPrice' => 5, @@ -122,7 +81,7 @@ public function getTestCases() ] ], 'Testing product price with tier price and sub items Configuration #4' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration4(), + 'strategy' => $this->getBundleConfiguration4(), 'expectedResults' => [ // 0.5 * 1 * 10 'minimalPrice' => 5, @@ -131,7 +90,7 @@ public function getTestCases() ] ], 'Testing product price with tier price and sub items Configuration #5' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration5(), + 'strategy' => $this->getBundleConfiguration5(), 'expectedResults' => [ // 0.5 * 1 * 10 'minimalPrice' => 5, @@ -140,7 +99,7 @@ public function getTestCases() ] ], 'Testing product price with tier price and sub items Configuration #6' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration6(), + 'strategy' => $this->getBundleConfiguration6(), 'expectedResults' => [ // 0.5 * (1 * 10 + 1 * 10) 'minimalPrice' => 10, @@ -149,7 +108,7 @@ public function getTestCases() ] ], 'Testing product price with tier price and sub items Configuration #7' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration7(), + 'strategy' => $this->getBundleConfiguration7(), 'expectedResults' => [ // 0.5 * (1 * 10) 'minimalPrice' => 5, @@ -158,7 +117,7 @@ public function getTestCases() ] ], 'Testing product price with tier price and sub items Configuration #8' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration8(), + 'strategy' => $this->getBundleConfiguration8(), 'expectedResults' => [ // 0.5 * (1 * 10) 'minimalPrice' => 5, @@ -167,7 +126,7 @@ public function getTestCases() ] ], 'Testing price for dynamic bundle product with tier price on it and on sub item' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategyConfiguration10(), + 'strategy' => $this->getBundleConfiguration10(), 'expectedResults' => [ // 0.5 * 1 * 2.5 'minimalPrice' => 1.25, @@ -178,41 +137,33 @@ public function getTestCases() ]; } - public function getProductWithSubItemsAndOptionsStrategy() + public function getBundleConfiguration1() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], ] - ], - ]; - - return [ - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], + ] ]; - } - public function getProductWithSubItemsAndOptionsStrategyConfiguration1() - { - $optionsData = [ - [ - 'links' => [ - [ - 'sku' => 'simple1', - 'option_id' => 1, - ], - ] - ] + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 ]; return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -220,22 +171,33 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration1() ]; } - public function getProductWithSubItemsAndOptionsStrategyConfiguration2() + public function getBundleConfiguration2() { $optionsData = [ [ + 'title' => 'Op1', + 'type' => 'checkbox', 'required' => false, 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'qty' => 2, ], ] ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -243,25 +205,37 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration2() ]; } - public function getProductWithSubItemsAndOptionsStrategyConfiguration3() + public function getBundleConfiguration3() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -269,26 +243,37 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration3() ]; } - public function getProductWithSubItemsAndOptionsStrategyConfiguration4() + public function getBundleConfiguration4() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'multi', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -296,26 +281,37 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration4() ]; } - public function getProductWithSubItemsAndOptionsStrategyConfiguration5() + public function getBundleConfiguration5() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -323,40 +319,52 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration5() ]; } - public function getProductWithSubItemsAndOptionsStrategyConfiguration6() + public function getBundleConfiguration6() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -364,41 +372,52 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration6() ]; } - public function getProductWithSubItemsAndOptionsStrategyConfiguration7() + public function getBundleConfiguration7() { $optionsData = [ [ + 'title' => 'Op1', 'required' => false, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -406,42 +425,52 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration7() ]; } - public function getProductWithSubItemsAndOptionsStrategyConfiguration8() + public function getBundleConfiguration8() { $optionsData = [ [ + 'title' => 'Op1', 'required' => false, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ], [ + 'title' => 'Op2', 'required' => false, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 2, 'qty' => 3, ], ] ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -449,29 +478,46 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration8() ]; } - public function getProductWithSubItemsAndOptionsStrategyConfiguration10() + public function getBundleConfiguration10() { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, ], [ 'sku' => 'simple2', - 'option_id' => 1, 'qty' => 3, ], ] ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + + $tierPriceSimpleProductData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 2.5 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addTierPriceForSimple', - 'data' => ['simple1', 2.5] + 'data' => ['simple1', $tierPriceSimpleProductData] ], [ 'modifierName' => 'addSimpleProduct', @@ -480,70 +526,33 @@ public function getProductWithSubItemsAndOptionsStrategyConfiguration10() ]; } - protected function getFixtureForProductOption(array $data = []) - { - $fixture = $this->fixtureForProductOption; - - // make title different for each call - $fixture['title'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductOptionSelection($data) + /** + * @param \Magento\Catalog\Model\Product $product + * @param array $tirePriceData + * @return \Magento\Catalog\Model\Product + */ + protected function addTierPrice(\Magento\Catalog\Model\Product $product, $tirePriceData) { - $fixture = $this->fixtureForProductOptionSelection; + $tierPrice = $this->tierPriceFactory->create([ + 'data' => $tirePriceData + ]); + $product->setTierPrices([$tierPrice]); - return array_merge($fixture, $data); + return $product; } - protected function addTierPriceForSimple(\Magento\Catalog\Model\Product $bundleProduct, $sku, $price) + /** + * @param \Magento\Catalog\Model\Product $bundleProduct + * @param string $sku + * @param array $tirePriceData + * @return \Magento\Catalog\Model\Product + */ + protected function addTierPriceForSimple(\Magento\Catalog\Model\Product $bundleProduct, $sku, $tirePriceData) { $simple = $this->productRepository->get($sku, false, null, true); - $fixtureForTierPrice = $this->fixtureForTierPrice; - $fixtureForTierPrice['data']['value'] = $price; - $tierPrice = $this->tierPriceFactory->create($fixtureForTierPrice); - $simple->setTierPrices([$tierPrice]); + $simple = $this->addTierPrice($simple, $tirePriceData); $this->productRepository->save($simple); return $bundleProduct; } - - protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - $options = []; - - foreach ($optionsData as $optionData) { - $links = []; - $linksData = $optionData['links']; - unset($optionData['links']); - - $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) - ->setSku($bundleProduct->getSku()) - ->setOptionid(null); - - foreach ($linksData as $linkData) { - $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); - } - - $option->setProductLinks($links); - $options[] = $option; - } - - $extension = $bundleProduct->getExtensionAttributes(); - $extension->setBundleProductOptions($options); - $bundleProduct->setExtensionAttributes($extension); - - return $bundleProduct; - } - - private function addTierPrice(\Magento\Catalog\Model\Product $bundleProduct) - { - $tierPrice = $this->tierPriceFactory->create($this->fixtureForTierPrice); - $bundleProduct->setTierPrices([$tierPrice]); - - return $bundleProduct; - } } From 226ea7f5c095fff7212d2d188f4c315419cd1a6f Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 18 Oct 2016 12:13:05 -0500 Subject: [PATCH 1513/3232] MAGETWO-58691: Refactor Module_Quote, Module_Sales - fixed static test --- .../Magento/Test/Legacy/UnsecureFunctionsUsageTest.php | 3 ++- .../Magento/Test/Legacy/_files/security/blacklist.php | 5 +++-- .../Magento/Test/Legacy/_files/security/whitelist.txt | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php index 6b18eb2b71478..52972683319e8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php @@ -114,7 +114,8 @@ function ($path) use ($directoriesToScan, $fileExtensions, $blackListFiles) { if (strpos($path, $directory) === 0) { if (preg_match($fileExtensions, $path)) { foreach ($blackListFiles as $blackListFile) { - if (preg_match($blackListFile, $path)) { + $blackListFile = preg_quote($blackListFile, '#'); + if (preg_match('#' . $blackListFile . '#', $path)) { return false; } } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php index d120a4543b9dd..edcb6ab4d7fb9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ return [ - '/Test\/Unit/', - '/lib\/internal\/Magento\/Framework\/DB\/Adapter\/Pdo\/Mysql\.php/', + 'Test/Unit', + 'lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php', + 'lib/internal/Magento/Framework/Serialize/SerializerInterface.php', ]; diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/whitelist.txt b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/whitelist.txt index 2567475de6a03..e464d9713657f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/whitelist.txt +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/whitelist.txt @@ -1,4 +1,5 @@ +# "Component Type" "Component Name" "Path Pattern" module * / library * / setup -pub \ No newline at end of file +pub From 9dfaec84c3107ddcb6b412bbb508dc755e6c1b19 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 18 Oct 2016 16:00:12 -0500 Subject: [PATCH 1514/3232] MAGETWO-58691: Refactor Module_Quote, Module_Sales - fixed static test to skip function declarations and calls to class methods --- .../Magento/Test/Legacy/UnsecureFunctionsUsageTest.php | 4 ++-- .../Magento/Test/Legacy/_files/security/blacklist.php | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php index 52972683319e8..5220eb43644fd 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php @@ -64,7 +64,7 @@ function ($fileName) { if ($regexp) { $matches = preg_grep( $regexp, - file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) + file($fileName) ); if (!empty($matches)) { foreach (array_keys($matches) as $line) { @@ -161,7 +161,7 @@ private function prepareRegexp(array $functions) } $regexArray = []; foreach ($functions as $function) { - $regexArray[] = '\b' . $function . '\b\('; + $regexArray[] = '(? Date: Wed, 19 Oct 2016 15:14:14 -0500 Subject: [PATCH 1515/3232] MAGETWO-58691: Refactor Module_Quote, Module_Sales - replaced native functions with SerializerInterface --- .../Magento/Quote/Model/QueryResolver.php | 15 +++- .../Model/Quote/Address/Total/Collector.php | 7 +- .../Test/Unit/Model/QueryResolverTest.php | 75 ++++++++++++------- .../Magento/Sales/Model/Config/Ordered.php | 15 +++- .../Sales/Model/Order/Total/Config/Base.php | 7 +- .../Model/Order/Total/Config/BaseTest.php | 32 ++++++-- 6 files changed, 105 insertions(+), 46 deletions(-) diff --git a/app/code/Magento/Quote/Model/QueryResolver.php b/app/code/Magento/Quote/Model/QueryResolver.php index cfc1480feb663..216e644b767a0 100644 --- a/app/code/Magento/Quote/Model/QueryResolver.php +++ b/app/code/Magento/Quote/Model/QueryResolver.php @@ -5,8 +5,10 @@ */ namespace Magento\Quote\Model; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Config\CacheInterface; use Magento\Framework\App\ResourceConnection\ConfigInterface; +use Magento\Framework\Serialize\SerializerInterface; class QueryResolver { @@ -36,20 +38,27 @@ class QueryResolver * @var array */ private $cacheTags = []; + /** + * @var SerializerInterface + */ + private $serializer; /** * @param ConfigInterface $config * @param CacheInterface $cache * @param string $cacheId + * @param SerializerInterface $serializer */ public function __construct( ConfigInterface $config, CacheInterface $cache, - $cacheId = 'connection_config_cache' + $cacheId = 'connection_config_cache', + SerializerInterface $serializer = null ) { $this->config = $config; $this->cache = $cache; $this->cacheId = $cacheId; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -75,9 +84,9 @@ protected function initData() if (false === $data) { $singleQuery = $this->config->getConnectionName('checkout_setup') == 'default' ? true : false; $data['checkout'] = $singleQuery; - $this->cache->save(serialize($data), $this->cacheId, $this->cacheTags); + $this->cache->save($this->serializer->serialize($data), $this->cacheId, $this->cacheTags); } else { - $data = unserialize($data); + $data = $this->serializer->unserialize($data); } $this->merge($data); } diff --git a/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php b/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php index 8e62d1b942f1e..0b3dbc318b23c 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php +++ b/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Quote\Model\Quote\Address\Total; +use Magento\Framework\Serialize\SerializerInterface; /** * Address Total Collector model @@ -69,6 +70,7 @@ class Collector extends \Magento\Sales\Model\Config\Ordered * @param \Magento\Quote\Model\Quote\Address\TotalFactory $totalFactory * @param mixed $sourceData * @param mixed $store + * @param SerializerInterface $serializer */ public function __construct( \Magento\Framework\App\Cache\Type\Config $configCacheType, @@ -78,11 +80,12 @@ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Quote\Model\Quote\Address\TotalFactory $totalFactory, $sourceData = null, - $store = null + $store = null, + SerializerInterface $serializer = null ) { $this->_scopeConfig = $scopeConfig; $this->_totalFactory = $totalFactory; - parent::__construct($configCacheType, $logger, $salesConfig, $sourceData); + parent::__construct($configCacheType, $logger, $salesConfig, $sourceData, $serializer); $this->_store = $store ?: $storeManager->getStore(); $this->_initModels()->_initCollectors()->_initRetrievers(); } diff --git a/app/code/Magento/Quote/Test/Unit/Model/QueryResolverTest.php b/app/code/Magento/Quote/Test/Unit/Model/QueryResolverTest.php index a2075b1161fc2..eb6828afff4ed 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/QueryResolverTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/QueryResolverTest.php @@ -6,83 +6,100 @@ namespace Magento\Quote\Test\Unit\Model; +use Magento\Framework\Serialize\SerializerInterface; + class QueryResolverTest extends \PHPUnit_Framework_TestCase { /** * @var \Magento\Quote\Model\QueryResolver */ - protected $quoteResolver; + private $quoteResolver; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $configMock; + private $configMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $cacheMock; + private $cacheMock; + + /** + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializer; protected function setUp() { $this->configMock = $this->getMock(\Magento\Framework\App\ResourceConnection\ConfigInterface::class); $this->cacheMock = $this->getMock(\Magento\Framework\Config\CacheInterface::class); + $this->serializer = $this->getMockForAbstractClass(SerializerInterface::class); $this->quoteResolver = new \Magento\Quote\Model\QueryResolver( $this->configMock, $this->cacheMock, - 'connection_config_cache' + 'connection_config_cache', + $this->serializer ); - } public function testIsSingleQueryWhenDataWereCached() { - $queryData['checkout'] = true; + $serializedData = '{"checkout":true}'; + $data = ['checkout' => true]; $this->cacheMock ->expects($this->once()) ->method('load') ->with('connection_config_cache') - ->willReturn(serialize($queryData)); + ->willReturn($serializedData); + $this->serializer->expects($this->once()) + ->method('unserialize') + ->with($serializedData) + ->willReturn($data); $this->assertTrue($this->quoteResolver->isSingleQuery()); } - public function testIsSingleQueryWhenDataNotCached() + /** + * @param string $connectionName + * @param bool $isSingleQuery + * + * @dataProvider isSingleQueryWhenDataNotCachedDataProvider + */ + public function testIsSingleQueryWhenDataNotCached($connectionName, $isSingleQuery) { - $queryData['checkout'] = true; + $data = ['checkout' => $isSingleQuery]; + $serializedData = '{"checkout":true}'; $this->cacheMock ->expects($this->once()) ->method('load') ->with('connection_config_cache') ->willReturn(false); + $this->serializer->expects($this->never()) + ->method('unserialize'); $this->configMock ->expects($this->once()) ->method('getConnectionName') ->with('checkout_setup') - ->willReturn('default'); + ->willReturn($connectionName); + $this->serializer->expects($this->once()) + ->method('serialize') + ->with($data) + ->willReturn($serializedData); $this->cacheMock ->expects($this->once()) ->method('save') - ->with(serialize($queryData), 'connection_config_cache', []); - $this->assertTrue($this->quoteResolver->isSingleQuery()); + ->with($serializedData, 'connection_config_cache', []); + $this->assertEquals($isSingleQuery, $this->quoteResolver->isSingleQuery()); } - public function testIsSingleQueryWhenSeveralConnectionsExist() + /** + * @return array + */ + public function isSingleQueryWhenDataNotCachedDataProvider() { - $queryData['checkout'] = false; - $this->cacheMock - ->expects($this->once()) - ->method('load') - ->with('connection_config_cache') - ->willReturn(false); - $this->configMock - ->expects($this->once()) - ->method('getConnectionName') - ->with('checkout_setup') - ->willReturn('checkout'); - $this->cacheMock - ->expects($this->once()) - ->method('save') - ->with(serialize($queryData), 'connection_config_cache', []); - $this->assertFalse($this->quoteResolver->isSingleQuery()); + return [ + ['default', true], + ['checkout', false], + ]; } } diff --git a/app/code/Magento/Sales/Model/Config/Ordered.php b/app/code/Magento/Sales/Model/Config/Ordered.php index 7ea7d1f8cc5fa..c59bd097bf552 100644 --- a/app/code/Magento/Sales/Model/Config/Ordered.php +++ b/app/code/Magento/Sales/Model/Config/Ordered.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ namespace Magento\Sales\Model\Config; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; /** * Configuration class for ordered items @@ -68,23 +70,30 @@ abstract class Ordered extends \Magento\Framework\App\Config\Base * @var \Magento\Sales\Model\Config */ protected $_salesConfig; + /** + * @var SerializerInterface + */ + private $serializer; /** * @param \Magento\Framework\App\Cache\Type\Config $configCacheType * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Framework\Simplexml\Element $sourceData + * @param SerializerInterface $serializer */ public function __construct( \Magento\Framework\App\Cache\Type\Config $configCacheType, \Psr\Log\LoggerInterface $logger, \Magento\Sales\Model\Config $salesConfig, - $sourceData = null + $sourceData = null, + SerializerInterface $serializer = null ) { parent::__construct($sourceData); $this->_configCacheType = $configCacheType; $this->_logger = $logger; $this->_salesConfig = $salesConfig; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -179,11 +188,11 @@ protected function _initCollectors() $sortedCodes = []; $cachedData = $this->_configCacheType->load($this->_collectorsCacheKey); if ($cachedData) { - $sortedCodes = unserialize($cachedData); + $sortedCodes = $this->serializer->unserialize($cachedData); } if (!$sortedCodes) { $sortedCodes = $this->_getSortedCollectorCodes($this->_modelsConfig); - $this->_configCacheType->save(serialize($sortedCodes), $this->_collectorsCacheKey); + $this->_configCacheType->save($this->serializer->serialize($sortedCodes), $this->_collectorsCacheKey); } foreach ($sortedCodes as $code) { $this->_collectors[$code] = $this->_models[$code]; diff --git a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php index 22c71f48b6f35..20647e34c4535 100644 --- a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php +++ b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Sales\Model\Order\Total\Config; +use Magento\Framework\Serialize\SerializerInterface; /** * Configuration class for totals @@ -42,15 +43,17 @@ class Base extends \Magento\Sales\Model\Config\Ordered * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory * @param mixed $sourceData + * @param SerializerInterface $serializer */ public function __construct( \Magento\Framework\App\Cache\Type\Config $configCacheType, \Psr\Log\LoggerInterface $logger, \Magento\Sales\Model\Config $salesConfig, \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory, - $sourceData = null + $sourceData = null, + SerializerInterface $serializer = null ) { - parent::__construct($configCacheType, $logger, $salesConfig, $sourceData); + parent::__construct($configCacheType, $logger, $salesConfig, $sourceData, $serializer); $this->_orderTotalFactory = $orderTotalFactory; } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php index ed44331f577d0..bd519e76585ba 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php @@ -5,24 +5,28 @@ */ namespace Magento\Sales\Test\Unit\Model\Order\Total\Config; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class BaseTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Sales\Model\Order\Total\Config\Base */ - protected $object; + private $object; + + /** @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */ + private $serializer; /** @var \Magento\Framework\App\Cache\Type\Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $configCacheType; + private $configCacheType; /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $logger; + private $logger; /** @var \Magento\Sales\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $salesConfig; + private $salesConfig; /** @var \Magento\Sales\Model\Order\TotalFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $orderTotalFactory; + private $orderTotalFactory; protected function setUp() { @@ -30,6 +34,7 @@ protected function setUp() $this->logger = $this->getMock(\Psr\Log\LoggerInterface::class); $this->salesConfig = $this->getMock(\Magento\Sales\Model\Config::class, [], [], '', false); $this->orderTotalFactory = $this->getMock(\Magento\Sales\Model\Order\TotalFactory::class, [], [], '', false); + $this->serializer = $this->getMockForAbstractClass(SerializerInterface::class); $objectManager = new ObjectManager($this); $this->object = $objectManager->getObject( @@ -39,6 +44,7 @@ protected function setUp() 'logger' => $this->logger, 'salesConfig' => $this->salesConfig, 'orderTotalFactory' => $this->orderTotalFactory, + 'serializer' => $this->serializer, ] ); } @@ -59,8 +65,14 @@ public function testGetTotalModels() ->with(\Magento\Sales\Model\Order\Total\AbstractTotal::class) ->will($this->returnValue($total)); + $sortedCodes = ['other_code', 'some_code']; + $serializedCodes = '["other_code", "some_code"]'; + $this->serializer->expects($this->once()) + ->method('serialize') + ->with($sortedCodes) + ->willReturn($serializedCodes); $this->configCacheType->expects($this->once())->method('save') - ->with('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}', 'sorted_collectors'); + ->with($serializedCodes, 'sorted_collectors'); $this->assertSame( ['other_code' => $total, 'some_code' => $total], @@ -106,8 +118,14 @@ public function testGetTotalUnserializeCachedCollectorCodes() ->with(\Magento\Sales\Model\Order\Total\AbstractTotal::class) ->will($this->returnValue($total)); + $sortedCodes = ['other_code', 'some_code']; + $serializedCodes = '["other_code", "some_code"]'; $this->configCacheType->expects($this->once())->method('load')->with('sorted_collectors') - ->will($this->returnValue('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}')); + ->will($this->returnValue($serializedCodes)); + $this->serializer->expects($this->once()) + ->method('unserialize') + ->with($serializedCodes) + ->willReturn($sortedCodes); $this->configCacheType->expects($this->never())->method('save'); $this->assertSame( From 912bbc053f69c7e8112769841d102c3531b35739 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 19 Oct 2016 15:19:50 -0500 Subject: [PATCH 1516/3232] MAGETWO-58691: Refactor Module_Quote, Module_Sales - fixed child class and code style --- app/code/Magento/Sales/Model/Config/Ordered.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Sales/Model/Config/Ordered.php b/app/code/Magento/Sales/Model/Config/Ordered.php index c59bd097bf552..01e70b4845c45 100644 --- a/app/code/Magento/Sales/Model/Config/Ordered.php +++ b/app/code/Magento/Sales/Model/Config/Ordered.php @@ -70,6 +70,7 @@ abstract class Ordered extends \Magento\Framework\App\Config\Base * @var \Magento\Sales\Model\Config */ protected $_salesConfig; + /** * @var SerializerInterface */ From ae76c0c8fa61d247decd32c2feea7718c63d7f3e Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 19 Oct 2016 15:52:33 -0500 Subject: [PATCH 1517/3232] MAGETWO-58691: Refactor Module_Quote, Module_Sales - fixed code style --- app/code/Magento/Quote/Model/QueryResolver.php | 1 + app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php | 1 + app/code/Magento/Sales/Model/Config/Ordered.php | 1 + app/code/Magento/Sales/Model/Order/Total/Config/Base.php | 1 + 4 files changed, 4 insertions(+) diff --git a/app/code/Magento/Quote/Model/QueryResolver.php b/app/code/Magento/Quote/Model/QueryResolver.php index 216e644b767a0..04d83bab85b2b 100644 --- a/app/code/Magento/Quote/Model/QueryResolver.php +++ b/app/code/Magento/Quote/Model/QueryResolver.php @@ -38,6 +38,7 @@ class QueryResolver * @var array */ private $cacheTags = []; + /** * @var SerializerInterface */ diff --git a/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php b/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php index 0b3dbc318b23c..d430bf3acc6cd 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php +++ b/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Quote\Model\Quote\Address\Total; + use Magento\Framework\Serialize\SerializerInterface; /** diff --git a/app/code/Magento/Sales/Model/Config/Ordered.php b/app/code/Magento/Sales/Model/Config/Ordered.php index 01e70b4845c45..806a7b522c189 100644 --- a/app/code/Magento/Sales/Model/Config/Ordered.php +++ b/app/code/Magento/Sales/Model/Config/Ordered.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Sales\Model\Config; + use Magento\Framework\App\ObjectManager; use Magento\Framework\Serialize\SerializerInterface; diff --git a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php index 20647e34c4535..d96591118b822 100644 --- a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php +++ b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Sales\Model\Order\Total\Config; + use Magento\Framework\Serialize\SerializerInterface; /** From 3894d3100863fd237d306b84a7ed49fc27d2d88c Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 19 Oct 2016 17:20:45 -0500 Subject: [PATCH 1518/3232] MAGETWO-58691: Refactor Module_Quote, Module_Sales - simplified regexp for the static test --- .../Magento/Test/Legacy/UnsecureFunctionsUsageTest.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php index 5220eb43644fd..e5263713d71d7 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php @@ -159,10 +159,6 @@ private function prepareRegexp(array $functions) if (empty($functions)) { return ''; } - $regexArray = []; - foreach ($functions as $function) { - $regexArray[] = '(? Date: Thu, 20 Oct 2016 16:16:25 -0500 Subject: [PATCH 1519/3232] MAGETWO-58693: Refactor Module_Integration, Module_MarketPlace - replaced serialization with SerializeInterface --- app/code/Magento/Integration/Model/Config.php | 24 ++++- .../Integration/Model/ConsolidatedConfig.php | 20 +++- .../Integration/Model/IntegrationConfig.php | 20 +++- .../Unit/Model/ConsolidatedConfigTest.php | 37 +++++-- .../Test/Unit/Model/IntegrationConfigTest.php | 38 +++++-- app/code/Magento/Marketplace/Helper/Cache.php | 17 +++- .../Test/Unit/Helper/CacheTest.php | 98 ++++++++++--------- 7 files changed, 176 insertions(+), 78 deletions(-) diff --git a/app/code/Magento/Integration/Model/Config.php b/app/code/Magento/Integration/Model/Config.php index 70795cae00350..3cea4d3374319 100644 --- a/app/code/Magento/Integration/Model/Config.php +++ b/app/code/Magento/Integration/Model/Config.php @@ -5,6 +5,8 @@ */ namespace Magento\Integration\Model; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Integration\Model\Cache\Type; /** @@ -34,14 +36,24 @@ class Config */ protected $_integrations; + /** + * @var SerializerInterface + */ + private $serializer; + /** * @param Cache\Type $configCacheType * @param Config\Reader $configReader + * @param SerializerInterface $serializer */ - public function __construct(Cache\Type $configCacheType, Config\Reader $configReader) - { + public function __construct( + Cache\Type $configCacheType, + Config\Reader $configReader, + SerializerInterface $serializer = null + ) { $this->_configCacheType = $configCacheType; $this->_configReader = $configReader; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -55,10 +67,14 @@ public function getIntegrations() if (null === $this->_integrations) { $integrations = $this->_configCacheType->load(self::CACHE_ID); if ($integrations && is_string($integrations)) { - $this->_integrations = unserialize($integrations); + $this->_integrations = $this->serializer->unserialize($integrations); } else { $this->_integrations = $this->_configReader->read(); - $this->_configCacheType->save(serialize($this->_integrations), self::CACHE_ID, [Type::CACHE_TAG]); + $this->_configCacheType->save( + $this->serializer->serialize($this->_integrations), + self::CACHE_ID, + [Type::CACHE_TAG] + ); } } return $this->_integrations; diff --git a/app/code/Magento/Integration/Model/ConsolidatedConfig.php b/app/code/Magento/Integration/Model/ConsolidatedConfig.php index 9027bf774bc30..9208d19e7028f 100644 --- a/app/code/Magento/Integration/Model/ConsolidatedConfig.php +++ b/app/code/Magento/Integration/Model/ConsolidatedConfig.php @@ -5,6 +5,8 @@ */ namespace Magento\Integration\Model; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Integration\Model\Cache\TypeConsolidated; /** @@ -31,14 +33,24 @@ class ConsolidatedConfig */ protected $integrations; + /** + * @var SerializerInterface + */ + private $serializer; + /** * @param Cache\TypeConsolidated $configCacheType * @param Config\Consolidated\Reader $configReader + * @param SerializerInterface $serializer */ - public function __construct(Cache\TypeConsolidated $configCacheType, Config\Consolidated\Reader $configReader) - { + public function __construct( + Cache\TypeConsolidated $configCacheType, + Config\Consolidated\Reader $configReader, + SerializerInterface $serializer = null + ) { $this->configCacheType = $configCacheType; $this->configReader = $configReader; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -51,11 +63,11 @@ public function getIntegrations() if (null === $this->integrations) { $integrations = $this->configCacheType->load(self::CACHE_ID); if ($integrations && is_string($integrations)) { - $this->integrations = unserialize($integrations); + $this->integrations = $this->serializer->unserialize($integrations); } else { $this->integrations = $this->configReader->read(); $this->configCacheType->save( - serialize($this->integrations), + $this->serializer->serialize($this->integrations), self::CACHE_ID, [TypeConsolidated::CACHE_TAG] ); diff --git a/app/code/Magento/Integration/Model/IntegrationConfig.php b/app/code/Magento/Integration/Model/IntegrationConfig.php index 647bff70efe4a..cde4fc20d2235 100644 --- a/app/code/Magento/Integration/Model/IntegrationConfig.php +++ b/app/code/Magento/Integration/Model/IntegrationConfig.php @@ -6,6 +6,8 @@ namespace Magento\Integration\Model; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Integration\Model\Cache\TypeIntegration; use Magento\Integration\Model\Config\Integration\Reader; @@ -36,14 +38,24 @@ class IntegrationConfig */ protected $_integrations; + /** + * @var SerializerInterface + */ + private $serializer; + /** * @param TypeIntegration $configCacheType * @param Reader $configReader + * @param SerializerInterface $serializer */ - public function __construct(TypeIntegration $configCacheType, Reader $configReader) - { + public function __construct( + TypeIntegration $configCacheType, + Reader $configReader, + SerializerInterface $serializer = null + ) { $this->_configCacheType = $configCacheType; $this->_configReader = $configReader; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -57,11 +69,11 @@ public function getIntegrations() if (null === $this->_integrations) { $integrations = $this->_configCacheType->load(self::CACHE_ID); if ($integrations && is_string($integrations)) { - $this->_integrations = unserialize($integrations); + $this->_integrations = $this->serializer->unserialize($integrations); } else { $this->_integrations = $this->_configReader->read(); $this->_configCacheType->save( - serialize($this->_integrations), + $this->serializer->serialize($this->_integrations), self::CACHE_ID, [TypeIntegration::CACHE_TAG] ); diff --git a/app/code/Magento/Integration/Test/Unit/Model/ConsolidatedConfigTest.php b/app/code/Magento/Integration/Test/Unit/Model/ConsolidatedConfigTest.php index 0b75592782773..22b50a8aef8d0 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/ConsolidatedConfigTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/ConsolidatedConfigTest.php @@ -5,6 +5,7 @@ */ namespace Magento\Integration\Test\Unit\Model; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Integration\Model\ConsolidatedConfig as Config; use Magento\Integration\Model\Cache\TypeConsolidated as Type; @@ -18,17 +19,22 @@ class ConsolidatedConfigTest extends \PHPUnit_Framework_TestCase * * @var Config */ - protected $configModel; + private $configModel; /** * @var Type|\PHPUnit_Framework_MockObject_MockObject */ - protected $configCacheTypeMock; + private $configCacheTypeMock; /** * @var \Magento\Integration\Model\Config\Consolidated\Reader|\PHPUnit_Framework_MockObject_MockObject */ - protected $configReaderMock; + private $configReaderMock; + + /** + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializer; protected function setUp() { @@ -38,12 +44,16 @@ protected function setUp() $this->configReaderMock = $this->getMockBuilder(\Magento\Integration\Model\Config\Consolidated\Reader::class) ->disableOriginalConstructor() ->getMock(); + $this->serializer = $this->getMockBuilder(SerializerInterface::class) + ->disableOriginalConstructor() + ->getMock(); $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->configModel = $objectManagerHelper->getObject( \Magento\Integration\Model\ConsolidatedConfig::class, [ 'configCacheType' => $this->configCacheTypeMock, - 'configReader' => $this->configReaderMock + 'configReader' => $this->configReaderMock, + 'serializer' => $this->serializer, ] ); } @@ -51,10 +61,15 @@ protected function setUp() public function testGetIntegrationsFromConfigCacheType() { $integrations = ['foo', 'bar', 'baz']; + $serializedIntegrations = '["foo","bar","baz"]'; $this->configCacheTypeMock->expects($this->once()) ->method('load') ->with(Config::CACHE_ID) - ->will($this->returnValue(serialize($integrations))); + ->will($this->returnValue($serializedIntegrations)); + $this->serializer->expects($this->once()) + ->method('unserialize') + ->with($serializedIntegrations) + ->willReturn($integrations); $this->assertEquals($integrations, $this->configModel->getIntegrations()); } @@ -62,17 +77,21 @@ public function testGetIntegrationsFromConfigCacheType() public function testGetIntegrationsFromConfigReader() { $integrations = ['foo', 'bar', 'baz']; + $serializedIntegrations = '["foo","bar","baz"]'; $this->configCacheTypeMock->expects($this->once()) ->method('load') ->with(Config::CACHE_ID) ->will($this->returnValue(null)); - $this->configCacheTypeMock->expects($this->once()) - ->method('save') - ->with(serialize($integrations), Config::CACHE_ID, [Type::CACHE_TAG]) - ->will($this->returnValue(null)); $this->configReaderMock->expects($this->once()) ->method('read') ->will($this->returnValue($integrations)); + $this->serializer->expects($this->once()) + ->method('serialize') + ->with($integrations) + ->willReturn($serializedIntegrations); + $this->configCacheTypeMock->expects($this->once()) + ->method('save') + ->with($serializedIntegrations, Config::CACHE_ID, [Type::CACHE_TAG]); $this->assertEquals($integrations, $this->configModel->getIntegrations()); } diff --git a/app/code/Magento/Integration/Test/Unit/Model/IntegrationConfigTest.php b/app/code/Magento/Integration/Test/Unit/Model/IntegrationConfigTest.php index aed4e02453dc4..14871420a621a 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/IntegrationConfigTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/IntegrationConfigTest.php @@ -5,6 +5,7 @@ */ namespace Magento\Integration\Test\Unit\Model; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Integration\Model\IntegrationConfig; use Magento\Integration\Model\Cache\TypeIntegration; @@ -16,17 +17,22 @@ class IntegrationConfigTest extends \PHPUnit_Framework_TestCase /** * @var IntegrationConfig */ - protected $integrationConfigModel; + private $integrationConfigModel; /** * @var TypeIntegration|\PHPUnit_Framework_MockObject_MockObject */ - protected $configCacheTypeMock; + private $configCacheTypeMock; /** * @var \Magento\Integration\Model\Config\Integration\Reader|\PHPUnit_Framework_MockObject_MockObject */ - protected $configReaderMock; + private $configReaderMock; + + /** + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializer; protected function setUp() { @@ -36,19 +42,28 @@ protected function setUp() $this->configReaderMock = $this->getMockBuilder(\Magento\Integration\Model\Config\Integration\Reader::class) ->disableOriginalConstructor() ->getMock(); + $this->serializer = $this->getMockBuilder(SerializerInterface::class) + ->disableOriginalConstructor() + ->getMock(); $this->integrationConfigModel = new IntegrationConfig( $this->configCacheTypeMock, - $this->configReaderMock + $this->configReaderMock, + $this->serializer ); } public function testGetIntegrationsFromConfigCacheType() { $integrations = ['foo', 'bar', 'baz']; + $serializedIntegrations = '["foo","bar","baz"]'; $this->configCacheTypeMock->expects($this->once()) ->method('load') ->with(IntegrationConfig::CACHE_ID) - ->will($this->returnValue(serialize($integrations))); + ->will($this->returnValue($serializedIntegrations)); + $this->serializer->expects($this->once()) + ->method('unserialize') + ->with($serializedIntegrations) + ->willReturn($integrations); $this->assertEquals($integrations, $this->integrationConfigModel->getIntegrations()); } @@ -56,17 +71,22 @@ public function testGetIntegrationsFromConfigCacheType() public function testGetIntegrationsFromConfigReader() { $integrations = ['foo', 'bar', 'baz']; + $serializedIntegrations = '["foo","bar","baz"]'; $this->configCacheTypeMock->expects($this->once()) ->method('load') ->with(IntegrationConfig::CACHE_ID) ->will($this->returnValue(null)); - $this->configCacheTypeMock->expects($this->once()) - ->method('save') - ->with(serialize($integrations), IntegrationConfig::CACHE_ID, [TypeIntegration::CACHE_TAG]) - ->will($this->returnValue(null)); $this->configReaderMock->expects($this->once()) ->method('read') ->will($this->returnValue($integrations)); + $this->serializer->expects($this->once()) + ->method('serialize') + ->with($integrations) + ->willReturn($serializedIntegrations); + $this->configCacheTypeMock->expects($this->once()) + ->method('save') + ->with($serializedIntegrations, IntegrationConfig::CACHE_ID, [TypeIntegration::CACHE_TAG]) + ->will($this->returnValue(null)); $this->assertEquals($integrations, $this->integrationConfigModel->getIntegrations()); } diff --git a/app/code/Magento/Marketplace/Helper/Cache.php b/app/code/Magento/Marketplace/Helper/Cache.php index 1cb5fb9c710e6..a0a4ce73e0373 100644 --- a/app/code/Magento/Marketplace/Helper/Cache.php +++ b/app/code/Magento/Marketplace/Helper/Cache.php @@ -6,7 +6,8 @@ namespace Magento\Marketplace\Helper; -use Magento\Framework\Filesystem; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; /** * Cache helper @@ -25,15 +26,23 @@ class Cache extends \Magento\Framework\App\Helper\AbstractHelper */ protected $cache; + /** + * @var SerializerInterface + */ + private $serializer; + /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\Config\CacheInterface $cache + * @param SerializerInterface $serializer */ public function __construct( \Magento\Framework\App\Helper\Context $context, - \Magento\Framework\Config\CacheInterface $cache + \Magento\Framework\Config\CacheInterface $cache, + SerializerInterface $serializer = null ) { $this->cache = $cache; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); parent::__construct($context); } @@ -46,7 +55,7 @@ public function loadPartnersFromCache() { $data = $this->getCache()->load($this->pathToCacheFile); if (false !== $data) { - $data = unserialize($data); + $data = $this->serializer->unserialize($data); } return $data; } @@ -59,7 +68,7 @@ public function loadPartnersFromCache() */ public function savePartnersToCache($partners) { - return $this->getCache()->save(serialize($partners), $this->pathToCacheFile); + return $this->getCache()->save($this->serializer->serialize($partners), $this->pathToCacheFile); } /** diff --git a/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php b/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php index 75c6e6110389c..411c81d75479c 100644 --- a/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php +++ b/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php @@ -6,70 +6,80 @@ namespace Magento\Marketplace\Test\Unit\Helper; +use Magento\Framework\Serialize\SerializerInterface; + class CacheTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Marketplace\Helper\Cache + * @var \Magento\Framework\Config\CacheInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $cache; + + /** + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializer; + + /** + * @var \Magento\Marketplace\Helper\Cache */ - private $cacheHelperMock; + private $cacheHelper; protected function setUp() { - $this->cacheHelperMock = $this->getCacheHelperMock(['getCache']); + $this->cache = $this->getMockForAbstractClass(\Magento\Framework\Config\CacheInterface::class); + $this->serializer = $this->getMockForAbstractClass(SerializerInterface::class); + $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->cacheHelper = $objectManagerHelper->getObject( + \Magento\Marketplace\Helper\Cache::class, + [ + 'cache' => $this->cache, + 'serializer' => $this->serializer, + ] + ); } - /** - * @covers \Magento\Marketplace\Helper\Cache::loadPartnersFromCache - */ public function testLoadPartnersFromCache() { - $cache = $this->getCacheMock(); - $this->cacheHelperMock - ->expects($this->once()) - ->method('getCache') - ->will($this->returnValue($cache)); - $cache->expects($this->once()) + $partners = ['partner1', 'partner2']; + $serializedPartners = '["partner1", "partner2"]'; + $this->cache->expects($this->once()) ->method('load') - ->will($this->returnValue('')); + ->with('partners') + ->willReturn($serializedPartners); + $this->serializer->expects($this->once()) + ->method('unserialize') + ->with($serializedPartners) + ->willReturn($partners); - $this->cacheHelperMock->loadPartnersFromCache(); + + $this->assertSame($partners, $this->cacheHelper->loadPartnersFromCache()); } - /** - * @covers \Magento\Marketplace\Helper\Cache::savePartnersToCache - */ - public function testSavePartnersToCache() + public function testLoadPartnersFromCacheNoCachedData() { - $cache = $this->getCacheMock(); - $this->cacheHelperMock - ->expects($this->once()) - ->method('getCache') - ->will($this->returnValue($cache)); - $cache->expects($this->once()) - ->method('save') - ->will($this->returnValue(true)); + $this->cache->expects($this->once()) + ->method('load') + ->with('partners') + ->willReturn(false); + $this->serializer->expects($this->never()) + ->method('unserialize'); - $this->cacheHelperMock->savePartnersToCache([]); + $this->assertSame(false, $this->cacheHelper->loadPartnersFromCache()); } - /** - * Gets cache helper mock - * - * @param null $methods - * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Marketplace\Helper\Cache - */ - public function getCacheHelperMock($methods = null) + public function testSavePartnersToCache() { - return $this->getMock(\Magento\Marketplace\Helper\Cache::class, $methods, [], '', false); - } + $partners = ['partner1', 'partner2']; + $serializedPartners = '["partner1", "partner2"]'; + $this->serializer->expects($this->once()) + ->method('serialize') + ->with($partners) + ->willReturn($serializedPartners); + $this->cache->expects($this->once()) + ->method('save') + ->with($serializedPartners); - /** - * Gets Filesystem mock - * - * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Config\CacheInterface - */ - public function getCacheMock() - { - return $this->getMockForAbstractClass(\Magento\Framework\Config\CacheInterface::class); + $this->cacheHelper->savePartnersToCache($partners); } } From c84101b3287497e696e48a15b885328d5d61af73 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Thu, 20 Oct 2016 20:09:57 -0500 Subject: [PATCH 1520/3232] MAGETWO-58693: Refactor Module_Integration, Module_MarketPlace - fixed code style --- app/code/Magento/Integration/Model/Config.php | 2 +- app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Integration/Model/Config.php b/app/code/Magento/Integration/Model/Config.php index 3cea4d3374319..37ed0e7b2fb61 100644 --- a/app/code/Magento/Integration/Model/Config.php +++ b/app/code/Magento/Integration/Model/Config.php @@ -15,7 +15,7 @@ * This is a parent class for storing information about Integrations. * @deprecated */ -class Config +class Config extends ConsolidatedConfig { const CACHE_ID = 'integration'; diff --git a/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php b/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php index 411c81d75479c..00b78a47eb4b0 100644 --- a/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php +++ b/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php @@ -52,7 +52,6 @@ public function testLoadPartnersFromCache() ->with($serializedPartners) ->willReturn($partners); - $this->assertSame($partners, $this->cacheHelper->loadPartnersFromCache()); } From 8272e97e0c907d007c9737234b660ea1694e3438 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Thu, 20 Oct 2016 20:21:31 -0500 Subject: [PATCH 1521/3232] MAGETWO-58693: Refactor Module_Integration, Module_MarketPlace - blacklisted deprecated classes --- .../Magento/Test/Php/_files/phpcpd/blacklist/common.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 56e0d51516c26..19b152df88fdf 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -196,4 +196,6 @@ Magento/Framework/Mview/Config/Data Magento/Framework/View/File/Collector/Override Magento/Framework/MessageQueue/Consumer/Config/ConsumerConfigItem Magento/Framework/MessageQueue/Publisher/Config/PublisherConfigItem -Magento/Framework/MessageQueue/Topology/Config/ExchangeConfigItem \ No newline at end of file +Magento/Framework/MessageQueue/Topology/Config/ExchangeConfigItem +Magento/Integration/Model/Config +Magento/Integration/Model/IntegrationConfig From 09f3c9d2629b0b573b6fb03c4e9871d1ba998c5b Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Fri, 21 Oct 2016 10:50:03 -0500 Subject: [PATCH 1522/3232] MAGETWO-58693: Refactor Module_Integration, Module_MarketPlace - improved Copy-Paste static test to allow file names in the blacklist --- .../CodingStandard/Tool/CopyPasteDetector.php | 32 +++++++++++++------ .../Php/_files/phpcpd/blacklist/common.txt | 4 +-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php index b2d9c164fbd1b..b2766ebd90d92 100644 --- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php @@ -56,8 +56,7 @@ public function setBlackList(array $blackList) */ public function canRun() { - $vendorDir = require BP . '/app/etc/vendor_path.php'; - exec('php ' . BP . '/' . $vendorDir . '/bin/phpcpd --version', $output, $exitCode); + exec($this->getCommand() . ' --version', $output, $exitCode); return $exitCode === 0; } @@ -71,22 +70,37 @@ public function canRun() */ public function run(array $whiteList) { - $blackListStr = ' '; + $blacklistedDirs = []; + $blacklistedFileNames = []; foreach ($this->blacklist as $file) { $file = escapeshellarg(trim($file)); if (!$file) { continue; } - $blackListStr .= '--exclude ' . $file . ' '; + $ext = pathinfo($file, PATHINFO_EXTENSION); + if ($ext != '') { + $blacklistedFileNames[] = $file; + } else { + $blacklistedDirs[] = '--exclude ' . $file . ' '; + } } - $vendorDir = require BP . '/app/etc/vendor_path.php'; - $command = 'php ' . BP . '/' . $vendorDir . '/bin/phpcpd' . ' --log-pmd ' . escapeshellarg( - $this->reportFile - ) . ' --names-exclude "*Test.php" --min-lines 13' . $blackListStr . ' ' . implode(' ', $whiteList); - + $command = $this->getCommand() . ' --log-pmd ' . escapeshellarg($this->reportFile) + . ' --names-exclude ' . join(',', $blacklistedFileNames) . ' --min-lines 13 ' . join(' ', $blacklistedDirs) + . ' ' . implode(' ', $whiteList); exec($command, $output, $exitCode); return !(bool)$exitCode; } + + /** + * Get PHPCPD command + * + * @return string + */ + private function getCommand() + { + $vendorDir = require BP . '/app/etc/vendor_path.php'; + return 'php ' . BP . '/' . $vendorDir . '/bin/phpcpd'; + } } diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 19b152df88fdf..3afe3af79b14f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -197,5 +197,5 @@ Magento/Framework/View/File/Collector/Override Magento/Framework/MessageQueue/Consumer/Config/ConsumerConfigItem Magento/Framework/MessageQueue/Publisher/Config/PublisherConfigItem Magento/Framework/MessageQueue/Topology/Config/ExchangeConfigItem -Magento/Integration/Model/Config -Magento/Integration/Model/IntegrationConfig +IntegrationConfig.php +*Test.php From 9ba6fa8f6fa5c5580b56a4a82ba23930fc5de710 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Fri, 21 Oct 2016 15:54:22 -0500 Subject: [PATCH 1523/3232] MAGETWO-58693: Refactor Module_Integration, Module_MarketPlace - removed unnecessary inheritance --- app/code/Magento/Integration/Model/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Integration/Model/Config.php b/app/code/Magento/Integration/Model/Config.php index 37ed0e7b2fb61..3cea4d3374319 100644 --- a/app/code/Magento/Integration/Model/Config.php +++ b/app/code/Magento/Integration/Model/Config.php @@ -15,7 +15,7 @@ * This is a parent class for storing information about Integrations. * @deprecated */ -class Config extends ConsolidatedConfig +class Config { const CACHE_ID = 'integration'; From fa6501cf667a30d200d2e6b7c4b7a76ba81a1e51 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Mon, 24 Oct 2016 17:52:43 -0500 Subject: [PATCH 1524/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Introducing SerializerInterface --- app/code/Magento/Webapi/Model/Config.php | 19 +- .../Magento/Webapi/Model/ServiceMetadata.php | 39 +- .../Webapi/Test/Unit/Model/ConfigTest.php | 96 +++ .../Test/Unit/Model/ServiceMetadataTest.php | 591 +++++++++++------- .../Webapi/Model/ServiceMetadataTest.php | 250 ++++++++ 5 files changed, 769 insertions(+), 226 deletions(-) create mode 100644 app/code/Magento/Webapi/Test/Unit/Model/ConfigTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php diff --git a/app/code/Magento/Webapi/Model/Config.php b/app/code/Magento/Webapi/Model/Config.php index 45d29bc59cf0d..53bfda46eb495 100644 --- a/app/code/Magento/Webapi/Model/Config.php +++ b/app/code/Magento/Webapi/Model/Config.php @@ -8,6 +8,8 @@ use Magento\Webapi\Model\Cache\Type\Webapi as WebapiCache; use Magento\Webapi\Model\Config\Reader; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; /** * Web API Config Model. @@ -40,16 +42,25 @@ class Config */ protected $services; + /** + * @var SerializerInterface + */ + private $serializer; + /** * Initialize dependencies. * * @param WebapiCache $cache * @param Reader $configReader */ - public function __construct(WebapiCache $cache, Reader $configReader) - { + public function __construct( + WebapiCache $cache, + Reader $configReader, + SerializerInterface $serializer = null + ) { $this->cache = $cache; $this->configReader = $configReader; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -62,10 +73,10 @@ public function getServices() if (null === $this->services) { $services = $this->cache->load(self::CACHE_ID); if ($services && is_string($services)) { - $this->services = unserialize($services); + $this->services = $this->serializer->unserialize($services); } else { $this->services = $this->configReader->read(); - $this->cache->save(serialize($this->services), self::CACHE_ID); + $this->cache->save($this->serializer->serialize($this->services), self::CACHE_ID); } } return $this->services; diff --git a/app/code/Magento/Webapi/Model/ServiceMetadata.php b/app/code/Magento/Webapi/Model/ServiceMetadata.php index b75d10f9a271f..1b1eea3442a00 100644 --- a/app/code/Magento/Webapi/Model/ServiceMetadata.php +++ b/app/code/Magento/Webapi/Model/ServiceMetadata.php @@ -7,6 +7,8 @@ use Magento\Webapi\Model\Config\Converter; use Magento\Webapi\Model\Cache\Type\Webapi as WebApiCache; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; /** * Service Metadata Model @@ -74,6 +76,11 @@ class ServiceMetadata */ protected $typeProcessor; + /** + * @var SerializerInterface + */ + private $serializer; + /** * Initialize dependencies. * @@ -86,12 +93,14 @@ public function __construct( \Magento\Webapi\Model\Config $config, WebApiCache $cache, \Magento\Webapi\Model\Config\ClassReflector $classReflector, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor + \Magento\Framework\Reflection\TypeProcessor $typeProcessor, + SerializerInterface $serializer = null ) { $this->config = $config; $this->cache = $cache; $this->classReflector = $classReflector; $this->typeProcessor = $typeProcessor; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -142,12 +151,18 @@ public function getServicesConfig() $servicesConfig = $this->cache->load(self::SERVICES_CONFIG_CACHE_ID); $typesData = $this->cache->load(self::REFLECTED_TYPES_CACHE_ID); if ($servicesConfig && is_string($servicesConfig) && $typesData && is_string($typesData)) { - $this->services = unserialize($servicesConfig); - $this->typeProcessor->setTypesData(unserialize($typesData)); + $this->services = $this->serializer->unserialize($servicesConfig); + $this->typeProcessor->setTypesData($this->serializer->unserialize($typesData)); } else { $this->services = $this->initServicesMetadata(); - $this->cache->save(serialize($this->services), self::SERVICES_CONFIG_CACHE_ID); - $this->cache->save(serialize($this->typeProcessor->getTypesData()), self::REFLECTED_TYPES_CACHE_ID); + $this->cache->save( + $this->serializer->serialize($this->services), + self::SERVICES_CONFIG_CACHE_ID + ); + $this->cache->save( + $this->serializer->serialize($this->typeProcessor->getTypesData()), + self::REFLECTED_TYPES_CACHE_ID + ); } } return $this->services; @@ -256,12 +271,18 @@ public function getRoutesConfig() $routesConfig = $this->cache->load(self::ROUTES_CONFIG_CACHE_ID); $typesData = $this->cache->load(self::REFLECTED_TYPES_CACHE_ID); if ($routesConfig && is_string($routesConfig) && $typesData && is_string($typesData)) { - $this->routes = unserialize($routesConfig); - $this->typeProcessor->setTypesData(unserialize($typesData)); + $this->routes = $this->serializer->unserialize($routesConfig); + $this->typeProcessor->setTypesData($this->serializer->unserialize($typesData)); } else { $this->routes = $this->initRoutesMetadata(); - $this->cache->save(serialize($this->routes), self::ROUTES_CONFIG_CACHE_ID); - $this->cache->save(serialize($this->typeProcessor->getTypesData()), self::REFLECTED_TYPES_CACHE_ID); + $this->cache->save( + $this->serializer->serialize($this->routes), + self::ROUTES_CONFIG_CACHE_ID + ); + $this->cache->save( + $this->serializer->serialize($this->typeProcessor->getTypesData()), + self::REFLECTED_TYPES_CACHE_ID + ); } } return $this->routes; diff --git a/app/code/Magento/Webapi/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Webapi/Test/Unit/Model/ConfigTest.php new file mode 100644 index 0000000000000..74280f61916d7 --- /dev/null +++ b/app/code/Magento/Webapi/Test/Unit/Model/ConfigTest.php @@ -0,0 +1,96 @@ +webapiCacheMock = $this->getMock(\Magento\Webapi\Model\Cache\Type\Webapi::class, [], [], '', false); + $this->configReaderMock = $this->getMock(\Magento\Webapi\Model\Config\Reader::class, [], [], '', false); + $this->serializerMock = $this->getMock(SerializerInterface::class); + + $this->config = $objectManager->getObject( + Config::class, + [ + 'cache' => $this->webapiCacheMock, + 'configReader' => $this->configReaderMock, + 'serializer' => $this->serializerMock + ] + ); + } + + public function testGetServices() + { + $data = ['foo' => 'bar']; + $serializedData = 'serialized data'; + $this->webapiCacheMock->expects($this->once()) + ->method('load') + ->with(Config::CACHE_ID) + ->willReturn($serializedData); + $this->serializerMock->expects($this->once()) + ->method('unserialize') + ->with($serializedData) + ->willReturn($data); + $this->config->getServices(); + $this->assertEquals($data, $this->config->getServices()); + } + + public function testGetServicesNoCache() + { + $data = ['foo' => 'bar']; + $serializedData = 'serialized data'; + $this->webapiCacheMock->expects($this->once()) + ->method('load') + ->with(Config::CACHE_ID) + ->willReturn(false); + $this->serializerMock->expects($this->never()) + ->method('unserialize'); + $this->configReaderMock->expects($this->once()) + ->method('read') + ->willReturn($data); + $this->serializerMock->expects($this->once()) + ->method('serialize') + ->with($data) + ->willReturn($serializedData); + $this->webapiCacheMock->expects($this->once()) + ->method('save') + ->with( + $serializedData, + Config::CACHE_ID + ); + + $this->config->getServices(); + $this->assertEquals($data, $this->config->getServices()); + } +} diff --git a/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php b/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php index 29c1bf90402eb..7aa99a69c109a 100644 --- a/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php @@ -1,187 +1,444 @@ [ + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->configMock = $this->getMock(Config::class, [], [], '', false); + $this->cacheMock = $this->getMock(Webapi::class, [], [], '', false); + $this->classReflectorMock = $this->getMock(ClassReflector::class, [], [], '', false); + $this->typeProcessorMock = $this->getMock(TypeProcessor::class, [], [], '', false); + $this->serializerMock = $this->getMock(SerializerInterface::class); + + $this->serviceMetadata = $objectManager->getObject( + ServiceMetadata::class, + [ + 'config' => $this->configMock, + 'cache' => $this->cacheMock, + 'classReflector' => $this->classReflectorMock, + 'typeProcessor' => $this->typeProcessorMock, + 'serializer' => $this->serializerMock + ] + ); + } + + public function testGetServicesConfig() + { + $servicesConfig = ['foo' => 'bar']; + $typeData = ['bar' => 'foo']; + $serializedServicesConfig = 'serialized services config'; + $serializedTypeData = 'serialized type data'; + $this->cacheMock->expects($this->at(0)) + ->method('load') + ->with(ServiceMetadata::SERVICES_CONFIG_CACHE_ID) + ->willReturn($serializedServicesConfig); + $this->cacheMock->expects($this->at(1)) + ->method('load') + ->with(ServiceMetadata::REFLECTED_TYPES_CACHE_ID) + ->willReturn($serializedTypeData); + $this->serializerMock->expects($this->at(0)) + ->method('unserialize') + ->with($serializedServicesConfig) + ->willReturn($servicesConfig); + $this->serializerMock->expects($this->at(1)) + ->method('unserialize') + ->with($serializedTypeData) + ->willReturn($typeData); + $this->typeProcessorMock->expects($this->once()) + ->method('setTypesData') + ->with($typeData); + $this->serviceMetadata->getServicesConfig(); + $this->assertEquals($servicesConfig, $this->serviceMetadata->getServicesConfig()); + } + + public function testGetServicesConfigNoCache() + { + $servicesConfig = [ + 'services' => [ + CustomerRepositoryInterface::class => [ + 'V1' => [ + 'methods' => [ + 'getById' => [ + 'resources' => [ + [ + 'Magento_Customer::customer', + ] + ], + 'secure' => false + ] + ] + ] + ] + ] + ]; + $methodsReflectionData = [ + 'getById' => [ + 'documentation' => 'Get customer by customer ID.', 'interface' => [ 'in' => [ 'parameters' => [ 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%', - ], - 'requiredInputParameter' => [ + 'type' => 'int', 'required' => true, - ], - ], + 'documentation' => null + ] + ] ], 'out' => [ 'parameters' => [ - 'outputParameter' => [ - 'type' => 'string', + 'result' => [ + 'type' => 'CustomerDataCustomerInterface', + 'required' => true, + 'documentation' => null + ] + ] + ] + ] + ] + ]; + $servicesMetadata = [ + 'customerCustomerRepositoryV1' => [ + 'methods' => array_merge_recursive( + [ + 'getById' => [ + 'resources' => [ + [ + 'Magento_Customer::customer', + ], ], - ], + 'method' => 'getById', + 'inputRequired' => false, + 'isSecure' => false, + ] ], - ], - ], + $methodsReflectionData + ), + 'class' => CustomerRepositoryInterface::class, + 'description' => 'Customer CRUD interface.' + ] ]; - $classReflection = $this->getMock( - \Magento\Webapi\Model\Config\ClassReflector::class, - ['reflectClassMethods', 'extractClassDescription'], - [], - '', - false - ); - $classReflection->expects($this->any()) + $typeData = [ + 'CustomerDataCustomerInterface' => [ + 'documentation' => 'Customer interface.', + 'parameters' => [ + 'id' => [ + 'type' => 'int', + 'required' => false, + 'documentation' => 'Customer id' + ] + ] + ] + ]; + $serializedServicesConfig = 'serialized services config'; + $serializedTypeData = 'serialized type data'; + $this->cacheMock->expects($this->at(0)) + ->method('load') + ->with(ServiceMetadata::SERVICES_CONFIG_CACHE_ID) + ->willReturn(false); + $this->cacheMock->expects($this->at(1)) + ->method('load') + ->with(ServiceMetadata::REFLECTED_TYPES_CACHE_ID) + ->willReturn(false); + $this->serializerMock->expects($this->never()) + ->method('unserialize'); + $this->configMock->expects($this->once()) + ->method('getServices') + ->willReturn($servicesConfig); + $this->classReflectorMock->expects($this->once()) ->method('reflectClassMethods') - ->will($this->returnValue($interfaceParameters)); - $classReflection->expects($this->any()) + ->willReturn($methodsReflectionData); + $this->classReflectorMock->expects($this->once()) ->method('extractClassDescription') - ->will($this->returnValue('classDescription')); + ->with(CustomerRepositoryInterface::class) + ->willReturn('Customer CRUD interface.'); + $this->typeProcessorMock->expects($this->once()) + ->method('getTypesData') + ->willReturn($typeData); + $this->serializerMock->expects($this->at(0)) + ->method('serialize') + ->with($servicesMetadata) + ->willReturn($serializedServicesConfig); + $this->serializerMock->expects($this->at(1)) + ->method('serialize') + ->with($typeData) + ->willReturn($serializedTypeData); + $this->cacheMock->expects($this->at(2)) + ->method('save') + ->with( + $serializedServicesConfig, + ServiceMetadata::SERVICES_CONFIG_CACHE_ID + ); + $this->cacheMock->expects($this->at(3)) + ->method('save') + ->with( + $serializedTypeData, + ServiceMetadata::REFLECTED_TYPES_CACHE_ID + ); + $this->serviceMetadata->getServicesConfig(); + $this->assertEquals($servicesMetadata, $this->serviceMetadata->getServicesConfig()); + } + + public function testGetRoutesConfig() + { + $routesConfig = ['foo' => 'bar']; + $typeData = ['bar' => 'foo']; + $serializedRoutesConfig = 'serialized routes config'; + $serializedTypeData = 'serialized type data'; + $this->cacheMock->expects($this->at(0)) + ->method('load') + ->with(ServiceMetadata::ROUTES_CONFIG_CACHE_ID) + ->willReturn($serializedRoutesConfig); + $this->cacheMock->expects($this->at(1)) + ->method('load') + ->with(ServiceMetadata::REFLECTED_TYPES_CACHE_ID) + ->willReturn($serializedTypeData); + $this->serializerMock->expects($this->at(0)) + ->method('unserialize') + ->with($serializedRoutesConfig) + ->willReturn($routesConfig); + $this->serializerMock->expects($this->at(1)) + ->method('unserialize') + ->with($serializedTypeData) + ->willReturn($typeData); + $this->typeProcessorMock->expects($this->once()) + ->method('setTypesData') + ->with($typeData); + $this->serviceMetadata->getRoutesConfig(); + $this->assertEquals($routesConfig, $this->serviceMetadata->getRoutesConfig()); + } + public function testGetRoutesConfigNoCache() + { $servicesConfig = [ - 'services' => [\Magento\Customer\Api\AccountManagementInterface::class => [ - 'V1' => [ - 'methods' => [ - 'activateById' => [ - 'resources' => [ - [ - 'Magento_Customer::manage', - ], - ], - 'secure' => false, - ], - ], - ], - ], \Magento\Customer\Api\CustomerRepositoryInterface::class => [ + 'services' => [ + CustomerRepositoryInterface::class => [ 'V1' => [ 'methods' => [ 'getById' => [ 'resources' => [ [ 'Magento_Customer::customer', - ], + ] ], - 'secure' => false, - ], - ], - ], - ], + 'secure' => false + ] + ] + ] + ] ], 'routes' => [ - '/V1/customers/me/activate' => [ - 'PUT' => [ + '/V1/customers/:customerId' => [ + 'GET' => [ 'secure' => false, 'service' => [ - 'class' => \Magento\Customer\Api\AccountManagementInterface::class, - 'method' => 'activateById', + 'class' => CustomerRepositoryInterface::class, + 'method' => 'getById' ], 'resources' => [ - 'self' => true, + 'Magento_Customer::customer' => true ], + 'parameters' => [] + ] + ] + ], + 'class' => CustomerRepositoryInterface::class, + 'description' => 'Customer CRUD interface.', + ]; + $methodsReflectionData = [ + 'getById' => [ + 'documentation' => 'Get customer by customer ID.', + 'interface' => [ + 'in' => [ 'parameters' => [ 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%', - ], - ], + 'type' => 'int', + 'required' => true, + 'documentation' => null + ] + ] ], - ], - '/V1/customers/:customerId' => [ - 'GET' => [ - 'secure' => false, - 'service' => [ - 'class' => \Magento\Customer\Api\CustomerRepositoryInterface::class, - 'method' => 'getById', - ], - 'resources' => [ - 'Magento_Customer::customer' => true, - ], + 'out' => [ 'parameters' => [ - ], + 'result' => [ + 'type' => 'CustomerDataCustomerInterface', + 'required' => true, + 'documentation' => null + ] + ] + ] + ] + ] + ]; + $routesMetadata = [ + 'customerCustomerRepositoryV1' => [ + 'methods' => array_merge_recursive( + [ + 'getById' => [ + 'resources' => [ + [ + 'Magento_Customer::customer', + ] + ], + 'method' => 'getById', + 'inputRequired' => false, + 'isSecure' => false, + ] ], + $methodsReflectionData + ), + 'routes' => [ + '/V1/customers/:customerId' => [ + 'GET' => [ + 'method' => 'getById', + 'parameters' => [] + ] + ] ], + 'class' => CustomerRepositoryInterface::class, + 'description' => 'Customer CRUD interface.' ] ]; - - /** - * @var $cacheMock \Magento\Webapi\Model\Cache\Type\Webapi - */ - $cacheMock = $this->getMockBuilder(\Magento\Webapi\Model\Cache\Type\Webapi::class) - ->disableOriginalConstructor() - ->getMock(); - - /** @var $readerMock \Magento\Webapi\Model\Config\Reader */ - $readerMock = $this->getMockBuilder(\Magento\Webapi\Model\Config\Reader::class) - ->disableOriginalConstructor() - ->getMock(); - $readerMock->expects($this->any())->method('read')->will($this->returnValue($servicesConfig)); - - /** @var $config \Magento\Webapi\Model\Config */ - $config = new \Magento\Webapi\Model\Config($cacheMock, $readerMock); - - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $typeProcessor = $objectManager->getObject(\Magento\Framework\Reflection\TypeProcessor::class); - - /** @var $config \Magento\Webapi\Model\ServiceMetadata */ - $this->serviceMetadata = new \Magento\Webapi\Model\ServiceMetadata( - $config, - $cacheMock, - $classReflection, - $typeProcessor - ); - - parent::setUp(); + $typeData = [ + 'CustomerDataCustomerInterface' => [ + 'documentation' => 'Customer interface.', + 'parameters' => [ + 'id' => [ + 'type' => 'int', + 'required' => false, + 'documentation' => 'Customer id' + ] + ] + ] + ]; + $serializedRoutesConfig = 'serialized routes config'; + $serializedTypeData = 'serialized type data'; + $this->cacheMock->expects($this->at(0)) + ->method('load') + ->with(ServiceMetadata::ROUTES_CONFIG_CACHE_ID) + ->willReturn(false); + $this->cacheMock->expects($this->at(1)) + ->method('load') + ->with(ServiceMetadata::REFLECTED_TYPES_CACHE_ID) + ->willReturn(false); + $this->serializerMock->expects($this->never()) + ->method('unserialize'); + $this->configMock->expects($this->exactly(2)) + ->method('getServices') + ->willReturn($servicesConfig); + $this->classReflectorMock->expects($this->once()) + ->method('reflectClassMethods') + ->willReturn($methodsReflectionData); + $this->classReflectorMock->expects($this->once()) + ->method('extractClassDescription') + ->with(CustomerRepositoryInterface::class) + ->willReturn('Customer CRUD interface.'); + $this->typeProcessorMock->expects($this->exactly(2)) + ->method('getTypesData') + ->willReturn($typeData); + $this->serializerMock->expects($this->at(2)) + ->method('serialize') + ->with($routesMetadata) + ->willReturn($serializedRoutesConfig); + $this->serializerMock->expects($this->at(3)) + ->method('serialize') + ->with($typeData) + ->willReturn($serializedTypeData); + $this->cacheMock->expects($this->at(6)) + ->method('save') + ->with( + $serializedRoutesConfig, + ServiceMetadata::ROUTES_CONFIG_CACHE_ID + ); + $this->cacheMock->expects($this->at(7)) + ->method('save') + ->with( + $serializedTypeData, + ServiceMetadata::REFLECTED_TYPES_CACHE_ID + ); + $this->serviceMetadata->getRoutesConfig(); + $this->assertEquals($routesMetadata, $this->serviceMetadata->getRoutesConfig()); } /** - * Test identifying service name including subservices using class name. - * - * @dataProvider serviceNameDataProvider + * @dataProvider getServiceNameDataProvider */ public function testGetServiceName($className, $version, $preserveVersion, $expected) { - $actual = $this->serviceMetadata->getServiceName($className, $version, $preserveVersion); - $this->assertEquals($expected, $actual); + $this->assertEquals( + $expected, + $this->serviceMetadata->getServiceName($className, $version, $preserveVersion) + ); } /** - * Dataprovider for testGetServiceName - * * @return string */ - public function serviceNameDataProvider() + public function getServiceNameDataProvider() { return [ - [\Magento\Customer\Api\AccountManagementInterface::class, 'V1', false, 'customerAccountManagement'], - [\Magento\Customer\Api\AddressRepositoryInterface::class, 'V1', true, 'customerAddressRepositoryV1'], + [ + \Magento\Customer\Api\AccountManagementInterface::class, + 'V1', + false, + 'customerAccountManagement' + ], + [ + \Magento\Customer\Api\AddressRepositoryInterface::class, + 'V1', + true, + 'customerAddressRepositoryV1' + ], ]; } /** * @expectedException \InvalidArgumentException - * @dataProvider dataProviderForTestGetServiceNameInvalidName + * @dataProvider getServiceNameInvalidNameDataProvider */ public function testGetServiceNameInvalidName($interfaceClassName, $version) { @@ -189,111 +446,19 @@ public function testGetServiceNameInvalidName($interfaceClassName, $version) } /** - * Dataprovider for testGetServiceNameInvalidName - * * @return string */ - public function dataProviderForTestGetServiceNameInvalidName() + public function getServiceNameInvalidNameDataProvider() { return [ - ['BarV1Interface', 'V1'], // Missed vendor, module, 'Service' + ['BarV1Interface', 'V1'], // Missed vendor, module and Service ['Service\\V1Interface', 'V1'], // Missed vendor and module ['Magento\\Foo\\Service\\BarVxInterface', 'V1'], // Version number should be a number - ['Magento\\Foo\\Service\\BarInterface', 'V1'], // Version missed - ['Magento\\Foo\\Service\\BarV1', 'V1'], // 'Interface' missed - ['Foo\\Service\\BarV1Interface', 'V1'], // Module missed - ['Foo\\BarV1Interface', 'V1'] // Module and 'Service' missed - ]; - } - - public function testGetServiceMetadata() - { - $expectedResult = [ - 'methods' => [ - 'activateById' => [ - 'method' => 'activateById', - 'inputRequired' => '', - 'isSecure' => '', - 'resources' => [['Magento_Customer::manage']], - 'interface' => [ - 'in' => [ - 'parameters' => [ - 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%', - ], - 'requiredInputParameter' => [ - 'required' => true, - ], - ], - ], - 'out' => [ - 'parameters' => [ - 'outputParameter' => [ - 'type' => 'string', - ], - ], - ], - ], - ], - ], - 'class' => \Magento\Customer\Api\AccountManagementInterface::class, - 'description' => 'classDescription', + ['Magento\\Foo\\Service\\BarInterface', 'V1'], // Missed version + ['Magento\\Foo\\Service\\BarV1', 'V1'], // Missed Interface + ['Foo\\Service\\BarV1Interface', 'V1'], // Missed module + ['Foo\\BarV1Interface', 'V1'] // Missed module and Service ]; - $result = $this->serviceMetadata->getServiceMetadata('customerAccountManagementV1'); - $this->assertEquals($expectedResult, $result); } - public function testGetRouteMetadata() - { - $expectedResult = [ - 'methods' => [ - 'activateById' => [ - 'method' => 'activateById', - 'inputRequired' => '', - 'isSecure' => '', - 'resources' => [['Magento_Customer::manage']], - 'interface' => [ - 'in' => [ - 'parameters' => [ - 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%', - ], - 'requiredInputParameter' => [ - 'required' => true, - ], - ], - ], - 'out' => [ - 'parameters' => [ - 'outputParameter' => [ - 'type' => 'string', - ], - ], - ], - ], - ], - ], - 'class' => \Magento\Customer\Api\AccountManagementInterface::class, - 'description' => 'classDescription', - 'routes' => [ - '/V1/customers/me/activate' => [ - 'PUT' => [ - 'method' => 'activateById', - 'parameters' => [ - 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%' - ] - ] - ] - ] - ] - ]; - $result = $this->serviceMetadata->getRouteMetadata('customerAccountManagementV1'); - $this->assertEquals($expectedResult, $result); - } } - -require_once realpath(__DIR__ . '/../_files/test_interfaces.php'); diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php new file mode 100644 index 0000000000000..c74b0888d24d5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php @@ -0,0 +1,250 @@ + [ + 'interface' => [ + 'in' => [ + 'parameters' => [ + 'customerId' => [ + 'force' => true, + 'value' => '%customer_id%', + ], + 'requiredInputParameter' => [ + 'required' => true, + ], + ], + ], + 'out' => [ + 'parameters' => [ + 'outputParameter' => [ + 'type' => 'string', + ], + ], + ], + ], + ], + ]; + $classReflection = $this->getMock( + \Magento\Webapi\Model\Config\ClassReflector::class, + ['reflectClassMethods', 'extractClassDescription'], + [], + '', + false + ); + $classReflection->expects($this->any()) + ->method('reflectClassMethods') + ->will($this->returnValue($interfaceParameters)); + $classReflection->expects($this->any()) + ->method('extractClassDescription') + ->will($this->returnValue('classDescription')); + + $servicesConfig = [ + 'services' => [\Magento\Customer\Api\AccountManagementInterface::class => [ + 'V1' => [ + 'methods' => [ + 'activateById' => [ + 'resources' => [ + [ + 'Magento_Customer::manage', + ], + ], + 'secure' => false, + ], + ], + ], + ], \Magento\Customer\Api\CustomerRepositoryInterface::class => [ + 'V1' => [ + 'methods' => [ + 'getById' => [ + 'resources' => [ + [ + 'Magento_Customer::customer', + ], + ], + 'secure' => false, + ], + ], + ], + ], + ], + 'routes' => [ + '/V1/customers/me/activate' => [ + 'PUT' => [ + 'secure' => false, + 'service' => [ + 'class' => \Magento\Customer\Api\AccountManagementInterface::class, + 'method' => 'activateById', + ], + 'resources' => [ + 'self' => true, + ], + 'parameters' => [ + 'customerId' => [ + 'force' => true, + 'value' => '%customer_id%', + ], + ], + ], + ], + '/V1/customers/:customerId' => [ + 'GET' => [ + 'secure' => false, + 'service' => [ + 'class' => \Magento\Customer\Api\CustomerRepositoryInterface::class, + 'method' => 'getById', + ], + 'resources' => [ + 'Magento_Customer::customer' => true, + ], + 'parameters' => [ + ], + ], + ], + ] + ]; + + /** + * @var $cacheMock \Magento\Webapi\Model\Cache\Type\Webapi + */ + $cacheMock = $this->getMockBuilder(\Magento\Webapi\Model\Cache\Type\Webapi::class) + ->disableOriginalConstructor() + ->getMock(); + + /** @var $readerMock \Magento\Webapi\Model\Config\Reader */ + $readerMock = $this->getMockBuilder(\Magento\Webapi\Model\Config\Reader::class) + ->disableOriginalConstructor() + ->getMock(); + $readerMock->expects($this->any())->method('read')->will($this->returnValue($servicesConfig)); + + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** @var $config \Magento\Webapi\Model\Config */ + $config = $objectManager->create( + \Magento\Webapi\Model\Config::class, + [ + 'cache' => $cacheMock, + 'configReader' => $readerMock, + ] + ); + + $typeProcessor = $objectManager->create(\Magento\Framework\Reflection\TypeProcessor::class); + + /** @var $config \Magento\Webapi\Model\ServiceMetadata */ + $this->serviceMetadata = $objectManager->create( + \Magento\Webapi\Model\ServiceMetadata::class, + [ + 'config' => $config, + 'cache' => $cacheMock, + 'classReflector' => $classReflection, + 'typeProcessor' => $typeProcessor, + ] + ); + } + + public function testGetServiceMetadata() + { + $expectedResult = [ + 'methods' => [ + 'activateById' => [ + 'method' => 'activateById', + 'inputRequired' => '', + 'isSecure' => '', + 'resources' => [['Magento_Customer::manage']], + 'interface' => [ + 'in' => [ + 'parameters' => [ + 'customerId' => [ + 'force' => true, + 'value' => '%customer_id%', + ], + 'requiredInputParameter' => [ + 'required' => true, + ], + ], + ], + 'out' => [ + 'parameters' => [ + 'outputParameter' => [ + 'type' => 'string', + ], + ], + ], + ], + ], + ], + 'class' => \Magento\Customer\Api\AccountManagementInterface::class, + 'description' => 'classDescription', + ]; + $result = $this->serviceMetadata->getServiceMetadata('customerAccountManagementV1'); + $this->assertEquals($expectedResult, $result); + } + + public function testGetRouteMetadata() + { + $expectedResult = [ + 'methods' => [ + 'activateById' => [ + 'method' => 'activateById', + 'inputRequired' => '', + 'isSecure' => '', + 'resources' => [['Magento_Customer::manage']], + 'interface' => [ + 'in' => [ + 'parameters' => [ + 'customerId' => [ + 'force' => true, + 'value' => '%customer_id%', + ], + 'requiredInputParameter' => [ + 'required' => true, + ], + ], + ], + 'out' => [ + 'parameters' => [ + 'outputParameter' => [ + 'type' => 'string', + ], + ], + ], + ], + ], + ], + 'class' => \Magento\Customer\Api\AccountManagementInterface::class, + 'description' => 'classDescription', + 'routes' => [ + '/V1/customers/me/activate' => [ + 'PUT' => [ + 'method' => 'activateById', + 'parameters' => [ + 'customerId' => [ + 'force' => true, + 'value' => '%customer_id%' + ] + ] + ] + ] + ] + ]; + $result = $this->serviceMetadata->getRouteMetadata('customerAccountManagementV1'); + $this->assertEquals($expectedResult, $result); + } +} From 1eb7a9c8224b14be4950e0963fec3ebb05091dd7 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Mon, 24 Oct 2016 17:55:32 -0500 Subject: [PATCH 1525/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Introducing SerializerInterface --- app/code/Magento/Webapi/Model/Config.php | 1 + app/code/Magento/Webapi/Model/ServiceMetadata.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/code/Magento/Webapi/Model/Config.php b/app/code/Magento/Webapi/Model/Config.php index 53bfda46eb495..fb6dc894e3c0a 100644 --- a/app/code/Magento/Webapi/Model/Config.php +++ b/app/code/Magento/Webapi/Model/Config.php @@ -52,6 +52,7 @@ class Config * * @param WebapiCache $cache * @param Reader $configReader + * @param SerializerInterface|null $serializer */ public function __construct( WebapiCache $cache, diff --git a/app/code/Magento/Webapi/Model/ServiceMetadata.php b/app/code/Magento/Webapi/Model/ServiceMetadata.php index 1b1eea3442a00..14e45ccb409db 100644 --- a/app/code/Magento/Webapi/Model/ServiceMetadata.php +++ b/app/code/Magento/Webapi/Model/ServiceMetadata.php @@ -88,6 +88,7 @@ class ServiceMetadata * @param WebApiCache $cache * @param \Magento\Webapi\Model\Config\ClassReflector $classReflector * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor + * @param SerializerInterface|null $serializer */ public function __construct( \Magento\Webapi\Model\Config $config, From 8cfebabafc499366128f8a626cf42eae52c36e29 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Mon, 24 Oct 2016 19:26:02 -0500 Subject: [PATCH 1526/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Moving unit test to integration tests --- .../Test/Unit/_files/test_interfaces.php | 31 ------------- .../Magento/Webapi}/Model/Soap/ConfigTest.php | 43 +++++++++---------- 2 files changed, 21 insertions(+), 53 deletions(-) delete mode 100644 app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php rename {app/code/Magento/Webapi/Test/Unit => dev/tests/integration/testsuite/Magento/Webapi}/Model/Soap/ConfigTest.php (84%) diff --git a/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php b/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php deleted file mode 100644 index 288a747cefd89..0000000000000 --- a/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php +++ /dev/null @@ -1,31 +0,0 @@ -objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $typeProcessor = $this->objectManager->getObject(\Magento\Framework\Reflection\TypeProcessor::class); + $typeProcessor = $this->objectManager->create(\Magento\Framework\Reflection\TypeProcessor::class); $objectManagerMock = $this->getMockBuilder( \Magento\Framework\App\ObjectManager::class @@ -97,13 +95,17 @@ protected function setUp() $config = new \Magento\Webapi\Model\Config($cacheMock, $readerMock); /** @var $config \Magento\Webapi\Model\ServiceMetadata */ - $serviceMetadata = new \Magento\Webapi\Model\ServiceMetadata( - $config, - $cacheMock, - $classReflection, - $typeProcessor); + $serviceMetadata = $this->objectManager->create( + \Magento\Webapi\Model\ServiceMetadata::class, + [ + 'config' => $config, + 'cache' => $cacheMock, + 'classReflector' => $classReflection, + 'typeProcessor' => $typeProcessor + ] + ); - $this->_soapConfig = $this->objectManager->getObject( + $this->_soapConfig = $this->objectManager->create( \Magento\Webapi\Model\Soap\Config::class, [ 'objectManager' => $objectManagerMock, @@ -111,7 +113,6 @@ protected function setUp() 'serviceMetadata' => $serviceMetadata, ] ); - parent::setUp(); } public function testGetRequestedSoapServices() @@ -162,5 +163,3 @@ public function testGetSoapOperation() $this->assertEquals($expectedResult, $soapOperation); } } - -require_once realpath(__DIR__ . '/../../_files/test_interfaces.php'); From 83de1a1982d465b8af4d9b27e0a3df9e0d42f0c4 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Mon, 24 Oct 2016 19:23:39 -0500 Subject: [PATCH 1527/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Introducing SerializerInterface --- .../Test/Unit/_files/test_interfaces.php | 31 ------------- .../Magento/Webapi}/Model/Soap/ConfigTest.php | 43 +++++++++---------- 2 files changed, 21 insertions(+), 53 deletions(-) delete mode 100644 app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php rename {app/code/Magento/Webapi/Test/Unit => dev/tests/integration/testsuite/Magento/Webapi}/Model/Soap/ConfigTest.php (84%) diff --git a/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php b/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php deleted file mode 100644 index 288a747cefd89..0000000000000 --- a/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php +++ /dev/null @@ -1,31 +0,0 @@ -objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $typeProcessor = $this->objectManager->getObject(\Magento\Framework\Reflection\TypeProcessor::class); + $typeProcessor = $this->objectManager->create(\Magento\Framework\Reflection\TypeProcessor::class); $objectManagerMock = $this->getMockBuilder( \Magento\Framework\App\ObjectManager::class @@ -97,13 +95,17 @@ protected function setUp() $config = new \Magento\Webapi\Model\Config($cacheMock, $readerMock); /** @var $config \Magento\Webapi\Model\ServiceMetadata */ - $serviceMetadata = new \Magento\Webapi\Model\ServiceMetadata( - $config, - $cacheMock, - $classReflection, - $typeProcessor); + $serviceMetadata = $this->objectManager->create( + \Magento\Webapi\Model\ServiceMetadata::class, + [ + 'config' => $config, + 'cache' => $cacheMock, + 'classReflector' => $classReflection, + 'typeProcessor' => $typeProcessor + ] + ); - $this->_soapConfig = $this->objectManager->getObject( + $this->_soapConfig = $this->objectManager->create( \Magento\Webapi\Model\Soap\Config::class, [ 'objectManager' => $objectManagerMock, @@ -111,7 +113,6 @@ protected function setUp() 'serviceMetadata' => $serviceMetadata, ] ); - parent::setUp(); } public function testGetRequestedSoapServices() @@ -162,5 +163,3 @@ public function testGetSoapOperation() $this->assertEquals($expectedResult, $soapOperation); } } - -require_once realpath(__DIR__ . '/../../_files/test_interfaces.php'); From ed1b9c56bdca9aecd3f922ec7c1a6316ef1e6873 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Mon, 24 Oct 2016 19:37:17 -0500 Subject: [PATCH 1528/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Introducing SerializerInterface --- .../Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php b/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php index 7aa99a69c109a..4125f82b7923f 100644 --- a/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php @@ -96,6 +96,9 @@ public function testGetServicesConfig() $this->assertEquals($servicesConfig, $this->serviceMetadata->getServicesConfig()); } + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function testGetServicesConfigNoCache() { $servicesConfig = [ @@ -252,6 +255,9 @@ public function testGetRoutesConfig() $this->assertEquals($routesConfig, $this->serviceMetadata->getRoutesConfig()); } + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function testGetRoutesConfigNoCache() { $servicesConfig = [ @@ -460,5 +466,4 @@ public function getServiceNameInvalidNameDataProvider() ['Foo\\BarV1Interface', 'V1'] // Missed module and Service ]; } - } From 0e2beb8ad87785604c4676df791b85c41c5f49b2 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 25 Oct 2016 15:49:10 -0500 Subject: [PATCH 1529/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Refactoring integration tests --- .../Webapi/Model/ServiceMetadataTest.php | 261 +++++------------- .../Magento/Webapi/Model/Soap/ConfigTest.php | 203 ++++++-------- 2 files changed, 150 insertions(+), 314 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php index c74b0888d24d5..521e0b6fc7c3a 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php @@ -5,231 +5,116 @@ */ namespace Magento\Webapi\Model; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Webapi\Model\ServiceMetadata; +use Magento\Customer\Api\AccountManagementInterface; + class ServiceMetadataTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Webapi\Model\ServiceMetadata + * @var ServiceMetadata */ private $serviceMetadata; - /** - * Set up helper. - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ protected function setUp() { - $interfaceParameters = [ - 'activateById' => [ - 'interface' => [ - 'in' => [ - 'parameters' => [ - 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%', - ], - 'requiredInputParameter' => [ - 'required' => true, - ], - ], - ], - 'out' => [ - 'parameters' => [ - 'outputParameter' => [ - 'type' => 'string', - ], - ], - ], - ], - ], - ]; - $classReflection = $this->getMock( - \Magento\Webapi\Model\Config\ClassReflector::class, - ['reflectClassMethods', 'extractClassDescription'], - [], - '', - false - ); - $classReflection->expects($this->any()) - ->method('reflectClassMethods') - ->will($this->returnValue($interfaceParameters)); - $classReflection->expects($this->any()) - ->method('extractClassDescription') - ->will($this->returnValue('classDescription')); - - $servicesConfig = [ - 'services' => [\Magento\Customer\Api\AccountManagementInterface::class => [ - 'V1' => [ - 'methods' => [ - 'activateById' => [ - 'resources' => [ - [ - 'Magento_Customer::manage', - ], - ], - 'secure' => false, - ], - ], - ], - ], \Magento\Customer\Api\CustomerRepositoryInterface::class => [ - 'V1' => [ - 'methods' => [ - 'getById' => [ - 'resources' => [ - [ - 'Magento_Customer::customer', - ], - ], - 'secure' => false, - ], - ], - ], - ], - ], - 'routes' => [ - '/V1/customers/me/activate' => [ - 'PUT' => [ - 'secure' => false, - 'service' => [ - 'class' => \Magento\Customer\Api\AccountManagementInterface::class, - 'method' => 'activateById', - ], - 'resources' => [ - 'self' => true, - ], - 'parameters' => [ - 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%', - ], - ], - ], - ], - '/V1/customers/:customerId' => [ - 'GET' => [ - 'secure' => false, - 'service' => [ - 'class' => \Magento\Customer\Api\CustomerRepositoryInterface::class, - 'method' => 'getById', - ], - 'resources' => [ - 'Magento_Customer::customer' => true, - ], - 'parameters' => [ - ], - ], - ], - ] - ]; - - /** - * @var $cacheMock \Magento\Webapi\Model\Cache\Type\Webapi - */ - $cacheMock = $this->getMockBuilder(\Magento\Webapi\Model\Cache\Type\Webapi::class) - ->disableOriginalConstructor() - ->getMock(); - - /** @var $readerMock \Magento\Webapi\Model\Config\Reader */ - $readerMock = $this->getMockBuilder(\Magento\Webapi\Model\Config\Reader::class) - ->disableOriginalConstructor() - ->getMock(); - $readerMock->expects($this->any())->method('read')->will($this->returnValue($servicesConfig)); - - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - /** @var $config \Magento\Webapi\Model\Config */ - $config = $objectManager->create( - \Magento\Webapi\Model\Config::class, - [ - 'cache' => $cacheMock, - 'configReader' => $readerMock, - ] - ); - - $typeProcessor = $objectManager->create(\Magento\Framework\Reflection\TypeProcessor::class); - - /** @var $config \Magento\Webapi\Model\ServiceMetadata */ - $this->serviceMetadata = $objectManager->create( - \Magento\Webapi\Model\ServiceMetadata::class, - [ - 'config' => $config, - 'cache' => $cacheMock, - 'classReflector' => $classReflection, - 'typeProcessor' => $typeProcessor, - ] - ); + $objectManager = Bootstrap::getObjectManager(); + $this->serviceMetadata = $objectManager->create(ServiceMetadata::class); } public function testGetServiceMetadata() { - $expectedResult = [ + $expected = [ 'methods' => [ - 'activateById' => [ - 'method' => 'activateById', - 'inputRequired' => '', - 'isSecure' => '', - 'resources' => [['Magento_Customer::manage']], + 'activate' => [ + 'method' => 'activate', + 'inputRequired' => false, + 'isSecure' => false, + 'resources' => [ + 'Magento_Customer::manage' + ], + 'documentation' => 'Activate a customer account using a key that was sent in a confirmation email.', 'interface' => [ 'in' => [ 'parameters' => [ - 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%', - ], - 'requiredInputParameter' => [ + 'email' => [ + 'type' => 'string', 'required' => true, + 'documentation' => null ], - ], + 'confirmationKey' => [ + 'type' => 'string', + 'required' => true, + 'documentation' => null + ] + ] ], 'out' => [ 'parameters' => [ - 'outputParameter' => [ - 'type' => 'string', - ], + 'result' => [ + 'type' => 'CustomerDataCustomerInterface', + 'required' => true, + 'documentation' => '' + ] ], - ], - ], - ], + 'throws' => [ + '\Magento\Framework\Exception\LocalizedException' + ] + ] + ] + ] ], - 'class' => \Magento\Customer\Api\AccountManagementInterface::class, - 'description' => 'classDescription', + 'class' => AccountManagementInterface::class, + 'description' => 'Interface for managing customers accounts.', ]; - $result = $this->serviceMetadata->getServiceMetadata('customerAccountManagementV1'); - $this->assertEquals($expectedResult, $result); + $actual = $this->serviceMetadata->getServiceMetadata('customerAccountManagementV1'); + $this->assertEquals(array_replace_recursive($expected, $actual), $actual); } public function testGetRouteMetadata() { - $expectedResult = [ + $expected = [ 'methods' => [ - 'activateById' => [ - 'method' => 'activateById', - 'inputRequired' => '', - 'isSecure' => '', - 'resources' => [['Magento_Customer::manage']], + 'activate' => [ + 'method' => 'activate', + 'inputRequired' => false, + 'isSecure' => false, + 'resources' => [ + 'Magento_Customer::manage' + ], + 'documentation' => 'Activate a customer account using a key that was sent in a confirmation email.', 'interface' => [ 'in' => [ 'parameters' => [ - 'customerId' => [ - 'force' => true, - 'value' => '%customer_id%', - ], - 'requiredInputParameter' => [ + 'email' => [ + 'type' => 'string', 'required' => true, + 'documentation' => null ], - ], + 'confirmationKey' => [ + 'type' => 'string', + 'required' => true, + 'documentation' => null + ] + ] ], 'out' => [ 'parameters' => [ - 'outputParameter' => [ - 'type' => 'string', - ], + 'result' => [ + 'type' => 'CustomerDataCustomerInterface', + 'required' => true, + 'documentation' => '' + ] ], - ], - ], - ], + 'throws' => [ + '\Magento\Framework\Exception\LocalizedException' + ] + ] + ] + ] ], - 'class' => \Magento\Customer\Api\AccountManagementInterface::class, - 'description' => 'classDescription', + 'class' => AccountManagementInterface::class, + 'description' => 'Interface for managing customers accounts.', 'routes' => [ '/V1/customers/me/activate' => [ 'PUT' => [ @@ -244,7 +129,7 @@ public function testGetRouteMetadata() ] ] ]; - $result = $this->serviceMetadata->getRouteMetadata('customerAccountManagementV1'); - $this->assertEquals($expectedResult, $result); + $actual = $this->serviceMetadata->getRouteMetadata('customerAccountManagementV1'); + $this->assertEquals(array_replace_recursive($expected, $actual), $actual); } } diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index 74e6728fcee26..4ab3bccd42d95 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -5,161 +5,112 @@ */ namespace Magento\Webapi\Model\Soap; -// @codingStandardsIgnoreFile +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Webapi\Model\Soap\Config; +use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\Exception\LocalizedException; class ConfigTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Webapi\Model\Soap\Config + * @var Config */ - private $_soapConfig; + private $soapConfig; - /** - * @var \Magento\TestFramework\Helper\Bootstrap - */ - private $objectManager; - - /** - * Set up helper. - */ protected function setUp() { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - $typeProcessor = $this->objectManager->create(\Magento\Framework\Reflection\TypeProcessor::class); - - $objectManagerMock = $this->getMockBuilder( - \Magento\Framework\App\ObjectManager::class - )->disableOriginalConstructor()->getMock(); - - $classReflection = $this->getMock( - \Magento\Webapi\Model\Config\ClassReflector::class, - ['reflectClassMethods'], - ['_typeProcessor' => $typeProcessor], - '' - ); - $classReflection->expects($this->any())->method('reflectClassMethods')->will($this->returnValue([])); + $objectManager = Bootstrap::getObjectManager(); + $this->soapConfig = $objectManager->create(Config::class); + } - $servicesConfig = [ - 'services' => [\Magento\Customer\Api\AccountManagementInterface::class => [ - 'V1' => [ - 'methods' => [ - 'activate' => [ - 'resources' => [ - [ - 'Magento_Customer::manage', - ], - ], - 'secure' => false, - ], + public function testGetRequestedSoapServices() + { + $expected = [ + 'customerAccountManagementV1' => [ + 'methods' => [ + 'activate' => [ + 'method' => 'activate', + 'inputRequired' => false, + 'isSecure' => false, + 'resources' => [ + 'Magento_Customer::manage' ], - ], - ], \Magento\Customer\Api\CustomerRepositoryInterface::class => [ - 'V1' => [ - 'methods' => [ - 'getById' => [ - 'resources' => [ - [ - 'Magento_Customer::customer', + 'documentation' + => 'Activate a customer account using a key that was sent in a confirmation email.', + 'interface' => [ + 'in' => [ + 'parameters' => [ + 'email' => [ + 'type' => 'string', + 'required' => true, + 'documentation' => null ], - ], - 'secure' => false, + 'confirmationKey' => [ + 'type' => 'string', + 'required' => true, + 'documentation' => null + ] + ] ], - ], - ], + 'out' => [ + 'parameters' => [ + 'result' => [ + 'type' => 'CustomerDataCustomerInterface', + 'required' => true, + 'documentation' => null + ] + ], + 'throws' => [ + '\Magento\Framework\Exception\LocalizedException' + ] + ] + ] + ] ], - ], - ]; - - /** - * @var $registryMock \Magento\Framework\Registry - */ - $registryMock = $this->getMockBuilder(\Magento\Framework\Registry::class) - ->disableOriginalConstructor() - ->getMock(); - - /** - * @var $cacheMock \Magento\Webapi\Model\Cache\Type\Webapi - */ - $cacheMock = $this->getMockBuilder(\Magento\Webapi\Model\Cache\Type\Webapi::class) - ->disableOriginalConstructor() - ->getMock(); - - /** @var $readerMock \Magento\Webapi\Model\Config\Reader */ - $readerMock = $this->getMockBuilder(\Magento\Webapi\Model\Config\Reader::class) - ->disableOriginalConstructor() - ->getMock(); - $readerMock->expects($this->any())->method('read')->will($this->returnValue($servicesConfig)); - - /** @var $config \Magento\Webapi\Model\Config */ - $config = new \Magento\Webapi\Model\Config($cacheMock, $readerMock); - - /** @var $config \Magento\Webapi\Model\ServiceMetadata */ - $serviceMetadata = $this->objectManager->create( - \Magento\Webapi\Model\ServiceMetadata::class, - [ - 'config' => $config, - 'cache' => $cacheMock, - 'classReflector' => $classReflection, - 'typeProcessor' => $typeProcessor + 'class' => AccountManagementInterface::class, + 'description' => 'Interface for managing customers accounts.', ] - ); - - $this->_soapConfig = $this->objectManager->create( - \Magento\Webapi\Model\Soap\Config::class, + ]; + $actual = $this->soapConfig->getRequestedSoapServices( [ - 'objectManager' => $objectManagerMock, - 'registry' => $registryMock, - 'serviceMetadata' => $serviceMetadata, + 'customerAccountManagementV1', + 'NonExistentService' ] ); - } - - public function testGetRequestedSoapServices() - { - $expectedResult = [ - 'customerAccountManagementV1' => - [ - 'methods' => [ - 'activate' => [ - 'method' => 'activate', - 'inputRequired' => '', - 'isSecure' => '', - 'resources' => [['Magento_Customer::manage']], - ], - ], - 'class' => \Magento\Customer\Api\AccountManagementInterface::class, - 'description' => 'Interface for managing customers accounts.', - ], - ]; - - $result = $this->_soapConfig->getRequestedSoapServices( - ['customerAccountManagementV1', 'moduleBarV2', 'moduleBazV1'] - ); - - $this->assertEquals($expectedResult, $result); + $this->assertEquals(array_replace_recursive($expected, $actual), $actual); } public function testGetServiceMethodInfo() { - $expectedResult = [ - 'class' => \Magento\Customer\Api\CustomerRepositoryInterface::class, + $expected = [ + 'class' => CustomerRepositoryInterface::class, 'method' => 'getById', 'isSecure' => false, - 'resources' => [['Magento_Customer::customer']], + 'resources' => [ + 'Magento_Customer::customer', + 'self' + ], ]; - $methodInfo = $this->_soapConfig->getServiceMethodInfo( + $actual = $this->soapConfig->getServiceMethodInfo( 'customerCustomerRepositoryV1GetById', - ['customerCustomerRepositoryV1', 'moduleBazV1'] + [ + 'customerCustomerRepositoryV1', + 'NonExistentService' + ] ); - $this->assertEquals($expectedResult, $methodInfo); + $this->assertEquals($expected, $actual); } public function testGetSoapOperation() { - $expectedResult = 'customerAccountManagementV1Activate'; - $soapOperation = $this->_soapConfig - ->getSoapOperation(\Magento\Customer\Api\AccountManagementInterface::class, 'activate', 'V1'); - $this->assertEquals($expectedResult, $soapOperation); + $expected = 'customerAccountManagementV1Activate'; + $actual = $this->soapConfig + ->getSoapOperation( + AccountManagementInterface::class, + 'activate', + 'V1' + ); + $this->assertEquals($expected, $actual); } } From 2e9233b3ea266516a5b7a7817bfcc6e36006ed91 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 25 Oct 2016 15:54:09 -0500 Subject: [PATCH 1530/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Refactoring integration tests --- .../testsuite/Magento/Webapi/Model/ServiceMetadataTest.php | 6 +++--- .../testsuite/Magento/Webapi/Model/Soap/ConfigTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php index 521e0b6fc7c3a..78748e84c1131 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php @@ -11,7 +11,7 @@ class ServiceMetadataTest extends \PHPUnit_Framework_TestCase { - /** + /**bootstrap.sh * @var ServiceMetadata */ private $serviceMetadata; @@ -68,7 +68,7 @@ public function testGetServiceMetadata() 'description' => 'Interface for managing customers accounts.', ]; $actual = $this->serviceMetadata->getServiceMetadata('customerAccountManagementV1'); - $this->assertEquals(array_replace_recursive($expected, $actual), $actual); + $this->assertEquals(array_replace_recursive($actual, $expected), $actual); } public function testGetRouteMetadata() @@ -130,6 +130,6 @@ public function testGetRouteMetadata() ] ]; $actual = $this->serviceMetadata->getRouteMetadata('customerAccountManagementV1'); - $this->assertEquals(array_replace_recursive($expected, $actual), $actual); + $this->assertEquals(array_replace_recursive($actual, $expected), $actual); } } diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index 4ab3bccd42d95..9625803339fa6 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -78,7 +78,7 @@ public function testGetRequestedSoapServices() 'NonExistentService' ] ); - $this->assertEquals(array_replace_recursive($expected, $actual), $actual); + $this->assertEquals(array_replace_recursive($actual, $expected), $actual); } public function testGetServiceMethodInfo() From 2bb4c834d5d9fe1a9f8bef3c06b9cf3d27e65214 Mon Sep 17 00:00:00 2001 From: Joan He Date: Thu, 27 Oct 2016 14:44:32 -0500 Subject: [PATCH 1531/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Refactoring integration tests --- .../testsuite/Magento/Webapi/Model/ServiceMetadataTest.php | 4 ++-- .../testsuite/Magento/Webapi/Model/Soap/ConfigTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php index 78748e84c1131..37bbd10363ef5 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php @@ -58,7 +58,7 @@ public function testGetServiceMetadata() ] ], 'throws' => [ - '\Magento\Framework\Exception\LocalizedException' + \Magento\Framework\Exception\LocalizedException::class ] ] ] @@ -107,7 +107,7 @@ public function testGetRouteMetadata() ] ], 'throws' => [ - '\Magento\Framework\Exception\LocalizedException' + \Magento\Framework\Exception\LocalizedException::class ] ] ] diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index 9625803339fa6..8b016fe35fc95 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -62,7 +62,7 @@ public function testGetRequestedSoapServices() ] ], 'throws' => [ - '\Magento\Framework\Exception\LocalizedException' + \Magento\Framework\Exception\LocalizedException::class ] ] ] From 4c31f32033238aca4434c7f018188d55abeb598e Mon Sep 17 00:00:00 2001 From: Joan He Date: Thu, 27 Oct 2016 17:02:18 -0500 Subject: [PATCH 1532/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Refactoring integration tests --- .../testsuite/Magento/Webapi/Model/ServiceMetadataTest.php | 5 ++--- .../testsuite/Magento/Webapi/Model/Soap/ConfigTest.php | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php index 37bbd10363ef5..7bfbe08a34a09 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php @@ -6,7 +6,6 @@ namespace Magento\Webapi\Model; use Magento\TestFramework\Helper\Bootstrap; -use Magento\Webapi\Model\ServiceMetadata; use Magento\Customer\Api\AccountManagementInterface; class ServiceMetadataTest extends \PHPUnit_Framework_TestCase @@ -58,7 +57,7 @@ public function testGetServiceMetadata() ] ], 'throws' => [ - \Magento\Framework\Exception\LocalizedException::class + "\\Magento\\Framework\\Exception\\LocalizedException" ] ] ] @@ -107,7 +106,7 @@ public function testGetRouteMetadata() ] ], 'throws' => [ - \Magento\Framework\Exception\LocalizedException::class + "\\Magento\\Framework\\Exception\\LocalizedException" ] ] ] diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index 8b016fe35fc95..95743e9e10537 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -6,10 +6,8 @@ namespace Magento\Webapi\Model\Soap; use Magento\TestFramework\Helper\Bootstrap; -use Magento\Webapi\Model\Soap\Config; use Magento\Customer\Api\AccountManagementInterface; use Magento\Customer\Api\CustomerRepositoryInterface; -use Magento\Framework\Exception\LocalizedException; class ConfigTest extends \PHPUnit_Framework_TestCase { @@ -62,7 +60,7 @@ public function testGetRequestedSoapServices() ] ], 'throws' => [ - \Magento\Framework\Exception\LocalizedException::class + "\\Magento\\Framework\\Exception\\LocalizedException" ] ] ] From 79be4b306f8f0059cbdba455f293978c9f67a495 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 27 Oct 2016 16:45:43 -0500 Subject: [PATCH 1533/3232] MAGETWO-59440: Refactor Module_Eav Introducing SerializerInterface --- app/code/Magento/Eav/Model/Config.php | 23 +- .../ResourceModel/Entity/Attribute/Set.php | 31 ++- .../Model/ResourceModel/Entity/Attribute.php | 63 ++++-- .../Eav/Test/Unit/Model/ConfigTest.php | 204 +++++++++++++++--- .../Entity/Attribute/SetTest.php | 141 ++++++------ .../ResourceModel/Entity/AttributeTest.php | 197 +++++++++++------ .../Magento/Eav/Model/ConfigTest.php | 49 +++++ 7 files changed, 503 insertions(+), 205 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php index 36be7733dcd75..89d0bc93c8007 100644 --- a/app/code/Magento/Eav/Model/Config.php +++ b/app/code/Magento/Eav/Model/Config.php @@ -6,6 +6,8 @@ namespace Magento\Eav\Model; use Magento\Eav\Model\Entity\Type; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\App\ObjectManager; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -92,6 +94,11 @@ class Config */ protected $_universalFactory; + /** + * @var SerializerInterface + */ + private $serializer; + /** * @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory @@ -105,13 +112,15 @@ public function __construct( \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory, \Magento\Eav\Model\ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory, \Magento\Framework\App\Cache\StateInterface $cacheState, - \Magento\Framework\Validator\UniversalFactory $universalFactory + \Magento\Framework\Validator\UniversalFactory $universalFactory, + SerializerInterface $serializer = null ) { $this->_cache = $cache; $this->_entityTypeFactory = $entityTypeFactory; $this->entityTypeCollectionFactory = $entityTypeCollectionFactory; $this->_cacheState = $cacheState; $this->_universalFactory = $universalFactory; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -278,7 +287,7 @@ protected function _initEntityTypes() \Magento\Framework\Profiler::start('EAV: ' . __METHOD__, ['group' => 'EAV', 'method' => __METHOD__]); if ($this->isCacheEnabled() && ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))) { - $this->_entityTypeData = unserialize($cache); + $this->_entityTypeData = $this->serializer->unserialize($cache); foreach ($this->_entityTypeData as $typeCode => $data) { $typeId = $data['entity_type_id']; $this->_addEntityTypeReference($typeId, $typeCode); @@ -302,7 +311,7 @@ protected function _initEntityTypes() if ($this->isCacheEnabled()) { $this->_cache->save( - serialize($this->_entityTypeData), + $this->serializer->serialize($this->_entityTypeData), self::ENTITIES_CACHE_ID, [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, @@ -372,7 +381,7 @@ protected function _initAttributes($entityType) } $cacheKey = self::ATTRIBUTES_CACHE_ID . $entityTypeCode; if ($this->isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) { - $attributes = unserialize($attributes); + $attributes = $this->serializer->unserialize($attributes); if ($attributes) { foreach ($attributes as $attribute) { $this->_createAttribute($entityType, $attribute); @@ -402,7 +411,7 @@ protected function _initAttributes($entityType) } if ($this->isCacheEnabled()) { $this->_cache->save( - serialize($this->_attributeData[$entityTypeCode]), + $this->serializer->serialize($this->_attributeData[$entityTypeCode]), $cacheKey, [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, @@ -487,7 +496,7 @@ public function getEntityAttributeCodes($entityType, $object = null) } if ($this->isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) { - $this->_attributeCodes[$cacheKey] = unserialize($attributes); + $this->_attributeCodes[$cacheKey] = $this->serializer->unserialize($attributes); return $this->_attributeCodes[$cacheKey]; } @@ -514,7 +523,7 @@ public function getEntityAttributeCodes($entityType, $object = null) $this->_attributeCodes[$cacheKey] = $attributes; if ($this->isCacheEnabled()) { $this->_cache->save( - serialize($attributes), + $this->serializer->serialize($attributes), $cacheKey, [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php index 4e6e45f5d2270..b3e7bf2bc3925 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php @@ -5,11 +5,8 @@ */ namespace Magento\Eav\Model\ResourceModel\Entity\Attribute; -/** - * Eav attribute set resource model - * - * @author Magento Core Team - */ +use Magento\Framework\Serialize\SerializerInterface; + class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { /** @@ -27,6 +24,11 @@ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb */ protected $eavConfig; + /** + * @var SerializerInterface + */ + private $serializer; + /** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param GroupFactory $attrGroupFactory @@ -152,7 +154,7 @@ public function getSetInfo(array $attributeIds, $setId = null) $cacheKey = self::ATTRIBUTES_CACHE_ID . $setId; if ($this->eavConfig->isCacheEnabled() && ($cache = $this->eavConfig->getCache()->load($cacheKey))) { - $setInfoData = unserialize($cache); + $setInfoData = $this->getSerializer()->unserialize($cache); } else { $attributeSetData = $this->fetchAttributeSetData($setId); @@ -168,7 +170,7 @@ public function getSetInfo(array $attributeIds, $setId = null) if ($this->eavConfig->isCacheEnabled()) { $this->eavConfig->getCache()->save( - serialize($setInfoData), + $this->getSerializer()->serialize($setInfoData), $cacheKey, [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, @@ -233,4 +235,19 @@ protected function fetchAttributeSetData($setId = null) } return $connection->fetchAll($select, $bind); } + + /** + * Get serializer + * + * @return SerializerInterface + * @deprecated + */ + private function getSerializer() + { + if (null === $this->serializer) { + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() + ->get(SerializerInterface::class); + } + return $this->serializer; + } } diff --git a/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php b/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php index c76449b1223ed..3452d452ac490 100644 --- a/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php +++ b/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php @@ -5,6 +5,13 @@ */ namespace Magento\Eav\Plugin\Model\ResourceModel\Entity; +use Magento\Framework\App\CacheInterface; +use Magento\Framework\App\Cache\StateInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Eav\Model\ResourceModel\Entity\Attribute as AttributeResource; +use Magento\Eav\Model\Cache\Type; +use Magento\Eav\Model\Entity\Attribute as EntityAttribute; + class Attribute { /** @@ -12,52 +19,74 @@ class Attribute */ const STORE_LABEL_ATTRIBUTE = 'EAV_STORE_LABEL_ATTRIBUTE'; - /** @var \Magento\Framework\App\CacheInterface */ - protected $cache; + /** + * @var CacheInterface + */ + private $cache; + + /** + * @var StateInterface + */ + private $cacheState; - /** @var bool|null */ - protected $isCacheEnabled = null; + /** + * @var SerializerInterface + */ + private $serializer; /** - * @param \Magento\Framework\App\CacheInterface $cache - * @param \Magento\Framework\App\Cache\StateInterface $cacheState + * @param CacheInterface $cache + * @param StateInterface $cacheState + * @param SerializerInterface $serializer * @codeCoverageIgnore */ public function __construct( - \Magento\Framework\App\CacheInterface $cache, - \Magento\Framework\App\Cache\StateInterface $cacheState + CacheInterface $cache, + StateInterface $cacheState, + SerializerInterface $serializer ) { $this->cache = $cache; - $this->isCacheEnabled = $cacheState->isEnabled(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER); + $this->serializer = $serializer; + $this->cacheState = $cacheState;; } /** - * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute $subject + * @param AttributeResource $subject * @param callable $proceed * @param int $attributeId * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundGetStoreLabelsByAttributeId( - \Magento\Eav\Model\ResourceModel\Entity\Attribute $subject, + AttributeResource $subject, \Closure $proceed, $attributeId ) { $cacheId = self::STORE_LABEL_ATTRIBUTE . $attributeId; - if ($this->isCacheEnabled && ($storeLabels = $this->cache->load($cacheId))) { - return unserialize($storeLabels); + if ($this->isCacheEnabled() && ($storeLabels = $this->cache->load($cacheId))) { + return $this->serializer->unserialize($storeLabels); } $storeLabels = $proceed($attributeId); - if ($this->isCacheEnabled) { + if ($this->isCacheEnabled()) { $this->cache->save( - serialize($storeLabels), + $this->serializer->serialize($storeLabels), $cacheId, [ - \Magento\Eav\Model\Cache\Type::CACHE_TAG, - \Magento\Eav\Model\Entity\Attribute::CACHE_TAG + Type::CACHE_TAG, + EntityAttribute::CACHE_TAG ] ); } return $storeLabels; } + + /** + * Check if cache is enabled + * + * @return bool + */ + private function isCacheEnabled() + { + return $this->cacheState->isEnabled(Type::TYPE_IDENTIFIER); + } } diff --git a/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php index f5fad571f205c..ff1e186de604a 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php @@ -3,11 +3,15 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Eav\Test\Unit\Model; use Magento\Framework\DataObject; use Magento\Eav\Model\Config; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Eav\Model\Entity\Type; +use Magento\Eav\Model\Cache\Type as Cache; +use Magento\Eav\Model\Entity\Attribute; +use Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection; class ConfigTest extends \PHPUnit_Framework_TestCase { @@ -34,19 +38,26 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Framework\App\Cache\StateInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $stateMock; + protected $cacheStateMock; /** * @var \Magento\Framework\Validator\UniversalFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $universalFactoryMock; + /** + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializerMock; + + /** + * @var Type|\PHPUnit_Framework_MockObject_MockObject + */ + private $typeMock; + protected function setUp() { - $this->cacheMock = $this->getMockBuilder(\Magento\Framework\App\CacheInterface::class) - ->disableOriginalConstructor() - ->setMethods(['load', 'getFrontend', 'save', 'remove', 'clean']) - ->getMock(); + $this->cacheMock = $this->getMock(\Magento\Framework\App\CacheInterface::class); $this->typeFactoryMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\TypeFactory::class) ->setMethods(['create']) ->disableOriginalConstructor() @@ -56,35 +67,44 @@ protected function setUp() ->setMethods(['create']) ->disableOriginalConstructor() ->getMock(); - $this->stateMock = $this->getMockBuilder(\Magento\Framework\App\Cache\StateInterface::class) - ->setMethods(['isEnabled', 'setEnabled', 'persist']) - ->disableOriginalConstructor() - ->getMock(); + $this->cacheStateMock = $this->getMock(\Magento\Framework\App\Cache\StateInterface::class); $this->universalFactoryMock = $this->getMockBuilder(\Magento\Framework\Validator\UniversalFactory::class) ->setMethods(['create']) ->disableOriginalConstructor() ->getMock(); + $this->serializerMock = $this->getMock(SerializerInterface::class); + + $this->typeMock = $this->getMock(Type::class, [], [], '', false); + $this->config = new Config( $this->cacheMock, $this->typeFactoryMock, $this->collectionFactoryMock, - $this->stateMock, - $this->universalFactoryMock + $this->cacheStateMock, + $this->universalFactoryMock, + $this->serializerMock ); } /** * @param boolean $cacheEnabled * @param int $loadCalls - * @param string $cachedValue + * @param int $cachedValue + * @param int $unserializeCalls * @dataProvider getAttributeCacheDataProvider * @return void */ - public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue) + public function testGetAttributeCache($cacheEnabled, $loadCalls, $unserializeCalls, $cachedValue) { + $attributeData = [ + [ + 'attribute_code' => 'attribute_code_1', + 'attribute_id' => 1 + ] + ]; $attributeCollectionMock = $this->getMockBuilder( - \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::class + Collection::class )->disableOriginalConstructor() ->setMethods(['getData', 'setEntityTypeFilter']) ->getMock(); @@ -96,29 +116,40 @@ public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue) ->expects($this->any()) ->method('getData') ->willReturn([]); - $entityAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class) + $entityAttributeMock = $this->getMockBuilder(Attribute::class) ->setMethods(['setData']) ->disableOriginalConstructor() ->getMock(); $factoryCalls = [ - [\Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::class, [], $attributeCollectionMock], - [\Magento\Eav\Model\Entity\Attribute::class, [], $entityAttributeMock], + [ + Collection::class, + [], + $attributeCollectionMock + ], + [ + Attribute::class, + [], + $entityAttributeMock + ], ]; - $this->stateMock + $this->cacheStateMock ->expects($this->atLeastOnce()) ->method('isEnabled') - ->with(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER) + ->with(Cache::TYPE_IDENTIFIER) ->willReturn($cacheEnabled); $this->cacheMock ->expects($this->exactly($loadCalls)) ->method('load') ->with(Config::ATTRIBUTES_CACHE_ID) ->willReturn($cachedValue); + $this->serializerMock + ->expects($this->exactly($unserializeCalls)) + ->method('unserialize') + ->with($cachedValue) + ->willReturn($attributeData); - $collectionStub = new DataObject([ - ['entity_type_code' => 'type_code_1', 'entity_type_id' => 1], - ]); + $collectionStub = new DataObject([$attributeData]); $this->collectionFactoryMock ->expects($this->any()) ->method('create') @@ -134,7 +165,7 @@ public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue) ->method('create') ->will($this->returnValueMap($factoryCalls)); - $entityType = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class) + $entityType = $this->getMockBuilder(Type::class) ->setMethods(['getEntity', 'setData', 'getData']) ->disableOriginalConstructor() ->getMock(); @@ -151,38 +182,145 @@ public function getAttributeCacheDataProvider() 'cache-disabled' => [ false, 0, + 0, false, ], 'cache-miss' => [ true, 1, + 0, false, ], 'cached' => [ true, 1, - serialize( - [ - ['attribute_code' => 'attribute_code_1', 'attribute_id' => 1], - ] - ), + 1, + 'attribute serialzied data', ], ]; } public function testClear() { - $this->cacheMock - ->expects($this->once()) + $this->cacheMock->expects($this->once()) ->method('clean') ->with( $this->equalTo( [ - \Magento\Eav\Model\Cache\Type::CACHE_TAG, - \Magento\Eav\Model\Entity\Attribute::CACHE_TAG, + Cache::CACHE_TAG, + Attribute::CACHE_TAG, ] ) ); $this->config->clear(); } + + public function testGetEntityTypeInstanceOfTypePassed() + { + $this->assertEquals( + $this->typeMock, + $this->config->getEntityType($this->typeMock) + ); + } + + public function testGetEntityTypeCacheExists() + { + $entityTypeCode = 'catalog_product'; + $data = [ + $entityTypeCode => [ + 'entity_type_id' => 1 + ] + ]; + $serializedData = 'serialized data'; + $this->cacheStateMock->expects($this->once()) + ->method('isEnabled') + ->with(Cache::TYPE_IDENTIFIER) + ->willReturn(true); + $this->cacheMock->expects($this->once()) + ->method('load') + ->with(Config::ENTITIES_CACHE_ID) + ->willReturn($serializedData); + $this->serializerMock->expects($this->once()) + ->method('unserialize') + ->with($serializedData) + ->willReturn($data); + $this->typeMock->expects($this->exactly(2)) + ->method('getId') + ->willReturn($data[$entityTypeCode]['entity_type_id']); + $this->typeMock->expects($this->once()) + ->method('getEntityTypeCode') + ->willReturn($entityTypeCode); + $this->typeFactoryMock->expects($this->once()) + ->method('create') + ->with(['data' => $data[$entityTypeCode]]) + ->willReturn($this->typeMock); + $this->assertInstanceOf( + Type::class, + $this->config->getEntityType($entityTypeCode) + ); + } + + public function testGetEntityTypeCacheDoesNotExist() + { + $entityTypeCode = 'catalog_product'; + $collectionData = [ + [ + 'entity_type_id' => 1, + 'entity_type_code' => $entityTypeCode + ] + ]; + $data = [ + $entityTypeCode => [ + 'entity_type_id' => 1, + 'entity_type_code' => $entityTypeCode, + 'attribute_model' => Attribute::class + ] + ]; + $serializedData = 'serialized data'; + $this->cacheStateMock->expects($this->once()) + ->method('isEnabled') + ->with(Cache::TYPE_IDENTIFIER) + ->willReturn(true); + $this->cacheMock->expects($this->once()) + ->method('load') + ->with(Config::ENTITIES_CACHE_ID) + ->willReturn(false); + $this->serializerMock->expects($this->never()) + ->method('unserialize'); + $attributeCollectionMock = $this->getMock(Collection::class, [], [], '', false); + $this->collectionFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($attributeCollectionMock); + $attributeCollectionMock->expects($this->once()) + ->method('getData') + ->willReturn($collectionData); + $this->serializerMock->expects($this->once()) + ->method('serialize') + ->with($data) + ->willReturn($serializedData); + $this->cacheMock->expects($this->once()) + ->method('save') + ->with( + $serializedData, + Config::ENTITIES_CACHE_ID, + [ + Cache::CACHE_TAG, + Attribute::CACHE_TAG + ] + ); + $this->typeMock->expects($this->exactly(2)) + ->method('getId') + ->willReturn($data[$entityTypeCode]['entity_type_id']); + $this->typeMock->expects($this->once()) + ->method('getEntityTypeCode') + ->willReturn($entityTypeCode); + $this->typeFactoryMock->expects($this->once()) + ->method('create') + ->with(['data' => $data[$entityTypeCode]]) + ->willReturn($this->typeMock); + $this->assertInstanceOf( + Type::class, + $this->config->getEntityType($entityTypeCode) + ); + } } diff --git a/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php b/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php index a380b14595eb2..e00a8ee97648c 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php @@ -1,14 +1,14 @@ resourceMock = $this->getMockBuilder(\Magento\Framework\App\ResourceConnection::class) ->disableOriginalConstructor() ->setMethods(['getConnection', 'getTableName']) @@ -81,31 +87,28 @@ protected function setUp() ->setMethods(['isCacheEnabled', 'getEntityType', 'getCache']) ->disableOriginalConstructor() ->getMock(); - $this->model = $this->getMock( + + $this->serializerMock = $this->getMock(SerializerInterface::class); + + $attributeGroupFactoryMock = $this->getMock( + \Magento\Eav\Model\ResourceModel\Entity\Attribute\GroupFactory::class, + [], + [], + '', + false + ); + + $this->model = $objectManager->getObject( \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set::class, [ - 'beginTransaction', - 'getMainTable', - 'getIdFieldName', - '_afterDelete', - 'commit', - 'rollBack', - '__wakeup' - ], - [ - $contextMock, - $this->getMock( - \Magento\Eav\Model\ResourceModel\Entity\Attribute\GroupFactory::class, - [], - [], - '', - false - ), - $this->eavConfigMock - ], - '', - true + 'context' => $contextMock, + 'attrGroupFactory' => $attributeGroupFactoryMock, + 'eavConfig' => $this->eavConfigMock + ] ); + + $objectManager->setBackwardCompatibleProperty($this->model, 'serializer', $this->serializerMock); + $this->typeMock = $this->getMock(\Magento\Eav\Model\Entity\Type::class, [], [], '', false); $this->objectMock = $this->getMock( \Magento\Framework\Model\AbstractModel::class, @@ -123,7 +126,6 @@ protected function setUp() '', false ); - } /** @@ -182,6 +184,22 @@ public function testBeforeDelete() */ public function testGetSetInfoCacheMiss() { + $serializedData = 'serialized data'; + $setElement = [ + 10000 => [ + 'group_id' => 10, + 'group_sort' => 100, + 'sort' => 1000 + ] + ]; + $setData = [ + 1 => $setElement, + 2 => [], + 3 => [] + ]; + $cached = [ + 1 => $setElement + ]; $cacheMock = $this->getMockBuilder(\Magento\Framework\App\CacheInterface::class) ->disableOriginalConstructor() ->setMethods(['load', 'save', 'getFrontend', 'remove', 'clean']) @@ -192,21 +210,15 @@ public function testGetSetInfoCacheMiss() ->method('load') ->with($cacheKey) ->willReturn(false); + $this->serializerMock->expects($this->once()) + ->method('serialize') + ->with($cached) + ->willReturn($serializedData); $cacheMock ->expects($this->once()) ->method('save') ->with( - serialize( - [ - 1 => [ - 10000 => [ - 'group_id' => 10, - 'group_sort' => 100, - 'sort' => 1000 - ] - ] - ] - ), + $serializedData, $cacheKey, [\Magento\Eav\Model\Cache\Type::CACHE_TAG, \Magento\Eav\Model\Entity\Attribute::CACHE_TAG] ); @@ -242,17 +254,7 @@ public function testGetSetInfoCacheMiss() $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($connectionMock); $this->resourceMock->expects($this->any())->method('getTableName')->willReturn('_TABLE_'); $this->assertEquals( - [ - 1 => [ - 10000 => [ - 'group_id' => 10, - 'group_sort' => 100, - 'sort' => 1000 - ] - ], - 2 => [], - 3 => [] - ], + $setData, $this->model->getSetInfo([1, 2, 3], 1) ); } @@ -262,42 +264,41 @@ public function testGetSetInfoCacheMiss() */ public function testGetSetInfoCacheHit() { - $cached = [ - 1 => [ - 10000 => [ - 'group_id' => 10, - 'group_sort' => 100, - 'sort' => 1000 - ] + $setElement = [ + 10000 => [ + 'group_id' => 10, + 'group_sort' => 100, + 'sort' => 1000 ] ]; - + $setData = [ + 1 => $setElement, + 2 => [], + 3 => [] + ]; + $cached = [ + 1 => $setElement + ]; + $serializedData = 'serialized data'; $this->resourceMock->expects($this->never())->method('getConnection'); $this->eavConfigMock->expects($this->any())->method('isCacheEnabled')->willReturn(true); $cacheMock = $this->getMockBuilder(\Magento\Framework\App\CacheInterface::class) ->disableOriginalConstructor() ->setMethods(['load', 'save', 'getFrontend', 'remove', 'clean']) ->getMock(); - $cacheMock - ->expects($this->once()) + $cacheMock->expects($this->once()) ->method('load') ->with(Set::ATTRIBUTES_CACHE_ID . 1) - ->willReturn(serialize($cached)); + ->willReturn($serializedData); + $this->serializerMock->expects($this->once()) + ->method('unserialize') + ->with($serializedData) + ->willReturn($cached); $this->eavConfigMock->expects($this->any())->method('getCache')->willReturn($cacheMock); $this->assertEquals( - [ - 1 => [ - 10000 => [ - 'group_id' => 10, - 'group_sort' => 100, - 'sort' => 1000 - ] - ], - 2 => [], - 3 => [] - ], + $setData, $this->model->getSetInfo([1, 2, 3], 1) ); } diff --git a/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php b/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php index 7d4561259cf88..67ea1912ccf8e 100644 --- a/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php @@ -3,111 +3,166 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\Eav\Test\Unit\Plugin\Model\ResourceModel\Entity; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\App\CacheInterface; +use Magento\Framework\App\Cache\StateInterface; +use Magento\Eav\Model\ResourceModel\Entity\Attribute as AttributeResource; +use Magento\Eav\Plugin\Model\ResourceModel\Entity\Attribute as AttributeResourcePlugin; +use Magento\Eav\Model\Cache\Type; +use Magento\Eav\Model\Entity\Attribute; class AttributeTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $cache; + /** + * @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $cacheMock; - /** @var \Magento\Framework\App\Cache\StateInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $cacheState; + /** + * @var StateInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $cacheStateMock; + + /** + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializerMock; + + /** + * @var AttributeResource|\PHPUnit_Framework_MockObject_MockObject + */ + private $attributeResourceMock; - /** @var \Magento\Eav\Model\ResourceModel\Entity\Attribute|\PHPUnit_Framework_MockObject_MockObject */ - protected $subject; + /** + * @var AttributeResourcePlugin + */ + private $attributeResourcePlugin; protected function setUp() { - $this->cache = $this->getMock(\Magento\Framework\App\CacheInterface::class); - $this->cacheState = $this->getMock(\Magento\Framework\App\Cache\StateInterface::class); - $this->subject = $this->getMock(\Magento\Eav\Model\ResourceModel\Entity\Attribute::class, [], [], '', false); + $objectManager = new ObjectManager($this); + $this->cacheMock = $this->getMock(CacheInterface::class); + $this->cacheStateMock = $this->getMock(StateInterface::class); + $this->attributeResourceMock = $this->getMock(AttributeResource::class, [], [], '', false); + $this->serializerMock = $this->getMock(SerializerInterface::class); + $this->attributeResourcePlugin = $objectManager->getObject( + AttributeResourcePlugin::class, + [ + 'cache' => $this->cacheMock, + 'cacheState' => $this->cacheStateMock, + 'serializer' => $this->serializerMock + ] + ); } - public function testGetStoreLabelsByAttributeIdOnCacheDisabled() + public function testAroundGetStoreLabelsByAttributeIdCacheIsDisabled() { - $this->cache->expects($this->never())->method('load'); + $attributeId = 1; + $this->cacheMock->expects($this->never()) + ->method('load'); + $this->cacheStateMock->expects($this->exactly(2)) + ->method('isEnabled') + ->with(Type::TYPE_IDENTIFIER) + ->willReturn(false); - $this->assertEquals( - 'attributeId', - $this->getAttribute(false)->aroundGetStoreLabelsByAttributeId( - $this->subject, - $this->mockPluginProceed('attributeId'), - 'attributeId' - ) + $isProceedCalled = false; + // @SuppressWarnings(PHPMD.UnusedFormalParameter) + $proceed = function($attributeId) use (&$isProceedCalled) { + $isProceedCalled = true; + }; + + $this->attributeResourcePlugin->aroundGetStoreLabelsByAttributeId( + $this->attributeResourceMock, + $proceed, + $attributeId ); + $this->assertTrue($isProceedCalled); } - public function testGetStoreLabelsByAttributeIdFromCache() + public function testAroundGetStoreLabelsByAttributeIdCacheExists() { $attributeId = 1; - $attributes = ['k' => 'v']; - $cacheId = \Magento\Eav\Plugin\Model\ResourceModel\Entity\Attribute::STORE_LABEL_ATTRIBUTE . $attributeId; - $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes)); + $attributes = ['foo' => 'bar']; + $serializedAttributes = 'serialized attributes'; + $cacheId = AttributeResourcePlugin::STORE_LABEL_ATTRIBUTE . $attributeId; + $this->cacheStateMock->expects($this->once()) + ->method('isEnabled') + ->with(Type::TYPE_IDENTIFIER) + ->willReturn(true); + $this->cacheMock->expects($this->once()) + ->method('load') + ->with($cacheId) + ->willReturn($serializedAttributes); + $this->serializerMock->expects($this->once()) + ->method('unserialize') + ->with($serializedAttributes) + ->willReturn($attributes); + + $isProceedCalled = false; + // @SuppressWarnings(PHPMD.UnusedFormalParameter) + $proceed = function($attributeId) use (&$isProceedCalled) { + $isProceedCalled = true; + }; $this->assertEquals( $attributes, - $this->getAttribute(true)->aroundGetStoreLabelsByAttributeId( - $this->subject, - $this->mockPluginProceed(), + $this->attributeResourcePlugin->aroundGetStoreLabelsByAttributeId( + $this->attributeResourceMock, + $proceed, $attributeId ) ); + $this->assertFalse($isProceedCalled); } - public function testGetStoreLabelsByAttributeIdWithCacheSave() + public function testAroundGetStoreLabelsByAttributeIdCacheDoesNotExist() { $attributeId = 1; - $cacheId = \Magento\Eav\Plugin\Model\ResourceModel\Entity\Attribute::STORE_LABEL_ATTRIBUTE . $attributeId; - $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false); - $this->cache->expects($this->any())->method('save')->with( - serialize([$attributeId]), - $cacheId, - [ - \Magento\Eav\Model\Cache\Type::CACHE_TAG, - \Magento\Eav\Model\Entity\Attribute::CACHE_TAG - ] - ); + $attributes = ['foo' => 'bar']; + $serializedAttributes = 'serialized attributes'; + $cacheId = AttributeResourcePlugin::STORE_LABEL_ATTRIBUTE . $attributeId; + $this->cacheStateMock->expects($this->exactly(2)) + ->method('isEnabled') + ->with(Type::TYPE_IDENTIFIER) + ->willReturn(true); + $this->cacheMock->expects($this->once()) + ->method('load') + ->with($cacheId) + ->willReturn(false); + $this->serializerMock->expects($this->never()) + ->method('unserialize') + ->with($serializedAttributes) + ->willReturn($attributes); + $this->serializerMock->expects($this->once()) + ->method('serialize') + ->with($attributes) + ->willReturn($serializedAttributes); + $this->cacheMock->expects($this->once()) + ->method('save') + ->with( + $serializedAttributes, + $cacheId, + [ + Type::CACHE_TAG, + Attribute::CACHE_TAG + ] + ); + + // @SuppressWarnings(PHPMD.UnusedFormalParameter) + $proceed = function($attributeId) use ($attributes) { + return $attributes; + }; $this->assertEquals( - [$attributeId], - $this->getAttribute(true)->aroundGetStoreLabelsByAttributeId( - $this->subject, - $this->mockPluginProceed([$attributeId]), + $attributes, + $this->attributeResourcePlugin->aroundGetStoreLabelsByAttributeId( + $this->attributeResourceMock, + $proceed, $attributeId ) ); } - - /** - * @param bool $cacheEnabledFlag - * @return \Magento\Eav\Plugin\Model\ResourceModel\Entity\Attribute - */ - protected function getAttribute($cacheEnabledFlag) - { - $this->cacheState->expects($this->any())->method('isEnabled') - ->with(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER)->willReturn($cacheEnabledFlag); - return (new ObjectManager($this))->getObject( - \Magento\Eav\Plugin\Model\ResourceModel\Entity\Attribute::class, - [ - 'cache' => $this->cache, - 'cacheState' => $this->cacheState - ] - ); - } - - /** - * @param mixed $returnValue - * @return callable - */ - protected function mockPluginProceed($returnValue = null) - { - return function () use ($returnValue) { - return $returnValue; - }; - } } diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php new file mode 100644 index 0000000000000..97b3cb4731771 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php @@ -0,0 +1,49 @@ +objectManager = Bootstrap::getObjectManager(); + $this->config = $this->objectManager->get(Config::class); + } + + public function testGetEntityAttributeCodes() + { + $entityType = 'catalog_product'; + $this->cleanAllCache(); + $this->assertEquals( + $this->config->getEntityAttributeCodes($entityType), + $this->config->getEntityAttributeCodes($entityType) + ); + } + + private function cleanAllCache() + { + /** @var \Magento\Framework\App\Cache\Frontend\Pool $cachePool */ + $cachePool = $this->objectManager->get(\Magento\Framework\App\Cache\Frontend\Pool::class); + /** @var \Magento\Framework\Cache\FrontendInterface $cacheType */ + foreach ($cachePool as $cacheType) { + $cacheType->getBackend()->clean(); + } + } +} From 65c0f57110b89b037ef7de4621c0570999ca2d08 Mon Sep 17 00:00:00 2001 From: Sergey Semenov Date: Fri, 28 Oct 2016 19:37:01 +0300 Subject: [PATCH 1534/3232] MAGETWO-59924: File attribute doesn't have placeholder in admin --- .../Magento/Ui/view/base/web/js/form/element/file-uploader.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js index 7a8f06bcdd87b..928e719fac4f9 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js @@ -117,7 +117,6 @@ define([ * @returns {FileUploder} Chainable. */ addFile: function (file) { - file.previewType = this.getFilePreviewType(file); file = this.processFile(file); this.isMultipleFiles ? @@ -159,6 +158,8 @@ define([ * @returns {Object} Modified file object. */ processFile: function (file) { + file.previewType = this.getFilePreviewType(file); + this.observe.call(file, true, [ 'previewWidth', 'previewHeight' From bf646df6705599ab742656949b26ebbb82582cce Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 27 Oct 2016 16:55:17 -0500 Subject: [PATCH 1535/3232] MAGETWO-59440: Refactor Module_Eav Introducing SerializerInterface --- .../testsuite/Magento/Eav/Model/ConfigTest.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php index 97b3cb4731771..4cb90c2c98c56 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php @@ -8,6 +8,7 @@ use Magento\Eav\Model\Config; use Magento\TestFramework\ObjectManager; use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\CacheCleaner; class ConfigTest extends \PHPUnit_Framework_TestCase { @@ -30,20 +31,10 @@ protected function setUp() public function testGetEntityAttributeCodes() { $entityType = 'catalog_product'; - $this->cleanAllCache(); + CacheCleaner::cleanAll(); $this->assertEquals( $this->config->getEntityAttributeCodes($entityType), $this->config->getEntityAttributeCodes($entityType) ); } - - private function cleanAllCache() - { - /** @var \Magento\Framework\App\Cache\Frontend\Pool $cachePool */ - $cachePool = $this->objectManager->get(\Magento\Framework\App\Cache\Frontend\Pool::class); - /** @var \Magento\Framework\Cache\FrontendInterface $cacheType */ - foreach ($cachePool as $cacheType) { - $cacheType->getBackend()->clean(); - } - } } From 45d7ddc6b93ed704e65e1fc5279ef494fc1b4ca0 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 27 Oct 2016 17:22:53 -0500 Subject: [PATCH 1536/3232] MAGETWO-59440: Refactor Module_Eav Introducing SerializerInterface --- app/code/Magento/Eav/Model/Config.php | 1 + .../Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php index 89d0bc93c8007..0d0237a1f6732 100644 --- a/app/code/Magento/Eav/Model/Config.php +++ b/app/code/Magento/Eav/Model/Config.php @@ -105,6 +105,7 @@ class Config * @param \Magento\Eav\Model\ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory * @param \Magento\Framework\App\Cache\StateInterface $cacheState * @param \Magento\Framework\Validator\UniversalFactory $universalFactory + * @param SerializerInterface $serializer * @codeCoverageIgnore */ public function __construct( diff --git a/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php b/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php index 3452d452ac490..56bad8bf75e11 100644 --- a/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php +++ b/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php @@ -47,7 +47,7 @@ public function __construct( ) { $this->cache = $cache; $this->serializer = $serializer; - $this->cacheState = $cacheState;; + $this->cacheState = $cacheState; } /** From 5b636d0b7dd63e64c9ff0a980ef0ffe2a16fe8aa Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 27 Oct 2016 17:50:41 -0500 Subject: [PATCH 1537/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Fixing tests --- .../testsuite/Magento/Webapi/Model/ServiceMetadataTest.php | 7 ++++--- .../testsuite/Magento/Webapi/Model/Soap/ConfigTest.php | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php index 7bfbe08a34a09..8fac1c9b0e703 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php @@ -7,10 +7,11 @@ use Magento\TestFramework\Helper\Bootstrap; use Magento\Customer\Api\AccountManagementInterface; +use Magento\Framework\Exception\LocalizedException; class ServiceMetadataTest extends \PHPUnit_Framework_TestCase { - /**bootstrap.sh + /** * @var ServiceMetadata */ private $serviceMetadata; @@ -57,7 +58,7 @@ public function testGetServiceMetadata() ] ], 'throws' => [ - "\\Magento\\Framework\\Exception\\LocalizedException" + '\\' . LocalizedException::class ] ] ] @@ -106,7 +107,7 @@ public function testGetRouteMetadata() ] ], 'throws' => [ - "\\Magento\\Framework\\Exception\\LocalizedException" + '\\' . LocalizedException::class ] ] ] diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index 95743e9e10537..ff1634c60782a 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -8,6 +8,7 @@ use Magento\TestFramework\Helper\Bootstrap; use Magento\Customer\Api\AccountManagementInterface; use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\Exception\LocalizedException; class ConfigTest extends \PHPUnit_Framework_TestCase { @@ -60,7 +61,7 @@ public function testGetRequestedSoapServices() ] ], 'throws' => [ - "\\Magento\\Framework\\Exception\\LocalizedException" + '\\' . LocalizedException::class ] ] ] From 7c4aadb5b09ad3905a99c68329dd750ccafcb7d2 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 27 Oct 2016 18:31:33 -0500 Subject: [PATCH 1538/3232] MAGETWO-59440: Refactor Module_Eav Fixing tests --- .../Plugin/Model/ResourceModel/Entity/AttributeTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php b/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php index 67ea1912ccf8e..3fa739d4096a8 100644 --- a/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php +++ b/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php @@ -70,7 +70,7 @@ public function testAroundGetStoreLabelsByAttributeIdCacheIsDisabled() $isProceedCalled = false; // @SuppressWarnings(PHPMD.UnusedFormalParameter) - $proceed = function($attributeId) use (&$isProceedCalled) { + $proceed = function ($attributeId) use (&$isProceedCalled) { $isProceedCalled = true; }; @@ -103,7 +103,7 @@ public function testAroundGetStoreLabelsByAttributeIdCacheExists() $isProceedCalled = false; // @SuppressWarnings(PHPMD.UnusedFormalParameter) - $proceed = function($attributeId) use (&$isProceedCalled) { + $proceed = function ($attributeId) use (&$isProceedCalled) { $isProceedCalled = true; }; @@ -152,7 +152,7 @@ public function testAroundGetStoreLabelsByAttributeIdCacheDoesNotExist() ); // @SuppressWarnings(PHPMD.UnusedFormalParameter) - $proceed = function($attributeId) use ($attributes) { + $proceed = function ($attributeId) use ($attributes) { return $attributes; }; From d196f666a1e1e3674fbbf1c6534f35690fdad2fb Mon Sep 17 00:00:00 2001 From: Joan He Date: Thu, 27 Oct 2016 21:24:00 -0500 Subject: [PATCH 1539/3232] MAGETWO-59440: Refactor Module_Eav --- app/code/Magento/Catalog/Model/Config.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Config.php b/app/code/Magento/Catalog/Model/Config.php index dec29a925cc4d..70d11f2e282b4 100644 --- a/app/code/Magento/Catalog/Model/Config.php +++ b/app/code/Magento/Catalog/Model/Config.php @@ -7,6 +7,7 @@ // @codingStandardsIgnoreFile namespace Magento\Catalog\Model; +use Magento\Framework\Serialize\SerializerInterface; /** * @SuppressWarnings(PHPMD.LongVariable) @@ -132,6 +133,7 @@ class Config extends \Magento\Eav\Model\Config * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setCollectionFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig + * @param SerializerInterface $serializer * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -147,7 +149,8 @@ public function __construct( \Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory, \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setCollectionFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Eav\Model\Config $eavConfig + \Magento\Eav\Model\Config $eavConfig, + SerializerInterface $serializer = null ) { $this->_scopeConfig = $scopeConfig; $this->_configFactory = $configFactory; @@ -157,7 +160,14 @@ public function __construct( $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; - parent::__construct($cache, $entityTypeFactory, $entityTypeCollectionFactory, $cacheState, $universalFactory); + parent::__construct( + $cache, + $entityTypeFactory, + $entityTypeCollectionFactory, + $cacheState, + $universalFactory, + $serializer + ); } /** From ec668787347ccfe2c345a7e82f3e9205287d4a36 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 28 Oct 2016 10:34:02 -0500 Subject: [PATCH 1540/3232] MAGETWO-59440: Refactor Module_Eav Adding integration test for Magento\Catalog\Model\Config --- .../Magento/Catalog/Model/ConfigTest.php | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/ConfigTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ConfigTest.php new file mode 100644 index 0000000000000..178107e487e92 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ConfigTest.php @@ -0,0 +1,61 @@ +objectManager = Bootstrap::getObjectManager(); + $this->config = $this->objectManager->get(Config::class); + } + + public function testGetEntityAttributeCodes() + { + $entityType = 'catalog_product'; + CacheCleaner::cleanAll(); + $this->assertEquals( + $this->config->getEntityAttributeCodes($entityType), + $this->config->getEntityAttributeCodes($entityType) + ); + } + + public function testGetAttribute() + { + $entityType = 'catalog_product'; + $attributeCode = 'color'; + CacheCleaner::cleanAll(); + $this->assertEquals( + $this->config->getAttribute($entityType, $attributeCode), + $this->config->getAttribute($entityType, $attributeCode) + ); + } + + public function testGetEntityType() + { + $entityType = 'catalog_product'; + CacheCleaner::cleanAll(); + $this->assertEquals( + $this->config->getEntityType($entityType), + $this->config->getEntityType($entityType) + ); + } +} From 220835ac851f56ff38ff2c3b11448a1808dfa019 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 28 Oct 2016 17:53:37 -0500 Subject: [PATCH 1541/3232] MAGETWO-58638: Refactor Framework_App, Framework_Config Removing CouplingBetweenObjects annotation --- lib/internal/Magento/Framework/Validator/Factory.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/internal/Magento/Framework/Validator/Factory.php b/lib/internal/Magento/Framework/Validator/Factory.php index b3d7147f42029..3b8608239be12 100644 --- a/lib/internal/Magento/Framework/Validator/Factory.php +++ b/lib/internal/Magento/Framework/Validator/Factory.php @@ -1,23 +1,20 @@ Date: Fri, 28 Oct 2016 17:55:36 -0500 Subject: [PATCH 1542/3232] MAGETWO-58638: Refactor Framework_App, Framework_Config Removing CouplingBetweenObjects annotation --- lib/internal/Magento/Framework/Validator/Factory.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/internal/Magento/Framework/Validator/Factory.php b/lib/internal/Magento/Framework/Validator/Factory.php index 3b8608239be12..f646748b15840 100644 --- a/lib/internal/Magento/Framework/Validator/Factory.php +++ b/lib/internal/Magento/Framework/Validator/Factory.php @@ -82,8 +82,8 @@ protected function _initializeConfigList() $this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml'); $this->cache->save($this->getSerializer()->serialize($this->_configFiles->toArray()), self::CACHE_KEY); } else { - $filesArray = $this->getSerializer()->unserialize($this->_configFiles); - $this->_configFiles = $this->getFileIteratorFactory()->create(array_keys($filesArray)); + $files = $this->getSerializer()->unserialize($this->_configFiles); + $this->_configFiles = $this->getFileIteratorFactory()->create(array_keys($files)); } } } @@ -161,8 +161,7 @@ public function createValidator($entityName, $groupName, array $builderConfig = private function getSerializer() { if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\SerializerInterface::class); + $this->serializer = $this->_objectManager->get(\Magento\Framework\Serialize\SerializerInterface::class); } return $this->serializer; } @@ -176,7 +175,7 @@ private function getSerializer() private function getFileIteratorFactory() { if ($this->fileIteratorFactory === null) { - $this->fileIteratorFactory = \Magento\Framework\App\ObjectManager::getInstance() + $this->fileIteratorFactory = $this->_objectManager ->get(\Magento\Framework\Config\FileIteratorFactory::class); } return $this->fileIteratorFactory; From 5691491cace5ce63e949821bc3f37e55cb9d5dde Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 28 Oct 2016 17:56:57 -0500 Subject: [PATCH 1543/3232] MAGETWO-58638: Refactor Framework_App, Framework_Config Renaming variable --- lib/internal/Magento/Framework/Validator/Factory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Validator/Factory.php b/lib/internal/Magento/Framework/Validator/Factory.php index f646748b15840..76633f48dfe0b 100644 --- a/lib/internal/Magento/Framework/Validator/Factory.php +++ b/lib/internal/Magento/Framework/Validator/Factory.php @@ -82,8 +82,8 @@ protected function _initializeConfigList() $this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml'); $this->cache->save($this->getSerializer()->serialize($this->_configFiles->toArray()), self::CACHE_KEY); } else { - $files = $this->getSerializer()->unserialize($this->_configFiles); - $this->_configFiles = $this->getFileIteratorFactory()->create(array_keys($files)); + $filesArray = $this->getSerializer()->unserialize($this->_configFiles); + $this->_configFiles = $this->getFileIteratorFactory()->create(array_keys($filesArray)); } } } From 9f9d3fe954389660c0078555a448615868189b22 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Sun, 30 Oct 2016 00:31:41 +0300 Subject: [PATCH 1544/3232] MAGETWO-60155: Default Billing Address and Default Shipping Address checkboxes on Customer page are saved incorrectly - Removed importing in namespace; --- .../Magento/Customer/Controller/Adminhtml/Index/Save.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php index bffbc5515183c..1c38dfa0c7179 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php @@ -11,11 +11,7 @@ use Magento\Customer\Controller\RegistryConstants; use Magento\Customer\Model\EmailNotificationInterface; use Magento\Customer\Model\Metadata\Form; -use Magento\Framework\Exception\LocalizedException; -/** - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ class Save extends \Magento\Customer\Controller\Adminhtml\Index { /** @@ -271,7 +267,7 @@ public function execute() $this->_addSessionErrorMessages($messages); $this->_getSession()->setCustomerFormData($originalRequestData); $returnToEdit = true; - } catch (LocalizedException $exception) { + } catch (\Magento\Framework\Exception\LocalizedException $exception) { $this->_addSessionErrorMessages($exception->getMessage()); $this->_getSession()->setCustomerFormData($originalRequestData); $returnToEdit = true; From 3e2ef715e9589f158b45d020dafb08d28c844238 Mon Sep 17 00:00:00 2001 From: aakimov Date: Tue, 25 Oct 2016 11:11:29 +0300 Subject: [PATCH 1545/3232] MAGETWO-59962: Unable to Create a new Order via Backend after Locale switching to nl_NL or de_DE --- .../Sales/view/adminhtml/layout/sales_order_create_index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b2e779e330fe0..6acb23ab0910e 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 @@ -16,7 +16,7 @@ - order-header + order-header From 89d1b2cf9ef66be0414ad57cf352f2497b97bd35 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Wed, 26 Oct 2016 10:25:52 +0300 Subject: [PATCH 1546/3232] MAGETWO-59626: Error saving configurable product after disabling child products --- .../Product/Form/Modifier/ImagesTest.php | 24 ++++++++++++++++++- .../Product/Form/Modifier/Images.php | 15 ++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ImagesTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ImagesTest.php index 2172e184a9a2e..7a55bd31e3dee 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ImagesTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ImagesTest.php @@ -24,7 +24,9 @@ protected function createModel() public function testModifyData() { - $this->assertSame($this->getSampleData(), $this->getModel()->modifyData($this->getSampleData())); + $this->productMock->expects($this->once())->method('getId')->willReturn(2051); + $actualResult = $this->getModel()->modifyData($this->getSampleData()); + $this->assertSame("", $actualResult[2051]['product']['media_gallery']['images'][0]['label']); } public function testModifyMeta() @@ -40,4 +42,24 @@ public function testModifyMeta() $this->assertSame([], $this->getModel()->modifyMeta($meta)); } + + /** + * {@inheritdoc} + */ + protected function getSampleData() + { + return [ + 2051 => [ + 'product' => [ + 'media_gallery' => [ + 'images' => [ + [ + 'label' => null + ] + ] + ] + ] + ] + ]; + } } diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Images.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Images.php index 810a06df4a42f..a8536cacc7966 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Images.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Images.php @@ -51,6 +51,21 @@ public function modifyMeta(array $meta) */ public function modifyData(array $data) { + /** @var \Magento\Catalog\Api\Data\ProductInterface $product */ + $product = $this->locator->getProduct(); + $modelId = $product->getId(); + if ( + isset($data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery']) + && !empty($data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery']) + && !empty($data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery']['images']) + ) { + foreach ($data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery']['images'] as $index => $image) { + if (!isset($image['label'])) { + $data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery']['images'][$index]['label'] = ""; + } + } + }; + return $data; } } From a25154ec416f55f4e6f3058c447617f9d6da2b77 Mon Sep 17 00:00:00 2001 From: Vitaliy Goncharenko Date: Mon, 31 Oct 2016 10:59:57 +0200 Subject: [PATCH 1547/3232] MAGETWO-53583: "Use Default" checkbox is checked again after saving empty fields (description, name, etc) - changes after CR --- .../Entity/Attribute/AbstractAttribute.php | 21 +++++---- .../Eav/Model/ResourceModel/UpdateHandler.php | 44 +++++++++---------- .../Model/ResourceModel/UpdateHandlerTest.php | 6 +-- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index 2804250a35c6e..ba6e670ee9642 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -116,7 +116,14 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens * * @var array */ - private $emptyStringTypes = ['int', 'decimal', 'datetime', 'varchar', 'text', 'static']; + private $emptyStringTypes = [ + 'int', + 'decimal', + 'datetime', + 'varchar', + 'text', + 'static', + ]; /** * @param \Magento\Framework\Model\Context $context @@ -607,18 +614,14 @@ protected function _getDefaultSourceModel() * Check if Value is empty. * * @param array|null|bool|int|float|string $value - * @param bool $strictEmptyStringType [optional] Flag for allow empty string as a possible value for String. - * By default set to TRUE = disallow empty string. * @return bool */ - public function isValueEmpty($value, $strictEmptyStringType = true) + public function isValueEmpty($value) { - $isInEmptyStringTypes = $strictEmptyStringType ? $this->isInEmptyStringTypes() : !$this->isInEmptyStringTypes(); - return (is_array($value) && count($value) == 0) - || $value === null - || ($value === false && $this->getBackend()->getType() != 'int') - || ($value === '' && $isInEmptyStringTypes); + || $value === null + || ($value === false && $this->getBackend()->getType() != 'int') + || ($value === '' && $this->isInEmptyStringTypes()); } /** diff --git a/app/code/Magento/Eav/Model/ResourceModel/UpdateHandler.php b/app/code/Magento/Eav/Model/ResourceModel/UpdateHandler.php index 4494d66b42fc6..bcaf11aaf5532 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/UpdateHandler.php +++ b/app/code/Magento/Eav/Model/ResourceModel/UpdateHandler.php @@ -125,26 +125,17 @@ public function execute($entityType, $entityData, $arguments = []) : null; // @todo verify is it normal to not have attributer_set_id $snapshot = $this->readSnapshot->execute($entityType, $entityDataForSnapshot); foreach ($this->getAttributes($entityType, $attributeSetId) as $attribute) { - if ($attribute->isStatic()) { - continue; - } $code = $attribute->getAttributeCode(); - /** - * Only scalar values can be stored in generic tables - */ - if (isset($entityData[$code]) && !is_scalar($entityData[$code])) { - continue; - } - /** - * Only changed attributes need to handle update process - */ - if (!array_key_exists($code, $entityData)) { + $isAllowedValueType = array_key_exists($code, $entityData) + && (is_scalar($entityData[$code]) || $entityData[$code] === null); + + if ($attribute->isStatic() || !$isAllowedValueType) { continue; } $newValue = $entityData[$code]; - $isValueEmpty = $attribute->isValueEmpty($newValue, false); - $isAllowedEmptyTextValue = $attribute->isAllowedEmptyTextValue($newValue); + $isValueEmpty = $attribute->isValueEmpty($newValue); + $isAllowedEmptyStringValue = $attribute->isAllowedEmptyTextValue($newValue); if (array_key_exists($code, $snapshot)) { $snapshotValue = $snapshot[$code]; @@ -155,25 +146,32 @@ public function execute($entityType, $entityData, $arguments = []) continue; } - if ($isValueEmpty && !$isAllowedEmptyTextValue) { - $this->attributePersistor->registerDelete( - $entityType, - $entityData[$metadata->getLinkField()], - $code - ); - } elseif ((!$isValueEmpty || $isAllowedEmptyTextValue) && $snapshotValue !== $newValue) { + if (!$isValueEmpty || $isAllowedEmptyStringValue) { + /** + * NOT Updated value for attributes not need to update + */ + if ($snapshotValue === $newValue) { + continue; + } + $this->attributePersistor->registerUpdate( $entityType, $entityData[$metadata->getLinkField()], $code, $newValue ); + } else { + $this->attributePersistor->registerDelete( + $entityType, + $entityData[$metadata->getLinkField()], + $code + ); } } else { /** * Only not empty value of attribute is insertable */ - if (!$isValueEmpty || $isAllowedEmptyTextValue) { + if (!$isValueEmpty || $isAllowedEmptyStringValue) { $this->attributePersistor->registerInsert( $entityType, $entityData[$metadata->getLinkField()], diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php index cd110713711e0..eb30a7d0168c6 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php @@ -47,7 +47,7 @@ public function testExecuteProcessForAllStores($code, $snapshotValue, $newValue, $resultEntity->setStoreId(0); $resultEntity->load(1); - $this->assertTrue($expected === $resultEntity->getData($code)); + $this->assertSame($expected, $resultEntity->getData($code)); } /** @@ -91,7 +91,7 @@ public function testExecuteProcessForCustomStore($code, $snapshotValue, $newValu $resultEntity->setStoreId($store->getId()); $resultEntity->load(1); - $this->assertTrue($expected === $resultEntity->getData($code)); + $this->assertSame($expected, $resultEntity->getData($code)); } /** @@ -174,7 +174,7 @@ public function testExecuteProcessForCustomAttributeInCustomStore( $expected = $optionIds[$expected]; } - $this->assertTrue($expected === $resultEntity->getData($code)); + $this->assertSame($expected, $resultEntity->getData($code)); } /** From 6c44491452e15e1c4b7eff51aa4d93f09f5b656e Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Mon, 31 Oct 2016 11:05:28 +0200 Subject: [PATCH 1548/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - FixedBundleTests refactoring --- .../FixedBundlePriceCalculatorTest.php | 6 +- ...ndleWithCatalogPriceRuleCalculatorTest.php | 234 ++++-------- ...edBundleWithSpecialPriceCalculatorTest.php | 234 ++++-------- ...FixedBundleWithTierPriceCalculatorTest.php | 350 ++++++++---------- 4 files changed, 313 insertions(+), 511 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php index 66ae6a975a72c..63d8e3ba060f0 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -12,7 +12,7 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php * @magentoAppArea frontend */ -class FixedBundlePriceCalculatorTest extends BundlePrice +class FixedBundlePriceCalculatorTest extends BundlePriceAbstract { /** * @param $strategyModifiers array @@ -88,6 +88,7 @@ public function getProductWithOneSimple() { $optionsData = [ [ + 'title' => 'Op1', 'required' => true, 'type' => 'checkbox', 'links' => [ @@ -113,6 +114,7 @@ public function getProductWithDifferentQty() { $optionsData = [ [ + 'title' => 'Op1', 'required' => true, 'type' => 'checkbox', 'links' => [ @@ -150,6 +152,7 @@ public function getProductWithSamePrice() { $optionsData = [ [ + 'title' => 'Op1', 'required' => true, 'type' => 'checkbox', 'links' => [ @@ -187,6 +190,7 @@ public function getProductWithDifferentPrice() { $optionsData = [ [ + 'title' => 'Op1', 'required' => true, 'type' => 'checkbox', 'links' => [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php index f5c72da722639..88d9be5e7a9fb 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php @@ -12,72 +12,17 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_catalog_rule.php * @magentoAppArea frontend */ -class FixedBundleWithCatalogPriceRuleCalculatorTest extends \PHPUnit_Framework_TestCase +class FixedBundleWithCatalogPriceRuleCalculatorTest extends BundlePriceAbstract { - /** @var \Magento\TestFramework\Helper\Bootstrap */ - protected $objectManager; - - /** @var \Magento\Catalog\Api\ProductRepositoryInterface */ - protected $productRepository; - - const CUSTOM_OPTION_PRICE_TYPE_FIXED = 'fixed'; - - const CUSTOM_OPTION_PRICE_TYPE_PERCENT = 'percent'; - - protected $fixtureForProductOption = [ - 'title' => 'Some title', - 'required' => true, - 'type' => 'checkbox' - ]; - - protected $fixtureForProductOptionSelection = [ - 'sku' => null, // need to set this - 'option_id' => null, // need to set this - 'qty' => 1, - 'is_default' => true, - 'price' => null, // need to set this - 'price_type' => LinkInterface::PRICE_TYPE_FIXED, - 'can_change_quantity' => 0 - ]; - - protected $fixtureForProductCustomOption = [ - 'option_id' => null, - 'previous_group' => 'text', - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 100, - 'price_type' => 'fixed', - 'sku' => '1-text', - 'max_characters' => 100, - ]; - - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); - } - /** - * @param $strategyModifiers array - * @param $expectedResults array + * @param array $strategyModifiers + * @param array $expectedResults * @dataProvider getTestCases * @magentoAppIsolation enabled */ public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); - - foreach ($strategyModifiers as $modifier) { - if (method_exists($this, $modifier['modifierName'])) { - array_unshift($modifier['data'], $bundleProduct); - $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); - } - } - - $this->productRepository->save($bundleProduct); - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $bundleProduct = $this->prepareFixture($strategyModifiers); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -600,10 +545,13 @@ public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $ { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], @@ -613,7 +561,12 @@ public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $ $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -633,10 +586,13 @@ public function getProductSubItemsAndOptionsStrategyConfiguration1($selectionsPr { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], @@ -646,7 +602,12 @@ public function getProductSubItemsAndOptionsStrategyConfiguration1($selectionsPr $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -666,11 +627,12 @@ public function getProductSubItemsAndOptionsStrategyConfiguration2($selectionsPr { $optionsData = [ [ + 'title' => 'Op1', + 'type' => 'checkbox', 'required' => false, 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'price' => 20, 'qty' => 2, 'price_type' => $selectionsPriceType @@ -681,7 +643,12 @@ public function getProductSubItemsAndOptionsStrategyConfiguration2($selectionsPr $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -701,16 +668,18 @@ public function getProductSubItemsAndOptionsStrategyConfiguration3($selectionsPr { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 10, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -721,7 +690,12 @@ public function getProductSubItemsAndOptionsStrategyConfiguration3($selectionsPr $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -741,17 +715,18 @@ public function getProductSubItemsAndOptionsStrategyConfiguration4($selectionsPr { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'multi', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -762,7 +737,12 @@ public function getProductSubItemsAndOptionsStrategyConfiguration4($selectionsPr $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -782,17 +762,18 @@ public function getProductSubItemsAndOptionsStrategyConfiguration5($selectionsPr { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -803,7 +784,12 @@ public function getProductSubItemsAndOptionsStrategyConfiguration5($selectionsPr $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -823,17 +809,18 @@ public function getProductSubItemsAndOptionsStrategyConfiguration6($selectionsPr { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -841,17 +828,18 @@ public function getProductSubItemsAndOptionsStrategyConfiguration6($selectionsPr ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 2, 'price' => 10, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -862,7 +850,12 @@ public function getProductSubItemsAndOptionsStrategyConfiguration6($selectionsPr $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -877,87 +870,4 @@ public function getProductSubItemsAndOptionsStrategyConfiguration6($selectionsPr ], ]; } - - protected function getFixtureForProductOption(array $data = []) - { - $fixture = $this->fixtureForProductOption; - - // make title different for each call - $fixture['title'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductOptionSelection($data) - { - $fixture = $this->fixtureForProductOptionSelection; - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductCustomOption(array $data = []) - { - $fixture = $this->fixtureForProductCustomOption; - - // make title and sku different for each call - $fixture['title'] .= ' ' . microtime(true); - $fixture['sku'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - $options = []; - - foreach ($optionsData as $optionData) { - $links = []; - $linksData = $optionData['links']; - unset($optionData['links']); - - $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) - ->setSku($bundleProduct->getSku()) - ->setOptionid(null); - - foreach ($linksData as $linkData) { - $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); - } - - $option->setProductLinks($links); - $options[] = $option; - } - - $extension = $bundleProduct->getExtensionAttributes(); - $extension->setBundleProductOptions($options); - $bundleProduct->setExtensionAttributes($extension); - - return $bundleProduct; - } - - protected function addCustomOption(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ - $customOptionFactory = $this->objectManager - ->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); - - $options = []; - foreach ($optionsData as $optionData) { - $customOption = $customOptionFactory->create( - [ - 'data' => $this->getFixtureForProductCustomOption($optionData) - ] - ); - $customOption->setProductSku($bundleProduct->getSku()); - $customOption->setOptionId(null); - - $options[] = $customOption; - } - - $bundleProduct->setOptions($options); - $bundleProduct->setCanSaveCustomOptions(true); - - return $bundleProduct; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php index 6b0572a0b1164..e178087e0cfc7 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php @@ -12,72 +12,17 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php * @magentoAppArea frontend */ -class FixedBundleWithSpecialPriceCalculatorTest extends \PHPUnit_Framework_TestCase +class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract { - /** @var \Magento\TestFramework\Helper\Bootstrap */ - protected $objectManager; - - /** @var \Magento\Catalog\Api\ProductRepositoryInterface */ - protected $productRepository; - - const CUSTOM_OPTION_PRICE_TYPE_FIXED = 'fixed'; - - const CUSTOM_OPTION_PRICE_TYPE_PERCENT = 'percent'; - - protected $fixtureForProductOption = [ - 'title' => 'Some title', - 'required' => true, - 'type' => 'checkbox' - ]; - - protected $fixtureForProductOptionSelection = [ - 'sku' => null, // need to set this - 'option_id' => null, // need to set this - 'qty' => 1, - 'is_default' => true, - 'price' => null, // need to set this - 'price_type' => LinkInterface::PRICE_TYPE_FIXED, - 'can_change_quantity' => 0 - ]; - - protected $fixtureForProductCustomOption = [ - 'option_id' => null, - 'previous_group' => 'text', - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 100, - 'price_type' => 'fixed', - 'sku' => '1-text', - 'max_characters' => 100, - ]; - - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); - } - /** - * @param $strategyModifiers array - * @param $expectedResults array + * @param array $strategyModifiers + * @param array $expectedResults * @dataProvider getTestCases * @magentoAppIsolation enabled */ public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); - - foreach ($strategyModifiers as $modifier) { - if (method_exists($this, $modifier['modifierName'])) { - array_unshift($modifier['data'], $bundleProduct); - $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); - } - } - - $this->productRepository->save($bundleProduct); - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $bundleProduct = $this->prepareFixture($strategyModifiers); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -624,10 +569,13 @@ public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $ { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], @@ -637,7 +585,12 @@ public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $ $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -659,10 +612,13 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ) { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], @@ -672,7 +628,12 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -698,11 +659,12 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ) { $optionsData = [ [ + 'title' => 'Op1', + 'type' => 'checkbox', 'required' => false, 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'price' => 20, 'qty' => 2, 'price_type' => $selectionsPriceType @@ -713,7 +675,12 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -739,16 +706,18 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ) { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 10, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -759,7 +728,12 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -785,17 +759,18 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ) { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'multi', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -806,7 +781,12 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -832,17 +812,18 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ) { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -853,7 +834,12 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -879,17 +865,18 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ) { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -897,17 +884,18 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 2, 'price' => 10, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -918,7 +906,12 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; @@ -938,93 +931,10 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - protected function getFixtureForProductOption(array $data = []) - { - $fixture = $this->fixtureForProductOption; - - // make title different for each call - $fixture['title'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductOptionSelection($data) - { - $fixture = $this->fixtureForProductOptionSelection; - - return array_merge($fixture, $data); - } - - protected function getFixtureForProductCustomOption(array $data = []) - { - $fixture = $this->fixtureForProductCustomOption; - - // make title and sku different for each call - $fixture['title'] .= ' ' . microtime(true); - $fixture['sku'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) { $bundleProduct->setSpecialPrice($discount); return $bundleProduct; } - - protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - $options = []; - - foreach ($optionsData as $optionData) { - $links = []; - $linksData = $optionData['links']; - unset($optionData['links']); - - $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) - ->setSku($bundleProduct->getSku()) - ->setOptionid(null); - - foreach ($linksData as $linkData) { - $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); - } - - $option->setProductLinks($links); - $options[] = $option; - } - - $extension = $bundleProduct->getExtensionAttributes(); - $extension->setBundleProductOptions($options); - $bundleProduct->setExtensionAttributes($extension); - - return $bundleProduct; - } - - protected function addCustomOption(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ - $customOptionFactory = $this->objectManager - ->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); - - $options = []; - foreach ($optionsData as $optionData) { - $customOption = $customOptionFactory->create( - [ - 'data' => $this->getFixtureForProductCustomOption($optionData) - ] - ); - $customOption->setProductSku($bundleProduct->getSku()); - $customOption->setOptionId(null); - - $options[] = $customOption; - } - - $bundleProduct->setOptions($options); - $bundleProduct->setCanSaveCustomOptions(true); - - return $bundleProduct; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php index 36482b9b83342..d9e9359c59c43 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php @@ -7,7 +7,6 @@ namespace Magento\Bundle\Model\Product; use \Magento\Bundle\Api\Data\LinkInterface; -use \Magento\Catalog\Api\ProductRepositoryInterface; use \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; /** @@ -16,63 +15,14 @@ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php * @magentoAppArea frontend */ -class FixedBundleWithTierPriceCalculatorTest extends \PHPUnit_Framework_TestCase +class FixedBundleWithTierPriceCalculatorTest extends BundlePriceAbstract { - - const CUSTOM_OPTION_PRICE_TYPE_FIXED = 'fixed'; - - const CUSTOM_OPTION_PRICE_TYPE_PERCENT = 'percent'; - - /** @var \Magento\TestFramework\Helper\Bootstrap */ - private $objectManager; - - /** @var ProductRepositoryInterface */ - private $productRepository; - /** @var ProductTierPriceInterfaceFactory */ private $tierPriceFactory; - private $fixtureForTierPrice = [ - 'data' => [ - 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, - 'qty' => 1, - 'value' => 50 - ] - ]; - - private $fixtureForProductOption = [ - 'title' => 'Some title', - 'required' => true, - 'type' => 'checkbox' - ]; - - private $fixtureForProductOptionSelection = [ - 'sku' => null, // need to set this - 'option_id' => null, // need to set this - 'qty' => 1, - 'is_default' => true, - 'price' => null, // need to set this - 'price_type' => LinkInterface::PRICE_TYPE_FIXED, - 'can_change_quantity' => 0 - ]; - - private $fixtureForProductCustomOption = [ - 'option_id' => null, - 'previous_group' => 'text', - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 100, - 'price_type' => 'fixed', - 'sku' => 'for-custom-option', - 'max_characters' => 100, - ]; - protected function setUp() { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class); + parent::setUp(); $this->tierPriceFactory = $this->objectManager->create(ProductTierPriceInterfaceFactory::class); } @@ -84,17 +34,7 @@ protected function setUp() */ public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); - $this->addTierPrice($bundleProduct); - foreach ($strategyModifiers as $modifier) { - if (method_exists($this, $modifier['modifierName'])) { - array_unshift($modifier['data'], $bundleProduct); - $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); - } - } - - $this->productRepository->save($bundleProduct); - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $bundleProduct = $this->prepareFixture($strategyModifiers); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -121,7 +61,6 @@ public function getTestCases() { return [ - 'Testing product price with tier price and without any sub items and options' => [ 'strategy' => $this->getEmptyProduct(), 'expectedResults' => [ @@ -175,20 +114,6 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and percent options Configuration #1' => [ - 'strategy' => $this->getProductConfiguration1( - LinkInterface::PRICE_TYPE_FIXED, - self::CUSTOM_OPTION_PRICE_TYPE_PERCENT - ), - 'expectedResults' => [ - // 0.5 * (110 + 1 * 20 + 110 * 1) - 'minimalPrice' => 120, - - // 0.5 * (110 + 1 * 20 + 110 * 1) - 'maximalPrice' => 120 - ] - ], - 'Testing product price with tier price, percent sub items and fixed options Configuration #1' => [ 'strategy' => $this->getProductConfiguration1( LinkInterface::PRICE_TYPE_PERCENT, @@ -488,17 +413,31 @@ public function getTestCases() public function getEmptyProduct() { - return []; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ] + ]; } public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], @@ -508,11 +447,26 @@ public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $ $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -528,10 +482,13 @@ public function getProductConfiguration1($selectionsPriceType, $customOptionsPri { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], @@ -541,11 +498,26 @@ public function getProductConfiguration1($selectionsPriceType, $customOptionsPri $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -561,11 +533,12 @@ public function getProductConfiguration2($selectionsPriceType, $customOptionsPri { $optionsData = [ [ + 'title' => 'Op1', + 'type' => 'checkbox', 'required' => false, 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, 'price' => 20, 'qty' => 2, 'price_type' => $selectionsPriceType @@ -576,11 +549,26 @@ public function getProductConfiguration2($selectionsPriceType, $customOptionsPri $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -596,16 +584,18 @@ public function getProductConfiguration3($selectionsPriceType, $customOptionsPri { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 10, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -616,11 +606,26 @@ public function getProductConfiguration3($selectionsPriceType, $customOptionsPri $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -636,17 +641,18 @@ public function getProductConfiguration4($selectionsPriceType, $customOptionsPri { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'multi', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -657,11 +663,26 @@ public function getProductConfiguration4($selectionsPriceType, $customOptionsPri $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -677,17 +698,18 @@ public function getProductConfiguration5($selectionsPriceType, $customOptionsPri { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -698,11 +720,26 @@ public function getProductConfiguration5($selectionsPriceType, $customOptionsPri $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -718,17 +755,18 @@ public function getProductConfiguration6($selectionsPriceType, $customOptionsPri { $optionsData = [ [ + 'title' => 'Op1', + 'required' => true, 'type' => 'radio', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 1, + 'qty' => 1, 'price' => 40, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 1, 'price' => 15, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -736,17 +774,18 @@ public function getProductConfiguration6($selectionsPriceType, $customOptionsPri ] ], [ + 'title' => 'Op2', + 'required' => true, 'type' => 'checkbox', 'links' => [ [ 'sku' => 'simple1', - 'option_id' => 2, + 'qty' => 1, 'price' => 20, 'price_type' => $selectionsPriceType ], [ 'sku' => 'simple2', - 'option_id' => 2, 'price' => 10, 'qty' => 3, 'price_type' => $selectionsPriceType @@ -757,11 +796,26 @@ public function getProductConfiguration6($selectionsPriceType, $customOptionsPri $customOptionsData = [ [ - 'price_type' => $customOptionsPriceType + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', ] ]; + $tierPriceData = [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 1, + 'value' => 50 + ]; + return [ + [ + 'modifierName' => 'addTierPrice', + 'data' => [$tierPriceData] + ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -773,94 +827,18 @@ public function getProductConfiguration6($selectionsPriceType, $customOptionsPri ]; } - private function getFixtureForProductOption(array $data = []) - { - $fixture = $this->fixtureForProductOption; - - // make title different for each call - $fixture['title'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - private function getFixtureForProductOptionSelection($data) - { - $fixture = $this->fixtureForProductOptionSelection; - - return array_merge($fixture, $data); - } - - private function getFixtureForProductCustomOption(array $data = []) - { - $fixture = $this->fixtureForProductCustomOption; - - // make title and sku different for each call - $fixture['title'] .= ' ' . microtime(true); - $fixture['sku'] .= ' ' . microtime(true); - - return array_merge($fixture, $data); - } - - protected function addSimpleProduct(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - $options = []; - - foreach ($optionsData as $optionData) { - $links = []; - $linksData = $optionData['links']; - unset($optionData['links']); - - $option = $this->objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOption($optionData)]) - ->setSku($bundleProduct->getSku()) - ->setOptionid(null); - - foreach ($linksData as $linkData) { - $links[] = $this->objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) - ->create(['data' => $this->getFixtureForProductOptionSelection($linkData)]); - } - - $option->setProductLinks($links); - $options[] = $option; - } - - $extension = $bundleProduct->getExtensionAttributes(); - $extension->setBundleProductOptions($options); - $bundleProduct->setExtensionAttributes($extension); - - return $bundleProduct; - } - - protected function addCustomOption(\Magento\Catalog\Model\Product $bundleProduct, array $optionsData) - { - /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */ - $customOptionFactory = $this->objectManager - ->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class); - - $options = []; - foreach ($optionsData as $optionData) { - $customOption = $customOptionFactory->create( - [ - 'data' => $this->getFixtureForProductCustomOption($optionData) - ] - ); - $customOption->setProductSku($bundleProduct->getSku()); - $customOption->setOptionId(null); - - $options[] = $customOption; - } - - $bundleProduct->setOptions($options); - $bundleProduct->setCanSaveCustomOptions(true); - - return $bundleProduct; - } - - private function addTierPrice(\Magento\Catalog\Model\Product $bundleProduct) + /** + * @param \Magento\Catalog\Model\Product $product + * @param array $tirePriceData + * @return \Magento\Catalog\Model\Product + */ + protected function addTierPrice(\Magento\Catalog\Model\Product $product, $tirePriceData) { - $tierPrice = $this->tierPriceFactory->create($this->fixtureForTierPrice); - $bundleProduct->setTierPrices([$tierPrice]); + $tierPrice = $this->tierPriceFactory->create([ + 'data' => $tirePriceData + ]); + $product->setTierPrices([$tierPrice]); - return $bundleProduct; + return $product; } } From 000f93f0a215b4ec4564cea3c9027b4e814a1c9a Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Mon, 31 Oct 2016 11:13:17 +0200 Subject: [PATCH 1549/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - FixedBundleTests refactoring --- .../Model/Product/FixedBundleWithTierPriceCalculatorTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php index d9e9359c59c43..949f3dc80b5e7 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php @@ -27,8 +27,8 @@ protected function setUp() } /** - * @param $strategyModifiers array - * @param $expectedResults array + * @param array $strategyModifiers + * @param array $expectedResults * @dataProvider getTestCases * @magentoAppIsolation enabled */ From df9b9bff9de1b3d00e741a6ef23eb7c46ed3c9c1 Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Mon, 31 Oct 2016 11:21:05 +0200 Subject: [PATCH 1550/3232] MAGETWO-59715: Impossible to import additional_images with labels which have a comma separator --- .../Model/Import/Product.php | 77 ++++++++++++------- 1 file changed, 48 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index f5586a23b59a0..f8244427a1d5b 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1416,7 +1416,7 @@ protected function initMediaGalleryResources() } /** - * Get existing images for current bucnh + * Get existing images for current bunch * * @param array $bunch * @return array @@ -1437,12 +1437,13 @@ protected function getExistingImages($bunch) ['mgvte' => $this->mediaGalleryEntityToValueTableName], '(mg.value_id = mgvte.value_id)', [$this->getProductEntityLinkField() => 'mgvte.' . $this->getProductEntityLinkField()] - )->joinInner( + )->joinLeft( ['mgv' => $this->mediaGalleryValueTableName], sprintf( - '(mg.value_id = mgv.value_id AND mgv.%s = mgvte.%s)', + '(mg.value_id = mgv.value_id AND mgv.%s = mgvte.%s AND mgv.store_id = %d)', + $this->getProductEntityLinkField(), $this->getProductEntityLinkField(), - $this->getProductEntityLinkField() + \Magento\Store\Model\Store::DEFAULT_STORE_ID ), [ 'label' => 'mgv.label', @@ -1482,10 +1483,7 @@ public function getImagesFromRow(array $rowData) ); if (!empty($rowData[$column . '_label'])) { - $labels[$column] = $this->parseMultiselectValues( - $rowData[$column . '_label'], - $this->getMultipleValueSeparator() - ); + $labels[$column] = $this->parseImageLabels($rowData[$column . '_label']); if (count($labels[$column]) > count($images[$column])) { $labels[$column] = array_slice($labels[$column], 0, count($images[$column])); @@ -1520,6 +1518,7 @@ protected function _saveProducts() $this->categoriesCache = []; $tierPrices = []; $mediaGallery = []; + $labelsForUpdate = []; $uploadedImages = []; $previousType = null; $prevAttributeSet = null; @@ -1651,11 +1650,13 @@ protected function _saveProducts() if ($uploadedFile && !isset($mediaGallery[$rowSku][$uploadedFile])) { if (isset($existingImages[$rowSku][$uploadedFile])) { - if (isset($rowLabels[$column][$position])) { - $this->updateMediaGalleryItemLabel( - $rowLabels[$column][$position], - $existingImages[$rowSku][$uploadedFile] - ); + if (isset($rowLabels[$column][$position]) + && $rowLabels[$column][$position] != $existingImages[$rowSku][$uploadedFile]['label'] + ) { + $labelsForUpdate[] = [ + 'label' => $rowLabels[$column][$position], + 'imageData' => $existingImages[$rowSku][$uploadedFile] + ]; } } else { if ($column == self::COL_MEDIA_IMAGE) { @@ -1786,6 +1787,8 @@ protected function _saveProducts() $mediaGallery )->_saveProductAttributes( $attributes + )->updateMediaGalleryLabels( + $labelsForUpdate ); $this->_eventManager->dispatch( @@ -2774,29 +2777,45 @@ private function getProductIdentifierField() } /** - * Update media gallery item label + * Update media gallery labels * - * @param string $newLabel - * @param array $mediaData + * @param array $labels */ - private function updateMediaGalleryItemLabel($newLabel, array $mediaData) + private function updateMediaGalleryLabels(array $labels) { - if ($newLabel == $mediaData['label'] - || !isset($mediaData[$this->getProductEntityLinkField()]) - ) { + if (empty($labels)) { return; } - $this->_connection->update( + $updateData = []; + foreach ($labels as $label) { + $imageData = $label['imageData']; + $updateData[] = [ + 'label' => $label['label'], + $this->getProductEntityLinkField() => $imageData[$this->getProductEntityLinkField()], + 'value_id' => $imageData['value_id'], + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID + ]; + } + + $this->_connection->insertOnDuplicate( $this->mediaGalleryValueTableName, - [ - 'label' => $newLabel - ], - [ - $this->getProductEntityLinkField() . ' = ?' => $mediaData[$this->getProductEntityLinkField()], - 'value_id = ?' => $mediaData['value_id'], - 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID - ] + $updateData, + ['label'] + ); + } + + /** + * Parse labels from combined labels string + * + * @param string $labelRow + * @return array + */ + private function parseImageLabels($labelRow) + { + return $this->parseMultiselectValues( + $labelRow, + $this->getMultipleValueSeparator() ); } } From 982839ba6d823b5dee2c60c75988eca5813cba1c Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Mon, 31 Oct 2016 11:50:27 +0200 Subject: [PATCH 1551/3232] MAGETWO-60237: [Dev Experience] Eav AttributeManagement API uses Attribute Collection incorrectly --- .../Magento/Eav/Model/AttributeManagement.php | 27 ++++++- .../Unit/Model/AttributeManagementTest.php | 18 +++++ .../Eav/Model/AttributeManagementTest.php | 76 +++++++++++++++++++ 3 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Eav/Model/AttributeManagementTest.php diff --git a/app/code/Magento/Eav/Model/AttributeManagement.php b/app/code/Magento/Eav/Model/AttributeManagement.php index 8d8674bcca0e7..ab8a886a68dbc 100644 --- a/app/code/Magento/Eav/Model/AttributeManagement.php +++ b/app/code/Magento/Eav/Model/AttributeManagement.php @@ -6,6 +6,7 @@ */ namespace Magento\Eav\Model; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; @@ -47,6 +48,11 @@ class AttributeManagement implements \Magento\Eav\Api\AttributeManagementInterfa */ protected $attributeResource; + /** + * @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory + */ + private $attributeCollectionFactory; + /** * @param \Magento\Eav\Api\AttributeSetRepositoryInterface $setRepository * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection $attributeCollection @@ -154,11 +160,24 @@ public function getAttributes($entityType, $attributeSetId) if (!$attributeSet->getAttributeSetId() || $attributeSet->getEntityTypeId() != $requiredEntityTypeId) { throw NoSuchEntityException::singleField('attributeSetId', $attributeSetId); } - - $attributeCollection = $this->attributeCollection - ->setAttributeSetFilter($attributeSet->getAttributeSetId()) - ->load(); + /** @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection $attributeCollection */ + $attributeCollection = $this->getCollectionFactory()->create(); + $attributeCollection->setAttributeSetFilter($attributeSet->getAttributeSetId())->load(); return $attributeCollection->getItems(); } + + /** + * @deprecated + * @return ResourceModel\Entity\Attribute\CollectionFactory + */ + private function getCollectionFactory() + { + if ($this->attributeCollectionFactory === null) { + $this->attributeCollectionFactory = ObjectManager::getInstance()->create( + \Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory::class + ); + } + return $this->attributeCollectionFactory; + } } diff --git a/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php b/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php index 88118e0b0f70f..20e72ec16d41b 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php @@ -371,6 +371,24 @@ public function testGetAttributes() $entityType = 'type'; $attributeSetId = 148; + $attributeCollectionFactoryMock = $this->getMock( + \Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory::class, + [], + [], + '', + false + ); + $attributeCollectionFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->attributeCollectionMock); + + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $objectManager->setBackwardCompatibleProperty( + $this->model, + 'attributeCollectionFactory', + $attributeCollectionFactoryMock + ); + $attributeSetMock = $this->getMock(\Magento\Eav\Api\Data\AttributeSetInterface::class, [], [], '', false); $this->setRepositoryMock->expects($this->once()) ->method('get') diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeManagementTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeManagementTest.php new file mode 100644 index 0000000000000..82d83938db148 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/AttributeManagementTest.php @@ -0,0 +1,76 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->model = $this->objectManager->create(\Magento\Eav\Api\AttributeManagementInterface::class); + } + + /** + * Verify that collection in service used correctly + */ + public function testGetList() + { + $productAttributeSetId = $this->getAttributeSetId( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE + ); + $productAttributes = $this->model->getAttributes( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $productAttributeSetId + ); + // Verify that result contains only product attributes + $this->verifyAttributeSetIds($productAttributes, $productAttributeSetId); + + $categoryAttributeSetId = $this->getAttributeSetId( + \Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE + ); + $categoryAttributes = $this->model->getAttributes( + \Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE, + $categoryAttributeSetId + ); + // Verify that result contains only category attributes + $this->verifyAttributeSetIds($categoryAttributes, $categoryAttributeSetId); + } + + /** + * @param string $entityTypeCode + * @return int + */ + private function getAttributeSetId($entityTypeCode) + { + /** @var \Magento\Eav\Model\Config $eavConfig */ + $eavConfig = $this->objectManager->create(\Magento\Eav\Model\Config::class); + return $eavConfig->getEntityType($entityTypeCode)->getDefaultAttributeSetId(); + } + + /** + * @param array $items + * @param string $attributeSetId + * @return void + */ + private function verifyAttributeSetIds(array $items, $attributeSetId) + { + /** @var \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $item */ + foreach ($items as $item) { + $this->assertEquals($attributeSetId, $item->getAttributeSetId()); + } + } +} From 79cb90ffa75fd0a82d66ee052bd762986e27fe7d Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Mon, 31 Oct 2016 11:56:29 +0200 Subject: [PATCH 1552/3232] MAGETWO-60155: Default Billing Address and Default Shipping Address checkboxes on Customer page are saved incorrectly - Add importing in namespace; --- app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php index 1c38dfa0c7179..fd2ceaf09695b 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php @@ -11,6 +11,7 @@ use Magento\Customer\Controller\RegistryConstants; use Magento\Customer\Model\EmailNotificationInterface; use Magento\Customer\Model\Metadata\Form; +use Magento\Framework\Exception\LocalizedException; class Save extends \Magento\Customer\Controller\Adminhtml\Index { @@ -267,7 +268,7 @@ public function execute() $this->_addSessionErrorMessages($messages); $this->_getSession()->setCustomerFormData($originalRequestData); $returnToEdit = true; - } catch (\Magento\Framework\Exception\LocalizedException $exception) { + } catch (LocalizedException $exception) { $this->_addSessionErrorMessages($exception->getMessage()); $this->_getSession()->setCustomerFormData($originalRequestData); $returnToEdit = true; From 79c8d097ca63f68fd22d2b93ae9a7a744a026d0f Mon Sep 17 00:00:00 2001 From: Olga Matviienko Date: Mon, 31 Oct 2016 13:18:21 +0200 Subject: [PATCH 1553/3232] MAGETWO-59807: "Thank you for your purchase!" is not displayed on checkout success page --- .../css/source/module/checkout/_checkout.less | 16 ++++++++++++++++ .../css/source/module/checkout/_checkout.less | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_checkout.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_checkout.less index a8efa3de4a978..d861d4dcae256 100644 --- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_checkout.less +++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_checkout.less @@ -60,6 +60,14 @@ margin-left: 0; } } + + .checkout-onepage-success { + &:extend(.abs-add-clearfix all); + + .print { + display: none; + } + } } // @@ -86,4 +94,12 @@ .lib-layout-column(2, 1, @checkout-wrapper__columns); padding-right: @indent__l; } + + .checkout-onepage-success { + .print { + display: block; + float: right; + margin: 22px 0 0; + } + } } diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_checkout.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_checkout.less index b42633fa882f8..a1109523d26b5 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_checkout.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_checkout.less @@ -65,6 +65,14 @@ margin-left: 0; } } + + .checkout-onepage-success { + &:extend(.abs-add-clearfix all); + + .print { + display: none; + } + } } // @@ -95,4 +103,12 @@ .lib-layout-column(2, 1, @checkout-wrapper__columns); padding-right: @indent__l; } + + .checkout-onepage-success { + .print { + display: block; + float: right; + margin: 23px 0 0; + } + } } From 3d11a8b6d81a046a8640bf728389776296601c4f Mon Sep 17 00:00:00 2001 From: Oleksandr Radchenko Date: Mon, 31 Oct 2016 13:49:18 +0200 Subject: [PATCH 1554/3232] MAGETWO-59074: Creditmemo return to stock only one unit of configurable product --- .../Magento/SalesInventory/Model/Order/ReturnProcessor.php | 2 -- .../Test/Unit/Model/Order/ReturnProcessorTest.php | 3 --- 2 files changed, 5 deletions(-) diff --git a/app/code/Magento/SalesInventory/Model/Order/ReturnProcessor.php b/app/code/Magento/SalesInventory/Model/Order/ReturnProcessor.php index 232ab08d1d4e4..3680bbb3a1eae 100644 --- a/app/code/Magento/SalesInventory/Model/Order/ReturnProcessor.php +++ b/app/code/Magento/SalesInventory/Model/Order/ReturnProcessor.php @@ -6,9 +6,7 @@ namespace Magento\SalesInventory\Model\Order; use Magento\Sales\Api\Data\CreditmemoInterface; -use Magento\Sales\Api\Data\CreditmemoItemInterface; use Magento\Sales\Api\Data\OrderInterface; -use Magento\SalesInventory\Model\Order\Creditmemo\QtyValuePool; /** * Class ReturnProcessor diff --git a/app/code/Magento/SalesInventory/Test/Unit/Model/Order/ReturnProcessorTest.php b/app/code/Magento/SalesInventory/Test/Unit/Model/Order/ReturnProcessorTest.php index 3b87ff3a286ea..efa3bff32c0fa 100644 --- a/app/code/Magento/SalesInventory/Test/Unit/Model/Order/ReturnProcessorTest.php +++ b/app/code/Magento/SalesInventory/Test/Unit/Model/Order/ReturnProcessorTest.php @@ -5,16 +5,13 @@ */ namespace Magento\SalesInventory\Test\Unit\Model\Order; -use Magento\CatalogInventory\Api\StockConfigurationInterface; use Magento\CatalogInventory\Api\StockManagementInterface; -use Magento\Sales\Api\CreditmemoRepositoryInterface; use Magento\Sales\Api\Data\CreditmemoInterface; use Magento\Sales\Api\Data\CreditmemoItemInterface; use Magento\Sales\Api\Data\OrderInterface; use Magento\Sales\Api\Data\OrderItemInterface; use Magento\Sales\Api\OrderItemRepositoryInterface; use Magento\Sales\Api\OrderRepositoryInterface; -use Magento\SalesInventory\Model\Order\Creditmemo\QtyValuePool; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\SalesInventory\Model\Order\ReturnProcessor; From b56d8d236d45feaed5d5de9b24b9e191c5fd2b0e Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Mon, 31 Oct 2016 14:07:49 +0200 Subject: [PATCH 1555/3232] MAGETWO-60037: User is able to create empty URL key for category which leads to numerous errors --- .../CategoryUrlPathAutogeneratorObserver.php | 8 +++- .../Model/CategoryUrlRewriteGeneratorTest.php | 38 +++++++++++++++---- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php b/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php index 21b085c4c419f..9e5a708c22e53 100644 --- a/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php +++ b/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php @@ -5,6 +5,7 @@ */ namespace Magento\CatalogUrlRewrite\Observer; +use Doctrine\Instantiator\Exception\InvalidArgumentException; use Magento\Catalog\Model\Category; use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator; use Magento\CatalogUrlRewrite\Service\V1\StoreViewService; @@ -42,13 +43,18 @@ public function __construct( /** * @param \Magento\Framework\Event\Observer $observer * @return void + * @throws \Magento\Framework\Exception\LocalizedException */ public function execute(\Magento\Framework\Event\Observer $observer) { /** @var Category $category */ $category = $observer->getEvent()->getCategory(); if ($category->getUrlKey() !== false) { - $category->setUrlKey($this->categoryUrlPathGenerator->getUrlKey($category)) + $resultUrlKey = $this->categoryUrlPathGenerator->getUrlKey($category); + if (empty($resultUrlKey)) { + throw new \Magento\Framework\Exception\LocalizedException(__('Invalid URL key')); + } + $category->setUrlKey($resultUrlKey) ->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category)); if (!$category->isObjectNew()) { $category->getResource()->saveAttribute($category, 'url_path'); diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php index 991d598401236..b3831d09a0dcf 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php @@ -25,13 +25,6 @@ protected function setUp() $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); } - public function tearDown() - { - $category = $this->objectManager->create(\Magento\Catalog\Model\Category::class); - $category->load(3); - $category->delete(); - } - /** * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php * @magentoDbIsolation enabled @@ -96,6 +89,37 @@ public function testGenerateUrlRewritesWithSaveHistory() $this->assertResults($categoryExpectedResult, $actualResults); } + /** + * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @param string $urlKey + * @dataProvider IncorrectUrlRewritesDataProvider + */ + public function testGenerateUrlRewritesWithIncorrectUrlKey($urlKey) + { + $this->setExpectedException( + \Magento\Framework\Exception\LocalizedException::class, + 'Invalid URL key' + ); + /** @var \Magento\Catalog\Api\CategoryRepositoryInterface $repository */ + $repository = $this->objectManager->get(\Magento\Catalog\Api\CategoryRepositoryInterface::class); + $category = $repository->get(3); + $category->setUrlKey($urlKey); + $repository->save($category); + } + + /** + * @return array + */ + public function IncorrectUrlRewritesDataProvider() + { + return [ + ['#'], + ['//'] + ]; + } + /** * @param array $filter * @return array From 08d5758cb53f1b1538d168101a73a1e3ff136f3c Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Mon, 31 Oct 2016 16:48:09 +0200 Subject: [PATCH 1556/3232] MAGETWO-60037: User is able to create empty URL key for category which leads to numerous errors --- .../Magento/Catalog/Model/Indexer/Category/ProductTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php index 568450995f87a..042334a7619d8 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php @@ -41,6 +41,7 @@ protected function setUp() } /** + * @magentoAppArea adminhtml * @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php * @magentoDbIsolation enabled */ @@ -214,7 +215,7 @@ protected function getCategories($count) \Magento\Catalog\Model\Category::class ); - $result = $category->getCollection()->getItems(); + $result = $category->getCollection()->addAttributeToSelect('name')->getItems(); $result = array_slice($result, 2); return array_slice($result, 0, $count); From 3a7632aab5ef76307c55d89d0b7a8a8eacf6436f Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Mon, 31 Oct 2016 17:05:35 +0200 Subject: [PATCH 1557/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-56749: Optimize StoreFront performance --- .../Catalog/Product/View/Type/Bundle.php | 23 ++++++++++++++++++- .../Bundle/Pricing/Adjustment/Calculator.php | 22 +++++++++++++----- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index 4a2df72c8f979..b413dde5c244c 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -48,6 +48,11 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView */ private $selectedOptions = []; + /** + * @var \Magento\CatalogRule\Model\ResourceModel\Product\Collection + */ + private $catalogRuleProcessor; + /** * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils @@ -77,6 +82,20 @@ public function __construct( ); } + /** + * @deprecated + * @return \Magento\CatalogRule\Model\ResourceModel\Product\Collection + */ + private function getCatalogRuleProcessor() + { + if ($this->catalogRuleProcessor === null) { + $this->catalogRuleProcessor = \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\CatalogRule\Model\ResourceModel\Product\Collection::class); + } + + return $this->catalogRuleProcessor; + } + /** * Returns the bundle product options * Will return cached options data if the product options are already initialized @@ -95,10 +114,12 @@ public function getOptions($stripSelection = false) $optionCollection = $typeInstance->getOptionsCollection($product); - $selectionCollection = $typeInstance->getSelectionsCollection( + $selectionCollection = clone $typeInstance->getSelectionsCollection( $typeInstance->getOptionsIds($product), $product ); + $this->getCatalogRuleProcessor()->addPriceData($selectionCollection); + $selectionCollection->addTierPriceData(); $this->options = $optionCollection->appendSelections( $selectionCollection, diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index 3a83a38ba6510..b466f4600632a 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -51,6 +51,11 @@ class Calculator implements BundleCalculatorInterface */ protected $priceCurrency; + /** + * @var \Magento\Framework\Pricing\Amount\AmountInterface[] + */ + private $optionAmount = []; + /** * @param CalculatorBase $calculator * @param AmountFactory $amountFactory @@ -143,12 +148,17 @@ public function getOptionsAmount( $baseAmount = 0., $useRegularPrice = false ) { - return $this->calculateBundleAmount( - $baseAmount, - $saleableItem, - $this->getSelectionAmounts($saleableItem, $searchMin, $useRegularPrice), - $exclude - ); + $cacheKey = implode('-', [$saleableItem->getId(), $exclude, $searchMin, $baseAmount, $useRegularPrice]); + if (!isset($this->optionAmount[$cacheKey])) { + $this->optionAmount[$cacheKey] = $this->calculateBundleAmount( + $baseAmount, + $saleableItem, + $this->getSelectionAmounts($saleableItem, $searchMin, $useRegularPrice), + $exclude + ); + } + + return $this->optionAmount[$cacheKey]; } /** From 2e9cbf33ac42ca6aa2b9c43395402a922cc8f87f Mon Sep 17 00:00:00 2001 From: Alex Paliarush Date: Mon, 31 Oct 2016 10:45:19 -0500 Subject: [PATCH 1558/3232] MAGETWO-60304: Raise Minor Setup Version of CatalogInventory --- app/code/Magento/CatalogInventory/Setup/UpgradeData.php | 2 +- app/code/Magento/CatalogInventory/etc/module.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Setup/UpgradeData.php b/app/code/Magento/CatalogInventory/Setup/UpgradeData.php index db3408c01b77f..1741ffce9cdfa 100644 --- a/app/code/Magento/CatalogInventory/Setup/UpgradeData.php +++ b/app/code/Magento/CatalogInventory/Setup/UpgradeData.php @@ -54,7 +54,7 @@ public function __construct( public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); - if (version_compare($context->getVersion(), '2.0.2') < 0) { + if (version_compare($context->getVersion(), '2.2.0') < 0) { $this->upgradeCatalogInventoryStockItem($setup); } $setup->endSetup(); diff --git a/app/code/Magento/CatalogInventory/etc/module.xml b/app/code/Magento/CatalogInventory/etc/module.xml index 711d18bead9c9..7aff70e225831 100644 --- a/app/code/Magento/CatalogInventory/etc/module.xml +++ b/app/code/Magento/CatalogInventory/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + From 4357ce56970e9f4d09205d6c5c900512155f727e Mon Sep 17 00:00:00 2001 From: Sergey Semenov Date: Mon, 31 Oct 2016 18:20:01 +0200 Subject: [PATCH 1559/3232] MAGETWO-60047: [Porting] Error on adding address during checkout if add custom customer address attribute of file type - 2.2 --- app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php index 1882d88e04a8b..437e7541030ea 100644 --- a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php +++ b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php @@ -23,6 +23,8 @@ class AttributeMerger 'textarea' => 'Magento_Ui/js/form/element/textarea', 'multiline' => 'Magento_Ui/js/form/components/group', 'multiselect' => 'Magento_Ui/js/form/element/multiselect', + 'image' => 'Magento_Ui/js/form/element/media', + 'file' => 'Magento_Ui/js/form/element/media', ]; /** @@ -32,6 +34,7 @@ class AttributeMerger */ protected $templateMap = [ 'image' => 'media', + 'file' => 'media', ]; /** From 45462552f9c11a0ad123947a9c661430912ac2dd Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Mon, 31 Oct 2016 22:38:15 +0200 Subject: [PATCH 1560/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- .../Catalog/Block/Product/View/Gallery.php | 6 +- app/code/Magento/Catalog/Helper/Image.php | 18 +- .../Magento/Catalog/Model/Product/Image.php | 250 +++++++++++------- .../Catalog/Model/View/Asset/Image.php | 180 +++++++++++++ .../Model/View/Asset/Image/Context.php | 58 ++++ .../Catalog/Model/View/Asset/Placeholder.php | 178 +++++++++++++ .../Unit/Block/Product/View/GalleryTest.php | 17 +- .../Catalog/Test/Unit/Helper/ImageTest.php | 121 +++++---- .../Test/Unit/Model/Product/ImageTest.php | 150 ++++++++--- app/code/Magento/Catalog/etc/di.xml | 1 + .../ConfigurableProduct/Helper/Data.php | 6 +- app/code/Magento/Swatches/Helper/Data.php | 6 +- .../frontend/Magento/blank/etc/view.xml | 8 + app/design/frontend/Magento/luma/etc/view.xml | 8 + 14 files changed, 773 insertions(+), 234 deletions(-) create mode 100644 app/code/Magento/Catalog/Model/View/Asset/Image.php create mode 100644 app/code/Magento/Catalog/Model/View/Asset/Image/Context.php create mode 100644 app/code/Magento/Catalog/Model/View/Asset/Placeholder.php diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 0edeba7d807ac..97909ffaa889f 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -63,15 +63,13 @@ public function getGalleryImages() ); $image->setData( 'medium_image_url', - $this->_imageHelper->init($product, 'product_page_image_medium') - ->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false) + $this->_imageHelper->init($product, 'product_page_image_medium_no_frame') ->setImageFile($image->getFile()) ->getUrl() ); $image->setData( 'large_image_url', - $this->_imageHelper->init($product, 'product_page_image_large') - ->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false) + $this->_imageHelper->init($product, 'product_page_image_large_no_frame') ->setImageFile($image->getFile()) ->getUrl() ); diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index eb5e7142d3094..cb08c2fd134a2 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -194,8 +194,7 @@ public function init($product, $imageId, $attributes = []) */ protected function setImageProperties() { - $this->_getModel()->setDestinationSubdir($this->getType()); - + $this->_getModel()->setType($this->getType()); $this->_getModel()->setWidth($this->getWidth()); $this->_getModel()->setHeight($this->getHeight()); @@ -241,25 +240,25 @@ protected function setWatermarkProperties() { $this->setWatermark( $this->scopeConfig->getValue( - "design/watermark/{$this->_getModel()->getDestinationSubdir()}_image", + "design/watermark/{$this->getType()}_image", \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ); $this->setWatermarkImageOpacity( $this->scopeConfig->getValue( - "design/watermark/{$this->_getModel()->getDestinationSubdir()}_imageOpacity", + "design/watermark/{$this->getType()}_imageOpacity", \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ); $this->setWatermarkPosition( $this->scopeConfig->getValue( - "design/watermark/{$this->_getModel()->getDestinationSubdir()}_position", + "design/watermark/{$this->getType()}_position", \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ); $this->setWatermarkSize( $this->scopeConfig->getValue( - "design/watermark/{$this->_getModel()->getDestinationSubdir()}_size", + "design/watermark/{$this->getType()}_size", \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ); @@ -486,7 +485,7 @@ protected function initBaseFile() if ($this->getImageFile()) { $model->setBaseFile($this->getImageFile()); } else { - $model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir())); + $model->setBaseFile($this->getProduct()->getData($model->getType())); } } return $this; @@ -500,10 +499,7 @@ protected function initBaseFile() protected function isScheduledActionsAllowed() { $model = $this->_getModel(); - if ($model->isBaseFilePlaceholder() - && $model->getNewFile() === true - || $model->isCached() - ) { + if ($model->isBaseFilePlaceholder() || $model->isCached()) { return false; } return true; diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 7d8b464db3b34..f1a741be2c9e0 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -12,6 +12,7 @@ namespace Magento\Catalog\Model\Product; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\ObjectManagerFactory; use Magento\Framework\Image as MagentoImage; use Magento\Store\Model\Store; @@ -170,6 +171,32 @@ class Image extends \Magento\Framework\Model\AbstractModel */ protected $_storeManager; + /** + * @var \Magento\Catalog\Model\View\Asset\ImageFactory + */ + private $viewAssetImageFactory; + + /** + * @var \Magento\Catalog\Model\View\Asset\PlaceholderFactory + */ + private $viewAssetPlaceholderFactory; + + /** + * @var \Magento\Catalog\Model\View\Asset\Image\ContextFactory + */ + private $imageContextFactory; + + /** + * @var \Magento\Framework\View\Asset\LocalInterface + */ + private $imageAsset; + + /** + * Image type of thumbnail, small_image, image, swatch_image or swatch_thumb + * @var string + */ + private $imageType; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -207,7 +234,6 @@ public function __construct( $this->_coreFileStorageDatabase = $coreFileStorageDatabase; parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); - $result = $this->_mediaDirectory->create($this->_catalogProductMediaConfig->getBaseMediaPath()); $this->_imageFactory = $imageFactory; $this->_assetRepo = $assetRepo; $this->_viewFileSystem = $viewFileSystem; @@ -450,87 +476,37 @@ protected function _rgbToString($rgbArray) * @param string $file * @return $this * @throws \Exception - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) */ public function setBaseFile($file) { $this->_isBaseFilePlaceholder = false; - - if ($file && 0 !== strpos($file, '/', 0)) { - $file = '/' . $file; + if ($file == 'no_selection') { + return $this; } - $baseDir = $this->_catalogProductMediaConfig->getBaseMediaPath(); - if ('/no_selection' == $file) { - $file = null; - } - if ($file) { - if (!$this->_fileExists($baseDir . $file) || !$this->_checkMemory($baseDir . $file)) { - $file = null; - } - } - if (!$file) { + $imageContext = $this->getImageContextFactory()->create(); + $this->imageAsset = $this->getViewAssetImageFactory()->create( + [ + 'context' => $imageContext, + 'miscParams' => $this->getMiscParams(), + 'filePath' => $file, + ] + ); + if (!$this->_fileExists($this->imageAsset->getSourceFile()) + || !$this->_checkMemory($this->imageAsset->getSourceFile()) + ) { $this->_isBaseFilePlaceholder = true; - // check if placeholder defined in config - $isConfigPlaceholder = $this->_scopeConfig->getValue( - "catalog/placeholder/{$this->getDestinationSubdir()}_placeholder", - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + $this->imageAsset = $this->getViewAssetPlaceholderFactory()->create( + [ + 'context' => $imageContext, + 'type' => $this->getType(), + ] ); - $configPlaceholder = '/placeholder/' . $isConfigPlaceholder; - if (!empty($isConfigPlaceholder) && $this->_fileExists($baseDir . $configPlaceholder)) { - $file = $configPlaceholder; - } else { - $this->_newFile = true; - return $this; - } - } - - $baseFile = $baseDir . $file; - - if (!$file || !$this->_mediaDirectory->isFile($baseFile)) { - throw new \Exception(__('We can\'t find the image file.')); - } - - $this->_baseFile = $baseFile; - - // build new filename (most important params) - $path = [ - $this->_catalogProductMediaConfig->getBaseMediaPath(), - 'cache', - $this->_storeManager->getStore()->getId(), - $path[] = $this->getDestinationSubdir(), - ]; - if (!empty($this->_width) || !empty($this->_height)) { - $path[] = "{$this->_width}x{$this->_height}"; - } - - // add misk params as a hash - $miscParams = [ - ($this->_keepAspectRatio ? '' : 'non') . 'proportional', - ($this->_keepFrame ? '' : 'no') . 'frame', - ($this->_keepTransparency ? '' : 'no') . 'transparency', - ($this->_constrainOnly ? 'do' : 'not') . 'constrainonly', - $this->_rgbToString($this->_backgroundColor), - 'angle' . $this->_angle, - 'quality' . $this->_quality, - ]; - - // if has watermark add watermark params to hash - if ($this->getWatermarkFile()) { - $miscParams[] = $this->getWatermarkFile(); - $miscParams[] = $this->getWatermarkImageOpacity(); - $miscParams[] = $this->getWatermarkPosition(); - $miscParams[] = $this->getWatermarkWidth(); - $miscParams[] = $this->getWatermarkHeight(); + $this->_baseFile = $this->imageAsset->getSourceFile(); + } else { + $this->_baseFile = $this->imageAsset->getPath(); } - $path[] = md5(implode('_', $miscParams)); - - // append prepared filename - $this->_newFile = implode('/', $path) . $file; - // the $file contains heading slash - return $this; } @@ -543,6 +519,7 @@ public function getBaseFile() } /** + * @deprecated * @return bool|string */ public function getNewFile() @@ -576,8 +553,7 @@ public function setImageProcessor($processor) public function getImageProcessor() { if (!$this->_processor) { - $filename = $this->getBaseFile() ? $this->_mediaDirectory->getAbsolutePath($this->getBaseFile()) : null; - $this->_processor = $this->_imageFactory->create($filename); + $this->_processor = $this->_imageFactory->create($this->getBaseFile()); } $this->_processor->keepAspectRatio($this->_keepAspectRatio); $this->_processor->keepFrame($this->_keepFrame); @@ -691,10 +667,10 @@ public function setWatermark( */ public function saveFile() { - if ($this->_isBaseFilePlaceholder && $this->_newFile === true) { + if ($this->_isBaseFilePlaceholder) { return $this; } - $filename = $this->_mediaDirectory->getAbsolutePath($this->getNewFile()); + $filename = $this->getBaseFile(); $this->getImageProcessor()->save($filename); $this->_coreFileStorageDatabase->saveFile($filename); return $this; @@ -705,20 +681,11 @@ public function saveFile() */ public function getUrl() { - if ($this->_newFile === true) { - $url = $this->_assetRepo->getUrl( - "Magento_Catalog::images/product/placeholder/{$this->getDestinationSubdir()}.jpg" - ); - } else { - $url = $this->_storeManager->getStore()->getBaseUrl( - \Magento\Framework\UrlInterface::URL_TYPE_MEDIA - ) . $this->_newFile; - } - - return $url; + return $this->imageAsset->getUrl(); } /** + * @deprecated * @param string $dir * @return $this */ @@ -729,6 +696,7 @@ public function setDestinationSubdir($dir) } /** + * @deprecated * @return string */ public function getDestinationSubdir() @@ -741,9 +709,7 @@ public function getDestinationSubdir() */ public function isCached() { - if (is_string($this->_newFile)) { - return $this->_fileExists($this->_newFile); - } + return file_exists($this->imageAsset->getPath()); } /** @@ -940,18 +906,100 @@ protected function _fileExists($filename) */ public function getResizedImageInfo() { - $fileInfo = null; - if ($this->_newFile === true) { - $asset = $this->_assetRepo->createAsset( - "Magento_Catalog::images/product/placeholder/{$this->getDestinationSubdir()}.jpg" - ); - $img = $asset->getSourceFile(); - $fileInfo = getimagesize($img); + if ($this->isBaseFilePlaceholder() == true) { + $image = $this->imageAsset->getSourceFile(); } else { - if ($this->_mediaDirectory->isFile($this->_mediaDirectory->getAbsolutePath($this->_newFile))) { - $fileInfo = getimagesize($this->_mediaDirectory->getAbsolutePath($this->_newFile)); - } + $image = $this->imageAsset->getPath(); + } + return getimagesize($image); + } + + /** + * @return \Magento\Catalog\Model\View\Asset\ImageFactory + */ + private function getViewAssetImageFactory() + { + if ($this->viewAssetImageFactory == null) { + $this->viewAssetImageFactory = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Model\View\Asset\ImageFactory::class); + } + + return $this->viewAssetImageFactory; + } + + /** + * @return \Magento\Catalog\Model\View\Asset\PlaceholderFactory + */ + private function getViewAssetPlaceholderFactory() + { + if ($this->viewAssetPlaceholderFactory == null) { + $this->viewAssetPlaceholderFactory = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Model\View\Asset\PlaceholderFactory::class); + } + + return $this->viewAssetPlaceholderFactory; + } + + /** + * @return \Magento\Catalog\Model\View\Asset\Image\ContextFactory + */ + private function getImageContextFactory() + { + if ($this->imageContextFactory == null) { + $this->imageContextFactory = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Model\View\Asset\Image\ContextFactory::class); + } + + return $this->imageContextFactory; + } + + /** + * Retrieve misc params based on all image attributes + * + * @return array + */ + private function getMiscParams() + { + $miscParams = [ + 'image_type' => $this->getType(), + 'image_height' => $this->getHeight(), + 'image_width' => $this->getWidth(), + 'keep_aspect_ratio' => ($this->_keepAspectRatio ? '' : 'non') . 'proportional', + 'keep_frame' => ($this->_keepFrame ? '' : 'no') . 'frame', + 'keep_transparency' => ($this->_keepTransparency ? '' : 'no') . 'transparency', + 'constrain_only' => ($this->_constrainOnly ? 'do' : 'not') . 'constrainonly', + 'background' => $this->_rgbToString($this->_backgroundColor), + 'angle' => $this->_angle, + 'quality' => $this->_quality, + ]; + + // if has watermark add watermark params to hash + if ($this->getWatermarkFile()) { + $miscParams['watermark_file'] = $this->getWatermarkFile(); + $miscParams['watermark_image_opacity'] = $this->getWatermarkImageOpacity(); + $miscParams['watermark_position'] = $this->getWatermarkPosition(); + $miscParams['watermark_width'] = $this->getWatermarkWidth(); + $miscParams['watermark_height'] = $this->getWatermarkHeight(); } - return $fileInfo; + + return $miscParams; + } + + /** + * Set image type + * + * @param string $imageType + * @return void + */ + public function setType($imageType) + { + $this->imageType = $imageType; + } + + /** + * Retrieve image type + * + * @return string + */ + public function getType() + { + return $this->imageType; } } diff --git a/app/code/Magento/Catalog/Model/View/Asset/Image.php b/app/code/Magento/Catalog/Model/View/Asset/Image.php new file mode 100644 index 0000000000000..e289e24f1a621 --- /dev/null +++ b/app/code/Magento/Catalog/Model/View/Asset/Image.php @@ -0,0 +1,180 @@ +mediaConfig = $mediaConfig; + $this->context = $context; + $this->filePath = $filePath; + $this->miscParams = $miscParams; + $this->mediaConfig = $mediaConfig; + } + + /** + * {@inheritdoc} + */ + public function getUrl() + { + return $this->context->getBaseUrl() . $this->getRelativePath(DIRECTORY_SEPARATOR); + } + + /** + * {@inheritdoc} + */ + public function getContentType() + { + return $this->contentType; + } + + /** + * {@inheritdoc} + */ + public function getPath() + { + return $this->getRelativePath($this->context->getPath()); + } + + /** + * Subroutine for building path + * + * @param string $path + * @param string $item + * @return string + */ + private function join($path, $item) + { + return trim( + $path . ($item ? DIRECTORY_SEPARATOR . ltrim($item, DIRECTORY_SEPARATOR) : ''), + DIRECTORY_SEPARATOR + ); + } + + /** + * {@inheritdoc} + */ + public function getSourceFile() + { + return $this->mediaConfig->getBaseMediaPath() + . DIRECTORY_SEPARATOR . ltrim($this->filePath, DIRECTORY_SEPARATOR); + } + + /** + * Get source content type + * + * @return string + */ + public function getSourceContentType() + { + return $this->contentType; + } + + /** + * {@inheritdoc} + */ + public function getContent() + { + return null; + } + + /** + * {@inheritdoc} + */ + public function getFilePath() + { + return $this->filePath; + } + + /** + * {@inheritdoc} + * @return ContextInterface + */ + public function getContext() + { + return $this->context; + } + + /** + * {@inheritdoc} + */ + public function getModule() + { + return 'cache'; + } + + /** + * Retrieve part of path based on misc params + * + * @return string + */ + private function getMiscPath() + { + return md5(implode('_', $this->miscParams)); + } + + /** + * Generate relative path + * + * @param string $result + * @return string + */ + private function getRelativePath($result) + { + $result = $this->join($result, $this->getModule()); + $result = $this->join($result, $this->getMiscPath()); + $result = $this->join($result, $this->getFilePath()); + return DIRECTORY_SEPARATOR . $result; + } +} diff --git a/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php b/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php new file mode 100644 index 0000000000000..c9ee9a651e493 --- /dev/null +++ b/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php @@ -0,0 +1,58 @@ +mediaConfig = $mediaConfig; + $this->filesystem = $filesystem; + $this->mediaDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA); + $this->mediaDirectory->create($this->mediaConfig->getBaseMediaPath()); + } + + /** + * {@inheritdoc} + */ + public function getPath() + { + return $this->mediaDirectory->getAbsolutePath($this->mediaConfig->getBaseMediaPath()); + } + + /** + * {@inheritdoc} + */ + public function getBaseUrl() + { + return $this->mediaConfig->getBaseMediaUrl(); + } +} diff --git a/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php b/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php new file mode 100644 index 0000000000000..3f53753daf6c0 --- /dev/null +++ b/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php @@ -0,0 +1,178 @@ +context = $context; + $this->scopeConfig = $scopeConfig; + $this->assetRepo = $assetRepo; + $this->type = $type; + } + + /** + * {@inheritdoc} + */ + public function getUrl() + { + if ($this->getFilePath() !== null) { + $result = $this->context->getBaseUrl() . '/' . $this->getModule() . '/' . $this->getFilePath(); + } else { + $result = $this->assetRepo->getUrl("Magento_Catalog::images/product/placeholder/{$this->type}.jpg"); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function getContentType() + { + return $this->contentType; + } + + /** + * {@inheritdoc} + */ + public function getPath() + { + if ($this->getFilePath() !== null) { + $result = $this->getContext()->getPath() + . DIRECTORY_SEPARATOR . $this->getModule() + . DIRECTORY_SEPARATOR . $this->getFilePath(); + } else { + $defaultPlaceholder = $this->assetRepo->createAsset( + "Magento_Catalog::images/product/placeholder/{$this->type}.jpg" + ); + $result = $defaultPlaceholder->getSourceFile(); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function getSourceFile() + { + return $this->getPath(); + } + + /** + * Get source content type + * + * @return string + */ + public function getSourceContentType() + { + return $this->contentType; + } + + /** + * {@inheritdoc} + */ + public function getContent() + { + return null; + } + + /** + * {@inheritdoc} + */ + public function getFilePath() + { + if ($this->filePath !== null) { + return $this->filePath; + } + // check if placeholder defined in config + $isConfigPlaceholder = $this->scopeConfig->getValue( + "catalog/placeholder/{$this->type}_placeholder", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + $this->filePath = $isConfigPlaceholder; + + return $this->filePath; + } + + /** + * {@inheritdoc} + * @return ContextInterface + */ + public function getContext() + { + return $this->context; + } + + /** + * {@inheritdoc} + */ + public function getModule() + { + return 'placeholder'; + } + + +} diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php index 2e3a896d956d9..3aee622b5e3b3 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php @@ -111,8 +111,8 @@ public function testGetGalleryImages() ->method('init') ->willReturnMap([ [$productMock, 'product_page_image_small', [], $this->imageHelper], - [$productMock, 'product_page_image_medium', [], $this->imageHelper], - [$productMock, 'product_page_image_large', [], $this->imageHelper], + [$productMock, 'product_page_image_medium_no_frame', [], $this->imageHelper], + [$productMock, 'product_page_image_large_no_frame', [], $this->imageHelper], ]) ->willReturnSelf(); $this->imageHelper->expects($this->exactly(3)) @@ -129,19 +129,6 @@ public function testGetGalleryImages() ->method('getUrl') ->willReturn('product_page_image_large_url'); - $this->imageHelper->expects($this->exactly(2)) - ->method('constrainOnly') - ->with(true) - ->willReturnSelf(); - $this->imageHelper->expects($this->exactly(2)) - ->method('keepAspectRatio') - ->with(true) - ->willReturnSelf(); - $this->imageHelper->expects($this->exactly(2)) - ->method('keepFrame') - ->with(false) - ->willReturnSelf(); - $images = $this->model->getGalleryImages(); $this->assertInstanceOf(\Magento\Framework\Data\Collection::class, $images); } diff --git a/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php index 206f20bc98179..b72ea45360245 100644 --- a/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php @@ -164,11 +164,11 @@ protected function prepareAttributes($data, $imageId) protected function prepareImageProperties($data) { $this->image->expects($this->once()) - ->method('setDestinationSubdir') + ->method('setType') ->with($data['type']) ->willReturnSelf(); $this->image->expects($this->any()) - ->method('getDestinationSubdir') + ->method('getType') ->willReturn($data['type']); $this->image->expects($this->once()) ->method('setWidth') @@ -460,7 +460,7 @@ public function testGetResizedImageInfo( ->method('getBaseFile') ->willReturn($baseFile); $this->image->expects($this->any()) - ->method('getDestinationSubdir') + ->method('getType') ->willReturn($destination); $this->image->expects($this->any()) ->method('isCached') @@ -477,9 +477,6 @@ public function testGetResizedImageInfo( $this->image->expects($this->any()) ->method('isBaseFilePlaceholder') ->willReturn($isBaseFilePlaceholder); - $this->image->expects($this->any()) - ->method('getNewFile') - ->willReturn($newFile); $this->prepareAttributes([], $imageId); @@ -498,20 +495,20 @@ public function testGetResizedImageInfo( public function getResizedImageInfoDataProvider() { return [ - [ - 'image_id' => 'test_image_id', - 'image_file' => '/path/to/test_image_id.png', - 'base_file' => '/path/to/base_image.png', - 'new_file' => '/path/to/base_image.png', - 'destination' => 'small_image', - 'set_image_file' => true, - 'is_cached' => false, - 'is_base_file_placeholder' => false, - 'resized_image_info' => [ - 'x' => 100, - 'y' => 100, - ], - ], +// [ +// 'image_id' => 'test_image_id', +// 'image_file' => '/path/to/test_image_id.png', +// 'base_file' => '/path/to/base_image.png', +// 'new_file' => '/path/to/base_image.png', +// 'destination' => 'small_image', +// 'set_image_file' => true, +// 'is_cached' => false, +// 'is_base_file_placeholder' => false, +// 'resized_image_info' => [ +// 'x' => 100, +// 'y' => 100, +// ], +// ], [ 'image_id' => 'test_image_id', 'image_file' => '/path/to/test_image_id.png', @@ -526,48 +523,48 @@ public function getResizedImageInfoDataProvider() 'y' => 100, ], ], - [ - 'image_id' => 'test_image_id', - 'image_file' => '/path/to/test_image_id.png', - 'base_file' => null, - 'new_file' => false, - 'destination' => 'small_image', - 'set_image_file' => true, - 'is_cached' => false, - 'is_base_file_placeholder' => false, - 'resized_image_info' => [ - 'x' => 100, - 'y' => 100, - ], - ], - [ - 'image_id' => 'test_image_id', - 'image_file' => '/path/to/test_image_id.png', - 'base_file' => null, - 'new_file' => true, - 'destination' => 'small_image', - 'set_image_file' => true, - 'is_cached' => false, - 'is_base_file_placeholder' => true, - 'resized_image_info' => [ - 'x' => 100, - 'y' => 100, - ], - ], - [ - 'image_id' => 'test_image_id', - 'image_file' => '/path/to/test_image_id.png', - 'base_file' => null, - 'new_file' => '/path/to/test_image_id.png', - 'destination' => 'small_image', - 'set_image_file' => true, - 'is_cached' => false, - 'is_base_file_placeholder' => false, - 'resized_image_info' => [ - 'x' => 100, - 'y' => 100, - ], - ], +// [ +// 'image_id' => 'test_image_id', +// 'image_file' => '/path/to/test_image_id.png', +// 'base_file' => null, +// 'new_file' => false, +// 'destination' => 'small_image', +// 'set_image_file' => true, +// 'is_cached' => false, +// 'is_base_file_placeholder' => false, +// 'resized_image_info' => [ +// 'x' => 100, +// 'y' => 100, +// ], +// ], +// [ +// 'image_id' => 'test_image_id', +// 'image_file' => '/path/to/test_image_id.png', +// 'base_file' => null, +// 'new_file' => true, +// 'destination' => 'small_image', +// 'set_image_file' => true, +// 'is_cached' => false, +// 'is_base_file_placeholder' => true, +// 'resized_image_info' => [ +// 'x' => 100, +// 'y' => 100, +// ], +// ], +// [ +// 'image_id' => 'test_image_id', +// 'image_file' => '/path/to/test_image_id.png', +// 'base_file' => null, +// 'new_file' => '/path/to/test_image_id.png', +// 'destination' => 'small_image', +// 'set_image_file' => true, +// 'is_cached' => false, +// 'is_base_file_placeholder' => false, +// 'resized_image_info' => [ +// 'x' => 100, +// 'y' => 100, +// ], +// ], ]; } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php index a032ffa33b375..f05c427483d86 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php @@ -75,6 +75,31 @@ class ImageTest extends \PHPUnit_Framework_TestCase */ protected $mediaDirectory; + /** + * @var \Magento\Framework\View\Asset\LocalInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $imageAsset; + + /** + * @var \Magento\Catalog\Model\View\Asset\ImageFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $viewAssetImageFactory; + + /** + * @var \Magento\Catalog\Model\View\Asset\PlaceholderFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $viewAssetPlaceholderFactory; + + /** + * @var \Magento\Catalog\Model\View\Asset\Image\ContextFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $imageContextFactory; + + /** + * @var \Magento\Framework\View\Asset\ContextInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $imageContext; + protected function setUp() { $this->context = $this->getMock(\Magento\Framework\Model\Context::class, [], [], '', false); @@ -99,7 +124,6 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods(['create', 'isFile', 'isExist', 'getAbsolutePath']) ->getMock(); - $this->mediaDirectory->expects($this->once())->method('create')->will($this->returnValue(true)); $this->filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false); $this->filesystem->expects($this->once())->method('getDirectoryWrite') @@ -110,20 +134,62 @@ protected function setUp() $this->fileSystem = $this->getMock(\Magento\Framework\View\FileSystem::class, [], [], '', false); $this->scopeConfigInterface = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); + $context = $this->getMockBuilder(\Magento\Framework\Model\Context::class) + ->disableOriginalConstructor() + ->getMock(); + $this->image = new \Magento\Catalog\Model\Product\Image( + $context, + $this->registry, + $this->storeManager, + $this->config, + $this->coreFileHelper, + $this->filesystem, + $this->factory, + $this->repository, + $this->fileSystem, + $this->scopeConfigInterface + ); + //Settings for backward compatible property $objectManagerHelper = new ObjectManagerHelper($this); - $this->image = $objectManagerHelper->getObject( - \Magento\Catalog\Model\Product\Image::class, - [ - 'registry' => $this->registry, - 'storeManager' => $this->storeManager, - 'catalogProductMediaConfig' => $this->config, - 'coreFileStorageDatabase' => $this->coreFileHelper, - 'filesystem' => $this->filesystem, - 'imageFactory' => $this->factory, - 'assetRepo' => $this->repository, - 'viewFileSystem' => $this->fileSystem, - 'scopeConfig' => $this->scopeConfigInterface - ] + $this->imageAsset = $this->getMockBuilder(\Magento\Framework\View\Asset\LocalInterface::class) + ->getMockForAbstractClass(); + $objectManagerHelper->setBackwardCompatibleProperty( + $this->image, + 'imageAsset', + $this->imageAsset + ); + + $this->viewAssetImageFactory = $this->getMockBuilder(\Magento\Catalog\Model\View\Asset\ImageFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $objectManagerHelper->setBackwardCompatibleProperty( + $this->image, + 'viewAssetImageFactory', + $this->viewAssetImageFactory + ); + + $this->viewAssetPlaceholderFactory = $this->getMockBuilder(\Magento\Catalog\Model\View\Asset\PlaceholderFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $objectManagerHelper->setBackwardCompatibleProperty( + $this->image, + 'viewAssetPlaceholderFactory', + $this->viewAssetPlaceholderFactory + ); + + $this->imageContext = $this->getMockBuilder(\Magento\Framework\View\Asset\ContextInterface::class) + ->getMockForAbstractClass(); + $this->imageContextFactory = $this->getMockBuilder(\Magento\Catalog\Model\View\Asset\Image\ContextFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->imageContextFactory->expects($this->any())->method('create')->willReturn($this->imageContext); + $objectManagerHelper->setBackwardCompatibleProperty( + $this->image, + 'imageContextFactory', + $this->imageContextFactory ); } @@ -177,18 +243,39 @@ public function testSetGetBaseFile() $absolutePath = dirname(dirname(__DIR__)) . '/_files/catalog/product/somefile.png'; $this->mediaDirectory->expects($this->any())->method('getAbsolutePath') ->will($this->returnValue($absolutePath)); + $this->viewAssetImageFactory->expects($this->any()) + ->method('create') + ->with( + [ + 'context' => $this->imageContext, + 'miscParams' => [ + 'image_type' => null, + 'image_height' => null, + 'image_width' => null, + 'keep_aspect_ratio' => 'proportional', + 'keep_frame' => 'frame', + 'keep_transparency' => 'transparency', + 'constrain_only' => 'doconstrainonly', + 'background' => 'ffffff', + 'angle' => null, + 'quality' => 80, + ], + 'filePath' => '/somefile.png', + ] + ) + ->willReturn($this->imageAsset); + $this->viewAssetPlaceholderFactory->expects($this->never())->method('create'); + + $this->imageAsset->expects($this->any())->method('getSourceFile')->willReturn('catalog/product/somefile.png'); + $this->imageAsset->expects($this->any())->method('getPath')->willReturn($absolutePath); $this->image->setBaseFile('/somefile.png'); - $this->assertEquals('catalog/product/somefile.png', $this->image->getBaseFile()); - $this->assertEquals( - 'catalog/product/cache/1//beff4985b56e3afdbeabfc89641a4582/somefile.png', - $this->image->getNewFile() - ); + $this->assertEquals($absolutePath, $this->image->getBaseFile()); } public function testSetBaseNoSelectionFile() { - $this->image->setBaseFile('/no_selection'); - $this->assertTrue($this->image->getNewFile()); + $this->image->setBaseFile('no_selection'); + $this->assertNull($this->image->getBaseFile()); } public function testSetGetImageProcessor() @@ -284,34 +371,31 @@ public function testSaveFile() )->disableOriginalConstructor()->getMock(); $this->image->setImageProcessor($imageProcessor); $this->coreFileHelper->expects($this->once())->method('saveFile')->will($this->returnValue(true)); - $absolutePath = dirname(dirname(__DIR__)) . '/_files/catalog/product/somefile.png'; - $this->mediaDirectory->expects($this->once())->method('getAbsolutePath') - ->will($this->returnValue($absolutePath)); $this->image->saveFile(); } public function testSaveFileNoSelection() { - $this->testSetBaseNoSelectionFile(); + $imageProcessor = $this->getMockBuilder( + \Magento\Framework\Image::class + )->disableOriginalConstructor()->getMock(); + $this->image->setImageProcessor($imageProcessor); $this->assertSame($this->image, $this->image->saveFile()); } public function testGetUrl() { $this->testSetGetBaseFile(); - $url = $this->image->getUrl(); - $this->assertEquals( - 'http://magento.com/media/catalog/product/cache/1//beff4985b56e3afdbeabfc89641a4582/somefile.png', - $url - ); + $this->imageAsset->expects($this->any())->method('getUrl')->will($this->returnValue('url of exist image')); + $this->assertEquals('url of exist image', $this->image->getUrl()); } public function testGetUrlNoSelection() { - $this->testSetBaseNoSelectionFile(); - $this->repository->expects($this->once())->method('getUrl')->will($this->returnValue('someurl')); - $this->assertEquals('someurl', $this->image->getUrl()); + $this->imageAsset->expects($this->any())->method('getUrl')->will($this->returnValue('URL to Default Placeholder')); + $this->image->setBaseFile('no_selection'); + $this->assertEquals('URL to Default Placeholder', $this->image->getUrl()); } public function testSetGetDestinationSubdir() diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 49ad7d67d7058..b81212ec55e37 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -47,6 +47,7 @@ + diff --git a/app/code/Magento/ConfigurableProduct/Helper/Data.php b/app/code/Magento/ConfigurableProduct/Helper/Data.php index 079aee7b23750..4c1370b1a0d7a 100644 --- a/app/code/Magento/ConfigurableProduct/Helper/Data.php +++ b/app/code/Magento/ConfigurableProduct/Helper/Data.php @@ -50,15 +50,13 @@ public function getGalleryImages(\Magento\Catalog\Api\Data\ProductInterface $pro ); $image->setData( 'medium_image_url', - $this->imageHelper->init($product, 'product_page_image_medium') - ->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false) + $this->imageHelper->init($product, 'product_page_image_medium_no_frame') ->setImageFile($image->getFile()) ->getUrl() ); $image->setData( 'large_image_url', - $this->imageHelper->init($product, 'product_page_image_large') - ->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false) + $this->imageHelper->init($product, 'product_page_image_large_no_frame') ->setImageFile($image->getFile()) ->getUrl() ); diff --git a/app/code/Magento/Swatches/Helper/Data.php b/app/code/Magento/Swatches/Helper/Data.php index 68a18ef8be6a1..fac2d1cfe9ca0 100644 --- a/app/code/Magento/Swatches/Helper/Data.php +++ b/app/code/Magento/Swatches/Helper/Data.php @@ -315,12 +315,10 @@ private function getGalleryImages(ModelProduct $product) private function getAllSizeImages(ModelProduct $product, $imageFile) { return [ - 'large' => $this->imageHelper->init($product, 'product_page_image_large') - ->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false) + 'large' => $this->imageHelper->init($product, 'product_page_image_large_no_frame') ->setImageFile($imageFile) ->getUrl(), - 'medium' => $this->imageHelper->init($product, 'product_page_image_medium') - ->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false) + 'medium' => $this->imageHelper->init($product, 'product_page_image_medium_no_frame') ->setImageFile($imageFile) ->getUrl(), 'small' => $this->imageHelper->init($product, 'product_page_image_small') diff --git a/app/design/frontend/Magento/blank/etc/view.xml b/app/design/frontend/Magento/blank/etc/view.xml index 3a92ad0a67410..f126fa1bb4efb 100644 --- a/app/design/frontend/Magento/blank/etc/view.xml +++ b/app/design/frontend/Magento/blank/etc/view.xml @@ -73,10 +73,18 @@ 140 + + false + 700 700 + + 700 + 700 + false + 90 90 diff --git a/app/design/frontend/Magento/luma/etc/view.xml b/app/design/frontend/Magento/luma/etc/view.xml index e0fc864e00084..f06515035721d 100644 --- a/app/design/frontend/Magento/luma/etc/view.xml +++ b/app/design/frontend/Magento/luma/etc/view.xml @@ -77,10 +77,18 @@ 140 + + false + 700 560 + + 700 + 700 + false + 88 110 From ae49bb65d7eb16044ff768f675f4c566201fda6c Mon Sep 17 00:00:00 2001 From: Norbert Nagy Date: Mon, 31 Oct 2016 21:55:14 +0100 Subject: [PATCH 1561/3232] Fix incorrect table name during catalog product indexing The left join used an incorrect table name and it added way more rows for a single entity than it should and the entity id wasn't unique anymore, which failed the insert part of the SQL query. --- .../Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index 4375092591d19..40516e55e930c 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -281,7 +281,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS if (!empty($columnValueNames)) { $select->joinLeft( $temporaryValueTableName, - sprintf('e.%1$s = %2$s.%1$s', $linkField, $temporaryTableName), + sprintf('e.%1$s = %2$s.%1$s', $linkField, $temporaryValueTableName), $columnValueNames ); $allColumns = array_merge($allColumns, $columnValueNames); From 0490a9707b58dc3f3d6e3656f522d460de2aa818 Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Mon, 31 Oct 2016 23:13:02 +0200 Subject: [PATCH 1562/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- .../Magento/Catalog/Model/Product/Image.php | 16 ++- .../Catalog/Model/View/Asset/Image.php | 8 +- .../Model/View/Asset/Image/Context.php | 3 +- .../Catalog/Model/View/Asset/Placeholder.php | 4 +- .../Catalog/Test/Unit/Helper/ImageTest.php | 111 ++++++++---------- .../Test/Unit/Model/Product/ImageTest.php | 25 ++-- 6 files changed, 87 insertions(+), 80 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index f1a741be2c9e0..c488476119eac 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -12,6 +12,7 @@ namespace Magento\Catalog\Model\Product; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ObjectManagerFactory; use Magento\Framework\Image as MagentoImage; use Magento\Store\Model\Store; @@ -481,7 +482,7 @@ public function setBaseFile($file) { $this->_isBaseFilePlaceholder = false; if ($file == 'no_selection') { - return $this; + return $this; } $imageContext = $this->getImageContextFactory()->create(); @@ -920,7 +921,9 @@ public function getResizedImageInfo() private function getViewAssetImageFactory() { if ($this->viewAssetImageFactory == null) { - $this->viewAssetImageFactory = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Model\View\Asset\ImageFactory::class); + $this->viewAssetImageFactory = ObjectManager::getInstance()->get( + \Magento\Catalog\Model\View\Asset\ImageFactory::class + ); } return $this->viewAssetImageFactory; @@ -932,7 +935,9 @@ private function getViewAssetImageFactory() private function getViewAssetPlaceholderFactory() { if ($this->viewAssetPlaceholderFactory == null) { - $this->viewAssetPlaceholderFactory = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Model\View\Asset\PlaceholderFactory::class); + $this->viewAssetPlaceholderFactory = ObjectManager::getInstance()->get( + \Magento\Catalog\Model\View\Asset\PlaceholderFactory::class + ); } return $this->viewAssetPlaceholderFactory; @@ -944,7 +949,9 @@ private function getViewAssetPlaceholderFactory() private function getImageContextFactory() { if ($this->imageContextFactory == null) { - $this->imageContextFactory = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Model\View\Asset\Image\ContextFactory::class); + $this->imageContextFactory = ObjectManager::getInstance()->get( + \Magento\Catalog\Model\View\Asset\Image\ContextFactory::class + ); } return $this->imageContextFactory; @@ -954,6 +961,7 @@ private function getImageContextFactory() * Retrieve misc params based on all image attributes * * @return array + * @SuppressWarnings(PHPMD.NPathComplexity) */ private function getMiscParams() { diff --git a/app/code/Magento/Catalog/Model/View/Asset/Image.php b/app/code/Magento/Catalog/Model/View/Asset/Image.php index e289e24f1a621..1b614480b5bf9 100644 --- a/app/code/Magento/Catalog/Model/View/Asset/Image.php +++ b/app/code/Magento/Catalog/Model/View/Asset/Image.php @@ -6,6 +6,7 @@ namespace Magento\Catalog\Model\View\Asset; +use Magento\Catalog\Model\Product\Media\ConfigInterface; use Magento\Framework\View\Asset\ContextInterface; use Magento\Framework\View\Asset\LocalInterface; @@ -39,19 +40,20 @@ class Image implements LocalInterface private $miscParams; /** - * @var \Magento\Catalog\Model\Product\Media\ConfigInterface + * @var ConfigInterface */ private $mediaConfig; /** * Image constructor. * + * @param ConfigInterface $mediaConfig * @param ContextInterface $context * @param string $filePath - * @param array $miscParams [] + * @param array $miscParams */ public function __construct( - \Magento\Catalog\Model\Product\Media\ConfigInterface $mediaConfig, + ConfigInterface $mediaConfig, ContextInterface $context, $filePath, array $miscParams = [] diff --git a/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php b/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php index c9ee9a651e493..33f0adb70c941 100644 --- a/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php +++ b/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php @@ -6,6 +6,7 @@ namespace Magento\Catalog\Model\View\Asset\Image; +use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\View\Asset\ContextInterface; /** @@ -36,7 +37,7 @@ public function __construct( ) { $this->mediaConfig = $mediaConfig; $this->filesystem = $filesystem; - $this->mediaDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA); + $this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA); $this->mediaDirectory->create($this->mediaConfig->getBaseMediaPath()); } diff --git a/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php b/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php index 3f53753daf6c0..ec71be45b4d2a 100644 --- a/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php +++ b/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php @@ -58,7 +58,7 @@ class Placeholder implements LocalInterface * @param ContextInterface $context * @param ScopeConfigInterface $scopeConfig * @param Repository $assetRepo - * @param $type + * @param string $type */ public function __construct( ContextInterface $context, @@ -173,6 +173,4 @@ public function getModule() { return 'placeholder'; } - - } diff --git a/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php index b72ea45360245..d06772088c425 100644 --- a/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php @@ -424,7 +424,6 @@ public function getLabelDataProvider() * @param string $imageId * @param string $imageFile * @param string $baseFile - * @param string $newFile * @param string $destination * @param boolean $setImageFile * @param boolean $isCached @@ -436,7 +435,6 @@ public function testGetResizedImageInfo( $imageId, $imageFile, $baseFile, - $newFile, $destination, $setImageFile, $isCached, @@ -495,25 +493,23 @@ public function testGetResizedImageInfo( public function getResizedImageInfoDataProvider() { return [ -// [ -// 'image_id' => 'test_image_id', -// 'image_file' => '/path/to/test_image_id.png', -// 'base_file' => '/path/to/base_image.png', -// 'new_file' => '/path/to/base_image.png', -// 'destination' => 'small_image', -// 'set_image_file' => true, -// 'is_cached' => false, -// 'is_base_file_placeholder' => false, -// 'resized_image_info' => [ -// 'x' => 100, -// 'y' => 100, -// ], -// ], + [ + 'image_id' => 'test_image_id', + 'image_file' => '/path/to/test_image_id.png', + 'base_file' => '/path/to/base_image.png', + 'destination' => 'small_image', + 'set_image_file' => true, + 'is_cached' => false, + 'is_base_file_placeholder' => false, + 'resized_image_info' => [ + 'x' => 100, + 'y' => 100, + ], + ], [ 'image_id' => 'test_image_id', 'image_file' => '/path/to/test_image_id.png', 'base_file' => null, - 'new_file' => true, 'destination' => 'small_image', 'set_image_file' => false, 'is_cached' => false, @@ -523,48 +519,45 @@ public function getResizedImageInfoDataProvider() 'y' => 100, ], ], -// [ -// 'image_id' => 'test_image_id', -// 'image_file' => '/path/to/test_image_id.png', -// 'base_file' => null, -// 'new_file' => false, -// 'destination' => 'small_image', -// 'set_image_file' => true, -// 'is_cached' => false, -// 'is_base_file_placeholder' => false, -// 'resized_image_info' => [ -// 'x' => 100, -// 'y' => 100, -// ], -// ], -// [ -// 'image_id' => 'test_image_id', -// 'image_file' => '/path/to/test_image_id.png', -// 'base_file' => null, -// 'new_file' => true, -// 'destination' => 'small_image', -// 'set_image_file' => true, -// 'is_cached' => false, -// 'is_base_file_placeholder' => true, -// 'resized_image_info' => [ -// 'x' => 100, -// 'y' => 100, -// ], -// ], -// [ -// 'image_id' => 'test_image_id', -// 'image_file' => '/path/to/test_image_id.png', -// 'base_file' => null, -// 'new_file' => '/path/to/test_image_id.png', -// 'destination' => 'small_image', -// 'set_image_file' => true, -// 'is_cached' => false, -// 'is_base_file_placeholder' => false, -// 'resized_image_info' => [ -// 'x' => 100, -// 'y' => 100, -// ], -// ], + [ + 'image_id' => 'test_image_id', + 'image_file' => '/path/to/test_image_id.png', + 'base_file' => null, + 'destination' => 'small_image', + 'set_image_file' => true, + 'is_cached' => false, + 'is_base_file_placeholder' => false, + 'resized_image_info' => [ + 'x' => 100, + 'y' => 100, + ], + ], + [ + 'image_id' => 'test_image_id', + 'image_file' => '/path/to/test_image_id.png', + 'base_file' => null, + 'destination' => 'small_image', + 'set_image_file' => true, + 'is_cached' => false, + 'is_base_file_placeholder' => true, + 'resized_image_info' => [ + 'x' => 100, + 'y' => 100, + ], + ], + [ + 'image_id' => 'test_image_id', + 'image_file' => '/path/to/test_image_id.png', + 'base_file' => null, + 'destination' => 'small_image', + 'set_image_file' => true, + 'is_cached' => false, + 'is_base_file_placeholder' => false, + 'resized_image_info' => [ + 'x' => 100, + 'y' => 100, + ], + ], ]; } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php index f05c427483d86..5fcf90d96db80 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php @@ -6,12 +6,17 @@ namespace Magento\Catalog\Test\Unit\Model\Product; +use Magento\Catalog\Model\View\Asset\Image\ContextFactory; +use Magento\Catalog\Model\View\Asset\ImageFactory; +use Magento\Catalog\Model\View\Asset\PlaceholderFactory; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\View\Asset\ContextInterface; /** * Class ImageTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) */ class ImageTest extends \PHPUnit_Framework_TestCase { @@ -81,22 +86,22 @@ class ImageTest extends \PHPUnit_Framework_TestCase protected $imageAsset; /** - * @var \Magento\Catalog\Model\View\Asset\ImageFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ImageFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $viewAssetImageFactory; /** - * @var \Magento\Catalog\Model\View\Asset\PlaceholderFactory|\PHPUnit_Framework_MockObject_MockObject + * @var PlaceholderFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $viewAssetPlaceholderFactory; /** - * @var \Magento\Catalog\Model\View\Asset\Image\ContextFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ContextFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $imageContextFactory; /** - * @var \Magento\Framework\View\Asset\ContextInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ContextInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $imageContext; @@ -159,7 +164,7 @@ protected function setUp() $this->imageAsset ); - $this->viewAssetImageFactory = $this->getMockBuilder(\Magento\Catalog\Model\View\Asset\ImageFactory::class) + $this->viewAssetImageFactory = $this->getMockBuilder(ImageFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -169,7 +174,7 @@ protected function setUp() $this->viewAssetImageFactory ); - $this->viewAssetPlaceholderFactory = $this->getMockBuilder(\Magento\Catalog\Model\View\Asset\PlaceholderFactory::class) + $this->viewAssetPlaceholderFactory = $this->getMockBuilder(PlaceholderFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -179,9 +184,9 @@ protected function setUp() $this->viewAssetPlaceholderFactory ); - $this->imageContext = $this->getMockBuilder(\Magento\Framework\View\Asset\ContextInterface::class) + $this->imageContext = $this->getMockBuilder(ContextInterface::class) ->getMockForAbstractClass(); - $this->imageContextFactory = $this->getMockBuilder(\Magento\Catalog\Model\View\Asset\Image\ContextFactory::class) + $this->imageContextFactory = $this->getMockBuilder(ContextFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -393,9 +398,9 @@ public function testGetUrl() public function testGetUrlNoSelection() { - $this->imageAsset->expects($this->any())->method('getUrl')->will($this->returnValue('URL to Default Placeholder')); + $this->imageAsset->expects($this->any())->method('getUrl')->will($this->returnValue('Default Placeholder URL')); $this->image->setBaseFile('no_selection'); - $this->assertEquals('URL to Default Placeholder', $this->image->getUrl()); + $this->assertEquals('Default Placeholder URL', $this->image->getUrl()); } public function testSetGetDestinationSubdir() From 1527713f82aa535692d23b3f5c432b80b13f89ae Mon Sep 17 00:00:00 2001 From: Vitaliy Goncharenko Date: Tue, 1 Nov 2016 11:36:32 +0200 Subject: [PATCH 1563/3232] MAGETWO-60283: Prices of configurable product are incorrectly recalculated when display currency is changed --- .../Magento/Catalog/Block/Product/View.php | 29 ++++------- .../Test/Repository/Product/CustomOptions.xml | 17 +++++++ .../Test/Repository/ConfigData.xml | 12 +++++ ...AssertCurrencyRateAppliedOnProductPage.php | 51 +++++++++++++++++++ .../Directory/Test/Repository/ConfigData.xml | 32 ++++++++++++ .../Test/TestCase/CreateCurrencyRateTest.php | 1 + .../Test/TestCase/CreateCurrencyRateTest.xml | 13 +++++ 7 files changed, 137 insertions(+), 18 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php create mode 100644 dev/tests/functional/tests/app/Magento/Directory/Test/Repository/ConfigData.xml diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index 8157ab4de07f2..b100ac3643dc1 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -7,7 +7,6 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Category; -use Magento\Catalog\Model\Product; /** * Product View block @@ -225,40 +224,34 @@ public function getJsonConfig() $config = [ 'productId' => $product->getId(), 'priceFormat' => $this->_localeFormat->getPriceFormat() - ]; + ]; return $this->_jsonEncoder->encode($config); } $tierPrices = []; $tierPricesList = $product->getPriceInfo()->getPrice('tier_price')->getTierPriceList(); foreach ($tierPricesList as $tierPrice) { - $tierPrices[] = $this->priceCurrency->convert($tierPrice['price']->getValue()); + $tierPrices[] = $tierPrice['price']->getValue(); } $config = [ - 'productId' => $product->getId(), + 'productId' => $product->getId(), 'priceFormat' => $this->_localeFormat->getPriceFormat(), - 'prices' => [ - 'oldPrice' => [ - 'amount' => $this->priceCurrency->convert( - $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue() - ), + 'prices' => [ + 'oldPrice' => [ + 'amount' => $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(), 'adjustments' => [] ], - 'basePrice' => [ - 'amount' => $this->priceCurrency->convert( - $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount() - ), + 'basePrice' => [ + 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount(), 'adjustments' => [] ], 'finalPrice' => [ - 'amount' => $this->priceCurrency->convert( - $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue() - ), + 'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(), 'adjustments' => [] ] ], - 'idSuffix' => '_clone', - 'tierPrices' => $tierPrices + 'idSuffix' => '_clone', + 'tierPrices' => $tierPrices ]; $responseObject = new \Magento\Framework\DataObject(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml index 3252f0178e241..09fda73b2a404 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml @@ -358,5 +358,22 @@ + + + + Test1 option %isolation% + No + Text/Field + + + 10 + Fixed + sku1_%isolation% + 45 + + + + + 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 index 9df42574840d6..3a099d79d370a 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml @@ -48,6 +48,18 @@ USD + + currency + US Dollar + 1 + USD + + + currency + US Dollar + 1 + USD + diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php b/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php new file mode 100644 index 0000000000000..aee8b2e53c6f4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php @@ -0,0 +1,51 @@ +open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + + \PHPUnit_Framework_Assert::assertEquals( + $basePrice, + $view->getViewBlock()->getPriceBlock()->getPrice(''), + 'Wrong price is displayed on Product page.' + ); + } + + /** + * Returns a string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Currency rate has been applied correctly on Product page."; + } +} 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 new file mode 100644 index 0000000000000..e1ae1dc1ebfb5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/Repository/ConfigData.xml @@ -0,0 +1,32 @@ + + + + + + + currency + 1 + + UAH + + + + currency + US Dollar + 1 + USD + + + currency + Ukrainian Hryvnia + 1 + UAH + + + + diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php index bc40a2ab98f6d..07daaff5d366f 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php @@ -68,6 +68,7 @@ public function test(CurrencyRate $currencyRate, CatalogProductSimple $product, // Steps: $this->currencyIndexPage->open(); + $this->currencyIndexPage->getCurrencyRateForm()->clickImportButton(); $this->currencyIndexPage->getCurrencyRateForm()->fill($currencyRate); $this->currencyIndexPage->getFormPageActions()->save(); } diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml index dd42950c18a78..083bcd5e4b0f1 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml @@ -20,5 +20,18 @@ + + USD + UAH + 2.000 + currency_symbols_uah + simple_10_dollar + not_required_text_option + config_base_currency_us_display_currency_uah + ₴20.00 + test_type:acceptance_test + + + From aef703240e112a7a05f503c7efc072a10711563e Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Tue, 1 Nov 2016 11:43:36 +0200 Subject: [PATCH 1564/3232] MAGETWO-59486: [FT] CreateProductAttributeEntityTest fails due to AssertAddedProductAttributeOnProductForm --- .../AssertAddedProductAttributeOnProductForm.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php index 54bf06f70b5f1..a2f816ca88ac2 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php @@ -13,6 +13,7 @@ use Magento\Catalog\Test\Fixture\CatalogProductAttribute; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; +use Magento\Mtf\Client\BrowserInterface; /** * Check attribute on product form. @@ -45,6 +46,13 @@ class AssertAddedProductAttributeOnProductForm extends AbstractConstraint */ protected $catalogProductEdit; + /** + * Locator for attributes section. + * + * @var string + */ + protected $attributes = '[data-index="attributes"]'; + /** * Add this attribute to Default attribute Template. Create product and Assert that created attribute * is displayed on product form (Products > Inventory > Catalog). @@ -66,7 +74,8 @@ public function processAssert( CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, - CatalogProductAttribute $productAttributeOriginal = null + CatalogProductAttribute $productAttributeOriginal = null, + BrowserInterface $browser ) { $this->fixtureFactory = $fixtureFactory; $this->catalogProductIndex = $catalogProductIndex; @@ -92,7 +101,9 @@ public function processAssert( $catalogProductAttribute = ($productAttributeOriginal !== null) ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData(); - $catalogProductEdit->getProductForm()->openSection(self::ATTRIBUTES); + if ($browser->find($this->attributes)->isVisible()) { + $catalogProductEdit->getProductForm()->openSection(self::ATTRIBUTES); + } \PHPUnit_Framework_Assert::assertTrue( $catalogProductEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), From a5f3b7d0d7a054b0aa44334fa4776f04a65282db Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Tue, 1 Nov 2016 12:59:10 +0200 Subject: [PATCH 1565/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Model/Product/Image.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index c488476119eac..5d0e02b061c16 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -505,7 +505,7 @@ public function setBaseFile($file) ); $this->_baseFile = $this->imageAsset->getSourceFile(); } else { - $this->_baseFile = $this->imageAsset->getPath(); + $this->_baseFile = $this->imageAsset->getSourceFile(); } return $this; @@ -554,7 +554,8 @@ public function setImageProcessor($processor) public function getImageProcessor() { if (!$this->_processor) { - $this->_processor = $this->_imageFactory->create($this->getBaseFile()); + $filename = $this->getBaseFile() ? $this->_mediaDirectory->getAbsolutePath($this->getBaseFile()) : null; + $this->_processor = $this->_imageFactory->create($filename); } $this->_processor->keepAspectRatio($this->_keepAspectRatio); $this->_processor->keepFrame($this->_keepFrame); @@ -671,7 +672,7 @@ public function saveFile() if ($this->_isBaseFilePlaceholder) { return $this; } - $filename = $this->getBaseFile(); + $filename = $this->getBaseFile() ? $this->imageAsset->getPath() : null; $this->getImageProcessor()->save($filename); $this->_coreFileStorageDatabase->saveFile($filename); return $this; From 8d2a34df9316dcd4004b06c71a0f75dc9a32f040 Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Tue, 1 Nov 2016 13:16:56 +0200 Subject: [PATCH 1566/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Model/Product/Image.php | 5 ++--- .../Catalog/Test/Unit/Model/Product/ImageTest.php | 5 +++-- .../Magento/Swatches/Test/Unit/Helper/DataTest.php | 13 ++----------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 5d0e02b061c16..eca05f94291c9 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -503,11 +503,10 @@ public function setBaseFile($file) 'type' => $this->getType(), ] ); - $this->_baseFile = $this->imageAsset->getSourceFile(); - } else { - $this->_baseFile = $this->imageAsset->getSourceFile(); } + $this->_baseFile = $this->imageAsset->getSourceFile(); + return $this; } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php index 5fcf90d96db80..be2d5de06a24a 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php @@ -272,9 +272,8 @@ public function testSetGetBaseFile() $this->viewAssetPlaceholderFactory->expects($this->never())->method('create'); $this->imageAsset->expects($this->any())->method('getSourceFile')->willReturn('catalog/product/somefile.png'); - $this->imageAsset->expects($this->any())->method('getPath')->willReturn($absolutePath); $this->image->setBaseFile('/somefile.png'); - $this->assertEquals($absolutePath, $this->image->getBaseFile()); + $this->assertEquals('catalog/product/somefile.png', $this->image->getBaseFile()); } public function testSetBaseNoSelectionFile() @@ -412,6 +411,8 @@ public function testSetGetDestinationSubdir() public function testIsCached() { $this->testSetGetBaseFile(); + $absolutePath = dirname(dirname(__DIR__)) . '/_files/catalog/product/watermark/somefile.png'; + $this->imageAsset->expects($this->any())->method('getPath')->willReturn($absolutePath); $this->assertTrue($this->image->isCached()); } diff --git a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php index 6cf79dae309a5..357850b444d17 100644 --- a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php @@ -322,8 +322,8 @@ public function testGetProductMediaGallery($mediaGallery, $image) $this->imageHelperMock->expects($this->any()) ->method('init') ->willReturnMap([ - [$this->productMock, 'product_page_image_large', [], $this->imageHelperMock], - [$this->productMock, 'product_page_image_medium', [], $this->imageHelperMock], + [$this->productMock, 'product_page_image_large_no_frame', [], $this->imageHelperMock], + [$this->productMock, 'product_page_image_medium_no_frame', [], $this->imageHelperMock], [$this->productMock, 'product_page_image_small', [], $this->imageHelperMock], ]); @@ -331,15 +331,6 @@ public function testGetProductMediaGallery($mediaGallery, $image) ->method('setImageFile') ->with($image) ->willReturnSelf(); - $this->imageHelperMock->expects($this->any()) - ->method('constrainOnly') - ->willReturnSelf(); - $this->imageHelperMock->expects($this->any()) - ->method('keepAspectRatio') - ->willReturnSelf(); - $this->imageHelperMock->expects($this->any()) - ->method('keepFrame') - ->willReturnSelf(); $this->imageHelperMock->expects($this->any()) ->method('getUrl') ->willReturn('http://full_path_to_image/magento1.png'); From 2a55f05ccd02a6be8e3e35070ea1d57a808180e6 Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Tue, 1 Nov 2016 13:31:55 +0200 Subject: [PATCH 1567/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- .../Magento/Catalog/Model/View/Asset/Image.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Model/View/Asset/Image.php b/app/code/Magento/Catalog/Model/View/Asset/Image.php index 1b614480b5bf9..bcb979c52b148 100644 --- a/app/code/Magento/Catalog/Model/View/Asset/Image.php +++ b/app/code/Magento/Catalog/Model/View/Asset/Image.php @@ -7,6 +7,8 @@ namespace Magento\Catalog\Model\View\Asset; use Magento\Catalog\Model\Product\Media\ConfigInterface; +use Magento\Framework\Encryption\Encryptor; +use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\View\Asset\ContextInterface; use Magento\Framework\View\Asset\LocalInterface; @@ -44,17 +46,24 @@ class Image implements LocalInterface */ private $mediaConfig; + /** + * @var EncryptorInterface + */ + private $encryptor; + /** * Image constructor. * * @param ConfigInterface $mediaConfig * @param ContextInterface $context - * @param string $filePath + * @param EncryptorInterface $encryptor + * @param $filePath * @param array $miscParams */ public function __construct( ConfigInterface $mediaConfig, ContextInterface $context, + EncryptorInterface $encryptor, $filePath, array $miscParams = [] ) { @@ -62,7 +71,7 @@ public function __construct( $this->context = $context; $this->filePath = $filePath; $this->miscParams = $miscParams; - $this->mediaConfig = $mediaConfig; + $this->encryptor = $encryptor; } /** @@ -163,7 +172,7 @@ public function getModule() */ private function getMiscPath() { - return md5(implode('_', $this->miscParams)); + return $this->encryptor->hash(implode('_', $this->miscParams), Encryptor::HASH_VERSION_MD5); } /** From 35894ebc525458fc17f3c2b66a54118b8d04d5f2 Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Tue, 1 Nov 2016 14:14:00 +0200 Subject: [PATCH 1568/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Model/View/Asset/Image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/View/Asset/Image.php b/app/code/Magento/Catalog/Model/View/Asset/Image.php index bcb979c52b148..31129d7d892d2 100644 --- a/app/code/Magento/Catalog/Model/View/Asset/Image.php +++ b/app/code/Magento/Catalog/Model/View/Asset/Image.php @@ -57,7 +57,7 @@ class Image implements LocalInterface * @param ConfigInterface $mediaConfig * @param ContextInterface $context * @param EncryptorInterface $encryptor - * @param $filePath + * @param string $filePath * @param array $miscParams */ public function __construct( From a25a24cc25d29b9b98bb4f3de53e0f5615b1feff Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Tue, 1 Nov 2016 14:35:49 +0200 Subject: [PATCH 1569/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60305: Broken page with Fixed bundle with website price scope --- .../ResourceModel/Selection/Collection.php | 43 +++++++++++++++---- .../DynamicBundlePriceCalculatorTest.php | 28 ++++++++++++ .../FixedBundlePriceCalculatorTest.php | 31 ++++++++++++- 3 files changed, 91 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index 83a2664ec70f3..bf3974ab13aff 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -31,6 +31,13 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection */ private $catalogRuleProcessor; + /** + * Is website scope prices joined to collection + + * @var bool + */ + private $websiteScopePriceJoined = false; + /** * @inheritDoc */ @@ -54,7 +61,7 @@ public function __construct( \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Stdlib\DateTime $dateTime, GroupManagementInterface $groupManagement, - \Magento\CatalogRule\Model\ResourceModel\Product\Collection $catalogRuleProcessor, + \Magento\CatalogRule\Model\ResourceModel\Product\Collection $catalogRuleProcessor = null, \Magento\Framework\DB\Adapter\AdapterInterface $connection = null ) { parent::__construct( @@ -153,6 +160,8 @@ public function joinPrices($websiteId) 'price_scope' => 'price.website_id' ] ); + $this->websiteScopePriceJoined = true; + return $this; } @@ -228,7 +237,7 @@ public function getNewEmptyItem() /** * Add filter by price * - * @param Product $product + * @param \Magento\Catalog\Model\Product $product * @param bool $searchMin * @param bool $useRegularPrice * @@ -241,7 +250,7 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) if ($useRegularPrice) { $minimalPriceExpression = 'minimal_price'; } else { - $this->catalogRuleProcessor->addPriceData($this, 'selection.product_id'); + $this->getCatalogRuleProcessor()->addPriceData($this, 'selection.product_id'); $minimalPriceExpression = 'LEAST(minimal_price, IFNULL(catalog_rule_price, 99999999))'; } $orderByValue = new \Zend_Db_Expr( @@ -252,7 +261,6 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) ); } else { $connection = $this->getConnection(); - $websiteId = $this->_storeManager->getStore()->getWebsiteId(); $priceType = $connection->getIfNullSql( 'price.selection_price_type', 'selection.selection_price_type' @@ -261,11 +269,14 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) 'price.selection_price_value', 'selection.selection_price_value' ); - $this->getSelect()->joinLeft( - ['price' => $this->getTable('catalog_product_bundle_selection_price')], - 'selection.selection_id = price.selection_id AND price.website_id = ' . (int)$websiteId, - [] - ); + if (!$this->websiteScopePriceJoined) { + $websiteId = $this->_storeManager->getStore()->getWebsiteId(); + $this->getSelect()->joinLeft( + ['price' => $this->getTable('catalog_product_bundle_selection_price')], + 'selection.selection_id = price.selection_id AND price.website_id = ' . (int)$websiteId, + [] + ); + } $price = $connection->getCheckSql( $priceType . ' = 1', (float) $product->getPrice() . ' * '. $priceValue . ' / 100', @@ -280,6 +291,20 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) return $this; } + /** + * @return \Magento\CatalogRule\Model\ResourceModel\Product\Collection + * @deprecated + */ + private function getCatalogRuleProcessor() + { + if (null === $this->catalogRuleProcessor) { + $this->catalogRuleProcessor = \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\CatalogRule\Model\ResourceModel\Product\Collection::class); + } + + return $this->catalogRuleProcessor; + } + /** * Clear collection data after clone */ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php index 81052bd2cef54..ba698a7cc73f2 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php @@ -39,6 +39,34 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec ); } + /** + * @param array $strategyModifiers + * @param array $expectedResults + * @dataProvider getTestCases + * @magentoAppIsolation enabled + * @magentoConfigFixture current_store catalog/price/scope 1 + */ + public function testPriceForDynamicBundleInWebsiteScope(array $strategyModifiers, array $expectedResults) + { + $bundleProduct = $this->prepareFixture($strategyModifiers); + + /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ + $priceInfo = $bundleProduct->getPriceInfo(); + $priceCode = \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE; + + $this->assertEquals( + $expectedResults['minimalPrice'], + $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(), + 'Failed to check minimal price on product' + ); + + $this->assertEquals( + $expectedResults['maximalPrice'], + $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(), + 'Failed to check maximal price on product' + ); + } + public function getTestCases() { return [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php index 63d8e3ba060f0..5ad26638dea3f 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -15,8 +15,8 @@ class FixedBundlePriceCalculatorTest extends BundlePriceAbstract { /** - * @param $strategyModifiers array - * @param $expectedResults array + * @param array $strategyModifiers + * @param array $expectedResults * @dataProvider getTestCases * @magentoAppIsolation enabled */ @@ -41,6 +41,33 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte ); } + /** + * @param array $strategyModifiers + * @param array $expectedResults + * @dataProvider getTestCases + * @magentoAppIsolation enabled + * @magentoConfigFixture current_store catalog/price/scope 1 + */ + public function testPriceForFixedBundleInWebsiteScope(array $strategyModifiers, array $expectedResults) + { + $bundleProduct = $this->prepareFixture($strategyModifiers); + + /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ + $priceInfo = $bundleProduct->getPriceInfo(); + $priceCode = \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE; + + $this->assertEquals( + $expectedResults['minimalPrice'], + $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(), + 'Failed to check minimal price on product' + ); + + $this->assertEquals( + $expectedResults['maximalPrice'], + $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(), + 'Failed to check maximal price on product' + ); + } public function getTestCases() { From 27ee68c6d361c4513f82e691b8d786bac27730d8 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Tue, 1 Nov 2016 16:10:09 +0200 Subject: [PATCH 1570/3232] MAGETWO-56073: [Performance] Unnecessary duplicating AJAX request on Shopping cart page --- .../view/frontend/web/js/model/new-customer-address.js | 8 ++++---- .../Checkout/view/frontend/web/js/view/shipping.js | 2 +- .../view/frontend/web/js/model/customer/address.js | 8 +++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js b/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js index 9a3685b212b43..c215b1989edbe 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js @@ -10,13 +10,13 @@ define([], function () { * Returns new address object */ return function (addressData) { - var identifier = Date.now(); - var regionId = null; + var identifier = Date.now(), + regionId; if (addressData.region && addressData.region.region_id) { regionId = addressData.region.region_id; } else if (addressData.country_id && addressData.country_id == window.checkoutConfig.defaultCountryId) { - regionId = window.checkoutConfig.defaultRegionId; + regionId = window.checkoutConfig.defaultRegionId || undefined; } return { @@ -25,7 +25,7 @@ define([], function () { regionId: regionId || addressData.regionId, regionCode: (addressData.region) ? addressData.region.region_code : null, region: (addressData.region) ? addressData.region.region : null, - customerId: addressData.customer_id, + customerId: addressData.customer_id || addressData.customerId, street: addressData.street, company: addressData.company, telephone: addressData.telephone, diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js index 8910e41731d11..fb15e47eaf7d4 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js @@ -79,7 +79,6 @@ define( fieldsetName = 'checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset'; this._super(); - shippingRatesValidator.initFields(fieldsetName); if (!quote.isVirtual()) { stepNavigator.registerStep( @@ -120,6 +119,7 @@ define( checkoutProvider.on('shippingAddress', function (shippingAddressData) { checkoutData.setShippingAddressFromData(shippingAddressData); }); + shippingRatesValidator.initFields(fieldsetName); }); return this; diff --git a/app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js b/app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js index 30fbef98fd39a..e013a96e4890a 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js +++ b/app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js @@ -10,11 +10,17 @@ define([], function() { * Returns new address object */ return function (addressData) { + var regionId; + + if (addressData.region['region_id'] && addressData.region['region_id'] !== '0') { + regionId = addressData.region['region_id'] + ''; + } + return { customerAddressId: addressData.id, email: addressData.email, countryId: addressData.country_id, - regionId: addressData.region_id, + regionId: regionId, regionCode: addressData.region.region_code, region: addressData.region.region, customerId: addressData.customer_id, From 27d24869b54c034f4520dcc00525656d1cea25b5 Mon Sep 17 00:00:00 2001 From: "Palamar, Mykola" Date: Tue, 1 Nov 2016 15:23:21 +0000 Subject: [PATCH 1571/3232] MAGETWO-47017: [Github] Add Configurable Product To Cart from Category Page #2574 #5850 #5882 #6572 #5558 - CR changes --- .../Swatches/Test/Block/Product/ProductList/ProductItem.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php index be7186c0368b9..414d03bc68787 100755 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php @@ -32,7 +32,8 @@ public function fillData(\Magento\ConfigurableProduct\Test\Fixture\ConfigurableP $checkoutData = $product->getCheckoutData(); $options = $checkoutData['options']['configurable_options']; $confAttrData = $product->getDataFieldConfig('configurable_attributes_data'); - $attributes = ($confAttrData['source'])->getAttributes(); + $confAttrSource = $confAttrData['source']; + $attributes = $confAttrSource->getAttributes(); foreach ($options as $option) { if (!isset($attributes[$option['title']])) { From 28fbc4adb0a0ce92e7a6c49dbe9925abbcb352ec Mon Sep 17 00:00:00 2001 From: aakimov Date: Tue, 1 Nov 2016 13:15:24 +0200 Subject: [PATCH 1572/3232] MAGETWO-59308: Design Theme Dropdown does not Display all Themes on Widget List Page --- .../Widget/Instance/Options/ThemeId.php | 4 ++ .../Widget/Instance/Options/Themes.php | 41 ++++++++++++++ .../Widget/Instance/Options/ThemesTest.php | 55 +++++++++++++++++++ .../adminhtml_widget_instance_block.xml | 2 +- 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Widget/Model/ResourceModel/Widget/Instance/Options/Themes.php create mode 100644 app/code/Magento/Widget/Test/Unit/Model/ResourceModel/Widget/Instance/Options/ThemesTest.php diff --git a/app/code/Magento/Widget/Model/ResourceModel/Widget/Instance/Options/ThemeId.php b/app/code/Magento/Widget/Model/ResourceModel/Widget/Instance/Options/ThemeId.php index f5197dd7d0435..dc048d41612b8 100644 --- a/app/code/Magento/Widget/Model/ResourceModel/Widget/Instance/Options/ThemeId.php +++ b/app/code/Magento/Widget/Model/ResourceModel/Widget/Instance/Options/ThemeId.php @@ -10,6 +10,10 @@ */ namespace Magento\Widget\Model\ResourceModel\Widget\Instance\Options; +/** + * @deprecated created new class that correctly loads theme options and whose name follows naming convention + * @see \Magento\Widget\Model\ResourceModel\Widget\Instance\Options\Themes + */ class ThemeId implements \Magento\Framework\Option\ArrayInterface { /** diff --git a/app/code/Magento/Widget/Model/ResourceModel/Widget/Instance/Options/Themes.php b/app/code/Magento/Widget/Model/ResourceModel/Widget/Instance/Options/Themes.php new file mode 100644 index 0000000000000..403dfeb40ff2e --- /dev/null +++ b/app/code/Magento/Widget/Model/ResourceModel/Widget/Instance/Options/Themes.php @@ -0,0 +1,41 @@ +themeCollectionFactory = $themeCollectionFactory; + } + + /** + * Return array of options as value-label pairs + * + * @return array Format: array('' => '', ...) + */ + public function toOptionArray() + { + // Load only visible themes that are used in frontend area + return $this->themeCollectionFactory->create()->loadRegisteredThemes()->toOptionHash(); + } +} diff --git a/app/code/Magento/Widget/Test/Unit/Model/ResourceModel/Widget/Instance/Options/ThemesTest.php b/app/code/Magento/Widget/Test/Unit/Model/ResourceModel/Widget/Instance/Options/ThemesTest.php new file mode 100644 index 0000000000000..e3854a5990132 --- /dev/null +++ b/app/code/Magento/Widget/Test/Unit/Model/ResourceModel/Widget/Instance/Options/ThemesTest.php @@ -0,0 +1,55 @@ +themeCollectionMock = $this->getMock(ThemeCollection::class, [], [], '', false); + $this->themeCollectionFactoryMock = $this->getMock(ThemeCollectionFactory::class, ['create'], [], '', false); + $this->model = new Themes( + $this->themeCollectionFactoryMock + ); + } + + public function testToOptionArray() + { + $expectedResult = [ + 1 => 'Theme Label', + ]; + $this->themeCollectionFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->themeCollectionMock); + + $this->themeCollectionMock->expects($this->once())->method('loadRegisteredThemes')->willReturnSelf(); + $this->themeCollectionMock->expects($this->once())->method('toOptionHash')->willReturn($expectedResult); + + $this->assertEquals($expectedResult, $this->model->toOptionArray()); + } +} diff --git a/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_block.xml b/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_block.xml index 2d9cf935afa0d..db73e302f4a76 100644 --- a/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_block.xml +++ b/app/code/Magento/Widget/view/adminhtml/layout/adminhtml_widget_instance_block.xml @@ -52,7 +52,7 @@ Design Theme theme_id options - + 1 From 1cfec96ed584849fcbe84300cff40783c9c832aa Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 1 Nov 2016 14:54:12 -0500 Subject: [PATCH 1573/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Introducing SerializerInterface, removing obsolete code --- .../ObjectManager/ConfigLoader/Compiled.php | 2 +- .../Framework/App/ObjectManagerFactory.php | 4 +- .../ObjectManager/Definition/Compiled.php | 2 +- .../ObjectManager/DefinitionFactory.php | 78 +++-------- .../Test/Unit/DefinitionFactoryTest.php | 122 ++++++------------ .../Di/Compiler/Config/Writer/Filesystem.php | 2 +- 6 files changed, 61 insertions(+), 149 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index 26ef880e151ff..8b92737752571 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -46,7 +46,7 @@ public function load($area) public static function getFilePath($area) { $diPath = DirectoryList::getDefaultConfig()[DirectoryList::DI][DirectoryList::PATH]; - return BP . $diPath . '/' . $area . '.json'; + return BP . $diPath . '/' . $area . '.ser'; } /** diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index bfe94a9dccc64..a16795ec6c9a6 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -117,7 +117,7 @@ public function create(array $arguments) $arguments = array_merge($deploymentConfig->get(), $arguments); $definitionFactory = new \Magento\Framework\ObjectManager\DefinitionFactory( $this->driverPool->getDriver(DriverPool::FILE), - $this->directoryList->getPath(DirectoryList::DI), + new \Magento\Framework\Serialize\Serializer\Json(), $this->directoryList->getPath(DirectoryList::GENERATION) ); @@ -127,7 +127,7 @@ public function create(array $arguments) /** @var EnvironmentFactory $envFactory */ $envFactory = new $this->envFactoryClassName($relations, $definitions); /** @var EnvironmentInterface $env */ - $env = $envFactory->createEnvironment(); + $env = $envFactory->createEnvironment(); /** @var ConfigInterface $diConfig */ $diConfig = $env->getDiConfig(); diff --git a/lib/internal/Magento/Framework/ObjectManager/Definition/Compiled.php b/lib/internal/Magento/Framework/ObjectManager/Definition/Compiled.php index db91618dccd23..e2a4f0c34a2a8 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Definition/Compiled.php +++ b/lib/internal/Magento/Framework/ObjectManager/Definition/Compiled.php @@ -22,7 +22,7 @@ class Compiled implements \Magento\Framework\ObjectManager\DefinitionInterface /** * @var \Magento\Framework\Code\Reader\ClassReaderInterface */ - protected $reader ; + protected $reader; /** * @var SerializerInterface diff --git a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php index 4e9026eb7b20d..f818296c526d8 100644 --- a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php +++ b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php @@ -1,33 +1,22 @@ _filesystemDriver = $filesystemDriver; - $this->_definitionDir = $definitionDir; + $this->serializer = $serializer; $this->_generationDir = $generationDir; - $this->_definitionFormat = $definitionFormat; } /** * Create class definitions * * @param mixed $definitions - * @return Runtime + * @return Compiled|Runtime */ public function createClassDefinition($definitions = false) { @@ -110,14 +91,7 @@ public function createClassDefinition($definitions = false) */ public function createPluginDefinition() { - $path = $this->_definitionDir . '/plugins.json'; - if ($this->_filesystemDriver->isReadable($path)) { - return new \Magento\Framework\Interception\Definition\Compiled( - $this->_unpack($this->_filesystemDriver->fileGetContents($path)) - ); - } else { - return new \Magento\Framework\Interception\Definition\Runtime(); - } + return new \Magento\Framework\Interception\Definition\Runtime(); } /** @@ -127,25 +101,7 @@ public function createPluginDefinition() */ public function createRelations() { - $path = $this->_definitionDir . '/relations.json'; - if ($this->_filesystemDriver->isReadable($path)) { - return new \Magento\Framework\ObjectManager\Relations\Compiled( - $this->_unpack($this->_filesystemDriver->fileGetContents($path)) - ); - } else { - return new \Magento\Framework\ObjectManager\Relations\Runtime(); - } - } - - /** - * Gets supported definition formats - * - * @return array - * @deprecated - */ - public static function getSupportedFormats() - { - return []; + return new \Magento\Framework\ObjectManager\Relations\Runtime(); } /** @@ -156,7 +112,7 @@ public static function getSupportedFormats() */ protected function _unpack($definitions) { - return json_decode($definitions); + return $this->serializer->unserialize($definitions); } /** diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php index 3861d274b5243..ca086c23aefe4 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php @@ -3,118 +3,74 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Framework\ObjectManager\Test\Unit; use Magento\Framework\ObjectManager\Definition\Compiled; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Filesystem\DriverInterface; +use Magento\Framework\ObjectManager\DefinitionFactory; +use Magento\Framework\ObjectManager\Definition\Runtime; class DefinitionFactoryTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\Filesystem\DriverInterface | \PHPUnit_Framework_MockObject_MockObject + * @var DriverInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $filesystemDriverMock; + private $filesystemDriverMock; /** - * @var \Magento\Framework\ObjectManager\DefinitionFactory + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $model; + private $serializerMock; /** - * @var string + * @var DefinitionFactory */ - protected $sampleContent; + private $definitionFactory; protected function setUp() { - $this->sampleContent = '[1,2,3]'; - $this->filesystemDriverMock = $this->getMock( - \Magento\Framework\Filesystem\Driver\File::class, - [], - [], - '', - false - ); - $this->model = new \Magento\Framework\ObjectManager\DefinitionFactory( + $this->filesystemDriverMock = $this->getMock(DriverInterface::class); + $this->serializerMock = $this->getMock(SerializerInterface::class); + $this->definitionFactory = new DefinitionFactory( $this->filesystemDriverMock, - 'DefinitionDir', - 'GenerationDir' + $this->serializerMock, + 'generation dir' ); } - public function testCreateClassDefinitionFromString() + public function testCreateClassDefinitionSerialized() { + $serializedDefinitions = 'serialized definitions'; + $definitions = [[], []]; + $this->serializerMock->expects($this->once()) + ->method('unserialize') + ->with($serializedDefinitions) + ->willReturn($definitions); $this->assertInstanceOf( - \Magento\Framework\ObjectManager\Definition\Compiled::class, - $this->model->createClassDefinition($this->sampleContent) + Compiled::class, + $this->definitionFactory->createClassDefinition($serializedDefinitions) ); } - /** - * @param string $path - * @param string $callMethod - * @param string $expectedClass - * @dataProvider createPluginsAndRelationsReadableDataProvider - */ - public function testCreatePluginsAndRelationsReadable($path, $callMethod, $expectedClass) - { - $this->filesystemDriverMock->expects($this->once())->method('isReadable') - ->with($path) - ->will($this->returnValue(true)); - $this->filesystemDriverMock->expects($this->once())->method('fileGetContents') - ->with($path) - ->will($this->returnValue($this->sampleContent)); - $this->assertInstanceOf($expectedClass, $this->model->$callMethod()); - } - - public function createPluginsAndRelationsReadableDataProvider() + public function testCreateClassDefinitionArray() { - return [ - 'relations' => [ - 'DefinitionDir/relations.json', - 'createRelations', \Magento\Framework\ObjectManager\Relations\Compiled::class, - ], - 'plugins' => [ - 'DefinitionDir/plugins.json', - 'createPluginDefinition', \Magento\Framework\Interception\Definition\Compiled::class, - ], - ]; - } - - /** - * @param string $path - * @param string $callMethod - * @param string $expectedClass - * @dataProvider createPluginsAndRelationsNotReadableDataProvider - */ - public function testCreatePluginsAndRelationsNotReadable($path, $callMethod, $expectedClass) - { - $this->filesystemDriverMock->expects($this->once())->method('isReadable') - ->with($path) - ->will($this->returnValue(false)); - $this->assertInstanceOf($expectedClass, $this->model->$callMethod()); - } - - public function createPluginsAndRelationsNotReadableDataProvider() - { - return [ - 'relations' => [ - 'DefinitionDir/relations.json', - 'createRelations', \Magento\Framework\ObjectManager\Relations\Runtime::class, - ], - 'plugins' => [ - 'DefinitionDir/plugins.json', - 'createPluginDefinition', \Magento\Framework\Interception\Definition\Runtime::class, - ], - ]; + $definitions = [[], []]; + $this->serializerMock->expects($this->never()) + ->method('unserialize'); + $this->assertInstanceOf( + Compiled::class, + $this->definitionFactory->createClassDefinition($definitions) + ); } - public function testGetSupportedFormats() + public function testCreateClassDefinition() { - $actual = \Magento\Framework\ObjectManager\DefinitionFactory::getSupportedFormats(); - $this->assertInternalType('array', $actual); - foreach ($actual as $className) { - $this->assertInternalType('string', $className); - } + $this->serializerMock->expects($this->never()) + ->method('unserialize'); + $this->assertInstanceOf( + Runtime::class, + $this->definitionFactory->createClassDefinition() + ); } } diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php b/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php index 3e2620fc20861..342b26a22e32b 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php @@ -46,7 +46,7 @@ public function write($key, array $config) $this->initialize(); file_put_contents( - $this->directoryList->getPath(DirectoryList::DI) . '/' . $key . '.json', + $this->directoryList->getPath(DirectoryList::DI) . '/' . $key . '.ser', $this->getSerializer()->serialize($config) ); } From 96603ae3c9f19ee2d237453dfe3f193542422611 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 1 Nov 2016 16:01:49 -0500 Subject: [PATCH 1574/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Introducing SerializerInterface, removing obsolete code --- .../App/ObjectManager/ConfigLoader/Compiled.php | 2 +- .../Framework/ObjectManager/DefinitionFactory.php | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index 8b92737752571..669c9f4121ac0 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -46,7 +46,7 @@ public function load($area) public static function getFilePath($area) { $diPath = DirectoryList::getDefaultConfig()[DirectoryList::DI][DirectoryList::PATH]; - return BP . $diPath . '/' . $area . '.ser'; + return BP . '/' . $diPath . '/' . $area . '.ser'; } /** diff --git a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php index f818296c526d8..7d9c3ea5e0b21 100644 --- a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php +++ b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php @@ -11,6 +11,7 @@ use Magento\Framework\ObjectManager\Profiler\Code\Generator as ProfilerGenerator; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\ObjectManager\Definition\Compiled; +use Magento\Framework\Code\Generator\Autoloader; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -31,11 +32,6 @@ class DefinitionFactory */ protected $_filesystemDriver; - /** - * @var string - */ - protected static $definitionClasses = Compiled::class; - /** * @var \Magento\Framework\Code\Generator */ @@ -65,7 +61,7 @@ public function __construct( * Create class definitions * * @param mixed $definitions - * @return Compiled|Runtime + * @return DefinitionInterface */ public function createClassDefinition($definitions = false) { @@ -73,10 +69,9 @@ public function createClassDefinition($definitions = false) if (is_string($definitions)) { $definitions = $this->_unpack($definitions); } - $definitionModel = self::$definitionClasses; - $result = new $definitionModel($definitions); + $result = new Compiled($definitions); } else { - $autoloader = new \Magento\Framework\Code\Generator\Autoloader($this->getCodeGenerator()); + $autoloader = new Autoloader($this->getCodeGenerator()); spl_autoload_register([$autoloader, 'load']); $result = new Runtime(); From 3cb01f17a1b201de8a89c90371e75c2cfdb667b9 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 1 Nov 2016 16:05:04 -0500 Subject: [PATCH 1575/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Introducing SerializerInterface, removing obsolete code --- .../ObjectManager/Test/Unit/DefinitionFactoryTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php index ca086c23aefe4..8ad1ac13a12cd 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php @@ -7,14 +7,14 @@ use Magento\Framework\ObjectManager\Definition\Compiled; use Magento\Framework\Serialize\SerializerInterface; -use Magento\Framework\Filesystem\DriverInterface; +use Magento\Framework\Filesystem\Driver\File; use Magento\Framework\ObjectManager\DefinitionFactory; use Magento\Framework\ObjectManager\Definition\Runtime; class DefinitionFactoryTest extends \PHPUnit_Framework_TestCase { /** - * @var DriverInterface|\PHPUnit_Framework_MockObject_MockObject + * @var File|\PHPUnit_Framework_MockObject_MockObject */ private $filesystemDriverMock; @@ -30,7 +30,7 @@ class DefinitionFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->filesystemDriverMock = $this->getMock(DriverInterface::class); + $this->filesystemDriverMock = $this->getMock(File::class); $this->serializerMock = $this->getMock(SerializerInterface::class); $this->definitionFactory = new DefinitionFactory( $this->filesystemDriverMock, From 67918750a813ebfce65faf6c3d2ea0d939e2da6b Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 1 Nov 2016 16:38:20 -0500 Subject: [PATCH 1576/3232] MAGETWO-60357: Extra parameter passed to parent constructor in \Magento\Indexer\Model\Config\Data::__construct Removing extra parameter --- .../Magento/Indexer/Model/Config/Data.php | 22 ++++++++-- .../Test/Unit/Model/Config/DataTest.php | 43 ++++++++++++++++--- 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Indexer/Model/Config/Data.php b/app/code/Magento/Indexer/Model/Config/Data.php index 703c875d1ef4e..7fdd3b326d5af 100644 --- a/app/code/Magento/Indexer/Model/Config/Data.php +++ b/app/code/Magento/Indexer/Model/Config/Data.php @@ -6,6 +6,7 @@ namespace Magento\Indexer\Model\Config; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; class Data extends \Magento\Framework\Config\Data { @@ -21,20 +22,18 @@ class Data extends \Magento\Framework\Config\Data * @param \Magento\Framework\Config\CacheInterface $cache * @param \Magento\Indexer\Model\ResourceModel\Indexer\State\Collection $stateCollection * @param string $cacheId - * @param SerializerInterface|null $serializer */ public function __construct( \Magento\Framework\Indexer\Config\Reader $reader, \Magento\Framework\Config\CacheInterface $cache, \Magento\Indexer\Model\ResourceModel\Indexer\State\Collection $stateCollection, - $cacheId = 'indexer_config', - SerializerInterface $serializer = null + $cacheId = 'indexer_config' ) { $this->stateCollection = $stateCollection; $isCacheExists = $cache->test($cacheId); - parent::__construct($reader, $cache, $cacheId, $serializer); + parent::__construct($reader, $cache, $cacheId); if (!$isCacheExists) { $this->deleteNonexistentStates(); @@ -55,4 +54,19 @@ protected function deleteNonexistentStates() } } } + + /** + * Get serializer + * + * @return SerializerInterface + * @deprecated + */ + protected function getSerializer() + { + if ($this->serializer === null) { + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() + ->get(Serialize::class); + } + return $this->serializer; + } } diff --git a/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php b/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php index e16c21b8f1125..fe66da6366e4d 100644 --- a/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Indexer\Test\Unit\Model\Config; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; + class DataTest extends \PHPUnit_Framework_TestCase { /** @@ -38,7 +41,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected $indexers = ['indexer1' => [], 'indexer3' => []]; /** - * @var \Magento\Framework\Serialize\SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */ private $serializerMock; @@ -61,7 +64,14 @@ protected function setUp() '', false ); - $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class); + $this->serializerMock = $this->getMock(SerializerInterface::class); + } + + protected function tearDown() + { + $reflectionProperty = new \ReflectionProperty(\Magento\Framework\App\ObjectManager::class, '_instance'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue(null); } public function testConstructorWithCache() @@ -80,12 +90,13 @@ public function testConstructorWithCache() $this->stateCollection->expects($this->never())->method('getItems'); + $this->mockObjectManager([Serialize::class => $this->serializerMock]); + $this->model = new \Magento\Indexer\Model\Config\Data( $this->reader, $this->cache, $this->stateCollection, - $this->cacheId, - $this->serializerMock + $this->cacheId ); } @@ -120,12 +131,32 @@ public function testConstructorWithoutCache() $this->stateCollection->expects($this->once())->method('getItems')->will($this->returnValue($states)); + $this->mockObjectManager([Serialize::class => $this->serializerMock]); + $this->model = new \Magento\Indexer\Model\Config\Data( $this->reader, $this->cache, $this->stateCollection, - $this->cacheId, - $this->serializerMock + $this->cacheId ); } + + /** + * Mock application object manager to return configured dependencies + * + * @param array $dependencies + * @return void + */ + private function mockObjectManager($dependencies) + { + $dependencyMap = []; + foreach ($dependencies as $type => $instance) { + $dependencyMap[] = [$type, $instance]; + } + $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); + $objectManagerMock->expects($this->any()) + ->method('get') + ->will($this->returnValueMap($dependencyMap)); + \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock); + } } From dfdc20b5562e6aaf7a5cd2638e8af2bf6b1b79a2 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 1 Nov 2016 17:26:44 -0500 Subject: [PATCH 1577/3232] MAGETWO-60357: Extra parameter passed to parent constructor in \Magento\Indexer\Model\Config\Data::__construct Reverting commit 67918750a813ebfce65faf6c3d2ea0d939e2da6b --- .../Magento/Indexer/Model/Config/Data.php | 22 ++-------- .../Test/Unit/Model/Config/DataTest.php | 43 +++---------------- 2 files changed, 10 insertions(+), 55 deletions(-) diff --git a/app/code/Magento/Indexer/Model/Config/Data.php b/app/code/Magento/Indexer/Model/Config/Data.php index 7fdd3b326d5af..703c875d1ef4e 100644 --- a/app/code/Magento/Indexer/Model/Config/Data.php +++ b/app/code/Magento/Indexer/Model/Config/Data.php @@ -6,7 +6,6 @@ namespace Magento\Indexer\Model\Config; use Magento\Framework\Serialize\SerializerInterface; -use Magento\Framework\Serialize\Serializer\Serialize; class Data extends \Magento\Framework\Config\Data { @@ -22,18 +21,20 @@ class Data extends \Magento\Framework\Config\Data * @param \Magento\Framework\Config\CacheInterface $cache * @param \Magento\Indexer\Model\ResourceModel\Indexer\State\Collection $stateCollection * @param string $cacheId + * @param SerializerInterface|null $serializer */ public function __construct( \Magento\Framework\Indexer\Config\Reader $reader, \Magento\Framework\Config\CacheInterface $cache, \Magento\Indexer\Model\ResourceModel\Indexer\State\Collection $stateCollection, - $cacheId = 'indexer_config' + $cacheId = 'indexer_config', + SerializerInterface $serializer = null ) { $this->stateCollection = $stateCollection; $isCacheExists = $cache->test($cacheId); - parent::__construct($reader, $cache, $cacheId); + parent::__construct($reader, $cache, $cacheId, $serializer); if (!$isCacheExists) { $this->deleteNonexistentStates(); @@ -54,19 +55,4 @@ protected function deleteNonexistentStates() } } } - - /** - * Get serializer - * - * @return SerializerInterface - * @deprecated - */ - protected function getSerializer() - { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(Serialize::class); - } - return $this->serializer; - } } diff --git a/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php b/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php index fe66da6366e4d..e16c21b8f1125 100644 --- a/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php @@ -5,9 +5,6 @@ */ namespace Magento\Indexer\Test\Unit\Model\Config; -use Magento\Framework\Serialize\SerializerInterface; -use Magento\Framework\Serialize\Serializer\Serialize; - class DataTest extends \PHPUnit_Framework_TestCase { /** @@ -41,7 +38,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected $indexers = ['indexer1' => [], 'indexer3' => []]; /** - * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Serialize\SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */ private $serializerMock; @@ -64,14 +61,7 @@ protected function setUp() '', false ); - $this->serializerMock = $this->getMock(SerializerInterface::class); - } - - protected function tearDown() - { - $reflectionProperty = new \ReflectionProperty(\Magento\Framework\App\ObjectManager::class, '_instance'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue(null); + $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class); } public function testConstructorWithCache() @@ -90,13 +80,12 @@ public function testConstructorWithCache() $this->stateCollection->expects($this->never())->method('getItems'); - $this->mockObjectManager([Serialize::class => $this->serializerMock]); - $this->model = new \Magento\Indexer\Model\Config\Data( $this->reader, $this->cache, $this->stateCollection, - $this->cacheId + $this->cacheId, + $this->serializerMock ); } @@ -131,32 +120,12 @@ public function testConstructorWithoutCache() $this->stateCollection->expects($this->once())->method('getItems')->will($this->returnValue($states)); - $this->mockObjectManager([Serialize::class => $this->serializerMock]); - $this->model = new \Magento\Indexer\Model\Config\Data( $this->reader, $this->cache, $this->stateCollection, - $this->cacheId + $this->cacheId, + $this->serializerMock ); } - - /** - * Mock application object manager to return configured dependencies - * - * @param array $dependencies - * @return void - */ - private function mockObjectManager($dependencies) - { - $dependencyMap = []; - foreach ($dependencies as $type => $instance) { - $dependencyMap[] = [$type, $instance]; - } - $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); - $objectManagerMock->expects($this->any()) - ->method('get') - ->will($this->returnValueMap($dependencyMap)); - \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock); - } } From 6a5ece2f27934b2ddf7a939617c12507d264ee90 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Wed, 2 Nov 2016 08:50:16 +0200 Subject: [PATCH 1578/3232] MAGETWO-59685: Checkout pages very slow due to pulling in JSON config, js scripts for unused payment & shipping methods #6997 #4868 --- .../Checkout/Block/Cart/LayoutProcessor.php | 11 +- .../Block/Checkout/AttributeMerger.php | 14 +- .../Block/Checkout/DirectoryDataProcessor.php | 146 ++++++++++++++++++ .../Block/Checkout/LayoutProcessor.php | 74 +++++++++ .../Unit/Block/Cart/LayoutProcessorTest.php | 9 +- .../Checkout/DirectoryDataProcessorTest.php | 114 ++++++++++++++ .../Block/Checkout/LayoutProcessorTest.php | 10 ++ app/code/Magento/Checkout/etc/frontend/di.xml | 1 + .../Model/ResourceModel/Region/Collection.php | 47 ++++++ .../ResourceModel/Region/CollectionTest.php | 34 +++- .../view/base/web/js/form/element/select.js | 46 ++---- .../Ui/base/js/form/element/select.test.js | 2 +- 12 files changed, 470 insertions(+), 38 deletions(-) create mode 100644 app/code/Magento/Checkout/Block/Checkout/DirectoryDataProcessor.php create mode 100644 app/code/Magento/Checkout/Test/Unit/Block/Checkout/DirectoryDataProcessorTest.php diff --git a/app/code/Magento/Checkout/Block/Cart/LayoutProcessor.php b/app/code/Magento/Checkout/Block/Cart/LayoutProcessor.php index a492002b0a5a5..a042c41634bcb 100644 --- a/app/code/Magento/Checkout/Block/Cart/LayoutProcessor.php +++ b/app/code/Magento/Checkout/Block/Cart/LayoutProcessor.php @@ -85,14 +85,14 @@ public function process($jsLayout) 'visible' => true, 'formElement' => 'select', 'label' => __('Country'), - 'options' => $this->countryCollection->loadByStore()->toOptionArray(), + 'options' => [], 'value' => null ], 'region_id' => [ 'visible' => true, 'formElement' => 'select', 'label' => __('State/Province'), - 'options' => $this->regionCollection->load()->toOptionArray(), + 'options' => [], 'value' => null ], 'postcode' => [ @@ -103,6 +103,13 @@ public function process($jsLayout) ] ]; + if (!isset($jsLayout['components']['checkoutProvider']['dictionaries'])) { + $jsLayout['components']['checkoutProvider']['dictionaries'] = [ + 'country_id' => $this->countryCollection->loadByStore()->toOptionArray(), + 'region_id' => $this->regionCollection->addAllowedCountriesFilter()->toOptionArray(), + ]; + } + if (isset($jsLayout['components']['block-summary']['children']['block-shipping']['children'] ['address-fieldsets']['children']) ) { diff --git a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php index 1882d88e04a8b..e7686e4bea58b 100644 --- a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php +++ b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php @@ -192,6 +192,15 @@ protected function getFieldConfig( 'visible' => isset($additionalConfig['visible']) ? $additionalConfig['visible'] : true, ]; + if ($attributeCode === 'region_id' || $attributeCode === 'country_id') { + unset($element['options']); + $element['deps'] = [$providerName]; + $element['imports'] = [ + 'initialOptions' => 'index = ' . $providerName . ':dictionaries.' . $attributeCode, + 'setOptions' => 'index = ' . $providerName . ':dictionaries.' . $attributeCode + ]; + } + if (isset($attributeConfig['value']) && $attributeConfig['value'] != null) { $element['value'] = $attributeConfig['value']; } elseif (isset($attributeConfig['default']) && $attributeConfig['default'] != null) { @@ -341,11 +350,11 @@ protected function getCustomer() * @param string $attributeCode * @param array $attributeConfig * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function getFieldOptions($attributeCode, array $attributeConfig) { - $options = isset($attributeConfig['options']) ? $attributeConfig['options'] : []; - return ($attributeCode == 'country_id') ? $this->orderCountryOptions($options) : $options; + return isset($attributeConfig['options']) ? $attributeConfig['options'] : []; } /** @@ -353,6 +362,7 @@ protected function getFieldOptions($attributeCode, array $attributeConfig) * * @param array $countryOptions * @return array + * @deprecated */ protected function orderCountryOptions(array $countryOptions) { diff --git a/app/code/Magento/Checkout/Block/Checkout/DirectoryDataProcessor.php b/app/code/Magento/Checkout/Block/Checkout/DirectoryDataProcessor.php new file mode 100644 index 0000000000000..4a02ebbd079a4 --- /dev/null +++ b/app/code/Magento/Checkout/Block/Checkout/DirectoryDataProcessor.php @@ -0,0 +1,146 @@ +countryCollectionFactory = $countryCollection; + $this->regionCollectionFactory = $regionCollection; + $this->storeResolver = $storeResolver; + $this->directoryHelper = $directoryHelper; + } + + /** + * Process js Layout of block + * + * @param array $jsLayout + * @return array + */ + public function process($jsLayout) + { + if (!isset($jsLayout['components']['checkoutProvider']['dictionaries'])) { + $jsLayout['components']['checkoutProvider']['dictionaries'] = [ + 'country_id' => $this->getCountryOptions(), + 'region_id' => $this->getRegionOptions(), + ]; + } + + return $jsLayout; + } + + /** + * Get country options list. + * + * @return array + */ + private function getCountryOptions() + { + if (!isset($this->countryOptions)) { + $this->countryOptions = $this->countryCollectionFactory->create()->loadByStore( + $this->storeResolver->getCurrentStoreId() + )->toOptionArray(); + $this->countryOptions = $this->orderCountryOptions($this->countryOptions); + } + + return $this->countryOptions; + } + + /** + * Get region options list. + * + * @return array + */ + private function getRegionOptions() + { + if (!isset($this->regionOptions)) { + $this->regionOptions = $this->regionCollectionFactory->create()->addAllowedCountriesFilter( + $this->storeResolver->getCurrentStoreId() + )->toOptionArray(); + } + + return $this->regionOptions; + } + + /** + * Sort country options by top country codes. + * + * @param array $countryOptions + * @return array + */ + private function orderCountryOptions(array $countryOptions) + { + $topCountryCodes = $this->directoryHelper->getTopCountryCodes(); + if (empty($topCountryCodes)) { + return $countryOptions; + } + + $headOptions = []; + $tailOptions = [[ + 'value' => 'delimiter', + 'label' => '──────────', + 'disabled' => true, + ]]; + foreach ($countryOptions as $countryOption) { + if (empty($countryOption['value']) || in_array($countryOption['value'], $topCountryCodes)) { + array_push($headOptions, $countryOption); + } else { + array_push($tailOptions, $countryOption); + } + } + return array_merge($headOptions, $tailOptions); + } +} diff --git a/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php index 1b2c744419891..f7472aadaf765 100644 --- a/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php +++ b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php @@ -7,7 +7,11 @@ use Magento\Checkout\Helper\Data; use Magento\Framework\App\ObjectManager; +use Magento\Store\Api\StoreResolverInterface; +/** + * Class LayoutProcessor + */ class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcessorInterface { /** @@ -35,6 +39,16 @@ class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcesso */ private $checkoutDataHelper; + /** + * @var StoreResolverInterface + */ + private $storeResolver; + + /** + * @var \Magento\Shipping\Model\Config + */ + private $shippingConfig; + /** * @param \Magento\Customer\Model\AttributeMetadataDataProvider $attributeMetadataDataProvider * @param \Magento\Ui\Component\Form\AttributeMapper $attributeMapper @@ -146,6 +160,16 @@ public function process($jsLayout) $elements ); } + if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] + ['step-config']['children']['shipping-rates-validation']['children'] + )) { + $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] + ['step-config']['children']['shipping-rates-validation']['children'] = + $this->processShippingChildrenComponents( + $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] + ['step-config']['children']['shipping-rates-validation']['children'] + ); + } if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children'] @@ -163,6 +187,26 @@ public function process($jsLayout) return $jsLayout; } + /** + * Process shipping configuration to exclude inactive carriers. + * + * @param array $shippingRatesLayout + * @return array + */ + private function processShippingChildrenComponents($shippingRatesLayout) + { + $activeCarriers = $this->getShippingConfig()->getActiveCarriers( + $this->getStoreResolver()->getCurrentStoreId() + ); + foreach (array_keys($shippingRatesLayout) as $carrierName) { + $carrierKey = str_replace('-rates-validation', '', $carrierName); + if (!array_key_exists($carrierKey, $activeCarriers)) { + unset($shippingRatesLayout[$carrierName]); + } + } + return $shippingRatesLayout; + } + /** * Appends billing address form component to payment layout * @param array $paymentLayout @@ -314,4 +358,34 @@ private function getCheckoutDataHelper() return $this->checkoutDataHelper; } + + /** + * Get active carriers list. + * + * @return array + * @deprecated + */ + private function getShippingConfig() + { + if (!$this->shippingConfig) { + $this->shippingConfig = ObjectManager::getInstance()->get(\Magento\Shipping\Model\Config::class); + } + + return $this->shippingConfig; + } + + /** + * Get store resolver. + * + * @return StoreResolverInterface + * @deprecated + */ + private function getStoreResolver() + { + if (!$this->storeResolver) { + $this->storeResolver = ObjectManager::getInstance()->get(StoreResolverInterface::class); + } + + return $this->storeResolver; + } } diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/LayoutProcessorTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/LayoutProcessorTest.php index 95ffed86cbb35..5eabb6c9c86a4 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/LayoutProcessorTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/LayoutProcessorTest.php @@ -69,7 +69,7 @@ public function testProcess() $this->countryCollection->expects($this->once())->method('loadByStore')->willReturnSelf(); $this->countryCollection->expects($this->once())->method('toOptionArray')->willReturn($countries); - $this->regionCollection->expects($this->once())->method('load')->willReturnSelf(); + $this->regionCollection->expects($this->once())->method('addAllowedCountriesFilter')->willReturnSelf(); $this->regionCollection->expects($this->once())->method('toOptionArray')->willReturn($regions); $layoutMerged = $layout; @@ -77,7 +77,12 @@ public function testProcess() ['address-fieldsets']['children']['fieldThree'] = ['param' => 'value']; $layoutMergedPointer = &$layoutMerged['components']['block-summary']['children']['block-shipping'] ['children']['address-fieldsets']['children']; - + $layoutMerged['components']['checkoutProvider'] = [ + 'dictionaries' => [ + 'country_id' => [], + 'region_id' => [], + ] + ]; $elements = [ 'city' => [ 'visible' => false, diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Checkout/DirectoryDataProcessorTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/DirectoryDataProcessorTest.php new file mode 100644 index 0000000000000..c84fac464c047 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/DirectoryDataProcessorTest.php @@ -0,0 +1,114 @@ +countryCollectionFactoryMock = $this->getMock( + \Magento\Directory\Model\ResourceModel\Country\CollectionFactory::class, + ['create'], + [], + '', + false + ); + $this->countryCollectionMock = $this->getMock( + \Magento\Directory\Model\ResourceModel\Country\Collection::class, + [], + [], + '', + false + ); + $this->regionCollectionFactoryMock = $this->getMock( + \Magento\Directory\Model\ResourceModel\Region\CollectionFactory::class, + ['create'], + [], + '', + false + ); + $this->regionCollectionMock = $this->getMock( + \Magento\Directory\Model\ResourceModel\Region\Collection::class, + [], + [], + '', + false + ); + $this->storeResolverMock = $this->getMock( + \Magento\Store\Api\StoreResolverInterface::class + ); + $this->directoryDataHelperMock = $this->getMock( + \Magento\Directory\Helper\Data::class, + [], + [], + '', + false + ); + + $this->model = new \Magento\Checkout\Block\Checkout\DirectoryDataProcessor( + $this->countryCollectionFactoryMock, + $this->regionCollectionFactoryMock, + $this->storeResolverMock, + $this->directoryDataHelperMock + ); + } + + public function testProcess() + { + $expectedResult['components']['checkoutProvider']['dictionaries'] = [ + 'country_id' => [], + 'region_id' => [], + ]; + + $this->countryCollectionFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->countryCollectionMock); + $this->countryCollectionMock->expects($this->once())->method('loadByStore')->willReturnSelf(); + $this->countryCollectionMock->expects($this->once())->method('toOptionArray')->willReturn([]); + $this->regionCollectionFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->regionCollectionMock); + $this->regionCollectionMock->expects($this->once())->method('addAllowedCountriesFilter')->willReturnSelf(); + $this->regionCollectionMock->expects($this->once())->method('toOptionArray')->willReturn([]); + + $this->assertEquals($expectedResult, $this->model->process([])); + } +} diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php index 1351213f990b5..95aed9b56afc3 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php @@ -17,6 +17,8 @@ /** * LayoutProcessorTest covers a list of variations for * checkout layout processor + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class LayoutProcessorTest extends \PHPUnit_Framework_TestCase { @@ -45,6 +47,11 @@ class LayoutProcessorTest extends \PHPUnit_Framework_TestCase */ private $layoutProcessor; + /** + * @var MockObject + */ + private $storeResolver; + protected function setUp() { $objectManager = new ObjectManager($this); @@ -79,8 +86,11 @@ protected function setUp() $this->attributeMerger ); + $this->storeResolver = $this->getMock(\Magento\Store\Api\StoreResolverInterface::class); + $objectManager->setBackwardCompatibleProperty($this->layoutProcessor, 'checkoutDataHelper', $this->dataHelper); $objectManager->setBackwardCompatibleProperty($this->layoutProcessor, 'options', $options); + $objectManager->setBackwardCompatibleProperty($this->layoutProcessor, 'storeResolver', $this->storeResolver); } /** diff --git a/app/code/Magento/Checkout/etc/frontend/di.xml b/app/code/Magento/Checkout/etc/frontend/di.xml index 6fb9058c3b768..69ed33721740d 100644 --- a/app/code/Magento/Checkout/etc/frontend/di.xml +++ b/app/code/Magento/Checkout/etc/frontend/di.xml @@ -55,6 +55,7 @@ Magento\Checkout\Block\Checkout\LayoutProcessor Magento\Checkout\Block\Checkout\TotalsProcessor + Magento\Checkout\Block\Checkout\DirectoryDataProcessor
diff --git a/app/code/Magento/Directory/Model/ResourceModel/Region/Collection.php b/app/code/Magento/Directory/Model/ResourceModel/Region/Collection.php index 718e0c0223d76..3fdb20165d4be 100644 --- a/app/code/Magento/Directory/Model/ResourceModel/Region/Collection.php +++ b/app/code/Magento/Directory/Model/ResourceModel/Region/Collection.php @@ -9,6 +9,14 @@ */ namespace Magento\Directory\Model\ResourceModel\Region; +use Magento\Directory\Model\AllowedCountries; +use Magento\Framework\App\ObjectManager; +use Magento\Store\Model\ScopeInterface; + +/** + * Class Collection + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection { /** @@ -30,6 +38,11 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab */ protected $_localeResolver; + /** + * @var AllowedCountries + */ + private $allowedCountriesReader; + /** * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory * @param \Psr\Log\LoggerInterface $logger @@ -89,6 +102,40 @@ protected function _initSelect() return $this; } + /** + * Return Allowed Countries reader + * + * @return \Magento\Directory\Model\AllowedCountries + * @deprecated + */ + private function getAllowedCountriesReader() + { + if (!$this->allowedCountriesReader) { + $this->allowedCountriesReader = ObjectManager::getInstance()->get(AllowedCountries::class); + } + + return $this->allowedCountriesReader; + } + + /** + * Set allowed countries filter based on the given store. + * This is a convenience method for collection filtering based on store configuration settings. + * + * @param null|int|string|\Magento\Store\Model\Store $store + * @return \Magento\Directory\Model\ResourceModel\Region\Collection + */ + public function addAllowedCountriesFilter($store = null) + { + $allowedCountries = $this->getAllowedCountriesReader() + ->getAllowedCountries(ScopeInterface::SCOPE_STORE, $store); + + if (!empty($allowedCountries)) { + $this->addFieldToFilter('main_table.country_id', ['in' => $allowedCountries]); + } + + return $this; + } + /** * Filter by country_id * diff --git a/app/code/Magento/Directory/Test/Unit/Model/ResourceModel/Region/CollectionTest.php b/app/code/Magento/Directory/Test/Unit/Model/ResourceModel/Region/CollectionTest.php index 59c054b00a5f9..5c09ab119295a 100644 --- a/app/code/Magento/Directory/Test/Unit/Model/ResourceModel/Region/CollectionTest.php +++ b/app/code/Magento/Directory/Test/Unit/Model/ResourceModel/Region/CollectionTest.php @@ -6,6 +6,7 @@ namespace Magento\Directory\Test\Unit\Model\ResourceModel\Region; use Magento\Directory\Model\ResourceModel\Region\Collection; +use Magento\Directory\Model\AllowedCountries; use Magento\Framework\DB\Adapter\Pdo\Mysql; use Magento\Framework\DB\Select; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; @@ -15,7 +16,14 @@ use Magento\Framework\Locale\ResolverInterface; use Magento\Framework\DataObject; use Psr\Log\LoggerInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit_Framework_MockObject_MockObject as MockObject; +/** + * Class CollectionTest + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class CollectionTest extends \PHPUnit_Framework_TestCase { /** @@ -23,15 +31,22 @@ class CollectionTest extends \PHPUnit_Framework_TestCase */ private $collection; + /** + * @var MockObject + */ + private $allowedCountries; + protected function setUp() { + $objectManager = new ObjectManager($this); $entityFactoryMock = $this->getMock(EntityFactory::class, [], [], '', false); $loggerMock = $this->getMock(LoggerInterface::class); $fetchStrategyMock = $this->getMock(FetchStrategyInterface::class); $eventManagerMock = $this->getMock(ManagerInterface::class); $localeResolverMock = $this->getMock(ResolverInterface::class); $connectionMock = $this->getMock(Mysql::class, [], [], '', false); - $resourceMock = $this->getMockForAbstractClass(AbstractDb::class, + $resourceMock = $this->getMockForAbstractClass( + AbstractDb::class, [], '', false, @@ -39,6 +54,7 @@ protected function setUp() true, ['getConnection', 'getMainTable', 'getTable', '__wakeup'] ); + $this->allowedCountries = $this->getMock(AllowedCountries::class, [], [], '', false); $selectMock = $this->getMock(Select::class, [], [], '', false); $connectionMock->expects($this->any())->method('select')->will($this->returnValue($selectMock)); @@ -54,6 +70,12 @@ protected function setUp() $connectionMock, $resourceMock ); + + $objectManager->setBackwardCompatibleProperty( + $this->collection, + 'allowedCountriesReader', + $this->allowedCountries + ); } public function testToOptionArray() @@ -98,4 +120,14 @@ public function testToOptionArray() $this->assertEquals($expectedResult, $this->collection->toOptionArray()); } + + public function testAddAllowedCountriesFilter() + { + $allowedCountries = [1, 2, 3]; + $this->allowedCountries->expects($this->once())->method('getAllowedCountries')->with( + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null + )->willReturn($allowedCountries); + $this->assertEquals($this->collection->addAllowedCountriesFilter(), $this->collection); + } } diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/select.js b/app/code/Magento/Ui/view/base/web/js/form/element/select.js index 1887639c8d031..4567bba1d017a 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/select.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/select.js @@ -105,7 +105,9 @@ define([ return Abstract.extend({ defaults: { customName: '${ $.parentName }.${ $.index }_input', - elementTmpl: 'ui/form/element/select' + elementTmpl: 'ui/form/element/select', + caption: '', + options: [] }, /** @@ -127,28 +129,6 @@ define([ return this; }, - /** - * Parses options and merges the result with instance - * - * @param {Object} config - * @returns {Object} Chainable. - */ - initConfig: function (config) { - var options = config.options, - captionValue = config.captionValue || '', - result = parseOptions(options, captionValue); - - if (config.caption) { - delete result.caption; - } - - _.extend(config, result); - - this._super(); - - return this; - }, - /** * Calls 'initObservable' of parent, initializes 'options' and 'initialOptions' * properties, calls 'setOptions' passing options to it @@ -160,7 +140,7 @@ define([ this.initialOptions = this.options; - this.observe('options') + this.observe('options caption') .setOptions(this.options()); return this; @@ -209,7 +189,7 @@ define([ return option && option.value; } - if (!this.caption) { + if (!this.caption()) { return findFirst(this.options); } }, @@ -254,14 +234,20 @@ define([ * @returns {Object} Chainable */ setOptions: function (data) { - var isVisible; + var captionValue = this.captionValue || '', + result = parseOptions(data, captionValue), + isVisible; + + this.indexedOptions = indexOptions(result.options); - this.indexedOptions = indexOptions(data); + this.options(result.options); - this.options(data); + if (!this.caption()) { + this.caption(result.caption); + } if (this.customEntry) { - isVisible = !!data.length; + isVisible = !!result.options.length; this.setVisible(isVisible); this.toggleInput(!isVisible); @@ -301,7 +287,7 @@ define([ * @returns {Object} Chainable. */ clear: function () { - var value = this.caption ? '' : findFirst(this.options); + var value = this.caption() ? '' : findFirst(this.options); this.value(value); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js index db5855b0a692b..5d75b8c595366 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js @@ -121,7 +121,7 @@ define([ { value: 'valLast' }]; - model.caption = false; + model.caption(''); expect(model.normalizeData('')).toEqual('valFirst'); }); }); From 93af2417b24a1c12629022e9e7944375223e81e2 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Wed, 2 Nov 2016 08:51:34 +0200 Subject: [PATCH 1579/3232] MAGETWO-60110: [Github] Shipping Estimation Address is Merged with Customer Default Address during Checkout #6869 --- .../view/frontend/web/js/view/cart/shipping-estimation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-estimation.js b/app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-estimation.js index 3d4612fbe9ec5..cd43dc646584d 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-estimation.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-estimation.js @@ -52,9 +52,9 @@ define( addressConverter.quoteAddressToFormAddressData(address) : { // only the following fields must be used by estimation form data provider - country_id: address.countryId, + 'country_id': address.countryId, region: address.region, - region_id: address.regionId, + 'region_id': address.regionId, postcode: address.postcode }; checkoutProvider.set( From 5da49c002963ef5c5e37b522815883acfe79a00c Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Wed, 2 Nov 2016 09:46:15 +0200 Subject: [PATCH 1580/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - refactoring for static tests --- .../ResourceModel/Selection/Collection.php | 3 +- .../Model/Product/BundlePriceAbstract.php | 19 +++-- .../DynamicBundlePriceCalculatorTest.php | 22 +++-- ...ndleWithCatalogPriceRuleCalculatorTest.php | 43 +++++----- ...icBundleWithSpecialPriceCalculatorTest.php | 47 +++++----- ...namicBundleWithTierPriceCalculatorTest.php | 47 +++++----- .../FixedBundlePriceCalculatorTest.php | 26 +++--- ...ndleWithCatalogPriceRuleCalculatorTest.php | 81 +++++++++--------- ...edBundleWithSpecialPriceCalculatorTest.php | 85 ++++++++++--------- ...FixedBundleWithTierPriceCalculatorTest.php | 71 ++++++++-------- .../Bundle/Model/Product/IsSaleableTest.php | 42 ++++++--- .../dynamic_bundle_product.php | 4 +- .../dynamic_bundle_product_rollback.php | 2 +- .../PriceCalculator/fixed_bundle_product.php | 4 +- .../fixed_bundle_product_rollback.php | 2 +- .../Bundle/_files/issaleable_product.php | 2 +- .../_files/issaleable_product_rollback.php | 3 +- .../Bundle/_files/multiple_products.php | 5 +- 18 files changed, 285 insertions(+), 223 deletions(-) diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index bf3974ab13aff..afb04e62bf467 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -33,7 +33,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection /** * Is website scope prices joined to collection - + * * @var bool */ private $websiteScopePriceJoined = false; @@ -307,6 +307,7 @@ private function getCatalogRuleProcessor() /** * Clear collection data after clone + * @return void */ public function __clone() { diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php index b71a40cbdb561..86bc9f2c80744 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php @@ -5,6 +5,7 @@ */ namespace Magento\Bundle\Model\Product; + use Zend\Console\Exception\InvalidArgumentException; /** @@ -12,8 +13,10 @@ */ abstract class BundlePriceAbstract extends \PHPUnit_Framework_TestCase { + /** Fixed price type for product custom option */ const CUSTOM_OPTION_PRICE_TYPE_FIXED = 'fixed'; + /** Percent price type for product custom option */ const CUSTOM_OPTION_PRICE_TYPE_PERCENT = 'percent'; /** @var \Magento\TestFramework\Helper\Bootstrap */ @@ -35,13 +38,18 @@ protected function setUp() abstract public function getTestCases(); /** - * @param $strategyModifiers - * @throws InvalidArgumentException + * @param array $strategyModifiers + * @param string $productSku * @return \Magento\Catalog\Api\Data\ProductInterface + * @throws InvalidArgumentException + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\StateException + * @throws \Magento\Framework\Exception\CouldNotSaveException */ - protected function prepareFixture($strategyModifiers) + protected function prepareFixture($strategyModifiers, $productSku) { - $bundleProduct = $this->productRepository->get('spherical_horse_in_a_vacuum'); + $bundleProduct = $this->productRepository->get($productSku); foreach ($strategyModifiers as $modifier) { if (method_exists($this, $modifier['modifierName'])) { @@ -54,8 +62,7 @@ protected function prepareFixture($strategyModifiers) } } - $this->productRepository->save($bundleProduct); - return $this->productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + return $this->productRepository->save($bundleProduct); } /** diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php index ba698a7cc73f2..3cc9939ba38ad 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php @@ -20,7 +20,8 @@ class DynamicBundlePriceCalculatorTest extends BundlePriceAbstract */ public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -48,7 +49,8 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec */ public function testPriceForDynamicBundleInWebsiteScope(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -67,10 +69,14 @@ public function testPriceForDynamicBundleInWebsiteScope(array $strategyModifiers ); } + /** + * Test cases for current test + * @return array + */ public function getTestCases() { return [ - 'Testing price for dynamic bundle product with one simple' => [ + '#1 Testing price for dynamic bundle product with one simple' => [ 'strategy' => $this->getProductWithOneSimple(), 'expectedResults' => [ // just price from simple1 @@ -79,7 +85,7 @@ public function getTestCases() 'maximalPrice' => 10 ] ], - 'Testing price for dynamic bundle product with three simples and different qty' => [ + '#2 Testing price for dynamic bundle product with three simples and different qty' => [ 'strategy' => $this->getProductWithDifferentQty(), 'expectedResults' => [ // min price from simples 3*10 or 30 @@ -88,7 +94,7 @@ public function getTestCases() 'maximalPrice' => 100 ] ], - 'Testing price for dynamic bundle product with four simples and different price' => [ + '#3 Testing price for dynamic bundle product with four simples and different price' => [ 'strategy' => $this->getProductWithDifferentPrice(), 'expectedResults' => [ // 10 @@ -100,7 +106,7 @@ public function getTestCases() ]; } - public function getProductWithOneSimple() + private function getProductWithOneSimple() { $optionsData = [ [ @@ -124,7 +130,7 @@ public function getProductWithOneSimple() ]; } - public function getProductWithDifferentQty() + private function getProductWithDifferentQty() { $optionsData = [ [ @@ -156,7 +162,7 @@ public function getProductWithDifferentQty() ]; } - public function getProductWithDifferentPrice() + private function getProductWithDifferentPrice() { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php index fd6554b3b1d08..41644729fece3 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php @@ -20,7 +20,8 @@ class DynamicBundleWithCatalogPriceRuleCalculatorTest extends BundlePriceAbstrac */ public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -39,10 +40,14 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec ); } + /** + * Test cases for current test + * @return array + */ public function getTestCases() { return [ - 'Testing price for dynamic bundle product with sub items and catalog rule price' => [ + '#1 Testing price for dynamic bundle product with sub items and catalog rule price' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy(), 'expectedResults' => [ // 10 * 0.9 @@ -53,7 +58,7 @@ public function getTestCases() ] ], - 'Testing price for dynamic bundle product with special price, sub items and catalog rule price' => [ + '#2 Testing price for dynamic bundle product with special price, sub items and catalog rule price' => [ 'strategy' => $this->getBundleProductConfiguration1(), 'expectedResults' => [ // 0.5 * 10 * 0.9 @@ -64,7 +69,7 @@ public function getTestCases() ] ], - 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #2' => [ + '#3 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #2' => [ 'strategy' => $this->getBundleProductConfiguration2(), 'expectedResults' => [ // 0.9 * 2 * 10 @@ -75,7 +80,7 @@ public function getTestCases() ] ], - 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #3' => [ + '#4 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #3' => [ 'strategy' => $this->getBundleProductConfiguration3(), 'expectedResults' => [ // 0.9 * 1 * 10 @@ -86,7 +91,7 @@ public function getTestCases() ] ], - 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #4' => [ + '#5 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #4' => [ 'strategy' => $this->getBundleProductConfiguration4(), 'expectedResults' => [ // 0.9 * 1 * 10 @@ -97,7 +102,7 @@ public function getTestCases() ] ], - 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #5' => [ + '#6 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #5' => [ 'strategy' => $this->getBundleProductConfiguration5(), 'expectedResults' => [ // 0.9 * 1 * 10 @@ -108,7 +113,7 @@ public function getTestCases() ] ], - 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #6' => [ + '#7 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #6' => [ 'strategy' => $this->getBundleProductConfiguration6(), 'expectedResults' => [ // 0.9 * 1 * 10 + 0.9 * 1 * 10 @@ -119,7 +124,7 @@ public function getTestCases() ] ], - 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #7' => [ + '#8 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #7' => [ 'strategy' => $this->getBundleProductConfiguration7(), 'expectedResults' => [ // 1 * 0.9 * 10 @@ -130,7 +135,7 @@ public function getTestCases() ] ], - 'Testing price for dynamic bundle product with sub items and catalog rule price Configuration #8' => [ + '#9 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #8' => [ 'strategy' => $this->getBundleProductConfiguration8(), 'expectedResults' => [ // 0.9 * 1 * 10 @@ -143,7 +148,7 @@ public function getTestCases() ]; } - public function getProductWithSubItemsAndOptionsStrategy() + private function getProductWithSubItemsAndOptionsStrategy() { $optionsData = [ [ @@ -167,7 +172,7 @@ public function getProductWithSubItemsAndOptionsStrategy() ]; } - public function getBundleProductConfiguration1() + private function getBundleProductConfiguration1() { $optionsData = [ [ @@ -195,7 +200,7 @@ public function getBundleProductConfiguration1() ]; } - public function getBundleProductConfiguration2() + private function getBundleProductConfiguration2() { $optionsData = [ [ @@ -219,7 +224,7 @@ public function getBundleProductConfiguration2() ]; } - public function getBundleProductConfiguration3() + private function getBundleProductConfiguration3() { $optionsData = [ [ @@ -247,7 +252,7 @@ public function getBundleProductConfiguration3() ]; } - public function getBundleProductConfiguration4() + private function getBundleProductConfiguration4() { $optionsData = [ [ @@ -275,7 +280,7 @@ public function getBundleProductConfiguration4() ]; } - public function getBundleProductConfiguration5() + private function getBundleProductConfiguration5() { $optionsData = [ [ @@ -303,7 +308,7 @@ public function getBundleProductConfiguration5() ]; } - public function getBundleProductConfiguration6() + private function getBundleProductConfiguration6() { $optionsData = [ [ @@ -346,7 +351,7 @@ public function getBundleProductConfiguration6() ]; } - public function getBundleProductConfiguration7() + private function getBundleProductConfiguration7() { $optionsData = [ [ @@ -389,7 +394,7 @@ public function getBundleProductConfiguration7() ]; } - public function getBundleProductConfiguration8() + private function getBundleProductConfiguration8() { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php index 8976da58d0250..02427515ad23e 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php @@ -20,7 +20,8 @@ class DynamicBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract */ public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -39,10 +40,14 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec ); } + /** + * Test cases for current test + * @return array + */ public function getTestCases() { return [ - 'Testing price for dynamic bundle product with special price and sub items Configuration #1' => [ + '#1 Testing price for dynamic bundle product with special price and sub items Configuration #1' => [ 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 0.5 * 10 @@ -51,7 +56,7 @@ public function getTestCases() 'maximalPrice' => 5 ] ], - 'Testing price for dynamic bundle product with special price and sub items Configuration #2' => [ + '#2 Testing price for dynamic bundle product with special price and sub items Configuration #2' => [ 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // 0.5 * 2 * 10 @@ -60,7 +65,7 @@ public function getTestCases() 'maximalPrice' => 10 ] ], - 'Testing price for dynamic bundle product with special price and sub items Configuration #3' => [ + '#3 Testing price for dynamic bundle product with special price and sub items Configuration #3' => [ 'strategy' => $this->getBundleConfiguration3(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -69,7 +74,7 @@ public function getTestCases() 'maximalPrice' => 35 ] ], - 'Testing price for dynamic bundle product with special price and sub items Configuration #4' => [ + '#4 Testing price for dynamic bundle product with special price and sub items Configuration #4' => [ 'strategy' => $this->getBundleConfiguration4(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -78,7 +83,7 @@ public function getTestCases() 'maximalPrice' => 35 ] ], - 'Testing price for dynamic bundle product with special price and sub items Configuration #5' => [ + '#5 Testing price for dynamic bundle product with special price and sub items Configuration #5' => [ 'strategy' => $this->getBundleConfiguration5(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -87,7 +92,7 @@ public function getTestCases() 'maximalPrice' => 30 ] ], - 'Testing price for dynamic bundle product with special price and sub items Configuration #6' => [ + '#6 Testing price for dynamic bundle product with special price and sub items Configuration #6' => [ 'strategy' => $this->getBundleConfiguration6(), 'expectedResults' => [ // 0.5 * (1 * 10 + 1 * 10) @@ -96,7 +101,7 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - 'Testing price for dynamic bundle product with special price and sub items Configuration #7' => [ + '#7 Testing price for dynamic bundle product with special price and sub items Configuration #7' => [ 'strategy' => $this->getBundleConfiguration7(), 'expectedResults' => [ // 0.5 * (1 * 10) @@ -105,7 +110,7 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - 'Testing price for dynamic bundle product with special price and sub items Configuration #8' => [ + '#8 Testing price for dynamic bundle product with special price and sub items Configuration #8' => [ 'strategy' => $this->getBundleConfiguration8(), 'expectedResults' => [ // 0.5 * (1 * 10) @@ -114,7 +119,7 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - 'Testing price for dynamic bundle product with sub item product that has special price' => [ + '#9 Testing price for dynamic bundle product with sub item product that has special price' => [ 'strategy' => $this->getBundleConfiguration9(), 'expectedResults' => [ // 1 * 3.5 @@ -123,7 +128,7 @@ public function getTestCases() 'maximalPrice' => 20 ] ], - 'Testing price for dynamic bundle product with special price on it and on sub item' => [ + '#10 Testing price for dynamic bundle product with special price on it and on sub item' => [ 'strategy' => $this->getBundleConfiguration10(), 'expectedResults' => [ // 0.5 * 1 * 3.5 @@ -135,7 +140,7 @@ public function getTestCases() ]; } - public function getBundleConfiguration1() + private function getBundleConfiguration1() { $optionsData = [ [ @@ -163,7 +168,7 @@ public function getBundleConfiguration1() ]; } - public function getBundleConfiguration2() + private function getBundleConfiguration2() { $optionsData = [ [ @@ -191,7 +196,7 @@ public function getBundleConfiguration2() ]; } - public function getBundleConfiguration3() + private function getBundleConfiguration3() { $optionsData = [ [ @@ -223,7 +228,7 @@ public function getBundleConfiguration3() ]; } - public function getBundleConfiguration4() + private function getBundleConfiguration4() { $optionsData = [ [ @@ -255,7 +260,7 @@ public function getBundleConfiguration4() ]; } - public function getBundleConfiguration5() + private function getBundleConfiguration5() { $optionsData = [ [ @@ -287,7 +292,7 @@ public function getBundleConfiguration5() ]; } - public function getBundleConfiguration6() + private function getBundleConfiguration6() { $optionsData = [ [ @@ -334,7 +339,7 @@ public function getBundleConfiguration6() ]; } - public function getBundleConfiguration7() + private function getBundleConfiguration7() { $optionsData = [ [ @@ -381,7 +386,7 @@ public function getBundleConfiguration7() ]; } - public function getBundleConfiguration8() + private function getBundleConfiguration8() { $optionsData = [ [ @@ -428,7 +433,7 @@ public function getBundleConfiguration8() ]; } - public function getBundleConfiguration9() + private function getBundleConfiguration9() { $optionsData = [ [ @@ -460,7 +465,7 @@ public function getBundleConfiguration9() ]; } - public function getBundleConfiguration10() + private function getBundleConfiguration10() { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php index 9612279da292e..b8a71e6dafdf0 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php @@ -24,14 +24,15 @@ protected function setUp() } /** - * @param $strategyModifiers array - * @param $expectedResults array + * @param array $strategyModifiers + * @param array $expectedResults * @dataProvider getTestCases * @magentoAppIsolation enabled */ public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -50,10 +51,14 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec ); } + /** + * Test cases for current test + * @return array + */ public function getTestCases() { return [ - 'Testing product price with tier price and sub items Configuration #1' => [ + '#1 Testing product price with tier price and sub items Configuration #1' => [ 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 0.5 * 10 @@ -62,7 +67,7 @@ public function getTestCases() 'maximalPrice' => 5 ] ], - 'Testing product price with tier price and sub items Configuration #2' => [ + '#2 Testing product price with tier price and sub items Configuration #2' => [ 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // 0.5 * 2 * 10 @@ -71,7 +76,7 @@ public function getTestCases() 'maximalPrice' => 10 ] ], - 'Testing product price with tier price and sub items Configuration #3' => [ + '#3 Testing product price with tier price and sub items Configuration #3' => [ 'strategy' => $this->getBundleConfiguration3(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -80,7 +85,7 @@ public function getTestCases() 'maximalPrice' => 35 ] ], - 'Testing product price with tier price and sub items Configuration #4' => [ + '#4 Testing product price with tier price and sub items Configuration #4' => [ 'strategy' => $this->getBundleConfiguration4(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -89,7 +94,7 @@ public function getTestCases() 'maximalPrice' => 35 ] ], - 'Testing product price with tier price and sub items Configuration #5' => [ + '#5 Testing product price with tier price and sub items Configuration #5' => [ 'strategy' => $this->getBundleConfiguration5(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -98,7 +103,7 @@ public function getTestCases() 'maximalPrice' => 30 ] ], - 'Testing product price with tier price and sub items Configuration #6' => [ + '#6 Testing product price with tier price and sub items Configuration #6' => [ 'strategy' => $this->getBundleConfiguration6(), 'expectedResults' => [ // 0.5 * (1 * 10 + 1 * 10) @@ -107,7 +112,7 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - 'Testing product price with tier price and sub items Configuration #7' => [ + '#7 Testing product price with tier price and sub items Configuration #7' => [ 'strategy' => $this->getBundleConfiguration7(), 'expectedResults' => [ // 0.5 * (1 * 10) @@ -116,7 +121,7 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - 'Testing product price with tier price and sub items Configuration #8' => [ + '#8 Testing product price with tier price and sub items Configuration #8' => [ 'strategy' => $this->getBundleConfiguration8(), 'expectedResults' => [ // 0.5 * (1 * 10) @@ -125,7 +130,7 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - 'Testing price for dynamic bundle product with tier price on it and on sub item' => [ + '#9 Testing price for dynamic bundle product with tier price on it and on sub item' => [ 'strategy' => $this->getBundleConfiguration10(), 'expectedResults' => [ // 0.5 * 1 * 2.5 @@ -137,7 +142,7 @@ public function getTestCases() ]; } - public function getBundleConfiguration1() + private function getBundleConfiguration1() { $optionsData = [ [ @@ -171,7 +176,7 @@ public function getBundleConfiguration1() ]; } - public function getBundleConfiguration2() + private function getBundleConfiguration2() { $optionsData = [ [ @@ -205,7 +210,7 @@ public function getBundleConfiguration2() ]; } - public function getBundleConfiguration3() + private function getBundleConfiguration3() { $optionsData = [ [ @@ -243,7 +248,7 @@ public function getBundleConfiguration3() ]; } - public function getBundleConfiguration4() + private function getBundleConfiguration4() { $optionsData = [ [ @@ -281,7 +286,7 @@ public function getBundleConfiguration4() ]; } - public function getBundleConfiguration5() + private function getBundleConfiguration5() { $optionsData = [ [ @@ -319,7 +324,7 @@ public function getBundleConfiguration5() ]; } - public function getBundleConfiguration6() + private function getBundleConfiguration6() { $optionsData = [ [ @@ -372,7 +377,7 @@ public function getBundleConfiguration6() ]; } - public function getBundleConfiguration7() + private function getBundleConfiguration7() { $optionsData = [ [ @@ -425,7 +430,7 @@ public function getBundleConfiguration7() ]; } - public function getBundleConfiguration8() + private function getBundleConfiguration8() { $optionsData = [ [ @@ -478,7 +483,7 @@ public function getBundleConfiguration8() ]; } - public function getBundleConfiguration10() + private function getBundleConfiguration10() { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php index 5ad26638dea3f..faf0bfcfa3396 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -22,7 +22,8 @@ class FixedBundlePriceCalculatorTest extends BundlePriceAbstract */ public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -50,7 +51,8 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte */ public function testPriceForFixedBundleInWebsiteScope(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -69,10 +71,14 @@ public function testPriceForFixedBundleInWebsiteScope(array $strategyModifiers, ); } + /** + * Test cases for current test + * @return array + */ public function getTestCases() { return [ - 'Testing price for fixed bundle product with one simple' => [ + '#1 Testing price for fixed bundle product with one simple' => [ 'strategy' => $this->getProductWithOneSimple(), 'expectedResults' => [ // 110 + 10 (price from simple1) @@ -81,7 +87,7 @@ public function getTestCases() 'maximalPrice' => 120 ] ], - 'Testing price for fixed bundle product with three simples and differnt qty' => [ + '#2 Testing price for fixed bundle product with three simples and differnt qty' => [ 'strategy' => $this->getProductWithDifferentQty(), 'expectedResults' => [ // 110 + 10 (min price from simples) @@ -90,7 +96,7 @@ public function getTestCases() 'maximalPrice' => 170 ] ], - 'Testing price for fixed bundle product with three simples and differnt price' => [ + '#3 Testing price for fixed bundle product with three simples and differnt price' => [ 'strategy' => $this->getProductWithDifferentPrice(), 'expectedResults' => [ // 110 + 10 @@ -99,7 +105,7 @@ public function getTestCases() 'maximalPrice' => 170 ] ], - 'Testing price for fixed bundle product with three simples' => [ + '#4 Testing price for fixed bundle product with three simples' => [ 'strategy' => $this->getProductWithSamePrice(), 'expectedResults' => [ // 110 + 10 @@ -111,7 +117,7 @@ public function getTestCases() ]; } - public function getProductWithOneSimple() + private function getProductWithOneSimple() { $optionsData = [ [ @@ -137,7 +143,7 @@ public function getProductWithOneSimple() ]; } - public function getProductWithDifferentQty() + private function getProductWithDifferentQty() { $optionsData = [ [ @@ -175,7 +181,7 @@ public function getProductWithDifferentQty() ]; } - public function getProductWithSamePrice() + private function getProductWithSamePrice() { $optionsData = [ [ @@ -213,7 +219,7 @@ public function getProductWithSamePrice() ]; } - public function getProductWithDifferentPrice() + private function getProductWithDifferentPrice() { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php index 88d9be5e7a9fb..a18929463ea95 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php @@ -22,7 +22,8 @@ class FixedBundleWithCatalogPriceRuleCalculatorTest extends BundlePriceAbstract */ public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -41,11 +42,15 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte ); } + /** + * Test cases for current test + * @return array + */ public function getTestCases() { return [ ' - Testing price for fixed bundle product + #1 Testing price for fixed bundle product with catalog price rule and without sub items and options ' => [ 'strategy' => $this->getEmptyProductStrategy(), @@ -59,7 +64,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #2 Testing price for fixed bundle product with catalog price rule, fixed sub items and fixed options ' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( @@ -76,7 +81,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #3 Testing price for fixed bundle product with catalog price rule, percent sub items and percent options ' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( @@ -93,7 +98,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #4 Testing price for fixed bundle product with catalog price rule, fixed sub items and percent options ' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( @@ -110,7 +115,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #5 Testing price for fixed bundle product with catalog price rule, percent sub items and fixed options ' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( @@ -127,7 +132,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #6 Testing price for fixed bundle product with catalog price rule, fixed sub items and fixed options Configuration #1 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration1( @@ -144,7 +149,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #7 Testing price for fixed bundle product with catalog price rule, percent sub items and percent options Configuration #1 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration1( @@ -161,7 +166,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #8 Testing price for fixed bundle product with catalog price rule, fixed sub items and percent options Configuration #1 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration1( @@ -178,7 +183,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #9 Testing price for fixed bundle product with catalog price rule, percent sub items and fixed options Configuration #1 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration1( @@ -195,7 +200,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #10 Testing price for fixed bundle product with catalog price rule, fixed sub items and fixed options Configuration #2 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration2( @@ -212,7 +217,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #11 Testing price for fixed bundle product with catalog price rule, percent sub items and percent options Configuration #2 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration2( @@ -229,7 +234,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #12 Testing price for fixed bundle product with catalog price rule, fixed sub items and percent options Configuration #2 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration2( @@ -246,7 +251,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #13 Testing price for fixed bundle product with catalog price rule, percent sub items and fixed options Configuration #2 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration2( @@ -263,7 +268,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #14 Testing price for fixed bundle product with catalog price rule, fixed sub items and fixed options Configuration #3 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration3( @@ -280,7 +285,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #15 Testing price for fixed bundle product with catalog price rule, percent sub items and percent options Configuration #3 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration3( @@ -297,7 +302,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #16 Testing price for fixed bundle product with catalog price rule, fixed sub items and percent options Configuration #3 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration3( @@ -314,7 +319,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #17 Testing price for fixed bundle product with catalog price rule, percent sub items and fixed options Configuration #3 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration3( @@ -331,7 +336,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #18 Testing price for fixed bundle product with catalog price rule, fixed sub items and fixed options Configuration #4 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration4( @@ -348,7 +353,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #19 Testing price for fixed bundle product with catalog price rule, percent sub items and percent options Configuration #4 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration4( @@ -365,7 +370,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #20 Testing price for fixed bundle product with catalog price rule, fixed sub items and percent options Configuration #4 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration4( @@ -382,7 +387,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #21 Testing price for fixed bundle product with catalog price rule, percent sub items and fixed options Configuration #4 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration4( @@ -399,7 +404,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #22 Testing price for fixed bundle product with catalog price rule, fixed sub items and fixed options Configuration #5 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration5( @@ -416,7 +421,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #23 Testing price for fixed bundle product with catalog price rule, percent sub items and percent options Configuration #5 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration5( @@ -433,7 +438,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #24 Testing price for fixed bundle product with catalog price rule, fixed sub items and percent options Configuration #5 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration5( @@ -450,7 +455,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #25 Testing price for fixed bundle product with catalog price rule, percent sub items and fixed options Configuration #5 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration5( @@ -467,7 +472,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #26 Testing price for fixed bundle product with catalog price rule, fixed sub items and fixed options Configuration #6 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration6( @@ -484,7 +489,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #27 Testing price for fixed bundle product with catalog price rule, percent sub items and percent options Configuration #6 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration6( @@ -501,7 +506,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #28 Testing price for fixed bundle product with catalog price rule, fixed sub items and percent options Configuration #6 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration6( @@ -518,7 +523,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #29 Testing price for fixed bundle product with catalog price rule, percent sub items and fixed options Configuration #6 ' => [ 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration6( @@ -536,12 +541,12 @@ public function getTestCases() ]; } - public function getEmptyProductStrategy() + private function getEmptyProductStrategy() { return []; } - public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) + private function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -582,7 +587,7 @@ public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $ ]; } - public function getProductSubItemsAndOptionsStrategyConfiguration1($selectionsPriceType, $customOptionsPriceType) + private function getProductSubItemsAndOptionsStrategyConfiguration1($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -623,7 +628,7 @@ public function getProductSubItemsAndOptionsStrategyConfiguration1($selectionsPr ]; } - public function getProductSubItemsAndOptionsStrategyConfiguration2($selectionsPriceType, $customOptionsPriceType) + private function getProductSubItemsAndOptionsStrategyConfiguration2($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -664,7 +669,7 @@ public function getProductSubItemsAndOptionsStrategyConfiguration2($selectionsPr ]; } - public function getProductSubItemsAndOptionsStrategyConfiguration3($selectionsPriceType, $customOptionsPriceType) + private function getProductSubItemsAndOptionsStrategyConfiguration3($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -711,7 +716,7 @@ public function getProductSubItemsAndOptionsStrategyConfiguration3($selectionsPr ]; } - public function getProductSubItemsAndOptionsStrategyConfiguration4($selectionsPriceType, $customOptionsPriceType) + private function getProductSubItemsAndOptionsStrategyConfiguration4($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -758,7 +763,7 @@ public function getProductSubItemsAndOptionsStrategyConfiguration4($selectionsPr ]; } - public function getProductSubItemsAndOptionsStrategyConfiguration5($selectionsPriceType, $customOptionsPriceType) + private function getProductSubItemsAndOptionsStrategyConfiguration5($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -805,7 +810,7 @@ public function getProductSubItemsAndOptionsStrategyConfiguration5($selectionsPr ]; } - public function getProductSubItemsAndOptionsStrategyConfiguration6($selectionsPriceType, $customOptionsPriceType) + private function getProductSubItemsAndOptionsStrategyConfiguration6($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php index e178087e0cfc7..092c35fc5db3c 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php @@ -22,7 +22,8 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract */ public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -41,11 +42,15 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte ); } + /** + * Test cases for current test + * @return array + */ public function getTestCases() { return [ ' - Testing price for fixed bundle product + #1 Testing price for fixed bundle product without any discounts, sub items and options ' => [ 'strategy' => $this->getEmptyProductStrategy(), @@ -59,7 +64,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #2 Testing price for fixed bundle product with special price and without any sub items and options ' => [ 'strategy' => $this->getEmptyProductWithSpecialPriceStrategy(), @@ -73,7 +78,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #3 Testing price for fixed bundle product with fixed sub items, fixed options and without any discounts ' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( @@ -90,7 +95,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #4 Testing price for fixed bundle product with percent sub items, percent options and without any discounts ' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( @@ -107,7 +112,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #5 Testing price for fixed bundle product with fixed sub items, percent options and without any discounts ' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( @@ -124,7 +129,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #6 Testing price for fixed bundle product with percent sub items, fixed options and without any discounts ' => [ 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( @@ -141,7 +146,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #7 Testing price for fixed bundle product with special price, fixed sub items and fixed options Configuration #1 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( @@ -158,7 +163,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #8 Testing price for fixed bundle product with special price, percent sub items and percent options Configuration #1 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( @@ -175,7 +180,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #9 Testing price for fixed bundle product with special price, fixed sub items and percent options Configuration #1 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( @@ -192,7 +197,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #10 Testing price for fixed bundle product with special price, percent sub items and fixed options Configuration #1 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( @@ -209,7 +214,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #11 Testing price for fixed bundle product with special price, fixed sub items and fixed options Configuration #2 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( @@ -226,7 +231,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #12 Testing price for fixed bundle product with special price, percent sub items and percent options Configuration #2 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( @@ -243,7 +248,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #13 Testing price for fixed bundle product with special price, fixed sub items and percent options Configuration #2 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( @@ -260,7 +265,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #14 Testing price for fixed bundle product with special price, percent sub items and fixed options Configuration #2 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( @@ -277,7 +282,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #15 Testing price for fixed bundle product with special price, fixed sub items and fixed options Configuration #3 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( @@ -294,7 +299,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #16 Testing price for fixed bundle product with special price, percent sub items and percent options Configuration #3 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( @@ -311,7 +316,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #17 Testing price for fixed bundle product with special price, fixed sub items and percent options Configuration #3 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( @@ -328,7 +333,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #18 Testing price for fixed bundle product with special price, percent sub items and fixed options Configuration #3 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( @@ -345,7 +350,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #19 Testing price for fixed bundle product with special price, fixed sub items and fixed options Configuration #4 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( @@ -362,7 +367,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #20 Testing price for fixed bundle product with special price, percent sub items and percent options Configuration #4 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( @@ -379,7 +384,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #21 Testing price for fixed bundle product with special price, fixed sub items and percent options Configuration #4 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( @@ -396,7 +401,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #22 Testing price for fixed bundle product with special price, percent sub items and fixed options Configuration #4 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( @@ -413,7 +418,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #23 Testing price for fixed bundle product with special price, fixed sub items and fixed options Configuration #5 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( @@ -430,7 +435,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #24 Testing price for fixed bundle product with special price, percent sub items and percent options Configuration #5 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( @@ -447,7 +452,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #25 Testing price for fixed bundle product with special price, fixed sub items and percent options Configuration #5 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( @@ -464,7 +469,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #26 Testing price for fixed bundle product with special price, percent sub items and fixed options Configuration #5 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( @@ -481,7 +486,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #27 Testing price for fixed bundle product with special price, fixed sub items and fixed options Configuration #6 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( @@ -498,7 +503,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #28 Testing price for fixed bundle product with special price, percent sub items and percent options Configuration #6 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( @@ -515,7 +520,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #29 Testing price for fixed bundle product with special price, fixed sub items and percent options Configuration #6 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( @@ -532,7 +537,7 @@ public function getTestCases() ], ' - Testing price for fixed bundle product + #30 Testing price for fixed bundle product with special price, percent sub items and fixed options Configuration #6 ' => [ 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( @@ -550,12 +555,12 @@ public function getTestCases() ]; } - public function getEmptyProductStrategy() + private function getEmptyProductStrategy() { return []; } - public function getEmptyProductWithSpecialPriceStrategy() + private function getEmptyProductWithSpecialPriceStrategy() { return [ [ @@ -565,7 +570,7 @@ public function getEmptyProductWithSpecialPriceStrategy() ]; } - public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) + private function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -606,7 +611,7 @@ public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $ ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( + private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( $selectionsPriceType, $customOptionsPriceType ) { @@ -653,7 +658,7 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( + private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( $selectionsPriceType, $customOptionsPriceType ) { @@ -700,7 +705,7 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( + private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( $selectionsPriceType, $customOptionsPriceType ) { @@ -753,7 +758,7 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( + private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( $selectionsPriceType, $customOptionsPriceType ) { @@ -806,7 +811,7 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( + private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( $selectionsPriceType, $customOptionsPriceType ) { @@ -859,7 +864,7 @@ public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguratio ]; } - public function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( + private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( $selectionsPriceType, $customOptionsPriceType ) { diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php index 949f3dc80b5e7..4e4e2dd497c98 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php @@ -34,7 +34,8 @@ protected function setUp() */ public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults) { - $bundleProduct = $this->prepareFixture($strategyModifiers); + $this->prepareFixture($strategyModifiers, 'bundle_product'); + $bundleProduct = $this->productRepository->get('bundle_product', false, null, true); /** @var \Magento\Framework\Pricing\PriceInfo\Base $priceInfo */ $priceInfo = $bundleProduct->getPriceInfo(); @@ -54,14 +55,14 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte } /** - * Test cases for fixed bundle product + * Test cases for current test * @return array */ public function getTestCases() { return [ - 'Testing product price with tier price and without any sub items and options' => [ + '#1 Testing product price with tier price and without any sub items and options' => [ 'strategy' => $this->getEmptyProduct(), 'expectedResults' => [ // 110 * 0.5 @@ -72,7 +73,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and fixed options Configuration #1' => [ + '#2 Testing product price with tier price, fixed sub items and fixed options Configuration #1' => [ 'strategy' => $this->getProductConfiguration1( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -86,7 +87,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and percent options Configuration #1' => [ + '#3 Testing product price with tier price, percent sub items and percent options Configuration #1' => [ 'strategy' => $this->getProductConfiguration1( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -100,7 +101,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and percent options Configuration #1' => [ + '#4 Testing product price with tier price, fixed sub items and percent options Configuration #1' => [ 'strategy' => $this->getProductConfiguration1( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -114,7 +115,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and fixed options Configuration #1' => [ + '#5 Testing product price with tier price, percent sub items and fixed options Configuration #1' => [ 'strategy' => $this->getProductConfiguration1( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -128,7 +129,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and fixed options Configuration #2' => [ + '#6 Testing product price with tier price, fixed sub items and fixed options Configuration #2' => [ 'strategy' => $this->getProductConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -142,7 +143,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and percent options Configuration #2' => [ + '#7 Testing product price with tier price, percent sub items and percent options Configuration #2' => [ 'strategy' => $this->getProductConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -156,7 +157,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and percent options Configuration #2' => [ + '#8 Testing product price with tier price, fixed sub items and percent options Configuration #2' => [ 'strategy' => $this->getProductConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -170,7 +171,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and fixed options Configuration #2' => [ + '#9 Testing product price with tier price, percent sub items and fixed options Configuration #2' => [ 'strategy' => $this->getProductConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -184,7 +185,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and fixed options Configuration #3' => [ + '#10 Testing product price with tier price, fixed sub items and fixed options Configuration #3' => [ 'strategy' => $this->getProductConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -198,7 +199,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and percent options Configuration #3' => [ + '#11 Testing product price with tier price, percent sub items and percent options Configuration #3' => [ 'strategy' => $this->getProductConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -212,7 +213,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and percent options Configuration #3' => [ + '#12 Testing product price with tier price, fixed sub items and percent options Configuration #3' => [ 'strategy' => $this->getProductConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -226,7 +227,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and fixed options Configuration #3' => [ + '#13 Testing product price with tier price, percent sub items and fixed options Configuration #3' => [ 'strategy' => $this->getProductConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -240,7 +241,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and fixed options Configuration #4' => [ + '#14 Testing product price with tier price, fixed sub items and fixed options Configuration #4' => [ 'strategy' => $this->getProductConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -254,7 +255,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and percent options Configuration #4' => [ + '#15 Testing product price with tier price, percent sub items and percent options Configuration #4' => [ 'strategy' => $this->getProductConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -268,7 +269,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and percent options Configuration #4' => [ + '#16 Testing product price with tier price, fixed sub items and percent options Configuration #4' => [ 'strategy' => $this->getProductConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -282,7 +283,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and fixed options Configuration #4' => [ + '#17 Testing product price with tier price, percent sub items and fixed options Configuration #4' => [ 'strategy' => $this->getProductConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -296,7 +297,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and fixed options Configuration #5' => [ + '#18 Testing product price with tier price, fixed sub items and fixed options Configuration #5' => [ 'strategy' => $this->getProductConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -310,7 +311,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and percent options Configuration #5' => [ + '#19 Testing product price with tier price, percent sub items and percent options Configuration #5' => [ 'strategy' => $this->getProductConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -324,7 +325,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and percent options Configuration #5' => [ + '#20 Testing product price with tier price, fixed sub items and percent options Configuration #5' => [ 'strategy' => $this->getProductConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -338,7 +339,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and fixed options Configuration #5' => [ + '#21 Testing product price with tier price, percent sub items and fixed options Configuration #5' => [ 'strategy' => $this->getProductConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -352,7 +353,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and fixed options Configuration #6' => [ + '#22 Testing product price with tier price, fixed sub items and fixed options Configuration #6' => [ 'strategy' => $this->getProductConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -366,7 +367,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and percent options Configuration #6' => [ + '#23 Testing product price with tier price, percent sub items and percent options Configuration #6' => [ 'strategy' => $this->getProductConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -380,7 +381,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, fixed sub items and percent options Configuration #6' => [ + '#24 Testing product price with tier price, fixed sub items and percent options Configuration #6' => [ 'strategy' => $this->getProductConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT @@ -394,7 +395,7 @@ public function getTestCases() ] ], - 'Testing product price with tier price, percent sub items and fixed options Configuration #6' => [ + '#25 Testing product price with tier price, percent sub items and fixed options Configuration #6' => [ 'strategy' => $this->getProductConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED @@ -411,7 +412,7 @@ public function getTestCases() ]; } - public function getEmptyProduct() + private function getEmptyProduct() { $tierPriceData = [ 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, @@ -427,7 +428,7 @@ public function getEmptyProduct() ]; } - public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) + private function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -478,7 +479,7 @@ public function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $ ]; } - public function getProductConfiguration1($selectionsPriceType, $customOptionsPriceType) + private function getProductConfiguration1($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -529,7 +530,7 @@ public function getProductConfiguration1($selectionsPriceType, $customOptionsPri ]; } - public function getProductConfiguration2($selectionsPriceType, $customOptionsPriceType) + private function getProductConfiguration2($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -580,7 +581,7 @@ public function getProductConfiguration2($selectionsPriceType, $customOptionsPri ]; } - public function getProductConfiguration3($selectionsPriceType, $customOptionsPriceType) + private function getProductConfiguration3($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -637,7 +638,7 @@ public function getProductConfiguration3($selectionsPriceType, $customOptionsPri ]; } - public function getProductConfiguration4($selectionsPriceType, $customOptionsPriceType) + private function getProductConfiguration4($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -694,7 +695,7 @@ public function getProductConfiguration4($selectionsPriceType, $customOptionsPri ]; } - public function getProductConfiguration5($selectionsPriceType, $customOptionsPriceType) + private function getProductConfiguration5($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -751,7 +752,7 @@ public function getProductConfiguration5($selectionsPriceType, $customOptionsPri ]; } - public function getProductConfiguration6($selectionsPriceType, $customOptionsPriceType) + private function getProductConfiguration6($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php index fb04b268bfdfe..de45c9e06b447 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php @@ -42,7 +42,8 @@ public function testIsSaleableOnEnabledStatus() $this->assertTrue( $bundleProduct->isSalable(), - 'Bundle product supposed to be saleable if his status is enabled' + 'Bundle product supposed to be saleable + if his status is enabled' ); } @@ -59,7 +60,8 @@ public function testIsSaleableOnDisabledStatus() $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be non saleable if his status is disabled' + 'Bundle product supposed to be non saleable + if his status is disabled' ); } @@ -78,7 +80,8 @@ public function testIsSaleableOnEnabledStatusAndIsSalableIsTrue() $this->assertTrue( $bundleProduct->isSalable(), - 'Bundle product supposed to be saleable if his status is enabled and it has data is_salable = true' + 'Bundle product supposed to be saleable + if his status is enabled and it has data is_salable = true' ); } @@ -97,7 +100,8 @@ public function testIsSaleableOnEnabledStatusAndIsSalableIsFalse() $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be non saleable if his status is enabled but his data is_salable = false' + 'Bundle product supposed to be non saleable + if his status is enabled but his data is_salable = false' ); } @@ -114,7 +118,8 @@ public function testIsSaleableOnAllItemsSalableIsTrue() $this->assertTrue( $bundleProduct->isSalable(), - 'Bundle product supposed to be saleable if it has data all_items_salable = true' + 'Bundle product supposed to be saleable + if it has data all_items_salable = true' ); } @@ -131,7 +136,8 @@ public function testIsSaleableOnAllItemsSalableIsFalse() $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be non saleable if it has data all_items_salable = false' + 'Bundle product supposed to be non saleable + if it has data all_items_salable = false' ); } @@ -158,7 +164,8 @@ public function testIsSaleableOnBundleWithoutOptions() $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be non saleable if it has no options' + 'Bundle product supposed to be non saleable + if it has no options' ); } @@ -187,7 +194,8 @@ public function testIsSaleableOnBundleWithoutSelections() $bundleProduct = $this->productRepository->get('bundle-product', false, null, true); $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be non saleable if it has no selections' + 'Bundle product supposed to be non saleable + if it has no selections' ); } @@ -211,7 +219,8 @@ public function testIsSaleableOnBundleWithoutSaleableSelections() $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be non saleable if all his selections are not saleable' + 'Bundle product supposed to be non saleable + if all his selections are not saleable' ); } @@ -235,7 +244,8 @@ public function testIsSaleableOnBundleWithoutSaleableSelectionsOnRequiredOption( $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be non saleable if it has at least one required option with no saleable selections' + 'Bundle product supposed to be non saleable + if it has at least one required option with no saleable selections' ); } @@ -254,7 +264,8 @@ public function testIsSaleableOnBundleWithNotEnoughQtyOfSelection() $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be non saleable if there are not enough qty of selections on required options' + 'Bundle product supposed to be non saleable + if there are not enough qty of selections on required options' ); } @@ -288,7 +299,8 @@ public function testIsSaleableOnBundleWithSelectionCanChangeQty() $this->assertTrue( $bundleProduct->isSalable(), - 'Bundle product supposed to be saleable if all his selections have selection_can_change_qty = 1' + 'Bundle product supposed to be saleable + if all his selections have selection_can_change_qty = 1' ); } @@ -324,7 +336,8 @@ public function testIsSaleableOnBundleWithoutRequiredOptions() $this->assertFalse( $bundleProduct->isSalable(), - 'Bundle product supposed to be not saleable if all his options are not required and selections are not saleable' + 'Bundle product supposed to be not saleable + if all his options are not required and selections are not saleable' ); } @@ -362,7 +375,8 @@ public function testIsSaleableOnBundleWithOneSaleableSelection() $this->assertTrue( $bundleProduct->isSalable(), - 'Bundle product supposed to be saleable if it has at least one not required option with saleable selection' + 'Bundle product supposed to be saleable + if it has at least one not required option with saleable selection' ); } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php index 218ae90d4509f..9918cb0c743fb 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php @@ -15,8 +15,8 @@ ->setId(42) ->setAttributeSetId(4) ->setWebsiteIds([1]) - ->setName('Spherical Horse in a Vacuum') - ->setSku('spherical_horse_in_a_vacuum') + ->setName('Spherical Bundle Product in a Vacuum') + ->setSku('bundle_product') ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_rollback.php index bb41cddb8e0a4..33db954a6eee8 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_rollback.php @@ -15,7 +15,7 @@ $registry->register('isSecureArea', true); try { - $product = $productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $product = $productRepository->get('bundle_product', false, null, true); $productRepository->delete($product); } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { //Product already removed diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php index 7b501db8e89a4..a8f3974f6584e 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php @@ -15,8 +15,8 @@ ->setId(42) ->setAttributeSetId(4) ->setWebsiteIds([1]) - ->setName('Spherical Horse in a Vacuum') - ->setSku('spherical_horse_in_a_vacuum') + ->setName('Spherical Bundle Product in a Vacuum') + ->setSku('bundle_product') ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_rollback.php index bb41cddb8e0a4..33db954a6eee8 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_rollback.php @@ -15,7 +15,7 @@ $registry->register('isSecureArea', true); try { - $product = $productRepository->get('spherical_horse_in_a_vacuum', false, null, true); + $product = $productRepository->get('bundle_product', false, null, true); $productRepository->delete($product); } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { //Product already removed diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product.php index 5e96221737241..0075f3ab8ec86 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product.php @@ -207,4 +207,4 @@ $product->setExtensionAttributes($extension); } -$productRepository->save($product, true); \ No newline at end of file +$productRepository->save($product, true); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product_rollback.php index f65dbbbb5435b..a24861525f009 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product_rollback.php @@ -13,7 +13,8 @@ $registry->register('isSecureArea', true); /** @var $product \Magento\Catalog\Model\Product */ -$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); +$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); try { $product = $productRepository->get('bundle-product'); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php index 04def919e6aa7..08624244df162 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php @@ -4,7 +4,8 @@ * See COPYING.txt for license details. */ -$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); +$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); @@ -125,4 +126,4 @@ ->setCateroryIds([]) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 15, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); -$productRepository->save($product); \ No newline at end of file +$productRepository->save($product); From 3d13eac787e06191e0230f4c5b194368481b7583 Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Wed, 2 Nov 2016 10:36:53 +0200 Subject: [PATCH 1581/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - removed unused testcase --- ...FixedBundleWithTierPriceCalculatorTest.php | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php index 4e4e2dd497c98..7766158967f55 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php @@ -428,57 +428,6 @@ private function getEmptyProduct() ]; } - private function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) - { - $optionsData = [ - [ - 'title' => 'Op1', - 'required' => true, - 'type' => 'checkbox', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - 'price' => 20, - 'price_type' => $selectionsPriceType - ], - ] - ], - ]; - - $customOptionsData = [ - [ - 'price_type' => $customOptionsPriceType, - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'price' => 100, - 'sku' => '1-text', - ] - ]; - - $tierPriceData = [ - 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, - 'qty' => 1, - 'value' => 50 - ]; - - return [ - [ - 'modifierName' => 'addTierPrice', - 'data' => [$tierPriceData] - ], - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - [ - 'modifierName' => 'addCustomOption', - 'data' => [$customOptionsData] - ], - ]; - } - private function getProductConfiguration1($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ From 85a14895ac5d39ba0967e14bbe9b11e1d5d3c82b Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Wed, 2 Nov 2016 11:33:59 +0200 Subject: [PATCH 1582/3232] MAGETWO-59486: [FT] CreateProductAttributeEntityTest fails due to AssertAddedProductAttributeOnProductForm --- .../Constraint/AssertAddedProductAttributeOnProductForm.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php index a2f816ca88ac2..91533717bac48 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php @@ -74,8 +74,9 @@ public function processAssert( CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, - CatalogProductAttribute $productAttributeOriginal = null, - BrowserInterface $browser + BrowserInterface $browser, + CatalogProductAttribute $productAttributeOriginal = null + ) { $this->fixtureFactory = $fixtureFactory; $this->catalogProductIndex = $catalogProductIndex; From 96535d6b2df319268a01278bd49ee0f43b4b5625 Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Wed, 2 Nov 2016 12:18:31 +0200 Subject: [PATCH 1583/3232] MAGETWO-60359: Unable to place order with Braintree PayPal token from Admin panel - Added payment code to event name --- .../Braintree/view/adminhtml/web/js/vault.js | 2 +- .../Vault/view/adminhtml/web/js/vault.js | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Braintree/view/adminhtml/web/js/vault.js b/app/code/Magento/Braintree/view/adminhtml/web/js/vault.js index ea832acb537e0..14729714b4e60 100644 --- a/app/code/Magento/Braintree/view/adminhtml/web/js/vault.js +++ b/app/code/Magento/Braintree/view/adminhtml/web/js/vault.js @@ -28,7 +28,7 @@ define([ self.$selector = $('#' + self.selector); self.$container = $('#' + self.container); self.$selector.on( - 'setVaultNotActive', + 'setVaultNotActive.' + self.getCode(), function () { self.$selector.off('submitOrder.' + self.getCode()); } diff --git a/app/code/Magento/Vault/view/adminhtml/web/js/vault.js b/app/code/Magento/Vault/view/adminhtml/web/js/vault.js index 560e65c007f8a..66c17801ec02e 100644 --- a/app/code/Magento/Vault/view/adminhtml/web/js/vault.js +++ b/app/code/Magento/Vault/view/adminhtml/web/js/vault.js @@ -33,8 +33,8 @@ define([ .observe(['active']); // re-init payment method events - self.$selector.off('changePaymentMethod.' + this.code) - .on('changePaymentMethod.' + this.code, this.changePaymentMethod.bind(this)); + self.$selector.off('changePaymentMethod.' + this.getCode()) + .on('changePaymentMethod.' + this.getCode(), this.changePaymentMethod.bind(this)); if (this.active()) { $('#' + this.fieldset + ' input:radio:first').trigger('click'); @@ -50,7 +50,7 @@ define([ * @returns {exports.changePaymentMethod} */ changePaymentMethod: function (event, method) { - this.active(method === this.code); + this.active(method === this.getCode()); return this; }, @@ -61,13 +61,21 @@ define([ */ onActiveChange: function (isActive) { if (!isActive) { - this.$selector.trigger('setVaultNotActive'); + this.$selector.trigger('setVaultNotActive.' + this.getCode()); return; } $('#' + this.fieldset + ' input:radio:first').trigger('click'); - window.order.addExcludedPaymentMethod(this.code); + window.order.addExcludedPaymentMethod(this.getCode()); + }, + + /** + * Get payment method code + * @returns {String} + */ + getCode: function () { + return this.code; } }); }); From cfae102211d4a9c2cb7a3c48ffbc534a139910b0 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Wed, 2 Nov 2016 12:58:41 +0200 Subject: [PATCH 1584/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60096: Fix FAT CreateSimpleProductEntityTest --- .../Observer/AddInventoryDataObserver.php | 40 +++++++++++++++++++ .../Magento/CatalogInventory/etc/events.xml | 3 ++ 2 files changed, 43 insertions(+) create mode 100644 app/code/Magento/CatalogInventory/Observer/AddInventoryDataObserver.php diff --git a/app/code/Magento/CatalogInventory/Observer/AddInventoryDataObserver.php b/app/code/Magento/CatalogInventory/Observer/AddInventoryDataObserver.php new file mode 100644 index 0000000000000..b664b5a80784f --- /dev/null +++ b/app/code/Magento/CatalogInventory/Observer/AddInventoryDataObserver.php @@ -0,0 +1,40 @@ +stockHelper = $stockHelper; + } + + /** + * Add stock information to product + * + * @param EventObserver $observer + * @return void + */ + public function execute(EventObserver $observer) + { + $product = $observer->getEvent()->getProduct(); + if ($product instanceof \Magento\Catalog\Model\Product) { + $this->stockHelper->assignStatusToProduct($product); + } + } +} diff --git a/app/code/Magento/CatalogInventory/etc/events.xml b/app/code/Magento/CatalogInventory/etc/events.xml index 6dd357fda7b65..a1476c2c3f8b1 100644 --- a/app/code/Magento/CatalogInventory/etc/events.xml +++ b/app/code/Magento/CatalogInventory/etc/events.xml @@ -9,6 +9,9 @@ + + + From 1117eac76b88c87cf501d28759b752408a69d152 Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Wed, 2 Nov 2016 13:41:50 +0200 Subject: [PATCH 1585/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - refactoring for integration tests --- .../ResourceModel/Selection/Collection.php | 53 +--- .../DynamicBundlePriceCalculatorTest.php | 17 + ...ndleWithCatalogPriceRuleCalculatorTest.php | 91 ++++-- ...icBundleWithSpecialPriceCalculatorTest.php | 100 +++++- ...namicBundleWithTierPriceCalculatorTest.php | 94 +++++- .../FixedBundlePriceCalculatorTest.php | 23 +- ...ndleWithCatalogPriceRuleCalculatorTest.php | 292 +++++++----------- ...edBundleWithSpecialPriceCalculatorTest.php | 177 +++++++---- ...FixedBundleWithTierPriceCalculatorTest.php | 232 ++++++++++---- .../Bundle/Model/Product/IsSaleableTest.php | 28 +- 10 files changed, 689 insertions(+), 418 deletions(-) diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index afb04e62bf467..d1bbc8e7bbd40 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -29,7 +29,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection /** * @var \Magento\CatalogRule\Model\ResourceModel\Product\Collection */ - private $catalogRuleProcessor; + private $catalogRuleProcessor = null; /** * Is website scope prices joined to collection @@ -38,57 +38,6 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection */ private $websiteScopePriceJoined = false; - /** - * @inheritDoc - */ - public function __construct( - \Magento\Framework\Data\Collection\EntityFactory $entityFactory, - \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Eav\Model\Config $eavConfig, - \Magento\Framework\App\ResourceConnection $resource, - \Magento\Eav\Model\EntityFactory $eavEntityFactory, - \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, - \Magento\Framework\Validator\UniversalFactory $universalFactory, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, - \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, - \Magento\Catalog\Model\ResourceModel\Url $catalogUrl, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Customer\Model\Session $customerSession, - \Magento\Framework\Stdlib\DateTime $dateTime, - GroupManagementInterface $groupManagement, - \Magento\CatalogRule\Model\ResourceModel\Product\Collection $catalogRuleProcessor = null, - \Magento\Framework\DB\Adapter\AdapterInterface $connection = null - ) { - parent::__construct( - $entityFactory, - $logger, - $fetchStrategy, - $eventManager, - $eavConfig, - $resource, - $eavEntityFactory, - $resourceHelper, - $universalFactory, - $storeManager, - $moduleManager, - $catalogProductFlatState, - $scopeConfig, - $productOptionFactory, - $catalogUrl, - $localeDate, - $customerSession, - $dateTime, - $groupManagement, - $connection - ); - $this->catalogRuleProcessor = $catalogRuleProcessor; - } - /** * Initialize collection * diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php index 3cc9939ba38ad..0206bfa38f041 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php @@ -85,6 +85,7 @@ public function getTestCases() 'maximalPrice' => 10 ] ], + '#2 Testing price for dynamic bundle product with three simples and different qty' => [ 'strategy' => $this->getProductWithDifferentQty(), 'expectedResults' => [ @@ -94,6 +95,7 @@ public function getTestCases() 'maximalPrice' => 100 ] ], + '#3 Testing price for dynamic bundle product with four simples and different price' => [ 'strategy' => $this->getProductWithDifferentPrice(), 'expectedResults' => [ @@ -106,6 +108,11 @@ public function getTestCases() ]; } + /** + * Dynamic bundle product with one simple + * + * @return array + */ private function getProductWithOneSimple() { $optionsData = [ @@ -130,6 +137,11 @@ private function getProductWithOneSimple() ]; } + /** + * Dynamic bundle product with three simples and different qty + * + * @return array + */ private function getProductWithDifferentQty() { $optionsData = [ @@ -162,6 +174,11 @@ private function getProductWithDifferentQty() ]; } + /** + * Dynamic bundle product with three simples and different price + * + * @return array + */ private function getProductWithDifferentPrice() { $optionsData = [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php index 41644729fece3..80ad5e6a85786 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php @@ -43,12 +43,13 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec /** * Test cases for current test * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function getTestCases() { return [ - '#1 Testing price for dynamic bundle product with sub items and catalog rule price' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy(), + '#1 Testing price for dynamic bundle with one required option' => [ + 'strategy' => $this->getBundleProductConfiguration1(), 'expectedResults' => [ // 10 * 0.9 'minimalPrice' => 9, @@ -58,8 +59,8 @@ public function getTestCases() ] ], - '#2 Testing price for dynamic bundle product with special price, sub items and catalog rule price' => [ - 'strategy' => $this->getBundleProductConfiguration1(), + '#2 Testing price for dynamic bundle with one required option and special price' => [ + 'strategy' => $this->getBundleProductConfiguration2(), 'expectedResults' => [ // 0.5 * 10 * 0.9 'minimalPrice' => 4.5, @@ -69,8 +70,8 @@ public function getTestCases() ] ], - '#3 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #2' => [ - 'strategy' => $this->getBundleProductConfiguration2(), + '#3 Testing price for dynamic bundle with one non required option' => [ + 'strategy' => $this->getBundleProductConfiguration3(), 'expectedResults' => [ // 0.9 * 2 * 10 'minimalPrice' => 18, @@ -80,8 +81,8 @@ public function getTestCases() ] ], - '#4 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #3' => [ - 'strategy' => $this->getBundleProductConfiguration3(), + '#4 Testing price for dynamic bundle with one required checkbox type option and 2 simples' => [ + 'strategy' => $this->getBundleProductConfiguration4(), 'expectedResults' => [ // 0.9 * 1 * 10 'minimalPrice' => 9, @@ -91,8 +92,8 @@ public function getTestCases() ] ], - '#5 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #4' => [ - 'strategy' => $this->getBundleProductConfiguration4(), + '#5 Testing price for dynamic bundle with one required multi type option and 2 simples' => [ + 'strategy' => $this->getBundleProductConfiguration5(), 'expectedResults' => [ // 0.9 * 1 * 10 'minimalPrice' => 9, @@ -102,8 +103,8 @@ public function getTestCases() ] ], - '#6 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #5' => [ - 'strategy' => $this->getBundleProductConfiguration5(), + '#6 Testing price for dynamic bundle with one required radio type option and 2 simples' => [ + 'strategy' => $this->getBundleProductConfiguration6(), 'expectedResults' => [ // 0.9 * 1 * 10 'minimalPrice' => 9, @@ -113,8 +114,8 @@ public function getTestCases() ] ], - '#7 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #6' => [ - 'strategy' => $this->getBundleProductConfiguration6(), + '#7 Testing price for dynamic bundle with two required options' => [ + 'strategy' => $this->getBundleProductConfiguration7(), 'expectedResults' => [ // 0.9 * 1 * 10 + 0.9 * 1 * 10 'minimalPrice' => 18, @@ -124,8 +125,8 @@ public function getTestCases() ] ], - '#8 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #7' => [ - 'strategy' => $this->getBundleProductConfiguration7(), + '#8 Testing price for dynamic bundle with one required option and one non required' => [ + 'strategy' => $this->getBundleProductConfiguration8(), 'expectedResults' => [ // 1 * 0.9 * 10 'minimalPrice' => 9, @@ -135,8 +136,8 @@ public function getTestCases() ] ], - '#9 Testing price for dynamic bundle product with sub items and catalog rule price Configuration #8' => [ - 'strategy' => $this->getBundleProductConfiguration8(), + '#9 Testing price for dynamic bundle with two non required options' => [ + 'strategy' => $this->getBundleProductConfiguration9(), 'expectedResults' => [ // 0.9 * 1 * 10 'minimalPrice' => 9, @@ -148,7 +149,11 @@ public function getTestCases() ]; } - private function getProductWithSubItemsAndOptionsStrategy() + /** + * Dynamic bundle with one required option + * @return array + */ + private function getBundleProductConfiguration1() { $optionsData = [ [ @@ -172,7 +177,11 @@ private function getProductWithSubItemsAndOptionsStrategy() ]; } - private function getBundleProductConfiguration1() + /** + * Dynamic bundle with one required option and special price + * @return array + */ + private function getBundleProductConfiguration2() { $optionsData = [ [ @@ -200,7 +209,11 @@ private function getBundleProductConfiguration1() ]; } - private function getBundleProductConfiguration2() + /** + * Dynamic bundle with one non required option + * @return array + */ + private function getBundleProductConfiguration3() { $optionsData = [ [ @@ -224,7 +237,11 @@ private function getBundleProductConfiguration2() ]; } - private function getBundleProductConfiguration3() + /** + * Dynamic bundle with one required checkbox type option and 2 simples + * @return array + */ + private function getBundleProductConfiguration4() { $optionsData = [ [ @@ -252,7 +269,11 @@ private function getBundleProductConfiguration3() ]; } - private function getBundleProductConfiguration4() + /** + * Dynamic bundle with one required multi type option and 2 simples + * @return array + */ + private function getBundleProductConfiguration5() { $optionsData = [ [ @@ -280,7 +301,11 @@ private function getBundleProductConfiguration4() ]; } - private function getBundleProductConfiguration5() + /** + * Dynamic bundle with one required radio type option and 2 simples + * @return array + */ + private function getBundleProductConfiguration6() { $optionsData = [ [ @@ -308,7 +333,11 @@ private function getBundleProductConfiguration5() ]; } - private function getBundleProductConfiguration6() + /** + * Dynamic bundle with two required options + * @return array + */ + private function getBundleProductConfiguration7() { $optionsData = [ [ @@ -351,7 +380,11 @@ private function getBundleProductConfiguration6() ]; } - private function getBundleProductConfiguration7() + /** + * Dynamic bundle with one required option and one non required + * @return array + */ + private function getBundleProductConfiguration8() { $optionsData = [ [ @@ -394,7 +427,11 @@ private function getBundleProductConfiguration7() ]; } - private function getBundleProductConfiguration8() + /** + * Dynamic bundle with two non required options + * @return array + */ + private function getBundleProductConfiguration9() { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php index 02427515ad23e..8b56a1128b98f 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php @@ -43,11 +43,15 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec /** * Test cases for current test * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function getTestCases() { return [ - '#1 Testing price for dynamic bundle product with special price and sub items Configuration #1' => [ + ' + #1 Testing price for dynamic bundle + with one required option and special price + ' => [ 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 0.5 * 10 @@ -56,7 +60,11 @@ public function getTestCases() 'maximalPrice' => 5 ] ], - '#2 Testing price for dynamic bundle product with special price and sub items Configuration #2' => [ + + ' + #2 Testing price for dynamic bundle + with one non required option and special price + ' => [ 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // 0.5 * 2 * 10 @@ -65,7 +73,11 @@ public function getTestCases() 'maximalPrice' => 10 ] ], - '#3 Testing price for dynamic bundle product with special price and sub items Configuration #3' => [ + + ' + #3 Testing price for dynamic bundle + with one required checkbox type option, two simples and special price + ' => [ 'strategy' => $this->getBundleConfiguration3(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -74,7 +86,11 @@ public function getTestCases() 'maximalPrice' => 35 ] ], - '#4 Testing price for dynamic bundle product with special price and sub items Configuration #4' => [ + + ' + #4 Testing price for dynamic bundle + with one required multi type option, two simples and special price + ' => [ 'strategy' => $this->getBundleConfiguration4(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -83,7 +99,11 @@ public function getTestCases() 'maximalPrice' => 35 ] ], - '#5 Testing price for dynamic bundle product with special price and sub items Configuration #5' => [ + + ' + #5 Testing price for dynamic bundle + with one required radio type option, two simples and special price + ' => [ 'strategy' => $this->getBundleConfiguration5(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -92,7 +112,11 @@ public function getTestCases() 'maximalPrice' => 30 ] ], - '#6 Testing price for dynamic bundle product with special price and sub items Configuration #6' => [ + + ' + #6 Testing price for dynamic bundle + with two required options and special price + ' => [ 'strategy' => $this->getBundleConfiguration6(), 'expectedResults' => [ // 0.5 * (1 * 10 + 1 * 10) @@ -101,7 +125,11 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - '#7 Testing price for dynamic bundle product with special price and sub items Configuration #7' => [ + + ' + #7 Testing price for dynamic bundle + with one required option, one non required and special price + ' => [ 'strategy' => $this->getBundleConfiguration7(), 'expectedResults' => [ // 0.5 * (1 * 10) @@ -110,7 +138,11 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - '#8 Testing price for dynamic bundle product with special price and sub items Configuration #8' => [ + + ' + #8 Testing price for dynamic bundle + with two non required options and special price + ' => [ 'strategy' => $this->getBundleConfiguration8(), 'expectedResults' => [ // 0.5 * (1 * 10) @@ -119,7 +151,11 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - '#9 Testing price for dynamic bundle product with sub item product that has special price' => [ + + ' + #9 Testing price for dynamic bundle + with one simple product with special price + ' => [ 'strategy' => $this->getBundleConfiguration9(), 'expectedResults' => [ // 1 * 3.5 @@ -128,7 +164,11 @@ public function getTestCases() 'maximalPrice' => 20 ] ], - '#10 Testing price for dynamic bundle product with special price on it and on sub item' => [ + + ' + #10 Testing price for dynamic bundle + with special price and with one simple product with special price + ' => [ 'strategy' => $this->getBundleConfiguration10(), 'expectedResults' => [ // 0.5 * 1 * 3.5 @@ -140,6 +180,10 @@ public function getTestCases() ]; } + /** + * Dynamic bundle with one required option and special price + * @return array + */ private function getBundleConfiguration1() { $optionsData = [ @@ -168,6 +212,10 @@ private function getBundleConfiguration1() ]; } + /** + * Dynamic bundle with one non required option and special price + * @return array + */ private function getBundleConfiguration2() { $optionsData = [ @@ -196,6 +244,10 @@ private function getBundleConfiguration2() ]; } + /** + * Dynamic bundle with one required checkbox type option, two simples and special price + * @return array + */ private function getBundleConfiguration3() { $optionsData = [ @@ -228,6 +280,10 @@ private function getBundleConfiguration3() ]; } + /** + * Dynamic bundle with one required multi type option, two simples and special price + * @return array + */ private function getBundleConfiguration4() { $optionsData = [ @@ -260,6 +316,10 @@ private function getBundleConfiguration4() ]; } + /** + * Dynamic bundle with one required radio type option, two simples and special price + * @return array + */ private function getBundleConfiguration5() { $optionsData = [ @@ -292,6 +352,10 @@ private function getBundleConfiguration5() ]; } + /** + * Dynamic bundle with two required options and special price + * @return array + */ private function getBundleConfiguration6() { $optionsData = [ @@ -339,6 +403,10 @@ private function getBundleConfiguration6() ]; } + /** + * Dynamic bundle with one required option, one non required and special price + * @return array + */ private function getBundleConfiguration7() { $optionsData = [ @@ -386,6 +454,10 @@ private function getBundleConfiguration7() ]; } + /** + * Dynamic bundle with two non required options and special price + * @return array + */ private function getBundleConfiguration8() { $optionsData = [ @@ -433,6 +505,10 @@ private function getBundleConfiguration8() ]; } + /** + * Dynamic bundle with one simple product with special price + * @return array + */ private function getBundleConfiguration9() { $optionsData = [ @@ -465,6 +541,10 @@ private function getBundleConfiguration9() ]; } + /** + * Dynamic bundle with special price and with one simple product with special price + * @return array + */ private function getBundleConfiguration10() { $optionsData = [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php index b8a71e6dafdf0..0be5adcb304f7 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php @@ -54,11 +54,15 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec /** * Test cases for current test * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function getTestCases() { return [ - '#1 Testing product price with tier price and sub items Configuration #1' => [ + ' + #1 Testing product price for dynamic bundle + with one required option and tier price + ' => [ 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 0.5 * 10 @@ -67,7 +71,11 @@ public function getTestCases() 'maximalPrice' => 5 ] ], - '#2 Testing product price with tier price and sub items Configuration #2' => [ + + ' + #2 Testing product price for dynamic bundle + with one non required option and tier price + ' => [ 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // 0.5 * 2 * 10 @@ -76,7 +84,11 @@ public function getTestCases() 'maximalPrice' => 10 ] ], - '#3 Testing product price with tier price and sub items Configuration #3' => [ + + ' + #3 Testing product price for dynamic bundle + with one required checkbox type option and tier price + ' => [ 'strategy' => $this->getBundleConfiguration3(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -85,7 +97,11 @@ public function getTestCases() 'maximalPrice' => 35 ] ], - '#4 Testing product price with tier price and sub items Configuration #4' => [ + + ' + #4 Testing product price for dynamic bundle + with one required multi type option and tier price + ' => [ 'strategy' => $this->getBundleConfiguration4(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -94,7 +110,11 @@ public function getTestCases() 'maximalPrice' => 35 ] ], - '#5 Testing product price with tier price and sub items Configuration #5' => [ + + ' + #5 Testing product price for dynamic bundle + with one required radio type option and tier price + ' => [ 'strategy' => $this->getBundleConfiguration5(), 'expectedResults' => [ // 0.5 * 1 * 10 @@ -103,7 +123,11 @@ public function getTestCases() 'maximalPrice' => 30 ] ], - '#6 Testing product price with tier price and sub items Configuration #6' => [ + + ' + #6 Testing product price for dynamic bundle + with two required options and tier price + ' => [ 'strategy' => $this->getBundleConfiguration6(), 'expectedResults' => [ // 0.5 * (1 * 10 + 1 * 10) @@ -112,7 +136,11 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - '#7 Testing product price with tier price and sub items Configuration #7' => [ + + ' + #7 Testing product price for dynamic bundle + with one required option, one non required option and tier price + ' => [ 'strategy' => $this->getBundleConfiguration7(), 'expectedResults' => [ // 0.5 * (1 * 10) @@ -121,7 +149,11 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - '#8 Testing product price with tier price and sub items Configuration #8' => [ + + ' + #8 Testing product price for dynamic bundle + with two non required options and tier price + ' => [ 'strategy' => $this->getBundleConfiguration8(), 'expectedResults' => [ // 0.5 * (1 * 10) @@ -130,8 +162,12 @@ public function getTestCases() 'maximalPrice' => 65 ] ], - '#9 Testing price for dynamic bundle product with tier price on it and on sub item' => [ - 'strategy' => $this->getBundleConfiguration10(), + + ' + #9 Testing product price for dynamic bundle + with tier price and with simple with tier price + ' => [ + 'strategy' => $this->getBundleConfiguration9(), 'expectedResults' => [ // 0.5 * 1 * 2.5 'minimalPrice' => 1.25, @@ -142,6 +178,10 @@ public function getTestCases() ]; } + /** + * Dynamic bundle with one required option and tier price + * @return array + */ private function getBundleConfiguration1() { $optionsData = [ @@ -176,6 +216,10 @@ private function getBundleConfiguration1() ]; } + /** + * Dynamic bundle with one non required option and tier price + * @return array + */ private function getBundleConfiguration2() { $optionsData = [ @@ -210,6 +254,10 @@ private function getBundleConfiguration2() ]; } + /** + * Dynamic bundle with one required checkbox type option and tier price + * @return array + */ private function getBundleConfiguration3() { $optionsData = [ @@ -248,6 +296,10 @@ private function getBundleConfiguration3() ]; } + /** + * Dynamic bundle with one required multi type option and tier price + * @return array + */ private function getBundleConfiguration4() { $optionsData = [ @@ -286,6 +338,10 @@ private function getBundleConfiguration4() ]; } + /** + * Dynamic bundle with one required radio type option and tier price + * @return array + */ private function getBundleConfiguration5() { $optionsData = [ @@ -324,6 +380,10 @@ private function getBundleConfiguration5() ]; } + /** + * Dynamic bundle with two required options and tier price + * @return array + */ private function getBundleConfiguration6() { $optionsData = [ @@ -377,6 +437,10 @@ private function getBundleConfiguration6() ]; } + /** + * Dynamic bundle with one required option, one non required option and tier price + * @return array + */ private function getBundleConfiguration7() { $optionsData = [ @@ -430,6 +494,10 @@ private function getBundleConfiguration7() ]; } + /** + * Dynamic bundle with two non required options and tier price + * @return array + */ private function getBundleConfiguration8() { $optionsData = [ @@ -483,7 +551,11 @@ private function getBundleConfiguration8() ]; } - private function getBundleConfiguration10() + /** + * Dynamic bundle with tier price and with simple with tier price + * @return array + */ + private function getBundleConfiguration9() { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php index faf0bfcfa3396..28e4886fb16ef 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -87,7 +87,8 @@ public function getTestCases() 'maximalPrice' => 120 ] ], - '#2 Testing price for fixed bundle product with three simples and differnt qty' => [ + + '#2 Testing price for fixed bundle product with three simples and different qty' => [ 'strategy' => $this->getProductWithDifferentQty(), 'expectedResults' => [ // 110 + 10 (min price from simples) @@ -96,7 +97,8 @@ public function getTestCases() 'maximalPrice' => 170 ] ], - '#3 Testing price for fixed bundle product with three simples and differnt price' => [ + + '#3 Testing price for fixed bundle product with three simples and different price' => [ 'strategy' => $this->getProductWithDifferentPrice(), 'expectedResults' => [ // 110 + 10 @@ -105,6 +107,7 @@ public function getTestCases() 'maximalPrice' => 170 ] ], + '#4 Testing price for fixed bundle product with three simples' => [ 'strategy' => $this->getProductWithSamePrice(), 'expectedResults' => [ @@ -117,6 +120,10 @@ public function getTestCases() ]; } + /** + * Fixed bundle product with one simple + * @return array + */ private function getProductWithOneSimple() { $optionsData = [ @@ -143,6 +150,10 @@ private function getProductWithOneSimple() ]; } + /** + * Fixed bundle product with three simples and different qty + * @return array + */ private function getProductWithDifferentQty() { $optionsData = [ @@ -181,6 +192,10 @@ private function getProductWithDifferentQty() ]; } + /** + * Fixed bundle product with three simples and different price + * @return array + */ private function getProductWithSamePrice() { $optionsData = [ @@ -219,6 +234,10 @@ private function getProductWithSamePrice() ]; } + /** + * Fixed bundle product with three simples + * @return array + */ private function getProductWithDifferentPrice() { $optionsData = [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php index a18929463ea95..57c8ba0cbbde1 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php @@ -45,6 +45,7 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte /** * Test cases for current test * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function getTestCases() { @@ -53,7 +54,7 @@ public function getTestCases() #1 Testing price for fixed bundle product with catalog price rule and without sub items and options ' => [ - 'strategy' => $this->getEmptyProductStrategy(), + 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 110 * 0.9 'minimalPrice' => 99, @@ -67,7 +68,7 @@ public function getTestCases() #2 Testing price for fixed bundle product with catalog price rule, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -84,7 +85,7 @@ public function getTestCases() #3 Testing price for fixed bundle product with catalog price rule, percent sub items and percent options ' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -101,7 +102,7 @@ public function getTestCases() #4 Testing price for fixed bundle product with catalog price rule, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -118,7 +119,7 @@ public function getTestCases() #5 Testing price for fixed bundle product with catalog price rule, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -133,77 +134,9 @@ public function getTestCases() ' #6 Testing price for fixed bundle product - with catalog price rule, fixed sub items and fixed options Configuration #1 - ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration1( - LinkInterface::PRICE_TYPE_FIXED, - self::CUSTOM_OPTION_PRICE_TYPE_FIXED - ), - 'expectedResults' => [ - // 0.9 * 110 + 1 * 20 + 100 - 'minimalPrice' => 219, - - // 0.9 * 110 + 1 * 20 + 100 - 'maximalPrice' => 219 - ] - ], - - ' - #7 Testing price for fixed bundle product - with catalog price rule, percent sub items and percent options Configuration #1 - ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration1( - LinkInterface::PRICE_TYPE_PERCENT, - self::CUSTOM_OPTION_PRICE_TYPE_PERCENT - ), - 'expectedResults' => [ - // 0.9 * 110 + 0.9 * 110 * 0.2 + 0.9 * 110 * 1 - 'minimalPrice' => 217.8, - - // 0.9 * 110 + 0.9 * 110 * 0.2 + 0.9 * 110 * 1 - 'maximalPrice' => 217.8 - ] - ], - - ' - #8 Testing price for fixed bundle product - with catalog price rule, fixed sub items and percent options Configuration #1 - ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration1( - LinkInterface::PRICE_TYPE_FIXED, - self::CUSTOM_OPTION_PRICE_TYPE_PERCENT - ), - 'expectedResults' => [ - // 0.9 * 110 + 1 * 20 + 0.9 * 110 * 1 - 'minimalPrice' => 218, - - // 0.9 * 110 + 1 * 20 + 0.9 * 110 * 1 - 'maximalPrice' => 218 - ] - ], - - ' - #9 Testing price for fixed bundle product - with catalog price rule, percent sub items and fixed options Configuration #1 - ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration1( - LinkInterface::PRICE_TYPE_PERCENT, - self::CUSTOM_OPTION_PRICE_TYPE_FIXED - ), - 'expectedResults' => [ - // 0.9 * 110 + 0.9 * 110 * 0.2 + 100 - 'minimalPrice' => 218.8, - - // 0.9 * 110 + 0.9 * 110 * 0.2 + 100 - 'maximalPrice' => 218.8 - ] - ], - - ' - #10 Testing price for fixed bundle product - with catalog price rule, fixed sub items and fixed options Configuration #2 + with catalog price rule, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration2( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -217,10 +150,10 @@ public function getTestCases() ], ' - #11 Testing price for fixed bundle product - with catalog price rule, percent sub items and percent options Configuration #2 + #7 Testing price for fixed bundle product + with catalog price rule, percent sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration2( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -234,10 +167,10 @@ public function getTestCases() ], ' - #12 Testing price for fixed bundle product - with catalog price rule, fixed sub items and percent options Configuration #2 + #8 Testing price for fixed bundle product + with catalog price rule, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration2( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -251,10 +184,10 @@ public function getTestCases() ], ' - #13 Testing price for fixed bundle product - with catalog price rule, percent sub items and fixed options Configuration #2 + #9 Testing price for fixed bundle product + with catalog price rule, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration2( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -268,10 +201,10 @@ public function getTestCases() ], ' - #14 Testing price for fixed bundle product - with catalog price rule, fixed sub items and fixed options Configuration #3 + #10 Testing price for fixed bundle product + with catalog price rule, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration3( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -285,10 +218,10 @@ public function getTestCases() ], ' - #15 Testing price for fixed bundle product - with catalog price rule, percent sub items and percent options Configuration #3 + #11 Testing price for fixed bundle product + with catalog price rule, percent sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration3( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -302,10 +235,10 @@ public function getTestCases() ], ' - #16 Testing price for fixed bundle product - with catalog price rule, fixed sub items and percent options Configuration #3 + #12 Testing price for fixed bundle product + with catalog price rule, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration3( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -319,10 +252,10 @@ public function getTestCases() ], ' - #17 Testing price for fixed bundle product - with catalog price rule, percent sub items and fixed options Configuration #3 + #13 Testing price for fixed bundle product + with catalog price rule, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration3( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -336,10 +269,10 @@ public function getTestCases() ], ' - #18 Testing price for fixed bundle product - with catalog price rule, fixed sub items and fixed options Configuration #4 + #14 Testing price for fixed bundle product + with catalog price rule, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration4( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -353,10 +286,10 @@ public function getTestCases() ], ' - #19 Testing price for fixed bundle product - with catalog price rule, percent sub items and percent options Configuration #4 + #15 Testing price for fixed bundle product + with catalog price rule, percent sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration4( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -370,10 +303,10 @@ public function getTestCases() ], ' - #20 Testing price for fixed bundle product - with catalog price rule, fixed sub items and percent options Configuration #4 + #16 Testing price for fixed bundle product + with catalog price rule, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration4( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -387,10 +320,10 @@ public function getTestCases() ], ' - #21 Testing price for fixed bundle product - with catalog price rule, percent sub items and fixed options Configuration #4 + #17 Testing price for fixed bundle product + with catalog price rule, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration4( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -404,10 +337,10 @@ public function getTestCases() ], ' - #22 Testing price for fixed bundle product - with catalog price rule, fixed sub items and fixed options Configuration #5 + #18 Testing price for fixed bundle product + with catalog price rule, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration5( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -421,10 +354,10 @@ public function getTestCases() ], ' - #23 Testing price for fixed bundle product - with catalog price rule, percent sub items and percent options Configuration #5 + #19 Testing price for fixed bundle product + with catalog price rule, percent sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration5( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -438,10 +371,10 @@ public function getTestCases() ], ' - #24 Testing price for fixed bundle product - with catalog price rule, fixed sub items and percent options Configuration #5 + #20 Testing price for fixed bundle product + with catalog price rule, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration5( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -455,10 +388,10 @@ public function getTestCases() ], ' - #25 Testing price for fixed bundle product - with catalog price rule, percent sub items and fixed options Configuration #5 + #21 Testing price for fixed bundle product + with catalog price rule, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration5( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -472,10 +405,10 @@ public function getTestCases() ], ' - #26 Testing price for fixed bundle product - with catalog price rule, fixed sub items and fixed options Configuration #6 + #22 Testing price for fixed bundle product + with catalog price rule, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration6( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -489,10 +422,10 @@ public function getTestCases() ], ' - #27 Testing price for fixed bundle product - with catalog price rule, percent sub items and percent options Configuration #6 + #23 Testing price for fixed bundle product + with catalog price rule, percent sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration6( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -506,10 +439,10 @@ public function getTestCases() ], ' - #28 Testing price for fixed bundle product - with catalog price rule, fixed sub items and percent options Configuration #6 + #24 Testing price for fixed bundle product + with catalog price rule, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration6( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -523,10 +456,10 @@ public function getTestCases() ], ' - #29 Testing price for fixed bundle product - with catalog price rule, percent sub items and fixed options Configuration #6 + #25 Testing price for fixed bundle product + with catalog price rule, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductSubItemsAndOptionsStrategyConfiguration6( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -541,53 +474,22 @@ public function getTestCases() ]; } - private function getEmptyProductStrategy() + /** + * Fixed bundle product with catalog price rule and without sub items and options + * @return array + */ + private function getBundleConfiguration1() { return []; } - private function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) - { - $optionsData = [ - [ - 'title' => 'Op1', - 'required' => true, - 'type' => 'checkbox', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - 'price' => 20, - 'price_type' => $selectionsPriceType - ], - ] - ], - ]; - - $customOptionsData = [ - [ - 'price_type' => $customOptionsPriceType, - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'price' => 100, - 'sku' => '1-text', - ] - ]; - - return [ - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - [ - 'modifierName' => 'addCustomOption', - 'data' => [$customOptionsData] - ], - ]; - } - - private function getProductSubItemsAndOptionsStrategyConfiguration1($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with catalog price rule, one required option and one custom option + * @param string $selectionsPriceType + * @param string $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration2($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -628,7 +530,13 @@ private function getProductSubItemsAndOptionsStrategyConfiguration1($selectionsP ]; } - private function getProductSubItemsAndOptionsStrategyConfiguration2($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with catalog price rule, one non required option and one custom option + * @param string $selectionsPriceType + * @param string $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration3($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -669,7 +577,13 @@ private function getProductSubItemsAndOptionsStrategyConfiguration2($selectionsP ]; } - private function getProductSubItemsAndOptionsStrategyConfiguration3($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with catalog price rule, one checkbox type option with 2 simples and one custom option + * @param string $selectionsPriceType + * @param string $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration4($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -716,7 +630,13 @@ private function getProductSubItemsAndOptionsStrategyConfiguration3($selectionsP ]; } - private function getProductSubItemsAndOptionsStrategyConfiguration4($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with catalog price rule, one multi type option with 2 simples and one custom option + * @param string $selectionsPriceType + * @param string $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration5($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -763,7 +683,13 @@ private function getProductSubItemsAndOptionsStrategyConfiguration4($selectionsP ]; } - private function getProductSubItemsAndOptionsStrategyConfiguration5($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with catalog price rule, one radio type option with 2 simples and one custom option + * @param string $selectionsPriceType + * @param string $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration6($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -810,7 +736,13 @@ private function getProductSubItemsAndOptionsStrategyConfiguration5($selectionsP ]; } - private function getProductSubItemsAndOptionsStrategyConfiguration6($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with catalog price rule, two required options and one custom option + * @param string $selectionsPriceType + * @param string $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration7($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php index 092c35fc5db3c..55fe57d082639 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php @@ -45,6 +45,7 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte /** * Test cases for current test * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function getTestCases() { @@ -53,7 +54,7 @@ public function getTestCases() #1 Testing price for fixed bundle product without any discounts, sub items and options ' => [ - 'strategy' => $this->getEmptyProductStrategy(), + 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // just product price 'minimalPrice' => 110, @@ -67,7 +68,7 @@ public function getTestCases() #2 Testing price for fixed bundle product with special price and without any sub items and options ' => [ - 'strategy' => $this->getEmptyProductWithSpecialPriceStrategy(), + 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // 110 * 0.5 'minimalPrice' => 55, @@ -81,7 +82,7 @@ public function getTestCases() #3 Testing price for fixed bundle product with fixed sub items, fixed options and without any discounts ' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -98,7 +99,7 @@ public function getTestCases() #4 Testing price for fixed bundle product with percent sub items, percent options and without any discounts ' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -115,7 +116,7 @@ public function getTestCases() #5 Testing price for fixed bundle product with fixed sub items, percent options and without any discounts ' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -132,7 +133,7 @@ public function getTestCases() #6 Testing price for fixed bundle product with percent sub items, fixed options and without any discounts ' => [ - 'strategy' => $this->getProductWithSubItemsAndOptionsStrategy( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -147,9 +148,9 @@ public function getTestCases() ' #7 Testing price for fixed bundle product - with special price, fixed sub items and fixed options Configuration #1 + with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -164,9 +165,9 @@ public function getTestCases() ' #8 Testing price for fixed bundle product - with special price, percent sub items and percent options Configuration #1 + with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -181,9 +182,9 @@ public function getTestCases() ' #9 Testing price for fixed bundle product - with special price, fixed sub items and percent options Configuration #1 + with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -198,9 +199,9 @@ public function getTestCases() ' #10 Testing price for fixed bundle product - with special price, percent sub items and fixed options Configuration #1 + with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -215,9 +216,9 @@ public function getTestCases() ' #11 Testing price for fixed bundle product - with special price, fixed sub items and fixed options Configuration #2 + with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -232,9 +233,9 @@ public function getTestCases() ' #12 Testing price for fixed bundle product - with special price, percent sub items and percent options Configuration #2 + with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -249,9 +250,9 @@ public function getTestCases() ' #13 Testing price for fixed bundle product - with special price, fixed sub items and percent options Configuration #2 + with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -266,9 +267,9 @@ public function getTestCases() ' #14 Testing price for fixed bundle product - with special price, percent sub items and fixed options Configuration #2 + with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -283,9 +284,9 @@ public function getTestCases() ' #15 Testing price for fixed bundle product - with special price, fixed sub items and fixed options Configuration #3 + with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -300,9 +301,9 @@ public function getTestCases() ' #16 Testing price for fixed bundle product - with special price, percent sub items and percent options Configuration #3 + with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -317,9 +318,9 @@ public function getTestCases() ' #17 Testing price for fixed bundle product - with special price, fixed sub items and percent options Configuration #3 + with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -334,9 +335,9 @@ public function getTestCases() ' #18 Testing price for fixed bundle product - with special price, percent sub items and fixed options Configuration #3 + with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -351,9 +352,9 @@ public function getTestCases() ' #19 Testing price for fixed bundle product - with special price, fixed sub items and fixed options Configuration #4 + with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -368,9 +369,9 @@ public function getTestCases() ' #20 Testing price for fixed bundle product - with special price, percent sub items and percent options Configuration #4 + with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -385,9 +386,9 @@ public function getTestCases() ' #21 Testing price for fixed bundle product - with special price, fixed sub items and percent options Configuration #4 + with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -402,9 +403,9 @@ public function getTestCases() ' #22 Testing price for fixed bundle product - with special price, percent sub items and fixed options Configuration #4 + with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -419,9 +420,9 @@ public function getTestCases() ' #23 Testing price for fixed bundle product - with special price, fixed sub items and fixed options Configuration #5 + with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( + 'strategy' => $this->getBundleConfiguration8( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -436,9 +437,9 @@ public function getTestCases() ' #24 Testing price for fixed bundle product - with special price, percent sub items and percent options Configuration #5 + with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( + 'strategy' => $this->getBundleConfiguration8( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -453,9 +454,9 @@ public function getTestCases() ' #25 Testing price for fixed bundle product - with special price, fixed sub items and percent options Configuration #5 + with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( + 'strategy' => $this->getBundleConfiguration8( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -470,9 +471,9 @@ public function getTestCases() ' #26 Testing price for fixed bundle product - with special price, percent sub items and fixed options Configuration #5 + with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( + 'strategy' => $this->getBundleConfiguration8( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -487,9 +488,9 @@ public function getTestCases() ' #27 Testing price for fixed bundle product - with special price, fixed sub items and fixed options Configuration #6 + with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( + 'strategy' => $this->getBundleConfiguration9( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -504,9 +505,9 @@ public function getTestCases() ' #28 Testing price for fixed bundle product - with special price, percent sub items and percent options Configuration #6 + with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( + 'strategy' => $this->getBundleConfiguration9( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -521,9 +522,9 @@ public function getTestCases() ' #29 Testing price for fixed bundle product - with special price, fixed sub items and percent options Configuration #6 + with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( + 'strategy' => $this->getBundleConfiguration9( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -538,9 +539,9 @@ public function getTestCases() ' #30 Testing price for fixed bundle product - with special price, percent sub items and fixed options Configuration #6 + with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( + 'strategy' => $this->getBundleConfiguration9( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -555,12 +556,20 @@ public function getTestCases() ]; } - private function getEmptyProductStrategy() + /** + * Fixed bundle product without any discounts, sub items and options + * @return array + */ + private function getBundleConfiguration1() { return []; } - private function getEmptyProductWithSpecialPriceStrategy() + /** + * Fixed bundle product with special price and without any sub items and options + * @return array + */ + private function getBundleConfiguration2() { return [ [ @@ -570,7 +579,13 @@ private function getEmptyProductWithSpecialPriceStrategy() ]; } - private function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with required option, custom option and without any discounts + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration3($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -611,7 +626,13 @@ private function getProductWithSubItemsAndOptionsStrategy($selectionsPriceType, ]; } - private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration1( + /** + * Fixed bundle product with required option, custom option and with special price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration4( $selectionsPriceType, $customOptionsPriceType ) { @@ -658,7 +679,13 @@ private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfigurati ]; } - private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration2( + /** + * Fixed bundle product with non required option, custom option and with special price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration5( $selectionsPriceType, $customOptionsPriceType ) { @@ -705,7 +732,13 @@ private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfigurati ]; } - private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration3( + /** + * Fixed bundle product with checkbox type option, custom option and with special price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration6( $selectionsPriceType, $customOptionsPriceType ) { @@ -758,7 +791,13 @@ private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfigurati ]; } - private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration4( + /** + * Fixed bundle product with multi type option, custom option and with special price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration7( $selectionsPriceType, $customOptionsPriceType ) { @@ -811,7 +850,13 @@ private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfigurati ]; } - private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration5( + /** + * Fixed bundle product with radio type option, custom option and with special price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration8( $selectionsPriceType, $customOptionsPriceType ) { @@ -864,7 +909,13 @@ private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfigurati ]; } - private function getProductWithSpecialPriceSubItemsAndOptionsStrategyConfiguration6( + /** + * Fixed bundle product with two required options, custom option and with special price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration9( $selectionsPriceType, $customOptionsPriceType ) { diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php index 7766158967f55..bd148080631ae 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php @@ -57,13 +57,16 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte /** * Test cases for current test * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function getTestCases() { - return [ - '#1 Testing product price with tier price and without any sub items and options' => [ - 'strategy' => $this->getEmptyProduct(), + ' + #1 Testing product price + with tier price and without any sub items and options + ' => [ + 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 110 * 0.5 'minimalPrice' => 55, @@ -73,8 +76,11 @@ public function getTestCases() ] ], - '#2 Testing product price with tier price, fixed sub items and fixed options Configuration #1' => [ - 'strategy' => $this->getProductConfiguration1( + ' + #2 Testing product price + with tier price, fixed sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -87,8 +93,11 @@ public function getTestCases() ] ], - '#3 Testing product price with tier price, percent sub items and percent options Configuration #1' => [ - 'strategy' => $this->getProductConfiguration1( + ' + #3 Testing product price + with tier price, percent sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -101,8 +110,11 @@ public function getTestCases() ] ], - '#4 Testing product price with tier price, fixed sub items and percent options Configuration #1' => [ - 'strategy' => $this->getProductConfiguration1( + ' + #4 Testing product price + with tier price, fixed sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -115,8 +127,11 @@ public function getTestCases() ] ], - '#5 Testing product price with tier price, percent sub items and fixed options Configuration #1' => [ - 'strategy' => $this->getProductConfiguration1( + ' + #5 Testing product price + with tier price, percent sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -129,8 +144,11 @@ public function getTestCases() ] ], - '#6 Testing product price with tier price, fixed sub items and fixed options Configuration #2' => [ - 'strategy' => $this->getProductConfiguration2( + ' + #6 Testing product price + with tier price, fixed sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -143,8 +161,11 @@ public function getTestCases() ] ], - '#7 Testing product price with tier price, percent sub items and percent options Configuration #2' => [ - 'strategy' => $this->getProductConfiguration2( + ' + #7 Testing product price + with tier price, percent sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -157,8 +178,11 @@ public function getTestCases() ] ], - '#8 Testing product price with tier price, fixed sub items and percent options Configuration #2' => [ - 'strategy' => $this->getProductConfiguration2( + ' + #8 Testing product price + with tier price, fixed sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -171,8 +195,11 @@ public function getTestCases() ] ], - '#9 Testing product price with tier price, percent sub items and fixed options Configuration #2' => [ - 'strategy' => $this->getProductConfiguration2( + ' + #9 Testing product price + with tier price, percent sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -185,8 +212,11 @@ public function getTestCases() ] ], - '#10 Testing product price with tier price, fixed sub items and fixed options Configuration #3' => [ - 'strategy' => $this->getProductConfiguration3( + ' + #10 Testing product price + with tier price, fixed sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -199,8 +229,11 @@ public function getTestCases() ] ], - '#11 Testing product price with tier price, percent sub items and percent options Configuration #3' => [ - 'strategy' => $this->getProductConfiguration3( + ' + #11 Testing product price + with tier price, percent sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -213,8 +246,11 @@ public function getTestCases() ] ], - '#12 Testing product price with tier price, fixed sub items and percent options Configuration #3' => [ - 'strategy' => $this->getProductConfiguration3( + ' + #12 Testing product price + with tier price, fixed sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -227,8 +263,11 @@ public function getTestCases() ] ], - '#13 Testing product price with tier price, percent sub items and fixed options Configuration #3' => [ - 'strategy' => $this->getProductConfiguration3( + ' + #13 Testing product price + with tier price, percent sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -241,8 +280,11 @@ public function getTestCases() ] ], - '#14 Testing product price with tier price, fixed sub items and fixed options Configuration #4' => [ - 'strategy' => $this->getProductConfiguration4( + ' + #14 Testing product price + with tier price, fixed sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -255,8 +297,11 @@ public function getTestCases() ] ], - '#15 Testing product price with tier price, percent sub items and percent options Configuration #4' => [ - 'strategy' => $this->getProductConfiguration4( + ' + #15 Testing product price + with tier price, percent sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -269,8 +314,11 @@ public function getTestCases() ] ], - '#16 Testing product price with tier price, fixed sub items and percent options Configuration #4' => [ - 'strategy' => $this->getProductConfiguration4( + ' + #16 Testing product price + with tier price, fixed sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -283,8 +331,11 @@ public function getTestCases() ] ], - '#17 Testing product price with tier price, percent sub items and fixed options Configuration #4' => [ - 'strategy' => $this->getProductConfiguration4( + ' + #17 Testing product price + with tier price, percent sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -297,8 +348,11 @@ public function getTestCases() ] ], - '#18 Testing product price with tier price, fixed sub items and fixed options Configuration #5' => [ - 'strategy' => $this->getProductConfiguration5( + ' + #18 Testing product price + with tier price, fixed sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -311,8 +365,11 @@ public function getTestCases() ] ], - '#19 Testing product price with tier price, percent sub items and percent options Configuration #5' => [ - 'strategy' => $this->getProductConfiguration5( + ' + #19 Testing product price + with tier price, percent sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -325,8 +382,11 @@ public function getTestCases() ] ], - '#20 Testing product price with tier price, fixed sub items and percent options Configuration #5' => [ - 'strategy' => $this->getProductConfiguration5( + ' + #20 Testing product price + with tier price, fixed sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -339,8 +399,11 @@ public function getTestCases() ] ], - '#21 Testing product price with tier price, percent sub items and fixed options Configuration #5' => [ - 'strategy' => $this->getProductConfiguration5( + ' + #21 Testing product price + with tier price, percent sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -353,8 +416,11 @@ public function getTestCases() ] ], - '#22 Testing product price with tier price, fixed sub items and fixed options Configuration #6' => [ - 'strategy' => $this->getProductConfiguration6( + ' + #22 Testing product price + with tier price, fixed sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -367,8 +433,11 @@ public function getTestCases() ] ], - '#23 Testing product price with tier price, percent sub items and percent options Configuration #6' => [ - 'strategy' => $this->getProductConfiguration6( + ' + #23 Testing product price + with tier price, percent sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -381,8 +450,11 @@ public function getTestCases() ] ], - '#24 Testing product price with tier price, fixed sub items and percent options Configuration #6' => [ - 'strategy' => $this->getProductConfiguration6( + ' + #24 Testing product price + with tier price, fixed sub items and percent options + ' => [ + 'strategy' => $this->getProductConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -395,8 +467,11 @@ public function getTestCases() ] ], - '#25 Testing product price with tier price, percent sub items and fixed options Configuration #6' => [ - 'strategy' => $this->getProductConfiguration6( + ' + #25 Testing product price + with tier price, percent sub items and fixed options + ' => [ + 'strategy' => $this->getProductConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -408,11 +483,14 @@ public function getTestCases() 'maximalPrice' => 207.25 ] ], - ]; } - private function getEmptyProduct() + /** + * Fixed bundle product without sub items and options and with tier price + * @return array + */ + private function getBundleConfiguration1() { $tierPriceData = [ 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, @@ -428,7 +506,13 @@ private function getEmptyProduct() ]; } - private function getProductConfiguration1($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with required option, custom option and with tier price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getProductConfiguration2($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -479,7 +563,13 @@ private function getProductConfiguration1($selectionsPriceType, $customOptionsPr ]; } - private function getProductConfiguration2($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with non required option, custom option and with tier price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getProductConfiguration3($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -530,7 +620,13 @@ private function getProductConfiguration2($selectionsPriceType, $customOptionsPr ]; } - private function getProductConfiguration3($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with checkbox type option, custom option and with tier price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getProductConfiguration4($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -587,7 +683,13 @@ private function getProductConfiguration3($selectionsPriceType, $customOptionsPr ]; } - private function getProductConfiguration4($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with multi type option, custom option and with tier price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getProductConfiguration5($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -644,7 +746,13 @@ private function getProductConfiguration4($selectionsPriceType, $customOptionsPr ]; } - private function getProductConfiguration5($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with radio type option, custom option and with tier price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getProductConfiguration6($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ @@ -701,7 +809,13 @@ private function getProductConfiguration5($selectionsPriceType, $customOptionsPr ]; } - private function getProductConfiguration6($selectionsPriceType, $customOptionsPriceType) + /** + * Fixed bundle product with two required options, custom option and with tier price + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getProductConfiguration7($selectionsPriceType, $customOptionsPriceType) { $optionsData = [ [ diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php index de45c9e06b447..7882475314072 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php @@ -30,7 +30,7 @@ protected function setUp() } /** - * check bundle product is saleable if his status is enabled + * Check bundle product is saleable if his status is enabled * * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable @@ -48,7 +48,7 @@ public function testIsSaleableOnEnabledStatus() } /** - * check bundle product is NOT saleable if his status is disabled + * Check bundle product is NOT saleable if his status is disabled * * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable @@ -66,7 +66,7 @@ public function testIsSaleableOnDisabledStatus() } /** - * check bundle product is saleable if his status is enabled + * Check bundle product is saleable if his status is enabled * and it has internal data is_salable = true * * @magentoAppIsolation enabled @@ -86,7 +86,7 @@ public function testIsSaleableOnEnabledStatusAndIsSalableIsTrue() } /** - * check bundle product is NOT saleable if + * Check bundle product is NOT saleable if * his status is enabled but his data is_salable = false * * @magentoAppIsolation enabled @@ -106,7 +106,7 @@ public function testIsSaleableOnEnabledStatusAndIsSalableIsFalse() } /** - * check bundle product is saleable if it has all_items_salable = true + * Check bundle product is saleable if it has all_items_salable = true * * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable @@ -124,7 +124,7 @@ public function testIsSaleableOnAllItemsSalableIsTrue() } /** - * check bundle product is NOT saleable if it has all_items_salable = false + * Check bundle product is NOT saleable if it has all_items_salable = false * * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable @@ -142,7 +142,7 @@ public function testIsSaleableOnAllItemsSalableIsFalse() } /** - * check bundle product is NOT saleable if it has no options + * Check bundle product is NOT saleable if it has no options * * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable @@ -170,7 +170,7 @@ public function testIsSaleableOnBundleWithoutOptions() } /** - * check bundle product is NOT saleable if it has no selections + * Check bundle product is NOT saleable if it has no selections * * @magentoAppIsolation enabled * @covers \Magento\Bundle\Model\Product\Type::isSalable @@ -200,7 +200,7 @@ public function testIsSaleableOnBundleWithoutSelections() } /** - * check bundle product is NOT saleable if + * Check bundle product is NOT saleable if * all his selections are not saleable * * @magentoAppIsolation enabled @@ -225,7 +225,7 @@ public function testIsSaleableOnBundleWithoutSaleableSelections() } /** - * check bundle product is NOT saleable if + * Check bundle product is NOT saleable if * it has at least one required option without saleable selections * * @magentoAppIsolation enabled @@ -250,7 +250,7 @@ public function testIsSaleableOnBundleWithoutSaleableSelectionsOnRequiredOption( } /** - * check bundle product is NOT saleable if + * Check bundle product is NOT saleable if * there are not enough qty of selection on required option * * @magentoAppIsolation enabled @@ -270,7 +270,7 @@ public function testIsSaleableOnBundleWithNotEnoughQtyOfSelection() } /** - * check bundle product is saleable if + * Check bundle product is saleable if * all his selections have selection_can_change_qty = 1 * * @magentoAppIsolation enabled @@ -305,7 +305,7 @@ public function testIsSaleableOnBundleWithSelectionCanChangeQty() } /** - * check bundle product is not saleable if + * Check bundle product is not saleable if * all his options are not required and selections are not saleable * * @magentoAppIsolation enabled @@ -342,7 +342,7 @@ public function testIsSaleableOnBundleWithoutRequiredOptions() } /** - * check bundle product is saleable if + * Check bundle product is saleable if * it has at least one not required option with saleable selections * * @magentoAppIsolation enabled From ff20a0da8e5bb84184820071c7f65fa6f3ce4ba1 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Wed, 2 Nov 2016 16:10:41 +0200 Subject: [PATCH 1586/3232] MAGETWO-60397: [GITHUB] Fix incorrect table name during catalog product indexing #7256 --- .../Product/Flat/FlatTableBuilderTest.php | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php index 7e5a8305467e8..83b6a7ac8eb48 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php @@ -107,24 +107,33 @@ protected function setUp() public function testBuild() { - list($storeId, $changedIds, $valueFieldSuffix, $tableDropSuffix, $fillTmpTables) = [1, [], '', '', true]; + $storeId = 1; + $changedIds = []; + $valueFieldSuffix = '_value'; + $tableDropSuffix = ''; + $fillTmpTables = true; $tableName = 'catalog_product_entity'; $attributeTable = 'catalog_product_entity_int'; $temporaryTableName = 'catalog_product_entity_int_tmp_indexer'; - $temporaryValueTableName = 'catalog_product_entity_int_tmp_indexer'; + $temporaryValueTableName = 'catalog_product_entity_int_tmp_indexer_value'; $linkField = 'entity_id'; $statusId = 22; + $eavCustomField = 'space_weight'; + $eavCustomValueField = $eavCustomField . $valueFieldSuffix; $this->flatIndexerMock->expects($this->once())->method('getAttributes')->willReturn([]); $this->flatIndexerMock->expects($this->exactly(3))->method('getFlatColumns') ->willReturnOnConsecutiveCalls( [], - [$linkField => []], - [$linkField => []] + [$eavCustomValueField => []], + [$eavCustomValueField => []] ); $this->flatIndexerMock->expects($this->once())->method('getFlatIndexes')->willReturn([]); $statusAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class) ->disableOriginalConstructor() ->getMock(); + $eavCustomAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class) + ->disableOriginalConstructor() + ->getMock(); $this->flatIndexerMock->expects($this->once())->method('getTablesStructure') ->willReturn( [ @@ -132,7 +141,8 @@ public function testBuild() $linkField => $statusAttributeMock ], 'catalog_product_entity_int' => [ - $linkField => $statusAttributeMock + $linkField => $statusAttributeMock, + $eavCustomField => $eavCustomAttributeMock ] ] ); @@ -155,6 +165,9 @@ public function testBuild() $statusAttributeMock->expects($this->atLeastOnce())->method('getBackend')->willReturn( $backendMock ); + $eavCustomAttributeMock->expects($this->atLeastOnce())->method('getBackend')->willReturn( + $backendMock + ); $statusAttributeMock->expects($this->atLeastOnce())->method('getId')->willReturn($statusId); $tableMock = $this->getMockBuilder(\Magento\Framework\DB\Ddl\Table::class) ->disableOriginalConstructor() @@ -185,12 +198,12 @@ public function testBuild() [ $temporaryTableName, "e.{$linkField} = {$temporaryTableName}.{$linkField}", - [$linkField] + [$linkField, $eavCustomField] ], [ $temporaryValueTableName, - "e.{$linkField} = " . $temporaryValueTableName . ".{$linkField}", - [$linkField] + "e.{$linkField} = {$temporaryValueTableName}.{$linkField}", + [$eavCustomValueField] ] )->willReturnSelf(); $this->metadataPoolMock->expects($this->atLeastOnce())->method('getMetadata')->with(ProductInterface::class) From aa5d9e6e86b38d250c50d0d0719aef10bf15dd76 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Wed, 2 Nov 2016 16:46:04 +0200 Subject: [PATCH 1587/3232] MAGETWO-59116: Stabilize builds - MAGETWO-55729 [Customer] Optimize performance for bundled products with lots of product options - Unit test fixes --- .../Catalog/Product/View/Type/BundleTest.php | 57 +++++++++++++------ 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php b/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php index f11fc30f5b28f..72cb634127404 100644 --- a/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php @@ -3,26 +3,28 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - namespace Magento\Bundle\Test\Unit\Block\Catalog\Product\View\Type; use Magento\Bundle\Block\Catalog\Product\View\Type\Bundle as BundleBlock; -use Magento\Framework\DataObject as MagentoObject; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class BundleTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Bundle\Model\Product\PriceFactory|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var \Magento\Bundle\Model\Product\PriceFactory|\PHPUnit_Framework_MockObject_MockObject + */ private $bundleProductPriceFactory; - /** @var \Magento\Framework\Json\Encoder|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var \Magento\Framework\Json\Encoder|\PHPUnit_Framework_MockObject_MockObject + */ private $jsonEncoder; - /** @var \Magento\Catalog\Helper\Product|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var \Magento\Catalog\Helper\Product|\PHPUnit_Framework_MockObject_MockObject + */ private $catalogProduct; /** @@ -30,7 +32,9 @@ class BundleTest extends \PHPUnit_Framework_TestCase */ private $eventManager; - /** @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject + */ private $product; /** @@ -86,6 +90,15 @@ protected function setUp() 'catalogProduct' => $this->catalogProduct ] ); + + $ruleProcessor = $this->getMockBuilder(\Magento\CatalogRule\Model\ResourceModel\Product\Collection::class) + ->disableOriginalConstructor() + ->getMock(); + $objectHelper->setBackwardCompatibleProperty( + $this->bundleBlock, + 'catalogRuleProcessor', + $ruleProcessor + ); } public function testGetOptionHtmlNoRenderer() @@ -138,7 +151,7 @@ public function testGetJsonConfigFixedPriceBundleNoOption() $options = []; $finalPriceMock = $this->getPriceMock( [ - 'getPriceWithoutOption' => new MagentoObject( + 'getPriceWithoutOption' => new \Magento\Framework\DataObject( [ 'value' => 100, 'base_amount' => 100, @@ -148,7 +161,7 @@ public function testGetJsonConfigFixedPriceBundleNoOption() ); $regularPriceMock = $this->getPriceMock( [ - 'getAmount' => new MagentoObject( + 'getAmount' => new \Magento\Framework\DataObject( [ 'value' => 110, 'base_amount' => 110, @@ -183,7 +196,9 @@ public function testGetJsonConfigFixedPriceBundle() 'Selection 1', 23, [ - ['price' => new MagentoObject(['base_amount' => $baseAmount, 'value' => $basePriceValue])] + ['price' => new \Magento\Framework\DataObject( + ['base_amount' => $baseAmount, 'value' => $basePriceValue] + )] ], true, true @@ -211,7 +226,7 @@ public function testGetJsonConfigFixedPriceBundle() ]; $finalPriceMock = $this->getPriceMock( [ - 'getPriceWithoutOption' => new MagentoObject( + 'getPriceWithoutOption' => new \Magento\Framework\DataObject( [ 'value' => 100, 'base_amount' => 100, @@ -221,7 +236,7 @@ public function testGetJsonConfigFixedPriceBundle() ); $regularPriceMock = $this->getPriceMock( [ - 'getAmount' => new MagentoObject( + 'getAmount' => new \Magento\Framework\DataObject( [ 'value' => 110, 'base_amount' => 110, @@ -269,7 +284,7 @@ public function testGetJsonConfigFixedPriceBundle() * @param array $options * @param \Magento\Framework\Pricing\PriceInfo\Base|\PHPUnit_Framework_MockObject_MockObject $priceInfo * @param string $priceType - * @return BundleBlock + * @return void */ private function updateBundleBlock($options, $priceInfo, $priceType) { @@ -281,6 +296,11 @@ private function updateBundleBlock($options, $priceInfo, $priceType) ->method('appendSelections') ->willReturn($options); + $selectionCollection = $this->getMockBuilder(\Magento\Bundle\Model\ResourceModel\Selection\Collection::class) + ->disableOriginalConstructor() + ->getMock(); + $selectionCollection->expects($this->once())->method('addTierPriceData'); + $typeInstance = $this->getMockBuilder(\Magento\Bundle\Model\Product\Type::class) ->disableOriginalConstructor() ->getMock(); @@ -290,6 +310,9 @@ private function updateBundleBlock($options, $priceInfo, $priceType) $typeInstance->expects($this->any()) ->method('getStoreFilter') ->willReturn(true); + $typeInstance->expects($this->once()) + ->method('getSelectionsCollection') + ->willReturn($selectionCollection); $this->product->expects($this->any()) ->method('getTypeInstance') @@ -368,7 +391,7 @@ private function getAmountPriceMock($value, $baseAmount, array $selectionAmounts ->with($selectionAmount['item']) ->will( $this->returnValue( - new MagentoObject( + new \Magento\Framework\DataObject( [ 'value' => $selectionAmount['value'], 'base_amount' => $selectionAmount['base_amount'], @@ -486,8 +509,8 @@ public function testGetOptions($stripSelection) ->willReturn($optionCollection); $typeInstance->expects($this->any())->method('getStoreFilter')->willReturn(true); $typeInstance->expects($this->any())->method('getOptionsCollection')->willReturn($optionCollection); - $typeInstance->expects($this->any())->method('getOptionsIds')->willReturn([1,2]); - $typeInstance->expects($this->once())->method('getSelectionsCollection')->with([1,2], $this->product) + $typeInstance->expects($this->any())->method('getOptionsIds')->willReturn([1, 2]); + $typeInstance->expects($this->once())->method('getSelectionsCollection')->with([1, 2], $this->product) ->willReturn($selectionConnection); $this->product->expects($this->any()) ->method('getTypeInstance')->willReturn($typeInstance); From b504d0a12510206f44bd2a0bc7264cb52ac5e28e Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Wed, 2 Nov 2016 16:58:54 +0200 Subject: [PATCH 1588/3232] MAGETWO-60045: Images are improperly matched with products --- app/code/Magento/Swatches/Helper/Data.php | 30 ++++++++++++++++++- .../Swatches/Test/Unit/Helper/DataTest.php | 14 +++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Swatches/Helper/Data.php b/app/code/Magento/Swatches/Helper/Data.php index 68a18ef8be6a1..a973a822c4101 100644 --- a/app/code/Magento/Swatches/Helper/Data.php +++ b/app/code/Magento/Swatches/Helper/Data.php @@ -63,6 +63,13 @@ class Data */ protected $imageHelper; + /** + * Product metadata pool + * + * @var \Magento\Framework\EntityManager\MetadataPool + */ + private $metadataPool; + /** * Data key which should populated to Attribute entity from "additional_data" field * @@ -196,7 +203,13 @@ public function loadVariationByFallback(Product $parentProduct, array $attribute } $productCollection = $this->productCollectionFactory->create(); - $this->addFilterByParent($productCollection, $parentProduct->getId()); + + $productLinkedFiled = $this->getMetadataPool() + ->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class) + ->getLinkField(); + $parentId = $parentProduct->getData($productLinkedFiled); + + $this->addFilterByParent($productCollection, $parentId); $configurableAttributes = $this->getAttributesFromConfigurable($parentProduct); $allAttributesArray = []; @@ -491,4 +504,19 @@ public function isTextSwatch(Attribute $attribute) } return $attribute->getData(Swatch::SWATCH_INPUT_TYPE_KEY) == Swatch::SWATCH_INPUT_TYPE_TEXT; } + + /** + * Get product metadata pool. + * + * @return \Magento\Framework\EntityManager\MetadataPool + * @deprecared + */ + protected function getMetadataPool() + { + if (!$this->metadataPool) { + $this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\EntityManager\MetadataPool::class); + } + return $this->metadataPool; + } } diff --git a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php index 6cf79dae309a5..44f07b060e174 100644 --- a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php @@ -46,6 +46,9 @@ class DataTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Api\ProductRepositoryInterface */ protected $productRepoMock; + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\EntityManager\MetadataPool*/ + private $metaDataPoolMock; + protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -108,7 +111,7 @@ protected function setUp() '', false ); - + $this->metaDataPoolMock = $this->getMock(\Magento\Framework\EntityManager\MetadataPool::class, [], [], '', false); $this->swatchHelperObject = $this->objectManager->getObject( \Magento\Swatches\Helper\Data::class, [ @@ -120,6 +123,9 @@ protected function setUp() 'imageHelper' => $this->imageHelperMock, ] ); + $this->objectManager->setBackwardCompatibleProperty( + $this->swatchHelperObject, 'metadataPool', $this->metaDataPoolMock + ); } public function dataForAdditionalData() @@ -246,12 +252,16 @@ public function dataForVariationWithSwatchImage() */ public function testLoadVariationByFallback($product) { + $metadataMock = $this->getMock(\Magento\Framework\EntityManager\EntityMetadataInterface::class); + $this->metaDataPoolMock->expects($this->once())->method('getMetadata')->willReturn($metadataMock); + $metadataMock->expects($this->once())->method('getLinkField')->willReturn('id'); + $this->getSwatchAttributes($product); $this->prepareVariationCollection(); $this->productCollectionMock->method('getFirstItem')->willReturn($this->productMock); - $this->productMock->method('getId')->willReturn(95); + $this->productMock->method('getData')->with('id')->willReturn(95); $this->productModelFactoryMock->method('create')->willReturn($this->productMock); $this->productMock->method('load')->with(95)->will($this->returnSelf()); From 69cf49f6921af44b5036c9cd6a09e53a6fd52e7e Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Wed, 2 Nov 2016 17:02:10 +0200 Subject: [PATCH 1589/3232] MAGETWO-59116: Stabilize builds - MAGETWO-55729 [Customer] Optimize performance for bundled products with lots of product options - Unit test fixes --- .../Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php b/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php index 4c7dc7bdb3ceb..8d9dccfd85f8f 100644 --- a/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php @@ -168,9 +168,10 @@ public function testGetterAmount($amountForBundle, $optionList, $expectedResult) ->getMock(); $selectionsCollection->expects($this->any())->method('getIterator') ->willReturn(new \ArrayIterator($option->getSelections())); + $selectionsCollection->expects($this->atLeastOnce())->method('getFirstItem') + ->willReturn($option->getSelections()[0]); - - $typeInstance->expects($this->at($index + 2))->method('getSelectionsCollection') + $typeInstance->expects($this->atLeastOnce())->method('getSelectionsCollection') ->willReturn($selectionsCollection); } From 00090299cf4964c51ca9337ecea289ec91191e9a Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Wed, 2 Nov 2016 17:31:08 +0200 Subject: [PATCH 1590/3232] MAGETWO-59116: Stabilize builds - MAGETWO-55729 [Customer] Optimize performance for bundled products with lots of product options - Unit test fixes --- .../Magento/Bundle/Test/Unit/Model/Product/TypeTest.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php index dc15017be9d4d..004e717f15680 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php @@ -138,8 +138,6 @@ protected function setUp() ] ); - $objectHelper->setBackwardCompatibleProperty($this->model, 'catalogRuleProcessor', $this->catalogRuleProcessor); - } /** @@ -2096,10 +2094,7 @@ public function testIsSalableFalse() */ public function testIsSalableWithoutOptions() { - $optionCollectionMock = $this->getMockBuilder(\Magento\Bundle\Model\ResourceModel\Option\Collection::class) - ->disableOriginalConstructor() - ->getMock(); - + $optionCollectionMock = $this->getOptionCollectionMock([]); $product = new \Magento\Framework\DataObject( [ 'is_salable' => true, From a9ce69f1bf22681f294968eedebc7c5fcc944a36 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 11:00:27 -0500 Subject: [PATCH 1591/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Removing obsolete code --- .../Framework/App/ObjectManagerFactory.php | 32 +-------- .../Interception/Definition/Compiled.php | 39 ----------- .../Test/Unit/Definition/CompiledTest.php | 24 ------- .../ObjectManager/DefinitionFactory.php | 33 ++------- .../ObjectManager/Relations/Compiled.php | 55 --------------- .../Test/Unit/Definition/CompiledTest.php | 68 ------------------- .../Test/Unit/DefinitionFactoryTest.php | 41 ++++------- .../Test/Unit/Relations/CompiledTest.php | 27 -------- 8 files changed, 17 insertions(+), 302 deletions(-) delete mode 100644 lib/internal/Magento/Framework/Interception/Definition/Compiled.php delete mode 100644 lib/internal/Magento/Framework/Interception/Test/Unit/Definition/CompiledTest.php delete mode 100644 lib/internal/Magento/Framework/ObjectManager/Relations/Compiled.php delete mode 100644 lib/internal/Magento/Framework/ObjectManager/Test/Unit/Definition/CompiledTest.php delete mode 100644 lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/CompiledTest.php diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index a16795ec6c9a6..a67304d798609 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -117,11 +117,10 @@ public function create(array $arguments) $arguments = array_merge($deploymentConfig->get(), $arguments); $definitionFactory = new \Magento\Framework\ObjectManager\DefinitionFactory( $this->driverPool->getDriver(DriverPool::FILE), - new \Magento\Framework\Serialize\Serializer\Json(), $this->directoryList->getPath(DirectoryList::GENERATION) ); - $definitions = $definitionFactory->createClassDefinition($deploymentConfig->get('definitions')); + $definitions = $definitionFactory->createClassDefinition(); $relations = $definitionFactory->createRelations(); /** @var EnvironmentFactory $envFactory */ @@ -287,33 +286,4 @@ protected function _loadPrimaryConfig(DirectoryList $directoryList, $driverPool, } return $configData; } - - /** - * Crete plugin list object - * - * @param \Magento\Framework\ObjectManagerInterface $objectManager - * @param \Magento\Framework\ObjectManager\RelationsInterface $relations - * @param \Magento\Framework\ObjectManager\DefinitionFactory $definitionFactory - * @param \Magento\Framework\ObjectManager\Config\Config $diConfig - * @param \Magento\Framework\ObjectManager\DefinitionInterface $definitions - * @return \Magento\Framework\Interception\PluginList\PluginList - */ - protected function _createPluginList( - \Magento\Framework\ObjectManagerInterface $objectManager, - \Magento\Framework\ObjectManager\RelationsInterface $relations, - \Magento\Framework\ObjectManager\DefinitionFactory $definitionFactory, - \Magento\Framework\ObjectManager\Config\Config $diConfig, - \Magento\Framework\ObjectManager\DefinitionInterface $definitions - ) { - return $objectManager->create( - \Magento\Framework\Interception\PluginList\PluginList::class, - [ - 'relations' => $relations, - 'definitions' => $definitionFactory->createPluginDefinition(), - 'omConfig' => $diConfig, - 'classDefinitions' => $definitions instanceof - \Magento\Framework\ObjectManager\Definition\Compiled ? $definitions : null - ] - ); - } } diff --git a/lib/internal/Magento/Framework/Interception/Definition/Compiled.php b/lib/internal/Magento/Framework/Interception/Definition/Compiled.php deleted file mode 100644 index 6fbe9c99dce86..0000000000000 --- a/lib/internal/Magento/Framework/Interception/Definition/Compiled.php +++ /dev/null @@ -1,39 +0,0 @@ -_definitions = $definitions; - } - - /** - * Retrieve list of methods - * - * @param string $type - * @return string[] - */ - public function getMethodList($type) - { - return $this->_definitions[$type]; - } -} diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Definition/CompiledTest.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Definition/CompiledTest.php deleted file mode 100644 index a64cd96b62966..0000000000000 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Definition/CompiledTest.php +++ /dev/null @@ -1,24 +0,0 @@ - 'definitions']; - - /** - * @covers \Magento\Framework\Interception\Definition\Compiled::getMethodList - * @covers \Magento\Framework\Interception\Definition\Compiled::__construct - */ - public function testGetMethodList() - { - $model = new \Magento\Framework\Interception\Definition\Compiled($this->_definitions); - $this->assertEquals('definitions', $model->getMethodList('type')); - } -} diff --git a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php index 7d9c3ea5e0b21..79d398e3da079 100644 --- a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php +++ b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php @@ -10,7 +10,6 @@ use Magento\Framework\ObjectManager\Definition\Runtime; use Magento\Framework\ObjectManager\Profiler\Code\Generator as ProfilerGenerator; use Magento\Framework\Serialize\SerializerInterface; -use Magento\Framework\ObjectManager\Definition\Compiled; use Magento\Framework\Code\Generator\Autoloader; /** @@ -44,39 +43,26 @@ class DefinitionFactory /** * @param DriverInterface $filesystemDriver - * @param SerializerInterface $serializer * @param string $generationDir */ public function __construct( DriverInterface $filesystemDriver, - SerializerInterface $serializer, $generationDir ) { $this->_filesystemDriver = $filesystemDriver; - $this->serializer = $serializer; $this->_generationDir = $generationDir; } /** * Create class definitions * - * @param mixed $definitions * @return DefinitionInterface */ - public function createClassDefinition($definitions = false) + public function createClassDefinition() { - if ($definitions) { - if (is_string($definitions)) { - $definitions = $this->_unpack($definitions); - } - $result = new Compiled($definitions); - } else { - $autoloader = new Autoloader($this->getCodeGenerator()); - spl_autoload_register([$autoloader, 'load']); - - $result = new Runtime(); - } - return $result; + $autoloader = new Autoloader($this->getCodeGenerator()); + spl_autoload_register([$autoloader, 'load']); + return new Runtime(); } /** @@ -99,17 +85,6 @@ public function createRelations() return new \Magento\Framework\ObjectManager\Relations\Runtime(); } - /** - * Un-compress definitions - * - * @param string $definitions - * @return mixed - */ - protected function _unpack($definitions) - { - return $this->serializer->unserialize($definitions); - } - /** * Get existing code generator. Instantiate a new one if it does not exist yet. * diff --git a/lib/internal/Magento/Framework/ObjectManager/Relations/Compiled.php b/lib/internal/Magento/Framework/ObjectManager/Relations/Compiled.php deleted file mode 100644 index 71455dbf9acd4..0000000000000 --- a/lib/internal/Magento/Framework/ObjectManager/Relations/Compiled.php +++ /dev/null @@ -1,55 +0,0 @@ -_relations = $relations; - } - - /** - * Check whether requested type is available for read - * - * @param string $type - * @return bool - */ - public function has($type) - { - return isset($this->_relations[$type]); - } - - /** - * Retrieve parents for class - * - * @param string $type - * @return array - */ - public function getParents($type) - { - return $this->_relations[$type]; - } -} diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Definition/CompiledTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Definition/CompiledTest.php deleted file mode 100644 index 49616e6765874..0000000000000 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Definition/CompiledTest.php +++ /dev/null @@ -1,68 +0,0 @@ -objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - } - - /** - * @param array $signatures - * @param array $definitions - * @param mixed $expected - * @dataProvider getParametersDataProvider - */ - public function testGetParametersWithoutDefinition($signatures, $definitions, $expected) - { - $model = new \Magento\Framework\ObjectManager\Definition\Compiled([$signatures, $definitions]); - $this->assertEquals($expected, $model->getParameters('wonderful')); - } - - public function getParametersDataProvider() - { - $wonderfulSignature = new \stdClass(); - return [ - [ - [], - ['wonderful' => null], - null, - ], - [ - ['wonderfulClass' => $wonderfulSignature], - ['wonderful' => 'wonderfulClass'], - $wonderfulSignature, - ] - ]; - } - - public function testGetParametersWithUnpacking() - { - $checkString = 'code to pack'; - $signatures = ['wonderfulClass' => json_encode($checkString)]; - $definitions = ['wonderful' => 'wonderfulClass']; - $object = new \Magento\Framework\ObjectManager\Definition\Compiled([$signatures, $definitions]); - $serializerMock = $this->getMock(SerializerInterface::class); - $serializerMock->expects($this->once()) - ->method('unserialize') - ->willReturnCallback(function ($data) { - return json_decode($data, true); - }); - $this->objectManagerHelper->setBackwardCompatibleProperty( - $object, - 'serializer', - $serializerMock - ); - $this->assertEquals($checkString, $object->getParameters('wonderful')); - } -} diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php index 8ad1ac13a12cd..99db458c11953 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php @@ -5,11 +5,11 @@ */ namespace Magento\Framework\ObjectManager\Test\Unit; -use Magento\Framework\ObjectManager\Definition\Compiled; -use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\Filesystem\Driver\File; use Magento\Framework\ObjectManager\DefinitionFactory; -use Magento\Framework\ObjectManager\Definition\Runtime; +use Magento\Framework\ObjectManager\DefinitionInterface; +use Magento\Framework\Interception\DefinitionInterface as InterceptionDefinitionInterface; +use Magento\Framework\ObjectManager\RelationsInterface; class DefinitionFactoryTest extends \PHPUnit_Framework_TestCase { @@ -18,11 +18,6 @@ class DefinitionFactoryTest extends \PHPUnit_Framework_TestCase */ private $filesystemDriverMock; - /** - * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $serializerMock; - /** * @var DefinitionFactory */ @@ -34,43 +29,31 @@ protected function setUp() $this->serializerMock = $this->getMock(SerializerInterface::class); $this->definitionFactory = new DefinitionFactory( $this->filesystemDriverMock, - $this->serializerMock, 'generation dir' ); } - public function testCreateClassDefinitionSerialized() + public function testCreateClassDefinition() { - $serializedDefinitions = 'serialized definitions'; - $definitions = [[], []]; - $this->serializerMock->expects($this->once()) - ->method('unserialize') - ->with($serializedDefinitions) - ->willReturn($definitions); $this->assertInstanceOf( - Compiled::class, - $this->definitionFactory->createClassDefinition($serializedDefinitions) + DefinitionInterface::class, + $this->definitionFactory->createClassDefinition() ); } - public function testCreateClassDefinitionArray() + public function testCreatePluginDefinition() { - $definitions = [[], []]; - $this->serializerMock->expects($this->never()) - ->method('unserialize'); $this->assertInstanceOf( - Compiled::class, - $this->definitionFactory->createClassDefinition($definitions) + InterceptionDefinitionInterface::class, + $this->definitionFactory->createPluginDefinition() ); } - public function testCreateClassDefinition() + public function testCreateRelations() { - $this->serializerMock->expects($this->never()) - ->method('unserialize'); $this->assertInstanceOf( - Runtime::class, - $this->definitionFactory->createClassDefinition() + RelationsInterface::class, + $this->definitionFactory->createRelations() ); } } diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/CompiledTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/CompiledTest.php deleted file mode 100644 index 336a798df100e..0000000000000 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/CompiledTest.php +++ /dev/null @@ -1,27 +0,0 @@ - 'yes']; - - $model = new \Magento\Framework\ObjectManager\Relations\Compiled($relations); - $this->assertEquals(true, $model->has('amazing')); - $this->assertEquals(false, $model->has('fuzzy')); - } - - public function testGetParents() - { - $relations = ['amazing' => 'parents']; - - $model = new \Magento\Framework\ObjectManager\Relations\Compiled($relations); - $this->assertEquals('parents', $model->getParents('amazing')); - } -} From 3660d01225cd2e96e3de3a43bcba03baba67dc8a Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Wed, 2 Nov 2016 18:33:34 +0200 Subject: [PATCH 1592/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -remove ScopePool and ReaderPool --- .../Backend/Catalog/Url/Rewrite/Suffix.php | 18 +- .../Magento/Cron/Model/Config/Reader/Db.php | 13 +- .../Test/Unit/Model/Config/Reader/DbTest.php | 16 +- app/code/Magento/Cron/etc/di.xml | 5 - .../Eav/Model/Entity/AttributeCache.php | 2 +- app/code/Magento/Store/etc/di.xml | 67 ------ app/etc/di.xml | 5 - .../testsuite/Magento/Test/App/ConfigTest.php | 6 +- lib/internal/Magento/Framework/App/Config.php | 9 +- .../App/Config/Scope/ReaderPoolInterface.php | 17 -- .../Framework/App/Config/ScopePool.php | 166 --------------- .../Framework/App/MutableScopeConfig.php | 31 ++- .../Framework/App/ReinitableConfig.php | 4 +- .../App/Test/Unit/Config/ScopePoolTest.php | 194 ------------------ .../Framework/App/Test/Unit/ConfigTest.php | 6 +- .../App/Test/Unit/ReinitableConfigTest.php | 22 -- .../Magento/Framework/Config/ReaderPool.php | 36 ---- 17 files changed, 61 insertions(+), 556 deletions(-) delete mode 100644 lib/internal/Magento/Framework/App/Config/Scope/ReaderPoolInterface.php delete mode 100644 lib/internal/Magento/Framework/App/Config/ScopePool.php delete mode 100644 lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php delete mode 100644 lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php delete mode 100644 lib/internal/Magento/Framework/Config/ReaderPool.php diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index c1f37eca1c55c..e441d703dcd9c 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -41,9 +41,9 @@ class Suffix extends \Magento\Framework\App\Config\Value protected $resource; /** - * @var \Magento\Framework\App\Config\ScopePool + * @var \Magento\Framework\App\Config */ - private $scopePool; + private $appConfig; /** * @param \Magento\Framework\Model\Context $context @@ -83,17 +83,17 @@ public function __construct( /** * Get instance of ScopePool * - * @return \Magento\Framework\App\Config\ScopePool + * @return \Magento\Framework\App\Config * @deprecated */ - private function getScopePool() + private function getAppConfig() { - if ($this->scopePool === null) { - $this->scopePool = \Magento\Framework\App\ObjectManager::getInstance()->get( - \Magento\Framework\App\Config\ScopePool::class + if ($this->appConfig === null) { + $this->appConfig = \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\App\Config::class ); } - return $this->scopePool; + return $this->appConfig; } /** @@ -177,7 +177,7 @@ protected function updateSuffixForUrlRewrites() if ($this->getValue() !== null) { $suffix = $this->getValue(); } else { - $this->getScopePool()->clean(); + $this->getAppConfig()->clean(); $suffix = $this->_config->getValue($this->getPath()); } foreach ($entities as $urlRewrite) { diff --git a/app/code/Magento/Cron/Model/Config/Reader/Db.php b/app/code/Magento/Cron/Model/Config/Reader/Db.php index 1a58c14470038..68434e121cb7d 100644 --- a/app/code/Magento/Cron/Model/Config/Reader/Db.php +++ b/app/code/Magento/Cron/Model/Config/Reader/Db.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Cron\Model\Config\Reader; +use Magento\Framework\App\Config; /** * Reader for cron parameters from data base storage @@ -21,19 +22,23 @@ class Db * @var \Magento\Framework\App\Config\Scope\ReaderInterface */ protected $_reader; + /** + * @var Config + */ + private $config; /** * Initialize parameters * - * @param \Magento\Framework\App\Config\Scope\ReaderInterface $defaultReader + * @param Config $config * @param \Magento\Cron\Model\Config\Converter\Db $converter */ public function __construct( - \Magento\Framework\App\Config\Scope\ReaderInterface $defaultReader, + Config $config, \Magento\Cron\Model\Config\Converter\Db $converter ) { - $this->_reader = $defaultReader; $this->_converter = $converter; + $this->config = $config; } /** @@ -43,6 +48,6 @@ public function __construct( */ public function get() { - return $this->_converter->convert($this->_reader->read()); + return $this->_converter->convert($this->config->get('system/default')); } } diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php b/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php index 90c0f2c496605..b291e51fc6b71 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ namespace Magento\Cron\Test\Unit\Model\Config\Reader; +use Magento\Framework\App\Config; +use Magento\GoogleAdwords\Block\Code; /** * Test reading for cron parameters from data base storage @@ -13,9 +15,9 @@ class DbTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Config | \PHPUnit_Framework_MockObject_MockObject */ - protected $_defaultReader; + protected $config; /** * @var \Magento\Cron\Model\Config\Converter\Db|\PHPUnit_Framework_MockObject_MockObject @@ -32,11 +34,11 @@ class DbTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->_defaultReader = $this->getMockBuilder( - \Magento\Framework\App\Config\Scope\ReaderInterface::class - )->getMockForAbstractClass(); + $this->config = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); $this->_converter = new \Magento\Cron\Model\Config\Converter\Db(); - $this->_reader = new \Magento\Cron\Model\Config\Reader\Db($this->_defaultReader, $this->_converter); + $this->_reader = new \Magento\Cron\Model\Config\Reader\Db($this->config, $this->_converter); } /** @@ -47,7 +49,7 @@ public function testGet() $job1 = ['schedule' => ['cron_expr' => '* * * * *']]; $job2 = ['schedule' => ['cron_expr' => '1 1 1 1 1']]; $data = ['crontab' => ['default' => ['jobs' => ['job1' => $job1, 'job2' => $job2]]]]; - $this->_defaultReader->expects($this->once())->method('read')->will($this->returnValue($data)); + $this->config->expects($this->once())->method('get')->with('system/default')->will($this->returnValue($data)); $expected = [ 'default' => [ 'job1' => ['schedule' => $job1['schedule']['cron_expr']], diff --git a/app/code/Magento/Cron/etc/di.xml b/app/code/Magento/Cron/etc/di.xml index a1fcb7dc80c79..d5624e96765c5 100644 --- a/app/code/Magento/Cron/etc/di.xml +++ b/app/code/Magento/Cron/etc/di.xml @@ -8,11 +8,6 @@ - - - DefaultScopeReader - - diff --git a/app/code/Magento/Eav/Model/Entity/AttributeCache.php b/app/code/Magento/Eav/Model/Entity/AttributeCache.php index 865fc5ebb5b1e..0597b08746698 100644 --- a/app/code/Magento/Eav/Model/Entity/AttributeCache.php +++ b/app/code/Magento/Eav/Model/Entity/AttributeCache.php @@ -120,7 +120,7 @@ public function saveAttributes($entityType, $attributes, $suffix = '') [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, \Magento\Eav\Model\Entity\Attribute::CACHE_TAG, - \Magento\Framework\App\Config\ScopePool::CACHE_TAG + \Magento\Framework\App\Config::SCOPE_CACHE_TAGE ] ); } diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml index ad1766bae3291..774eed7042009 100644 --- a/app/code/Magento/Store/etc/di.xml +++ b/app/code/Magento/Store/etc/di.xml @@ -33,12 +33,6 @@ Magento\Framework\App\Response\HeaderProvider\XFrameOptions::DEPLOYMENT_CONFIG_X_FRAME_OPT - - - Magento\Framework\Config\ReaderPool\Proxy - Magento\Framework\App\Cache\Type\Config - - store @@ -59,7 +53,6 @@ Magento\Store\Model\StoreManagerInterface\Proxy - @@ -322,66 +315,6 @@ - - - - - DefaultScopeReader - WebsiteScopeReader - WebsiteScopeReader - StoreScopeReader - StoreScopeReader - - - - - - - - Magento\Store\Model\Config\Reader\Source\Initial\DefaultScope - false - 10 - - - Magento\Store\Model\Config\Reader\Source\Dynamic\DefaultScope - false - 100 - - - - - - - - - Magento\Store\Model\Config\Reader\Source\Initial\Website - false - 10 - - - Magento\Store\Model\Config\Reader\Source\Dynamic\Website - false - 100 - - - - - - - - - Magento\Store\Model\Config\Reader\Source\Initial\Store - false - 10 - - - Magento\Store\Model\Config\Reader\Source\Dynamic\Store - false - 100 - - - - diff --git a/app/etc/di.xml b/app/etc/di.xml index 643390068a5e3..61abf896fa035 100755 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -955,11 +955,6 @@ Magento\Framework\View\Design\Theme\Image\Uploader\Proxy - - - Magento\Framework\App\Cache\Type\Config - - Magento\Framework\App\Config\Initial\Reader\Proxy diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/App/ConfigTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/App/ConfigTest.php index 541122a45571d..508550fc1385a 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/App/ConfigTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/App/ConfigTest.php @@ -10,7 +10,6 @@ namespace Magento\Test\App; use Magento\Framework\App\Config\ScopeCodeResolver; -use Magento\Framework\App\Config\ScopePool; use Magento\TestFramework\App\Config; class ConfigTest extends \PHPUnit_Framework_TestCase @@ -22,13 +21,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function setUp() { - $scopePool = $this->getMockBuilder(ScopePool::class) - ->disableOriginalConstructor() - ->getMock(); $scopeCodeResolver = $this->getMockBuilder(ScopeCodeResolver::class) ->disableOriginalConstructor() ->getMock(); - $this->model = new Config($scopePool, $scopeCodeResolver); + $this->model = new Config($scopeCodeResolver); } public function testGet() diff --git a/lib/internal/Magento/Framework/App/Config.php b/lib/internal/Magento/Framework/App/Config.php index 7cc78b8f22457..307744e137bae 100644 --- a/lib/internal/Magento/Framework/App/Config.php +++ b/lib/internal/Magento/Framework/App/Config.php @@ -7,7 +7,6 @@ */ namespace Magento\Framework\App; -use Magento\Framework\App\Config\ScopePool; use Magento\Framework\App\Config\ScopeCodeResolver; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Config\ConfigTypeInterface; @@ -22,10 +21,7 @@ class Config implements ScopeConfigInterface */ const CACHE_TAG = 'CONFIG'; - /** - * @var ScopePool - */ - protected $_scopePool; + const SCOPE_CACHE_TAGE = "config_scopes"; /** * @var ScopeCodeResolver @@ -40,16 +36,13 @@ class Config implements ScopeConfigInterface /** * Config constructor. * - * @param ScopePool $scopePool * @param ScopeCodeResolver $scopeCodeResolver * @param array $types */ public function __construct( - ScopePool $scopePool, ScopeCodeResolver $scopeCodeResolver, array $types = [] ) { - $this->_scopePool = $scopePool; $this->scopeCodeResolver = $scopeCodeResolver; $this->types = $types; } diff --git a/lib/internal/Magento/Framework/App/Config/Scope/ReaderPoolInterface.php b/lib/internal/Magento/Framework/App/Config/Scope/ReaderPoolInterface.php deleted file mode 100644 index 9c2b66dad2860..0000000000000 --- a/lib/internal/Magento/Framework/App/Config/Scope/ReaderPoolInterface.php +++ /dev/null @@ -1,17 +0,0 @@ -_readerPool = $readerPool; - $this->_dataFactory = $dataFactory; - $this->_cache = $cache; - $this->_cacheId = $cacheId; - $this->_scopeResolverPool = $scopeResolverPool; - } - - /** - * @deprecated - * @return RequestInterface - */ - private function getRequest() - { - if ($this->request === null) { - $this->request = ObjectManager::getInstance()->get(RequestInterface::class); - } - return $this->request; - } - - /** - * @deprecated - * @return ScopeCodeResolver - */ - public function getScopeCodeResolver() - { - if ($this->scopeCodeResolver === null) { - $this->scopeCodeResolver = ObjectManager::getInstance()->get(ScopeCodeResolver::class); - } - return $this->scopeCodeResolver; - } - - /** - * Retrieve config section - * - * @param string $scopeType - * @param string|\Magento\Framework\DataObject|null $scopeCode - * @return \Magento\Framework\App\Config\DataInterface - */ - public function getScope($scopeType, $scopeCode = null) - { - $scopeCode = $this->_getScopeCode($scopeType, $scopeCode); - - $code = $scopeType . '|' . $scopeCode; - - if (!isset($this->_scopes[$code])) { - // Key by url to support dynamic {{base_url}} and port assignments - $host = $this->getRequest()->getHttpHost(); - $port = $this->getRequest()->getServer('SERVER_PORT'); - $path = $this->getRequest()->getBasePath(); - - $urlInfo = $host . $port . trim($path, '/'); - $cacheKey = $this->_cacheId . '|' . $code . '|' . $urlInfo; - $data = $this->_cache->load($cacheKey); - - if ($data) { - $data = unserialize($data); - } else { - $reader = $this->_readerPool->getReader($scopeType); - if ($scopeType === ScopeConfigInterface::SCOPE_TYPE_DEFAULT) { - $data = $reader->read(); - } else { - $data = $reader->read($scopeCode); - } - - $this->_cache->save(serialize($data), $cacheKey, [self::CACHE_TAG]); - } - $this->_scopes[$code] = $this->_dataFactory->create(['data' => $data]); - } - return $this->_scopes[$code]; - } - - /** - * Clear cache of all scopes - * - * @return void - */ - public function clean() - { - $this->_scopes = []; - $this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, [self::CACHE_TAG]); - } - - /** - * Retrieve scope code value - * - * @param string $scopeType - * @param string|\Magento\Framework\DataObject|null $scopeCode - * @return string - */ - protected function _getScopeCode($scopeType, $scopeCode) - { - return $this->getScopeCodeResolver()->resolve($scopeType, $scopeCode); - } -} diff --git a/lib/internal/Magento/Framework/App/MutableScopeConfig.php b/lib/internal/Magento/Framework/App/MutableScopeConfig.php index 6166dac40e8c9..06bb1c1119a5d 100644 --- a/lib/internal/Magento/Framework/App/MutableScopeConfig.php +++ b/lib/internal/Magento/Framework/App/MutableScopeConfig.php @@ -16,6 +16,23 @@ */ class MutableScopeConfig extends Config implements MutableScopeConfigInterface { + private $data; + + /** + * @inheritdoc + */ + public function getValue( + $path = null, + $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + $scopeCode = null + ) { + if (isset($this->data[$scope][$scopeCode][$path])) { + return $this->data[$scope][$scopeCode][$path]; + } + + return parent::getValue($path, $scope, $scopeCode); + } + /** * Set config value in the corresponding config scope * @@ -31,9 +48,15 @@ public function setValue( $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null ) { - if (empty($scopeCode)) { - $scopeCode = null; - } - $this->_scopePool->getScope($scope, $scopeCode)->setValue($path, $value); + $this->data[$scope][$scopeCode][$path] = $value; + } + + /** + * @inheritdoc + */ + public function clean() + { + $this->data = null; + parent::clean(); } } diff --git a/lib/internal/Magento/Framework/App/ReinitableConfig.php b/lib/internal/Magento/Framework/App/ReinitableConfig.php index b98ede77fe133..a5838f4877061 100644 --- a/lib/internal/Magento/Framework/App/ReinitableConfig.php +++ b/lib/internal/Magento/Framework/App/ReinitableConfig.php @@ -9,6 +9,7 @@ /** * @inheritdoc + * @deprecated */ class ReinitableConfig extends MutableScopeConfig implements ReinitableConfigInterface { @@ -17,7 +18,8 @@ class ReinitableConfig extends MutableScopeConfig implements ReinitableConfigInt */ public function reinit() { - $this->_scopePool->clean(); + $this->clean(); return $this; } } + diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php deleted file mode 100644 index d252ede3a6241..0000000000000 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php +++ /dev/null @@ -1,194 +0,0 @@ -_readerPool = $this->getMockForAbstractClass(ReaderPoolInterface::class); - $this->_reader = $this->getMockForAbstractClass(ReaderInterface::class); - $this->_dataFactory = $this->getMockBuilder( - \Magento\Framework\App\Config\DataFactory::class - )->disableOriginalConstructor()->getMock(); - $this->_cache = $this->getMock(\Magento\Framework\Cache\FrontendInterface::class); - $this->_object = $helper->getObject( - \Magento\Framework\App\Config\ScopePool::class, - [ - 'readerPool' => $this->_readerPool, - 'dataFactory' => $this->_dataFactory, - 'cache' => $this->_cache, - 'cacheId' => 'test_cache_id' - ] - ); - - $requestMock = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class) - ->disableOriginalConstructor() - ->setMethods( - [ - 'getBasePath', - 'getModuleName', - 'setModuleName', - 'getActionName', - 'setActionName', - 'getParam', - 'getParams', - 'setParams', - 'getCookie', - 'isSecure', - 'getServer', - 'getHttpHost' - ] - )->getMock(); - $reflection = new \ReflectionClass(get_class($this->_object)); - $reflectionProperty = $reflection->getProperty('request'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->_object, $requestMock); - $requestMock->expects($this->any()) - ->method('getBasePath') - ->willReturn('baseUrl'); - - $this->scopeCodeResolver = $this->getMockBuilder(ScopeCodeResolver::class) - ->disableOriginalConstructor() - ->getMock(); - $reflection = new \ReflectionClass(get_class($this->_object)); - $reflectionProperty = $reflection->getProperty('scopeCodeResolver'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->_object, $this->scopeCodeResolver); - } - - /** - * @dataProvider getScopeDataProvider - * - * @param string $scopeType - * @param string $scope - * @param array $data - * @param string|null $cachedData - */ - public function testGetScope($scopeType, $scope, array $data, $cachedData) - { - $scopeCode = $scope instanceof \Magento\Framework\App\ScopeInterface ? $scope->getCode() : $scope; - $cacheKey = "test_cache_id|{$scopeType}|{$scopeCode}|baseUrl"; - - $this->scopeCodeResolver->expects($this->atLeastOnce()) - ->method('resolve') - ->willReturn($scopeCode); - - $this->_readerPool->expects( - $this->any() - )->method( - 'getReader' - )->with( - $scopeType - )->will( - $this->returnValue($this->_reader) - ); - $this->_cache->expects($this->once())->method('load')->with($cacheKey)->will($this->returnValue($cachedData)); - - if (!$cachedData) { - $this->_reader->expects($this->once())->method('read')->with('testScope')->will($this->returnValue($data)); - $this->_cache->expects( - $this->once() - )->method( - 'save' - )->with( - serialize($data), - $cacheKey, - [\Magento\Framework\App\Config\ScopePool::CACHE_TAG] - ); - } - - $configData = $this->getMockBuilder(\Magento\Framework\App\Config\Data::class) - ->disableOriginalConstructor() - ->getMock(); - $this->_dataFactory->expects( - $this->once() - )->method( - 'create' - )->with( - ['data' => $data] - )->will( - $this->returnValue($configData) - ); - $this->assertInstanceOf( - \Magento\Framework\App\Config\DataInterface::class, - $this->_object->getScope($scopeType, $scope) - ); - - // second call to check caching - $this->assertInstanceOf( - \Magento\Framework\App\Config\DataInterface::class, - $this->_object->getScope($scopeType, $scope) - ); - } - - public function getScopeDataProvider() - { - $baseScope = $this->getMockForAbstractClass(\Magento\Framework\App\ScopeInterface::class); - $baseScope->expects($this->any())->method('getCode')->will($this->returnValue('testScope')); - return [ - ['scopeType1', 'testScope', ['key' => 'value'], null], - ['scopeType2', 'testScope', ['key' => 'value'], serialize(['key' => 'value'])], - ['scopeType1', $baseScope, ['key' => 'value'], null] - ]; - } - - public function testClean() - { - $this->scopeCodeResolver->expects($this->never()) - ->method('resolve') - ->willReturnArgument(1); - $this->_cache->expects( - $this->once() - )->method( - 'clean' - )->with( - \Zend_Cache::CLEANING_MODE_MATCHING_TAG, - [\Magento\Framework\App\Config\ScopePool::CACHE_TAG] - ); - $this->_object->clean('testScope'); - } -} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php index 97b5cc752adf9..d2474829693e4 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php @@ -8,7 +8,6 @@ use Magento\Framework\App\Config; use Magento\Framework\App\Config\ConfigTypeInterface; use Magento\Framework\App\Config\ScopeCodeResolver; -use Magento\Framework\App\Config\ScopePool; use Magento\Framework\App\ScopeInterface; class ConfigTest extends \PHPUnit_Framework_TestCase @@ -35,9 +34,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function setUp() { - $scopePool = $this->getMockBuilder(ScopePool::class) - ->disableOriginalConstructor() - ->getMock(); $this->scopeCodeResolver = $this->getMockBuilder(ScopeCodeResolver::class) ->disableOriginalConstructor() ->getMock(); @@ -46,7 +42,7 @@ public function setUp() $this->scope = $this->getMockBuilder(ScopeInterface::class) ->getMockForAbstractClass(); - $this->appConfig = new Config($scopePool, $this->scopeCodeResolver, ['system' => $this->configType]); + $this->appConfig = new Config($this->scopeCodeResolver, ['system' => $this->configType]); } /** diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php deleted file mode 100644 index 9a35aa9104e80..0000000000000 --- a/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php +++ /dev/null @@ -1,22 +0,0 @@ -getMock(\Magento\Framework\App\Config\ScopePool::class, ['clean'], [], '', false); - $scopePool->expects($this->once())->method('clean'); - /** @var \Magento\Framework\App\ReinitableConfig $config */ - $config = $helper->getObject(\Magento\Framework\App\ReinitableConfig::class, ['scopePool' => $scopePool]); - $this->assertInstanceOf(\Magento\Framework\App\Config\ReinitableConfigInterface::class, $config->reinit()); - } -} diff --git a/lib/internal/Magento/Framework/Config/ReaderPool.php b/lib/internal/Magento/Framework/Config/ReaderPool.php deleted file mode 100644 index 18bfd660c0e8a..0000000000000 --- a/lib/internal/Magento/Framework/Config/ReaderPool.php +++ /dev/null @@ -1,36 +0,0 @@ -_readers = $readers; - } - - /** - * Retrieve reader by scope type - * - * @param string $scopeType - * @return mixed - */ - public function getReader($scopeType) - { - return $this->_readers[$scopeType]; - } -} From 2dfec226fa93379c1e12c277943cf3f9ff1cd5ef Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Wed, 2 Nov 2016 18:55:28 +0200 Subject: [PATCH 1593/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - removed unnecessary class dependence --- .../Magento/Bundle/Model/Product/BundlePriceAbstract.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php index 86bc9f2c80744..e69de8d62ef53 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php @@ -6,8 +6,6 @@ namespace Magento\Bundle\Model\Product; -use Zend\Console\Exception\InvalidArgumentException; - /** * Abstract class for testing bundle prices */ @@ -41,7 +39,6 @@ abstract public function getTestCases(); * @param array $strategyModifiers * @param string $productSku * @return \Magento\Catalog\Api\Data\ProductInterface - * @throws InvalidArgumentException * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\StateException @@ -56,7 +53,7 @@ protected function prepareFixture($strategyModifiers, $productSku) array_unshift($modifier['data'], $bundleProduct); $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); } else { - throw new InvalidArgumentException( + throw new \Magento\Framework\Exception\InputException( sprintf('Modifier %s does not exists', $modifier['modifierName']) ); } From 6a2f1a503e94c4b293041ed3f214e411b48e2fe9 Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Wed, 2 Nov 2016 18:56:43 +0200 Subject: [PATCH 1594/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- .../Model/View/Asset/Image/ContextTest.php | 77 +++++++++ .../Test/Unit/Model/View/Asset/ImageTest.php | 148 ++++++++++++++++ .../Unit/Model/View/Asset/PlaceholderTest.php | 163 ++++++++++++++++++ .../Test/Unit/Helper/DataTest.php | 72 +++++++- 4 files changed, 454 insertions(+), 6 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/View/Asset/PlaceholderTest.php diff --git a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php new file mode 100644 index 0000000000000..f14da4607b91c --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php @@ -0,0 +1,77 @@ +mediaConfig = $this->getMockBuilder(ConfigInterface::class)->getMockForAbstractClass(); + $this->mediaConfig->expects($this->any())->method('getBaseMediaPath')->willReturn('catalog/product'); + $this->mediaDirectory = $this->getMockBuilder(WriteInterface::class)->getMockForAbstractClass(); + $this->mediaDirectory->expects($this->once())->method('create')->with('catalog/product'); + $this->filesystem = $this->getMockBuilder(Filesystem::class) + ->disableOriginalConstructor() + ->getMock(); + $this->filesystem->expects($this->once()) + ->method('getDirectoryWrite') + ->with(DirectoryList::MEDIA) + ->willReturn($this->mediaDirectory); + $this->model = new Context( + $this->mediaConfig, + $this->filesystem + ); + } + + public function testGetPath() + { + $path = '/var/www/html/magento2ce/pub/media/catalog/product'; + $this->mediaDirectory->expects($this->once()) + ->method('getAbsolutePath') + ->with('catalog/product') + ->willReturn($path); + + $this->assertEquals($path, $this->model->getPath()); + } + + public function testGetUrl() + { + $baseUrl = 'http://localhost/pub/media/catalog/product'; + $this->mediaConfig->expects($this->once())->method('getBaseMediaUrl')->willReturn($baseUrl); + + $this->assertEquals($baseUrl, $this->model->getBaseUrl()); + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php new file mode 100644 index 0000000000000..5e96cdb1c3395 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php @@ -0,0 +1,148 @@ +mediaConfig = $this->getMockBuilder(ConfigInterface::class)->getMockForAbstractClass(); + $this->encryptor = $this->getMockBuilder(EncryptorInterface::class)->getMockForAbstractClass(); + $this->imageContext = $this->getMockBuilder(ContextInterface::class)->getMockForAbstractClass(); + $this->model = new Image( + $this->mediaConfig, + $this->imageContext, + $this->encryptor, + '/somefile.png' + ); + } + + public function testModuleAndContentAndContentType() + { + $contentType = 'image'; + $this->assertEquals($contentType, $this->model->getContentType()); + $this->assertEquals($contentType, $this->model->getSourceContentType()); + $this->assertNull($this->model->getContent()); + $this->assertEquals('cache', $this->model->getModule()); + } + + public function testGetFilePath() + { + $this->assertEquals('/somefile.png', $this->model->getFilePath()); + } + + public function testGetSoureFile() + { + $this->mediaConfig->expects($this->once())->method('getBaseMediaPath')->willReturn('catalog/product'); + $this->assertEquals('catalog/product/somefile.png', $this->model->getSourceFile()); + } + + public function testGetContext() + { + $this->assertInstanceOf(ContextInterface::class, $this->model->getContext()); + } + + /** + * @param string $filePath + * @param array $miscParams + * @dataProvider getPathDataProvider + */ + public function testGetPath($filePath, $miscParams) + { + $imageModel = new Image( + $this->mediaConfig, + $this->imageContext, + $this->encryptor, + $filePath, + $miscParams + ); + $absolutePath = '/var/www/html/magento2ce/pub/media/catalog/product'; + $hashPath = md5(implode('_', $miscParams)); + $this->imageContext->expects($this->once())->method('getPath')->willReturn($absolutePath); + $this->encryptor->expects($this->once())->method('hash')->willReturn($hashPath); + $this->assertEquals( + $absolutePath . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $hashPath . $filePath, + $imageModel->getPath() + ); + } + + /** + * @param string $filePath + * @param array $miscParams + * @dataProvider getPathDataProvider + */ + public function testGetUrl($filePath, $miscParams) + { + $imageModel = new Image( + $this->mediaConfig, + $this->imageContext, + $this->encryptor, + $filePath, + $miscParams + ); + $absolutePath = 'http://localhost/pub/media/catalog/product'; + $hashPath = md5(implode('_', $miscParams)); + $this->imageContext->expects($this->once())->method('getBaseUrl')->willReturn($absolutePath); + $this->encryptor->expects($this->once())->method('hash')->willReturn($hashPath); + $this->assertEquals( + $absolutePath . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $hashPath . $filePath, + $imageModel->getUrl() + ); + } + + public function getPathDataProvider() + { + return [ + [ + '/some_file.png', + [], //default value for miscParams + ], + [ + '/some_file_2.png', + [ + 'image_type' => 'thumbnail', + 'image_height' => 75, + 'image_width' => 75, + 'keep_aspect_ratio' => 'proportional', + 'keep_frame' => 'frame', + 'keep_transparency' => 'transparency', + 'constrain_only' => 'doconstrainonly', + 'background' => 'ffffff', + 'angle' => null, + 'quality' => 80, + ], + ] + ]; + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/PlaceholderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/PlaceholderTest.php new file mode 100644 index 0000000000000..38d5ceb16e6b5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/PlaceholderTest.php @@ -0,0 +1,163 @@ +scopeConfig = $this->getMockBuilder(ScopeConfigInterface::class)->getMockForAbstractClass(); + $this->imageContext = $this->getMockBuilder(ContextInterface::class)->getMockForAbstractClass(); + $this->repository = $this->getMockBuilder(Repository::class)->disableOriginalConstructor()->getMock(); + $this->model = new Placeholder( + $this->imageContext, + $this->scopeConfig, + $this->repository, + 'thumbnail' + ); + } + + public function testModuleAndContentAndContentType() + { + $contentType = 'image'; + $this->assertEquals($contentType, $this->model->getContentType()); + $this->assertEquals($contentType, $this->model->getSourceContentType()); + $this->assertNull($this->model->getContent()); + $this->assertEquals('placeholder', $this->model->getModule()); + } + + public function testGetFilePath() + { + $this->assertNull($this->model->getFilePath()); + $this->scopeConfig->expects($this->once())->method('getValue')->willReturn('default/thumbnail.jpg'); + $this->assertEquals('default/thumbnail.jpg', $this->model->getFilePath()); + } + + public function testGetContext() + { + $this->assertInstanceOf(ContextInterface::class, $this->model->getContext()); + } + + /** + * @param string $imageType + * @param string $placeholderPath + * @dataProvider getPathDataProvider + */ + public function testGetPathAndGetSourceFile($imageType, $placeholderPath) + { + $imageModel = new Placeholder( + $this->imageContext, + $this->scopeConfig, + $this->repository, + $imageType + ); + $absolutePath = '/var/www/html/magento2ce/pub/media/catalog/product'; + + $this->scopeConfig->expects($this->any()) + ->method('getValue') + ->with( + "catalog/placeholder/{$imageType}_placeholder", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null + )->willReturn($placeholderPath); + + if ($placeholderPath == null) { + $this->imageContext->expects($this->never())->method('getPath'); + $assetMock = $this->getMockBuilder(\Magento\Framework\View\Asset\MergeableInterface::class) + ->getMockForAbstractClass(); + $expectedResult = 'path/to_default/placeholder/by_type'; + $assetMock->expects($this->any())->method('getSourceFile')->willReturn($expectedResult); + $this->repository->expects($this->any())->method('createAsset')->willReturn($assetMock); + } else { + $this->imageContext->expects($this->any())->method('getPath')->willReturn($absolutePath); + $expectedResult = $absolutePath + . DIRECTORY_SEPARATOR . $imageModel->getModule() + . DIRECTORY_SEPARATOR . $placeholderPath; + } + + $this->assertEquals($expectedResult, $imageModel->getPath()); + $this->assertEquals($expectedResult, $imageModel->getSourceFile()); + } + + /** + * @param string $imageType + * @param string $placeholderPath + * @dataProvider getPathDataProvider + */ + public function testGetUrl($imageType, $placeholderPath) + { + $imageModel = new Placeholder( + $this->imageContext, + $this->scopeConfig, + $this->repository, + $imageType + ); + + $this->scopeConfig->expects($this->any()) + ->method('getValue') + ->with( + "catalog/placeholder/{$imageType}_placeholder", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null + )->willReturn($placeholderPath); + + if ($placeholderPath == null) { + $this->imageContext->expects($this->never())->method('getBaseUrl'); + $expectedResult = 'http://localhost/pub/media/catalog/product/to_default/placeholder/by_type'; + $this->repository->expects($this->any())->method('getUrl')->willReturn($expectedResult); + } else { + $baseUrl = 'http://localhost/pub/media/catalog/product'; + $this->imageContext->expects($this->any())->method('getBaseUrl')->willReturn($baseUrl); + $expectedResult = $baseUrl + . DIRECTORY_SEPARATOR . $imageModel->getModule() + . DIRECTORY_SEPARATOR . $placeholderPath; + } + + $this->assertEquals($expectedResult, $imageModel->getUrl()); + } + + public function getPathDataProvider() + { + return [ + [ + 'thumbnail', + 'default/thumbnail.jpg', + ], + [ + 'non_exist', + null, + ], + ]; + } +} diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php index be1f4c76a4f45..efb11e6b13a1d 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php @@ -35,7 +35,7 @@ protected function setUp() public function testGetAllowAttributes() { - $typeInstanceMock = $this->getMock( + $typeInstanceMock = $this->getMock( \Magento\ConfigurableProduct\Model\Product\Type\Configurable::class, [], [], '', false ); $typeInstanceMock->expects($this->once()) @@ -91,7 +91,7 @@ public function testGetOptions(array $expected, array $data) */ public function getOptionsDataProvider() { - $currentProductMock = $this->getMock( + $currentProductMock = $this->getMock( \Magento\Catalog\Model\Product::class, ['getTypeInstance', '__wakeup'], [], '', false ); $provider = []; @@ -106,10 +106,10 @@ public function getOptionsDataProvider() $attributesCount = 3; $attributes = []; for ($i = 1; $i < $attributesCount; $i++) { - $attribute = $this->getMock( + $attribute = $this->getMock( \Magento\Framework\DataObject::class, ['getProductAttribute'], [], '', false ); - $productAttribute = $this->getMock( + $productAttribute = $this->getMock( \Magento\Framework\DataObject::class, ['getId', 'getAttributeCode'], [], @@ -127,7 +127,7 @@ public function getOptionsDataProvider() ->will($this->returnValue($productAttribute)); $attributes[] = $attribute; } - $typeInstanceMock = $this->getMock( + $typeInstanceMock = $this->getMock( \Magento\ConfigurableProduct\Model\Product\Type\Configurable::class, [], [], '', false ); $typeInstanceMock->expects($this->any()) @@ -138,7 +138,7 @@ public function getOptionsDataProvider() ->will($this->returnValue($typeInstanceMock)); $allowedProducts = []; for ($i = 1; $i <= 2; $i++) { - $productMock = $this->getMock( + $productMock = $this->getMock( \Magento\Catalog\Model\Product::class, ['getData', 'getImage', 'getId', '__wakeup', 'getMediaGalleryImages'], [], '', false ); $productMock->expects($this->any()) @@ -195,4 +195,64 @@ public function getDataCallback($key) } return $map[$key]; } + + public function testGetGalleryImages() + { + $productMock = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class) + ->setMethods(['getMediaGalleryImages']) + ->getMockForAbstractClass(); + $productMock->expects($this->once()) + ->method('getMediaGalleryImages') + ->willReturn($this->getImagesCollection()); + + $this->_imageHelperMock->expects($this->exactly(3)) + ->method('init') + ->willReturnMap([ + [$productMock, 'product_page_image_small', [], $this->_imageHelperMock], + [$productMock, 'product_page_image_medium_no_frame', [], $this->_imageHelperMock], + [$productMock, 'product_page_image_large_no_frame', [], $this->_imageHelperMock], + ]) + ->willReturnSelf(); + $this->_imageHelperMock->expects($this->exactly(3)) + ->method('setImageFile') + ->with('test_file') + ->willReturnSelf(); + $this->_imageHelperMock->expects($this->at(0)) + ->method('getUrl') + ->willReturn('product_page_image_small_url'); + $this->_imageHelperMock->expects($this->at(1)) + ->method('getUrl') + ->willReturn('product_page_image_medium_url'); + $this->_imageHelperMock->expects($this->at(2)) + ->method('getUrl') + ->willReturn('product_page_image_large_url'); + + $this->assertInstanceOf( + \Magento\Framework\Data\Collection::class, + $this->_model->getGalleryImages($productMock) + ); + + } + + /** + * @return \Magento\Framework\Data\Collection + */ + private function getImagesCollection() + { + $collectionMock = $this->getMockBuilder(\Magento\Framework\Data\Collection::class) + ->disableOriginalConstructor() + ->getMock(); + + $items = [ + new \Magento\Framework\DataObject([ + 'file' => 'test_file' + ]), + ]; + + $collectionMock->expects($this->any()) + ->method('getIterator') + ->willReturn(new \ArrayIterator($items)); + + return $collectionMock; + } } From 0443d0bfed70a85f7a21d62d1869a09255fe3018 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Wed, 2 Nov 2016 19:01:16 +0200 Subject: [PATCH 1595/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -remove ScopePool and ReaderPool --- .../Config/Model/Config/Backend/Store.php | 5 --- .../Reader/Source/Deployed/SettingChecker.php | 35 +++++++++++++++++-- .../Source/Deployed/SettingCheckerTest.php | 20 ++++++++--- .../Test/Unit/DeploymentConfig/WriterTest.php | 6 ++-- .../Magento/Framework/Code/GeneratedFiles.php | 2 -- 5 files changed, 52 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Config/Model/Config/Backend/Store.php b/app/code/Magento/Config/Model/Config/Backend/Store.php index d33f5e5143daa..02f4ab96b5e5e 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Store.php +++ b/app/code/Magento/Config/Model/Config/Backend/Store.php @@ -45,11 +45,6 @@ public function __construct( */ public function afterSave() { - $this->_mutableConfig->setValue( - \Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, - $this->getValue(), - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); $this->_cacheManager->clean(); return parent::afterSave(); } diff --git a/app/code/Magento/Config/Model/Config/Reader/Source/Deployed/SettingChecker.php b/app/code/Magento/Config/Model/Config/Reader/Source/Deployed/SettingChecker.php index 598db6f41f99e..510eeab6f3a1b 100644 --- a/app/code/Magento/Config/Model/Config/Reader/Source/Deployed/SettingChecker.php +++ b/app/code/Magento/Config/Model/Config/Reader/Source/Deployed/SettingChecker.php @@ -6,7 +6,10 @@ namespace Magento\Config\Model\Config\Reader\Source\Deployed; use Magento\Config\Model\Config\Reader; +use Magento\Framework\App\Config\ScopeCodeResolver; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\App\ObjectManager; /** * Class for checking settings that defined in config file @@ -18,13 +21,39 @@ class SettingChecker */ private $config; + /** + * @var ScopeCodeResolver + */ + private $scopeCodeResolver; + /** * @param DeploymentConfig $config + * @param ScopeCodeResolver $scopeCodeResolver */ public function __construct( - DeploymentConfig $config + DeploymentConfig $config, + ScopeCodeResolver $scopeCodeResolver ) { $this->config = $config; + $this->scopeCodeResolver = $scopeCodeResolver; + } + + /** + * Resolve path by scope and scope code + * + * @param string $scope + * @param string $scopeCode + * @return string + */ + private function resolvePath($scope, $scopeCode) + { + $scopePath = 'system/' . $scope; + + if ($scope != ScopeConfigInterface::SCOPE_TYPE_DEFAULT) { + $scopePath .= '/' . $this->scopeCodeResolver->resolve($scope, $scopeCode); + } + + return $scopePath; } /** @@ -34,9 +63,9 @@ public function __construct( * @param string $scope * @return boolean */ - public function isReadOnly($path, $scope) + public function isReadOnly($path, $scope, $scopeCode) { - $config = $this->config->get('system/' . $scope . "/" . $path); + $config = $this->config->get($this->resolvePath($scope, $scopeCode) . "/" . $path); return $config !== null; } } diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Reader/Source/Deployed/SettingCheckerTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Reader/Source/Deployed/SettingCheckerTest.php index 08315d0a64a05..2e746eae410f4 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Reader/Source/Deployed/SettingCheckerTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Reader/Source/Deployed/SettingCheckerTest.php @@ -28,13 +28,20 @@ class SettingCheckerTest extends \PHPUnit_Framework_TestCase */ private $checker; + /** + * @var ScopeCodeResolver | \PHPUnit_Framework_MockObject_MockObject + */ + private $scopeCodeResolver; + public function setUp() { $this->config = $this->getMockBuilder(DeploymentConfig::class) ->disableOriginalConstructor() ->getMock(); - - $this->checker = new SettingChecker($this->config); + $this->scopeCodeResolver = $this->getMockBuilder(ScopeCodeResolver::class) + ->disableOriginalConstructor() + ->getMock(); + $this->checker = new SettingChecker($this->config, $this->scopeCodeResolver); } public function testIsDefined() @@ -42,6 +49,7 @@ public function testIsDefined() $path = 'general/web/locale'; $scope = 'website'; $scopeCode = 'myWebsite'; + $scopeCodeId = '4'; $this->config->expects($this->once()) ->method('get') @@ -51,9 +59,13 @@ public function testIsDefined() $path => 'value' ], ], - ]); - $this->assertTrue($this->checker->isReadOnly($path, $scope)); + $this->scopeCodeResolver->expects($this->once()) + ->method('resolve') + ->with($scope, $scopeCodeId) + ->willReturn($scopeCode); + + $this->assertTrue($this->checker->isReadOnly($path, $scope, $scopeCodeId)); } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php index 3a3b7b7cec0be..7d611de8bf616 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php @@ -117,7 +117,8 @@ public function testSaveConfig() $this->deploymentConfig->expects($this->once())->method('resetData'); $this->configFilePool->expects($this->once())->method('getPaths')->willReturn($configFiles); $this->dirWrite->expects($this->any())->method('isExist')->willReturn(true); - $this->reader->expects($this->once())->method('load')->willReturn($testSetExisting[ConfigFilePool::APP_CONFIG]); + $this->reader->expects($this->once())->method('load') + ->willReturn($testSetExisting[ConfigFilePool::APP_CONFIG]); $this->formatter ->expects($this->once()) ->method('format') @@ -166,7 +167,8 @@ public function testSaveConfigOverride() $this->deploymentConfig->expects($this->once())->method('resetData'); $this->configFilePool->expects($this->once())->method('getPaths')->willReturn($configFiles); $this->dirWrite->expects($this->any())->method('isExist')->willReturn(true); - $this->reader->expects($this->once())->method('load')->willReturn($testSetExisting[ConfigFilePool::APP_CONFIG]); + $this->reader->expects($this->once())->method('load') + ->willReturn($testSetExisting[ConfigFilePool::APP_CONFIG]); $this->formatter ->expects($this->once()) ->method('format') diff --git a/lib/internal/Magento/Framework/Code/GeneratedFiles.php b/lib/internal/Magento/Framework/Code/GeneratedFiles.php index 75d5ff4b4b73b..8111c50e1d49d 100644 --- a/lib/internal/Magento/Framework/Code/GeneratedFiles.php +++ b/lib/internal/Magento/Framework/Code/GeneratedFiles.php @@ -133,7 +133,6 @@ private function getEnabledCacheTypes() return $enabledCacheTypes; } - /** * Returns path to env.php file * @@ -184,7 +183,6 @@ private function disableAllCacheTypes() * TODO: to be removed in scope of MAGETWO-53476 * * @param string[] - * * @return void */ private function enableCacheTypes($cacheTypes) From 036992f8d09aa60fc310a439357ebf293e057edf Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Wed, 2 Nov 2016 19:03:42 +0200 Subject: [PATCH 1596/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -remove ScopePool and ReaderPool --- .../Config/Block/System/Config/Form.php | 8 +- app/code/Magento/Config/etc/di.xml | 1 + .../App/Config/Type/Translation.php | 50 +------- .../Unit/App/Config/Type/TranslationTest.php | 60 ++------- app/code/Magento/Translation/etc/di.xml | 24 +++- .../AbstractProductExportImportTestCase.php | 3 +- .../App/ApplicationDumpCommandTest.php | 31 +++++ .../Config/MetadataConfigTypeProcessor.php | 116 ++++++++++++++++++ .../Framework/App/DeploymentConfig/Reader.php | 17 ++- .../Framework/App/DeploymentConfig/Writer.php | 2 +- .../MetadataConfigTypeProcessorTest.php | 79 ++++++++++++ .../Test/Unit/DeploymentConfig/ReaderTest.php | 6 + 12 files changed, 289 insertions(+), 108 deletions(-) create mode 100644 lib/internal/Magento/Framework/App/Config/MetadataConfigTypeProcessor.php create mode 100644 lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php diff --git a/app/code/Magento/Config/Block/System/Config/Form.php b/app/code/Magento/Config/Block/System/Config/Form.php index dfcf44f631de6..d1a0da2a700a3 100644 --- a/app/code/Magento/Config/Block/System/Config/Form.php +++ b/app/code/Magento/Config/Block/System/Config/Form.php @@ -373,7 +373,9 @@ protected function _initElement( $sharedClass = $this->_getSharedCssClass($field); $requiresClass = $this->_getRequiresCssClass($field, $fieldPrefix); - $isReadOnly = $this->getSettingChecker()->isReadOnly($path, $this->getScope()); + $isReadOnly = $this->getSettingChecker()->isReadOnly($path, $this->getScope(), $this->getScopeCode()); + $canUseDefault = $this->canUseDefaultValue($field->showInDefault()); + $canUseWebsite = $this->canUseWebsiteValue($field->showInWebsite()); $formField = $fieldset->addField( $elementId, $field->getType(), @@ -390,8 +392,8 @@ protected function _initElement( 'scope' => $this->getScope(), 'scope_id' => $this->getScopeId(), 'scope_label' => $this->getScopeLabel($field), - 'can_use_default_value' => $this->canUseDefaultValue($field->showInDefault()), - 'can_use_website_value' => $this->canUseWebsiteValue($field->showInWebsite()), + 'can_use_default_value' => $canUseDefault, + 'can_use_website_value' => $canUseWebsite, 'can_restore_to_default' => $this->isCanRestoreToDefault($field->canRestore()), 'disabled' => $isReadOnly, 'is_disable_inheritance' => $isReadOnly diff --git a/app/code/Magento/Config/etc/di.xml b/app/code/Magento/Config/etc/di.xml index c2b3055da2c67..4f9eae24b55f6 100644 --- a/app/code/Magento/Config/etc/di.xml +++ b/app/code/Magento/Config/etc/di.xml @@ -109,6 +109,7 @@ Magento\Store\Model\Config\Processor\Placeholder + Magento\Framework\App\Config\MetadataConfigTypeProcessor diff --git a/app/code/Magento/Translation/App/Config/Type/Translation.php b/app/code/Magento/Translation/App/Config/Type/Translation.php index 937b586c83908..9a5090f3f5486 100644 --- a/app/code/Magento/Translation/App/Config/Type/Translation.php +++ b/app/code/Magento/Translation/App/Config/Type/Translation.php @@ -5,11 +5,9 @@ */ namespace Magento\Translation\App\Config\Type; -use Magento\Framework\App\Cache\Type\Translate; use Magento\Framework\App\Config\ConfigSourceInterface; use Magento\Framework\App\Config\ConfigTypeInterface; use Magento\Framework\DataObject; -use Magento\Framework\Cache\FrontendInterface; /** * Class which hold all translation sources and merge them @@ -23,37 +21,21 @@ class Translation implements ConfigTypeInterface /** * @var DataObject[] */ - private $data = []; + private $data; /** * @var ConfigSourceInterface */ private $source; - /** - * @var FrontendInterface - */ - private $cache; - - /** - * @var int - */ - private $cachingNestedLevel; - /** * Translation constructor. * @param ConfigSourceInterface $source - * @param FrontendInterface $cache - * @param int $cachingNestedLevel */ public function __construct( - ConfigSourceInterface $source, - FrontendInterface $cache, - $cachingNestedLevel = 1 + ConfigSourceInterface $source ) { $this->source = $source; - $this->cache = $cache; - $this->cachingNestedLevel = $cachingNestedLevel; } /** @@ -61,32 +43,11 @@ public function __construct( */ public function get($path = '') { - $cachePath = $this->getCachePath($path); - if (!isset($this->data[$cachePath])) { - $data = $this->cache->load(self::CONFIG_TYPE . '/' . $cachePath); - if (!$data) { - $this->data[$cachePath] = new DataObject([$cachePath => $this->source->get($cachePath)]); - $this->cache->save( - serialize($this->data), - self::CONFIG_TYPE . '/' . $cachePath, - [Translate::TYPE_IDENTIFIER] - ); - } else { - $this->data = unserialize($data); - } + if (!$this->data) { + $this->data = new DataObject($this->source->get()); } - return $this->data[$cachePath]->getData($path); - } - /** - * Build cache path - * - * @param string $path - * @return string - */ - private function getCachePath($path) - { - return implode('/', array_slice(explode('/', $path), 0, $this->cachingNestedLevel)); + return $this->data->getData($path); } /** @@ -97,6 +58,5 @@ private function getCachePath($path) public function clean() { $this->data = null; - $this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, [Translate::TYPE_IDENTIFIER]); } } diff --git a/app/code/Magento/Translation/Test/Unit/App/Config/Type/TranslationTest.php b/app/code/Magento/Translation/Test/Unit/App/Config/Type/TranslationTest.php index 82e0313dc55e0..8f2c1efdf515b 100644 --- a/app/code/Magento/Translation/Test/Unit/App/Config/Type/TranslationTest.php +++ b/app/code/Magento/Translation/Test/Unit/App/Config/Type/TranslationTest.php @@ -22,11 +22,6 @@ class TranslationTest extends \PHPUnit_Framework_TestCase */ private $source; - /** - * @var FrontendInterface|\PHPUnit_Framework_MockObject_MockObject - */ - private $cache; - /** * @var Translation */ @@ -36,60 +31,25 @@ public function setUp() { $this->source = $this->getMockBuilder(ConfigSourceInterface::class) ->getMockForAbstractClass(); - $this->cache = $this->getMockBuilder(FrontendInterface::class) - ->getMockForAbstractClass(); - - $this->configType = new Translation($this->source, $this->cache); + $this->configType = new Translation($this->source); } - /** - * @param bool $isCached - * @dataProvider getDataProvider - */ - public function testGet($isCached) + public function testGet() { $path = 'en_US/default'; $data = [ - 'default' => [ - 'hello' => 'bonjour' + 'en_US' => [ + 'default' => [ + 'hello' => 'bonjour' + ] ] ]; - $this->cache->expects($this->once()) - ->method('load') - ->with(Translation::CONFIG_TYPE . '/en_US') - ->willReturn($isCached ? serialize(['en_US' => new DataObject(['en_US' => $data])]) : false); - - if (!$isCached) { - $this->source->expects($this->once()) - ->method('get') - ->with('en_US') - ->willReturn([ - 'default' => [ - 'hello' => 'bonjour' - ] - ]); - $this->cache - ->expects($this->once()) - ->method('save') - ->with( - serialize(['en_US' => new DataObject(['en_US' => $data])]), - Translation::CONFIG_TYPE . '/en_US', - [Translate::TYPE_IDENTIFIER] - ); - } + $this->source->expects($this->once()) + ->method('get') + ->with() + ->willReturn($data); $this->assertEquals(['hello' => 'bonjour'], $this->configType->get($path)); } - - /** - * @return array - */ - public function getDataProvider() - { - return [ - [true], - [false] - ]; - } } diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml index 8e27e7bf0daec..3e76f80fff261 100644 --- a/app/code/Magento/Translation/etc/di.xml +++ b/app/code/Magento/Translation/etc/di.xml @@ -93,10 +93,30 @@ + + + Magento\Framework\App\DeploymentConfig\Reader + Magento\Translation\App\Config\Type\Translation::CONFIG_TYPE + Magento\Framework\Config\File\ConfigFilePool::APP_CONFIG + + + + + + + Magento\Translation\Model\Source\InitialTranslationSource\Proxy + 100 + + + translationConfigInitialDataProvider + 1000 + + + + - Magento\Translation\Model\Source\InitialTranslationSource\Proxy - Magento\Framework\App\Cache\Type\Config + translationConfigSourceAggregated diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php index d3f34c76752f5..c5ebf80c6a060 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php @@ -67,8 +67,7 @@ protected function setUp() $this->productResource = $this->objectManager->create( \Magento\Catalog\Model\ResourceModel\Product::class ); - $appConfig = $this->objectManager->get(Config::class); - $appConfig->clean(); + \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType::$commonAttributesCache = []; } protected function tearDown() diff --git a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php index 684b2498bca7e..a229b64bb7dd1 100644 --- a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php +++ b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php @@ -5,6 +5,12 @@ */ namespace Magento\Deploy\Console\Command\App; +use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Config\File\ConfigFilePool; +use Magento\Framework\Filesystem\DriverPool; +use Magento\Framework\ObjectManagerInterface; use Magento\TestFramework\Helper\Bootstrap; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -16,9 +22,15 @@ class ApplicationDumpCommandTest extends \PHPUnit_Framework_TestCase */ private $command; + /** + * @var ObjectManagerInterface + */ + private $objectManager; + public function setUp() { $this->command = Bootstrap::getObjectManager()->get(ApplicationDumpCommand::class); + $this->objectManager = Bootstrap::getObjectManager(); } public function testExecute() @@ -30,4 +42,23 @@ public function testExecute() ->with('Done.'); $this->assertEquals(0, $this->command->run($inputMock, $outputMock)); } + + public function tearDown() + { + /** @var ConfigFilePool $configFilePool */ + $configFilePool = $this->objectManager->get(ConfigFilePool::class); + $filePool = $configFilePool->getInitialFilePools(); + $file = $filePool[ConfigFilePool::LOCAL][ConfigFilePool::APP_CONFIG]; + /** @var DirectoryList $dirList */ + $dirList = $this->objectManager->get(DirectoryList::class); + $path = $dirList->getPath(DirectoryList::CONFIG); + $driverPool = $this->objectManager->get(DriverPool::class); + $fileDriver = $driverPool->getDriver(DriverPool::FILE); + if ($fileDriver->isExists($path . '/' . $file)) { + unlink($path . '/' . $file); + } + /** @var DeploymentConfig $deploymentConfig */ + $deploymentConfig = $this->objectManager->get(DeploymentConfig::class); + $deploymentConfig->resetData(); + } } diff --git a/lib/internal/Magento/Framework/App/Config/MetadataConfigTypeProcessor.php b/lib/internal/Magento/Framework/App/Config/MetadataConfigTypeProcessor.php new file mode 100644 index 0000000000000..04acde7950c13 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Config/MetadataConfigTypeProcessor.php @@ -0,0 +1,116 @@ +_processorFactory = $processorFactory; + $this->_metadata = $initialConfig->getMetadata(); + } + + /** + * Retrieve array value by path + * + * @param array $data + * @param string $path + * @return string|null + */ + protected function _getValue(array $data, $path) + { + $keys = explode('/', $path); + foreach ($keys as $key) { + if (is_array($data) && array_key_exists($key, $data)) { + $data = $data[$key]; + } else { + return null; + } + } + return $data; + } + + /** + * Set array value by path + * + * @param array &$container + * @param string $path + * @param string $value + * @return void + */ + protected function _setValue(array &$container, $path, $value) + { + $segments = explode('/', $path); + $currentPointer = & $container; + foreach ($segments as $segment) { + if (!isset($currentPointer[$segment])) { + $currentPointer[$segment] = []; + } + $currentPointer = & $currentPointer[$segment]; + } + $currentPointer = $value; + } + + /** + * Process data by sections: stores, default, websites and by scope codes + * + * @param array $data + * @return array + */ + private function processScopeData(array $data) + { + foreach ($this->_metadata as $path => $metadata) { + /** @var \Magento\Framework\App\Config\Data\ProcessorInterface $processor */ + $processor = $this->_processorFactory->get($metadata['backendModel']); + $value = $processor->processValue($this->_getValue($data, $path)); + $this->_setValue($data, $path, $value); + } + + return $data; + } + + /** + * Process config data + * + * @param array $data + * @return array + */ + public function process(array $rawData) + { + $processedData = []; + foreach ($rawData as $scope => $scopeData) { + if ($scope == ScopeConfigInterface::SCOPE_TYPE_DEFAULT) { + $processedData[ScopeConfigInterface::SCOPE_TYPE_DEFAULT] = $this->processScopeData($scopeData); + } else { + foreach ($scopeData as $scopeCode => $data) { + $processedData[$scope][$scopeCode] = $this->processScopeData($data); + } + } + } + + return $processedData; + } +} diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php index c20e1394ad3d3..104d0aa7fc63d 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php @@ -135,24 +135,31 @@ public function load($fileKey = null) /** * @param string $fileKey * @param string $pathConfig + * @param bool $ignoreInitialConfigFiles * @return array */ - private function loadConfigFile($fileKey, $pathConfig) + public function loadConfigFile($fileKey, $pathConfig, $ignoreInitialConfigFiles = false) { + $result = []; $initialFilePools = $this->configFilePool->getInitialFilePools(); $path = $this->dirList->getPath(DirectoryList::CONFIG); $fileDriver = $this->driverPool->getDriver(DriverPool::FILE); + if ($fileDriver->isExists($path . '/' . $pathConfig)) { $result = include $path . '/' . $pathConfig; - } else { - $result = []; + $result = is_array($result) ? $result : []; + } + + if (!$ignoreInitialConfigFiles) { foreach ($initialFilePools as $initialFiles) { if (isset($initialFiles[$fileKey]) && $fileDriver->isExists($path . '/' . $initialFiles[$fileKey])) { - $result = include $path . '/' . $initialFiles[$fileKey]; + $fileBuffer = include $path . '/' . $initialFiles[$fileKey]; + $result = array_replace_recursive($result, $fileBuffer); } } } - return is_array($result) ? $result : []; + + return $result; } /** diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php index 8f9b857f601bb..6cead0305a6c6 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php @@ -103,7 +103,7 @@ public function saveConfig(array $data, $override = false, $pool = null) $paths = $pool ? $this->configFilePool->getPathsByPool($pool) : $this->configFilePool->getPaths(); if (isset($paths[$fileKey])) { - $currentData = $this->reader->load($fileKey); + $currentData = $this->reader->loadConfigFile($fileKey, $paths[$fileKey], true); if ($currentData) { if ($override) { $config = array_merge($currentData, $config); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php new file mode 100644 index 0000000000000..c51561c9ddc68 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php @@ -0,0 +1,79 @@ +_modelPoolMock = $this->getMock( + 'Magento\Framework\App\Config\Data\ProcessorFactory', + [], + [], + '', + false + ); + $this->_initialConfigMock = $this->getMock('Magento\Framework\App\Config\Initial', [], [], '', false); + $this->_backendModelMock = $this->getMock('Magento\Framework\App\Config\Data\ProcessorInterface'); + $this->_initialConfigMock->expects( + $this->any() + )->method( + 'getMetadata' + )->will( + $this->returnValue(['some/config/path' => ['backendModel' => 'Custom_Backend_Model']]) + ); + $this->_model = new \Magento\Framework\App\Config\MetadataConfigTypeProcessor( + $this->_modelPoolMock, + $this->_initialConfigMock + ); + } + + public function testProcess() + { + $this->_modelPoolMock->expects( + $this->once() + )->method( + 'get' + )->with( + 'Custom_Backend_Model' + )->will( + $this->returnValue($this->_backendModelMock) + ); + $this->_backendModelMock->expects( + $this->once() + )->method( + 'processValue' + )->with( + 'value' + )->will( + $this->returnValue('processed_value') + ); + $data = ['default' => [ 'some' => ['config' => ['path' => 'value']], 'active' => 1]]; + $expectedResult = $data; + $expectedResult['default']['some']['config']['path'] = 'processed_value'; + $this->assertEquals($expectedResult, $this->_model->process($data)); + } +} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php index dc1187093c3b6..a321775883e09 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php @@ -135,6 +135,9 @@ public function testMerging() ->expects($this->any()) ->method('getPath') ->will($this->returnValueMap($files)); + $configFilePool->expects($this->any()) + ->method('getInitialFilePools') + ->willReturn([]); $configFilePool ->expects($this->any()) ->method('getPaths') @@ -155,6 +158,9 @@ public function testMergingWithDuplicateEndValues() ->expects($this->any()) ->method('getPath') ->will($this->returnValueMap($files)); + $configFilePool->expects($this->any()) + ->method('getInitialFilePools') + ->willReturn([]); $configFilePool ->expects($this->any()) ->method('getPaths') From 7edd729d278e612908c31e44bf446eec79d975f0 Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Wed, 2 Nov 2016 19:16:09 +0200 Subject: [PATCH 1597/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- .../Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php index f14da4607b91c..cdc1296486eef 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/View/Asset/Image/ContextTest.php @@ -36,7 +36,6 @@ class ContextTest extends \PHPUnit_Framework_TestCase */ protected $filesystem; - protected function setUp() { $this->mediaConfig = $this->getMockBuilder(ConfigInterface::class)->getMockForAbstractClass(); From 0b46b0e71e6052a4ded63426b1641edc50db7470 Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Wed, 2 Nov 2016 19:40:17 +0200 Subject: [PATCH 1598/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - removed unused variable --- .../Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php b/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php index 8d9dccfd85f8f..2d1ac8adce5f2 100644 --- a/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php @@ -162,7 +162,7 @@ public function testGetterAmount($amountForBundle, $optionList, $expectedResult) $optionsCollection->expects($this->atLeastOnce())->method('getSize') ->willReturn(count($options)); - foreach ($options as $index => $option) { + foreach ($options as $option) { $selectionsCollection = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); From a472c5840cc56a40fe9a958da6741249c4381f3c Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Wed, 2 Nov 2016 19:58:51 +0200 Subject: [PATCH 1599/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- .../testsuite/Magento/Catalog/Model/Product/ImageTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php index 88fd7797e768f..d8cfa774ad2d1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php @@ -23,7 +23,7 @@ public function testSetBaseFilePlaceholder() $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Catalog\Model\Product\Image::class ); - $model->setDestinationSubdir('image')->setBaseFile(''); + $model->setType('image')->setBaseFile(''); $this->assertEmpty($model->getBaseFile()); return $model; } From aa0cdd848c49ecd667dcb76b2a4476a924ab29c7 Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Wed, 2 Nov 2016 20:04:53 +0200 Subject: [PATCH 1600/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Model/View/Asset/Placeholder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php b/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php index ec71be45b4d2a..fd7dcd1c4692e 100644 --- a/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php +++ b/app/code/Magento/Catalog/Model/View/Asset/Placeholder.php @@ -8,6 +8,7 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\View\Asset\ContextInterface; +use Magento\Framework\View\Asset\File\NotFoundException; use Magento\Framework\View\Asset\LocalInterface; use Magento\Framework\View\Asset\Repository; @@ -107,7 +108,11 @@ public function getPath() $defaultPlaceholder = $this->assetRepo->createAsset( "Magento_Catalog::images/product/placeholder/{$this->type}.jpg" ); - $result = $defaultPlaceholder->getSourceFile(); + try { + $result = $defaultPlaceholder->getSourceFile(); + } catch (NotFoundException $e) { + $result = null; + } } return $result; From 47e7bb8aa9e5f799dc6ee75cc7bf5874274bb198 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 14:27:29 -0500 Subject: [PATCH 1601/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Fixing tests --- .../Framework/App/ObjectManagerFactory.php | 28 +++++++++++++++++++ .../ObjectManager/DefinitionFactory.php | 5 ---- .../Test/Unit/DefinitionFactoryTest.php | 1 - 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index a67304d798609..d5f4e782fc93f 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -286,4 +286,32 @@ protected function _loadPrimaryConfig(DirectoryList $directoryList, $driverPool, } return $configData; } + + /** + * Crete plugin list object + * + * @param \Magento\Framework\ObjectManagerInterface $objectManager + * @param \Magento\Framework\ObjectManager\RelationsInterface $relations + * @param \Magento\Framework\ObjectManager\DefinitionFactory $definitionFactory + * @param \Magento\Framework\ObjectManager\Config\Config $diConfig + * @param \Magento\Framework\ObjectManager\DefinitionInterface $definitions + * @return \Magento\Framework\Interception\PluginList\PluginList + */ + protected function _createPluginList( + \Magento\Framework\ObjectManagerInterface $objectManager, + \Magento\Framework\ObjectManager\RelationsInterface $relations, + \Magento\Framework\ObjectManager\DefinitionFactory $definitionFactory, + \Magento\Framework\ObjectManager\Config\Config $diConfig, + \Magento\Framework\ObjectManager\DefinitionInterface $definitions + ) { + return $objectManager->create( + \Magento\Framework\Interception\PluginList\PluginList::class, + [ + 'relations' => $relations, + 'definitions' => $definitionFactory->createPluginDefinition(), + 'omConfig' => $diConfig, + 'classDefinitions' => null + ] + ); + } } diff --git a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php index 79d398e3da079..29431b570bc64 100644 --- a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php +++ b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php @@ -36,11 +36,6 @@ class DefinitionFactory */ protected $codeGenerator; - /** - * @var SerializerInterface - */ - private $serializer; - /** * @param DriverInterface $filesystemDriver * @param string $generationDir diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php index 99db458c11953..8c587cec4351c 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php @@ -26,7 +26,6 @@ class DefinitionFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->filesystemDriverMock = $this->getMock(File::class); - $this->serializerMock = $this->getMock(SerializerInterface::class); $this->definitionFactory = new DefinitionFactory( $this->filesystemDriverMock, 'generation dir' From cc34832442336b62f6f63df43e0532057ad8fe7c Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 14:49:57 -0500 Subject: [PATCH 1602/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Refactoring to use Serialize implementation --- .../Magento/Framework/ObjectManager/Config/Compiled.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php index aa1fd86dbf7cf..5b979db102092 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php +++ b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php @@ -1,6 +1,5 @@ serializer === null) { + if (null === $this->serializer) { $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); + ->get(Serialize::class); } return $this->serializer; } From ff860672c02ca8afe6aa3fab0700d0eb744fb287 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 14:59:30 -0500 Subject: [PATCH 1603/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Removing obsolete code --- .../Framework/App/ObjectManagerFactory.php | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index d5f4e782fc93f..a67304d798609 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -286,32 +286,4 @@ protected function _loadPrimaryConfig(DirectoryList $directoryList, $driverPool, } return $configData; } - - /** - * Crete plugin list object - * - * @param \Magento\Framework\ObjectManagerInterface $objectManager - * @param \Magento\Framework\ObjectManager\RelationsInterface $relations - * @param \Magento\Framework\ObjectManager\DefinitionFactory $definitionFactory - * @param \Magento\Framework\ObjectManager\Config\Config $diConfig - * @param \Magento\Framework\ObjectManager\DefinitionInterface $definitions - * @return \Magento\Framework\Interception\PluginList\PluginList - */ - protected function _createPluginList( - \Magento\Framework\ObjectManagerInterface $objectManager, - \Magento\Framework\ObjectManager\RelationsInterface $relations, - \Magento\Framework\ObjectManager\DefinitionFactory $definitionFactory, - \Magento\Framework\ObjectManager\Config\Config $diConfig, - \Magento\Framework\ObjectManager\DefinitionInterface $definitions - ) { - return $objectManager->create( - \Magento\Framework\Interception\PluginList\PluginList::class, - [ - 'relations' => $relations, - 'definitions' => $definitionFactory->createPluginDefinition(), - 'omConfig' => $diConfig, - 'classDefinitions' => null - ] - ); - } } From 0f5597d5010390cc0b30c5ee520db568e79022e0 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 15:27:47 -0500 Subject: [PATCH 1604/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Removing obsolete code --- .../Magento/Framework/App/ObjectManagerFactory.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index a67304d798609..fc47cc5aca3d9 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -1,7 +1,5 @@ Date: Wed, 2 Nov 2016 16:49:01 -0500 Subject: [PATCH 1605/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding SerializerInterface dependency in the constructor --- .../Catalog/Model/Attribute/Config/Data.php | 17 ++++++++++++---- .../Catalog/Model/ProductOptions/Config.php | 10 +++++++--- .../Magento/Cron/Model/Groups/Config/Data.php | 13 +++++++----- .../Eav/Model/Entity/Attribute/Config.php | 8 +++----- .../Email/Model/Template/Config/Data.php | 17 ++++++++++++---- .../Search/Model/SearchEngine/Config/Data.php | 12 ++++++----- .../Api/ExtensionAttribute/Config.php | 11 ++++++---- .../App/ResourceConnection/Config.php | 5 +++-- .../Framework/Communication/Config/Data.php | 20 +++++++++++-------- .../Framework/Search/Request/Config.php | 14 +++++++++---- .../Module/Di/Code/Generator/PluginList.php | 2 -- 11 files changed, 83 insertions(+), 46 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Attribute/Config/Data.php b/app/code/Magento/Catalog/Model/Attribute/Config/Data.php index 032970a7461b6..2644e1fe83b3a 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Config/Data.php +++ b/app/code/Magento/Catalog/Model/Attribute/Config/Data.php @@ -1,22 +1,31 @@ Date: Wed, 2 Nov 2016 23:54:13 +0200 Subject: [PATCH 1606/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- .../Magento/Catalog/Model/Product/Image.php | 22 ------------------- app/code/Magento/Catalog/etc/di.xml | 1 + .../Catalog/Model/Product/ImageTest.php | 11 ++++++++-- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index eca05f94291c9..37a326919ba6b 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -182,11 +182,6 @@ class Image extends \Magento\Framework\Model\AbstractModel */ private $viewAssetPlaceholderFactory; - /** - * @var \Magento\Catalog\Model\View\Asset\Image\ContextFactory - */ - private $imageContextFactory; - /** * @var \Magento\Framework\View\Asset\LocalInterface */ @@ -485,10 +480,8 @@ public function setBaseFile($file) return $this; } - $imageContext = $this->getImageContextFactory()->create(); $this->imageAsset = $this->getViewAssetImageFactory()->create( [ - 'context' => $imageContext, 'miscParams' => $this->getMiscParams(), 'filePath' => $file, ] @@ -499,7 +492,6 @@ public function setBaseFile($file) $this->_isBaseFilePlaceholder = true; $this->imageAsset = $this->getViewAssetPlaceholderFactory()->create( [ - 'context' => $imageContext, 'type' => $this->getType(), ] ); @@ -943,20 +935,6 @@ private function getViewAssetPlaceholderFactory() return $this->viewAssetPlaceholderFactory; } - /** - * @return \Magento\Catalog\Model\View\Asset\Image\ContextFactory - */ - private function getImageContextFactory() - { - if ($this->imageContextFactory == null) { - $this->imageContextFactory = ObjectManager::getInstance()->get( - \Magento\Catalog\Model\View\Asset\Image\ContextFactory::class - ); - } - - return $this->imageContextFactory; - } - /** * Retrieve misc params based on all image attributes * diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index d6b8ed994deaa..27c3a0a2f14c8 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -49,6 +49,7 @@ + diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php index d8cfa774ad2d1..aaa450369bea8 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php @@ -23,8 +23,15 @@ public function testSetBaseFilePlaceholder() $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Catalog\Model\Product\Image::class ); - $model->setType('image')->setBaseFile(''); - $this->assertEmpty($model->getBaseFile()); + /** @var \Magento\Catalog\Model\View\Asset\Placeholder $defualtPlaceholder */ + $defualtPlaceholder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Catalog\Model\View\Asset\Placeholder::class, + ['type' => 'image'] + ); + + $model->setType('image'); + $model->setBaseFile(''); + $this->assertEquals($defualtPlaceholder->getSourceFile(), $model->getBaseFile()); return $model; } From 55c7c7b6054e1f09362749dc8d8080526f8b70db Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 17:30:03 -0500 Subject: [PATCH 1607/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding SerializerInterface dependency in the constructor --- .../Catalog/Model/Attribute/Config/Data.php | 7 +---- .../Catalog/Model/ProductTypes/Config.php | 4 +-- .../Config/Model/Config/Structure/Data.php | 8 ++++-- app/code/Magento/Cron/Model/Config/Data.php | 4 +-- .../Magento/Customer/Model/Address/Config.php | 2 +- .../Model/Country/Postcode/Config/Data.php | 8 +++--- .../Email/Model/Template/Config/Data.php | 7 +---- .../ImportExport/Model/Export/Config.php | 4 +-- .../ImportExport/Model/Import/Config.php | 4 +-- .../Magento/Indexer/Model/Config/Data.php | 4 +-- app/code/Magento/Sales/Model/Config/Data.php | 4 +-- .../TestFramework/Interception/PluginList.php | 11 +++++--- .../App/ResourceConnection/Config.php | 9 ++++--- .../Unit/ResourceConnection/ConfigTest.php | 3 +++ .../Magento/Framework/Cache/Config/Data.php | 13 +++++++--- .../Framework/Communication/Config/Data.php | 7 +---- .../Magento/Framework/Config/Data.php | 26 +++++-------------- .../Magento/Framework/Config/Data/Scoped.php | 8 +++++- .../Magento/Framework/Event/Config/Data.php | 12 +++++---- .../Interception/PluginList/PluginList.php | 4 +-- .../Magento/Framework/Mview/Config/Data.php | 4 +-- 21 files changed, 69 insertions(+), 84 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Attribute/Config/Data.php b/app/code/Magento/Catalog/Model/Attribute/Config/Data.php index 2644e1fe83b3a..08128376439a3 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Config/Data.php +++ b/app/code/Magento/Catalog/Model/Attribute/Config/Data.php @@ -9,11 +9,6 @@ class Data extends \Magento\Framework\Config\Data { - /** - * Cache identifier - */ - const CACHE_ID = 'catalog_attributes'; - /** * @param \Magento\Catalog\Model\Attribute\Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache @@ -23,7 +18,7 @@ class Data extends \Magento\Framework\Config\Data public function __construct( \Magento\Catalog\Model\Attribute\Config\Reader $reader, \Magento\Framework\Config\CacheInterface $cache, - $cacheId = 'eav_attributes', + $cacheId = 'catalog_attributes', SerializerInterface $serializer = null ) { parent::__construct($reader, $cache, $cacheId, $serializer); diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config.php b/app/code/Magento/Catalog/Model/ProductTypes/Config.php index d6f88d3bf4640..7a5465e525bf7 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/Config.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/Config.php @@ -10,11 +10,9 @@ class Config extends \Magento\Framework\Config\Data implements \Magento\Catalog\Model\ProductTypes\ConfigInterface { /** - * Config constructor - * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache - * @param string $cacheId + * @param string|null $cacheId * @param SerializerInterface|null $serializer */ public function __construct( diff --git a/app/code/Magento/Config/Model/Config/Structure/Data.php b/app/code/Magento/Config/Model/Config/Structure/Data.php index 414addf5b6f06..d785ce2b90861 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Data.php +++ b/app/code/Magento/Config/Model/Config/Structure/Data.php @@ -5,6 +5,8 @@ */ namespace Magento\Config\Model\Config\Structure; +use Magento\Framework\Serialize\SerializerInterface; + class Data extends \Magento\Framework\Config\Data\Scoped { /** @@ -12,14 +14,16 @@ class Data extends \Magento\Framework\Config\Data\Scoped * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache * @param string $cacheId + * @param SerializerInterface|null $serializer */ public function __construct( Reader $reader, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, - $cacheId + $cacheId, + SerializerInterface $serializer = null ) { - parent::__construct($reader, $configScope, $cache, $cacheId); + parent::__construct($reader, $configScope, $cache, $cacheId, $serializer); } /** diff --git a/app/code/Magento/Cron/Model/Config/Data.php b/app/code/Magento/Cron/Model/Config/Data.php index 3edc2e6237de8..5b2f638609df7 100644 --- a/app/code/Magento/Cron/Model/Config/Data.php +++ b/app/code/Magento/Cron/Model/Config/Data.php @@ -14,12 +14,10 @@ class Data extends \Magento\Framework\Config\Data { /** - * Data constructor - * * @param Reader\Xml $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param Reader\Db $dbReader - * @param string $cacheId + * @param string|null $cacheId * @param SerializerInterface|null $serializer */ public function __construct( diff --git a/app/code/Magento/Customer/Model/Address/Config.php b/app/code/Magento/Customer/Model/Address/Config.php index f53f9277cfa4f..dc2ceede663fb 100644 --- a/app/code/Magento/Customer/Model/Address/Config.php +++ b/app/code/Magento/Customer/Model/Address/Config.php @@ -68,7 +68,7 @@ class Config extends ConfigData * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Helper\Address $addressHelper * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param string $cacheId + * @param string|null $cacheId * @param SerializerInterface|null $serializer */ public function __construct( diff --git a/app/code/Magento/Directory/Model/Country/Postcode/Config/Data.php b/app/code/Magento/Directory/Model/Country/Postcode/Config/Data.php index 10a27b6a1b367..1a5241e0a11e5 100644 --- a/app/code/Magento/Directory/Model/Country/Postcode/Config/Data.php +++ b/app/code/Magento/Directory/Model/Country/Postcode/Config/Data.php @@ -10,17 +10,17 @@ class Data extends \Magento\Framework\Config\Data { /** - * Data constructor - * * @param Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache - * @param SerializerInterface $serializer + * @param string|null $cacheId + * @param SerializerInterface|null $serializer */ public function __construct( \Magento\Directory\Model\Country\Postcode\Config\Reader $reader, \Magento\Framework\Config\CacheInterface $cache, + $cacheId = 'country_postcodes', SerializerInterface $serializer = null ) { - parent::__construct($reader, $cache, 'country_postcodes', $serializer); + parent::__construct($reader, $cache, $cacheId, $serializer); } } diff --git a/app/code/Magento/Email/Model/Template/Config/Data.php b/app/code/Magento/Email/Model/Template/Config/Data.php index 182cd276771bb..e1d00e20e8d16 100644 --- a/app/code/Magento/Email/Model/Template/Config/Data.php +++ b/app/code/Magento/Email/Model/Template/Config/Data.php @@ -9,11 +9,6 @@ class Data extends \Magento\Framework\Config\Data { - /** - * Cache identifier - */ - const CACHE_ID = 'email_templates'; - /** * @param \Magento\Email\Model\Template\Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache @@ -23,7 +18,7 @@ class Data extends \Magento\Framework\Config\Data public function __construct( \Magento\Email\Model\Template\Config\Reader $reader, \Magento\Framework\Config\CacheInterface $cache, - $cacheId = self::CACHE_ID, + $cacheId = 'email_templates', SerializerInterface $serializer = null ) { parent::__construct($reader, $cache, $cacheId, $serializer); diff --git a/app/code/Magento/ImportExport/Model/Export/Config.php b/app/code/Magento/ImportExport/Model/Export/Config.php index 375aa7fa468b8..a2e1a02ffd306 100644 --- a/app/code/Magento/ImportExport/Model/Export/Config.php +++ b/app/code/Magento/ImportExport/Model/Export/Config.php @@ -10,11 +10,9 @@ class Config extends \Magento\Framework\Config\Data implements \Magento\ImportExport\Model\Export\ConfigInterface { /** - * Config constructor - * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache - * @param string $cacheId + * @param string|null $cacheId * @param SerializerInterface|null $serializer */ public function __construct( diff --git a/app/code/Magento/ImportExport/Model/Import/Config.php b/app/code/Magento/ImportExport/Model/Import/Config.php index 88a607c0ca0d5..826303785210a 100644 --- a/app/code/Magento/ImportExport/Model/Import/Config.php +++ b/app/code/Magento/ImportExport/Model/Import/Config.php @@ -10,11 +10,9 @@ class Config extends \Magento\Framework\Config\Data implements \Magento\ImportExport\Model\Import\ConfigInterface { /** - * Config constructor - * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache - * @param string $cacheId + * @param string|null $cacheId * @param SerializerInterface|null $serializer */ public function __construct( diff --git a/app/code/Magento/Indexer/Model/Config/Data.php b/app/code/Magento/Indexer/Model/Config/Data.php index 703c875d1ef4e..2e1e433e4be25 100644 --- a/app/code/Magento/Indexer/Model/Config/Data.php +++ b/app/code/Magento/Indexer/Model/Config/Data.php @@ -15,12 +15,10 @@ class Data extends \Magento\Framework\Config\Data protected $stateCollection; /** - * Data constructor - * * @param \Magento\Framework\Indexer\Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param \Magento\Indexer\Model\ResourceModel\Indexer\State\Collection $stateCollection - * @param string $cacheId + * @param string|null $cacheId * @param SerializerInterface|null $serializer */ public function __construct( diff --git a/app/code/Magento/Sales/Model/Config/Data.php b/app/code/Magento/Sales/Model/Config/Data.php index ddcb95efdfda6..0d44c627d5552 100644 --- a/app/code/Magento/Sales/Model/Config/Data.php +++ b/app/code/Magento/Sales/Model/Config/Data.php @@ -14,11 +14,9 @@ class Data extends \Magento\Framework\Config\Data { /** - * Data constructor - * * @param Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache - * @param string $cacheId + * @param string|null $cacheId * @param SerializerInterface|null $serializer */ public function __construct( diff --git a/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php b/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php index 9e8901c91fd75..07c2c698eee00 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php @@ -5,6 +5,8 @@ */ namespace Magento\TestFramework\Interception; +use Magento\Framework\Serialize\SerializerInterface; + class PluginList extends \Magento\Framework\Interception\PluginList\PluginList { /** @@ -22,7 +24,8 @@ class PluginList extends \Magento\Framework\Interception\PluginList\PluginList * @param \Magento\Framework\ObjectManagerInterface $objectManager * @param \Magento\Framework\ObjectManager\DefinitionInterface $classDefinitions * @param array $scopePriorityScheme - * @param string $cacheId + * @param string|null $cacheId + * @param SerializerInterface|null $serializer * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -36,7 +39,8 @@ public function __construct( \Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\ObjectManager\DefinitionInterface $classDefinitions, array $scopePriorityScheme, - $cacheId = 'plugins' + $cacheId = 'plugins', + SerializerInterface $serializer = null ) { parent::__construct( $reader, @@ -48,7 +52,8 @@ public function __construct( $objectManager, $classDefinitions, $scopePriorityScheme, - $cacheId + $cacheId, + $serializer ); $this->_originScopeScheme = $this->_scopePriorityScheme; } diff --git a/lib/internal/Magento/Framework/App/ResourceConnection/Config.php b/lib/internal/Magento/Framework/App/ResourceConnection/Config.php index c6b186e05a3df..da0b4d3b033e4 100644 --- a/lib/internal/Magento/Framework/App/ResourceConnection/Config.php +++ b/lib/internal/Magento/Framework/App/ResourceConnection/Config.php @@ -6,6 +6,7 @@ namespace Magento\Framework\App\ResourceConnection; use Magento\Framework\Config\ConfigOptionsListConstants; +use Magento\Framework\Serialize\SerializerInterface; /** * Resource configuration, uses application configuration to retrieve resource connection information @@ -24,7 +25,8 @@ class Config extends \Magento\Framework\Config\Data\Scoped implements ConfigInte * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig - * @param string $cacheId + * @param string|null $cacheId + * @param SerializerInterface|null $serializer * @throws \InvalidArgumentException */ public function __construct( @@ -32,9 +34,10 @@ public function __construct( \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, \Magento\Framework\App\DeploymentConfig $deploymentConfig, - $cacheId = 'resourcesCache' + $cacheId = 'resourcesCache', + SerializerInterface $serializer = null ) { - parent::__construct($reader, $configScope, $cache, $cacheId); + parent::__construct($reader, $configScope, $cache, $cacheId, $serializer); $resource = $deploymentConfig->getConfigData(ConfigOptionsListConstants::KEY_RESOURCE); foreach ($resource as $resourceName => $resourceData) { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php index fa96ef92f7b0b..62938aceae2cc 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php @@ -72,6 +72,9 @@ protected function setUp() ->with($jsonString) ->willReturn($this->resourcesConfig); + /** + * @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject $deploymentConfigMock + */ $deploymentConfigMock = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false); $deploymentConfigMock->expects($this->once()) ->method('getConfigData') diff --git a/lib/internal/Magento/Framework/Cache/Config/Data.php b/lib/internal/Magento/Framework/Cache/Config/Data.php index a1f203d9aa7bb..3a2ba6c8c0d05 100644 --- a/lib/internal/Magento/Framework/Cache/Config/Data.php +++ b/lib/internal/Magento/Framework/Cache/Config/Data.php @@ -1,12 +1,15 @@ reader = $reader; $this->cache = $cache; $this->cacheId = $cacheId; - $this->serializer = $serializer ?: $this->getSerializer(); + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); $this->initData(); } /** * Initialise data for configuration + * * @return void */ protected function initData() @@ -99,9 +99,9 @@ protected function initData() $data = $this->cache->load($this->cacheId); if (false === $data) { $data = $this->reader->read(); - $this->cache->save($this->getSerializer()->serialize($data), $this->cacheId, $this->cacheTags); + $this->cache->save($this->serializer->serialize($data), $this->cacheId, $this->cacheTags); } else { - $data = $this->getSerializer()->unserialize($data); + $data = $this->serializer->unserialize($data); } $this->merge($data); @@ -144,25 +144,11 @@ public function get($path = null, $default = null) /** * Clear cache data + * * @return void */ public function reset() { $this->cache->remove($this->cacheId); } - - /** - * Get serializer - * - * @return \Magento\Framework\Serialize\SerializerInterface - * @deprecated - */ - protected function getSerializer() - { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); - } - return $this->serializer; - } } diff --git a/lib/internal/Magento/Framework/Config/Data/Scoped.php b/lib/internal/Magento/Framework/Config/Data/Scoped.php index b5f01a14335fa..644c2649e4982 100644 --- a/lib/internal/Magento/Framework/Config/Data/Scoped.php +++ b/lib/internal/Magento/Framework/Config/Data/Scoped.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\Config\Data; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\App\ObjectManager; + class Scoped extends \Magento\Framework\Config\Data { /** @@ -56,17 +59,20 @@ class Scoped extends \Magento\Framework\Config\Data * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache * @param string $cacheId + * @param SerializerInterface|null $serializer */ public function __construct( \Magento\Framework\Config\ReaderInterface $reader, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, - $cacheId + $cacheId, + SerializerInterface $serializer = null ) { $this->_reader = $reader; $this->_configScope = $configScope; $this->_cache = $cache; $this->_cacheId = $cacheId; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);; } /** diff --git a/lib/internal/Magento/Framework/Event/Config/Data.php b/lib/internal/Magento/Framework/Event/Config/Data.php index 7bd082e5d465b..d5858be832fee 100644 --- a/lib/internal/Magento/Framework/Event/Config/Data.php +++ b/lib/internal/Magento/Framework/Event/Config/Data.php @@ -1,12 +1,12 @@ Date: Thu, 3 Nov 2016 00:38:37 +0200 Subject: [PATCH 1608/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- .../Test/Unit/Model/Product/ImageTest.php | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php index be2d5de06a24a..edacb318574ad 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php @@ -95,16 +95,6 @@ class ImageTest extends \PHPUnit_Framework_TestCase */ protected $viewAssetPlaceholderFactory; - /** - * @var ContextFactory|\PHPUnit_Framework_MockObject_MockObject - */ - protected $imageContextFactory; - - /** - * @var ContextInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $imageContext; - protected function setUp() { $this->context = $this->getMock(\Magento\Framework\Model\Context::class, [], [], '', false); @@ -183,19 +173,6 @@ protected function setUp() 'viewAssetPlaceholderFactory', $this->viewAssetPlaceholderFactory ); - - $this->imageContext = $this->getMockBuilder(ContextInterface::class) - ->getMockForAbstractClass(); - $this->imageContextFactory = $this->getMockBuilder(ContextFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->imageContextFactory->expects($this->any())->method('create')->willReturn($this->imageContext); - $objectManagerHelper->setBackwardCompatibleProperty( - $this->image, - 'imageContextFactory', - $this->imageContextFactory - ); } public function testSetGetQuality() @@ -252,7 +229,6 @@ public function testSetGetBaseFile() ->method('create') ->with( [ - 'context' => $this->imageContext, 'miscParams' => [ 'image_type' => null, 'image_height' => null, From eef56cacc6420f98a29019163f6bc5b72e0ac4ed Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 17:51:06 -0500 Subject: [PATCH 1609/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding SerializerInterface dependency in the constructor --- .../Test/Unit/Model/Country/Postcode/Config/DataTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Directory/Test/Unit/Model/Country/Postcode/Config/DataTest.php b/app/code/Magento/Directory/Test/Unit/Model/Country/Postcode/Config/DataTest.php index 20444b6080add..57c86ab58c91b 100644 --- a/app/code/Magento/Directory/Test/Unit/Model/Country/Postcode/Config/DataTest.php +++ b/app/code/Magento/Directory/Test/Unit/Model/Country/Postcode/Config/DataTest.php @@ -53,6 +53,7 @@ public function testGet() $configData = new \Magento\Directory\Model\Country\Postcode\Config\Data( $this->readerMock, $this->cacheMock, + 'country_postcodes', $this->serializerMock ); $this->assertEquals($expected, $configData->get()); From abbfc14d1de4b249d10cf71b39c50fc31550e393 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 18:04:10 -0500 Subject: [PATCH 1610/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding SerializerInterface dependency in the constructor --- .../Unit/ResourceConnection/ConfigTest.php | 25 +++++++++++-------- .../Magento/Framework/Config/Data/Scoped.php | 4 +-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php index 62938aceae2cc..6382394353749 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php @@ -27,6 +27,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ private $readerMock; + /** + * @var \Magento\Framework\Serialize\SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializerMock; + /** * @var array */ @@ -39,7 +44,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->scopeMock = $this->getMock(\Magento\Framework\Config\ScopeInterface::class); $this->cacheMock = $this->getMock(\Magento\Framework\Config\CacheInterface::class); @@ -50,7 +54,7 @@ protected function setUp() '', false ); - $serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class); + $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class); $this->resourcesConfig = [ 'mainResourceName' => ['name' => 'mainResourceName', 'extends' => 'anotherResourceName'], @@ -64,12 +68,12 @@ protected function setUp() 'validResource' => ['connection' => 'validConnectionName'], ]; - $jsonString = json_encode($this->resourcesConfig); + $serializedData = 'serialized data'; $this->cacheMock->expects($this->any()) ->method('load') - ->willReturn($jsonString); - $serializerMock->method('unserialize') - ->with($jsonString) + ->willReturn($serializedData); + $this->serializerMock->method('unserialize') + ->with($serializedData) ->willReturn($this->resourcesConfig); /** @@ -86,15 +90,15 @@ protected function setUp() $this->scopeMock, $this->cacheMock, $deploymentConfigMock, - 'cacheId' + 'cacheId', + $this->serializerMock ); - $objectManager->setBackwardCompatibleProperty($this->config, 'serializer', $serializerMock); } /** - * @dataProvider getConnectionNameDataProvider * @param string $resourceName * @param string $connectionName + * @dataProvider getConnectionNameDataProvider */ public function testGetConnectionName($resourceName, $connectionName) { @@ -117,7 +121,8 @@ public function testExceptionConstructor() $this->scopeMock, $this->cacheMock, $deploymentConfigMock, - 'cacheId' + 'cacheId', + $this->serializerMock ); } diff --git a/lib/internal/Magento/Framework/Config/Data/Scoped.php b/lib/internal/Magento/Framework/Config/Data/Scoped.php index 644c2649e4982..5e7bd441bbb29 100644 --- a/lib/internal/Magento/Framework/Config/Data/Scoped.php +++ b/lib/internal/Magento/Framework/Config/Data/Scoped.php @@ -104,12 +104,12 @@ protected function _loadScopedData() if (false == isset($this->_loadedScopes[$scopeCode])) { if ($scopeCode !== 'primary' && ($data = $this->_cache->load($scopeCode . '::' . $this->_cacheId)) ) { - $data = $this->getSerializer()->unserialize($data); + $data = $this->serializer->unserialize($data); } else { $data = $this->_reader->read($scopeCode); if ($scopeCode !== 'primary') { $this->_cache->save( - $this->getSerializer()->serialize($data), + $this->serializer->serialize($data), $scopeCode . '::' . $this->_cacheId ); } From 76a03c8cab38ae61fcc5251725fc39021d05fe9e Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Thu, 3 Nov 2016 01:29:07 +0200 Subject: [PATCH 1611/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Helper/Image.php | 2 +- app/code/Magento/Catalog/Model/Product/Image.php | 4 ++-- .../Magento/Catalog/Test/Unit/Model/Product/ImageTest.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index cb08c2fd134a2..06e18ad3166b7 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -442,7 +442,7 @@ public function getPlaceholder($placeholder = null) $placeholderFullPath = 'Magento_Catalog::images/product/placeholder/' . $placeholder . '.jpg'; } else { $placeholderFullPath = $this->_placeholder - ?: 'Magento_Catalog::images/product/placeholder/' . $this->_getModel()->getDestinationSubdir() . '.jpg'; + ?: 'Magento_Catalog::images/product/placeholder/' . $this->_getModel()->getType() . '.jpg'; } return $placeholderFullPath; } diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 37a326919ba6b..36ef498774eef 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -13,9 +13,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; -use Magento\Framework\App\ObjectManagerFactory; use Magento\Framework\Image as MagentoImage; -use Magento\Store\Model\Store; /** * @SuppressWarnings(PHPMD.TooManyFields) @@ -679,6 +677,7 @@ public function getUrl() /** * @deprecated + * @see \Magento\Catalog\Model\Product\Image::setType($imageType) * @param string $dir * @return $this */ @@ -690,6 +689,7 @@ public function setDestinationSubdir($dir) /** * @deprecated + * @see \Magento\Catalog\Model\Product\Image::getType() * @return string */ public function getDestinationSubdir() diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php index edacb318574ad..d780c5be55246 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php @@ -378,10 +378,10 @@ public function testGetUrlNoSelection() $this->assertEquals('Default Placeholder URL', $this->image->getUrl()); } - public function testSetGetDestinationSubdir() + public function testSetGetType() { - $this->image->setDestinationSubdir('somesubdir'); - $this->assertEquals('somesubdir', $this->image->getDestinationSubdir()); + $this->image->setType('image_type'); + $this->assertEquals('image_type', $this->image->getType()); } public function testIsCached() From b5e21241b871d674d3bf25f198ad2e32ee8c71d7 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 2 Nov 2016 21:15:52 -0500 Subject: [PATCH 1612/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Fixing tests --- lib/internal/Magento/Framework/Config/Data/Scoped.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Config/Data/Scoped.php b/lib/internal/Magento/Framework/Config/Data/Scoped.php index 5e7bd441bbb29..0171c97ff1e90 100644 --- a/lib/internal/Magento/Framework/Config/Data/Scoped.php +++ b/lib/internal/Magento/Framework/Config/Data/Scoped.php @@ -72,7 +72,7 @@ public function __construct( $this->_configScope = $configScope; $this->_cache = $cache; $this->_cacheId = $cacheId; - $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** From ad4adb45043d74f64a29f7e81bc379b94f9d9dbc Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Thu, 3 Nov 2016 11:18:44 +0200 Subject: [PATCH 1613/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -remove ScopePool and ReaderPool --- app/code/Magento/Cron/Model/Config/Reader/Db.php | 2 ++ .../Cron/Test/Unit/Model/Config/Reader/DbTest.php | 1 + .../testsuite/Magento/Store/_files/second_store.php | 1 - .../Magento/Framework/App/DeploymentConfig/Reader.php | 10 +++++----- .../Magento/Framework/App/MutableScopeConfig.php | 3 +++ .../Magento/Framework/App/ReinitableConfig.php | 1 - 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Cron/Model/Config/Reader/Db.php b/app/code/Magento/Cron/Model/Config/Reader/Db.php index 68434e121cb7d..52e3a5aed54de 100644 --- a/app/code/Magento/Cron/Model/Config/Reader/Db.php +++ b/app/code/Magento/Cron/Model/Config/Reader/Db.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Cron\Model\Config\Reader; + use Magento\Framework\App\Config; /** @@ -22,6 +23,7 @@ class Db * @var \Magento\Framework\App\Config\Scope\ReaderInterface */ protected $_reader; + /** * @var Config */ diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php b/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php index b291e51fc6b71..6205c993524e4 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Cron\Test\Unit\Model\Config\Reader; + use Magento\Framework\App\Config; use Magento\GoogleAdwords\Block\Code; 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 77d26a5308394..91b30888194f4 100644 --- a/dev/tests/integration/testsuite/Magento/Store/_files/second_store.php +++ b/dev/tests/integration/testsuite/Magento/Store/_files/second_store.php @@ -34,4 +34,3 @@ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( \Magento\Store\Model\StoreManagerInterface::class )->reinitStores(); - diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php index 104d0aa7fc63d..a1635fc4b2670 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php @@ -145,11 +145,6 @@ public function loadConfigFile($fileKey, $pathConfig, $ignoreInitialConfigFiles $path = $this->dirList->getPath(DirectoryList::CONFIG); $fileDriver = $this->driverPool->getDriver(DriverPool::FILE); - if ($fileDriver->isExists($path . '/' . $pathConfig)) { - $result = include $path . '/' . $pathConfig; - $result = is_array($result) ? $result : []; - } - if (!$ignoreInitialConfigFiles) { foreach ($initialFilePools as $initialFiles) { if (isset($initialFiles[$fileKey]) && $fileDriver->isExists($path . '/' . $initialFiles[$fileKey])) { @@ -159,6 +154,11 @@ public function loadConfigFile($fileKey, $pathConfig, $ignoreInitialConfigFiles } } + if ($fileDriver->isExists($path . '/' . $pathConfig)) { + $fileBuffer = include $path . '/' . $pathConfig; + $result = array_replace_recursive($result, $fileBuffer); + } + return $result; } diff --git a/lib/internal/Magento/Framework/App/MutableScopeConfig.php b/lib/internal/Magento/Framework/App/MutableScopeConfig.php index 06bb1c1119a5d..010504d993bfc 100644 --- a/lib/internal/Magento/Framework/App/MutableScopeConfig.php +++ b/lib/internal/Magento/Framework/App/MutableScopeConfig.php @@ -16,6 +16,9 @@ */ class MutableScopeConfig extends Config implements MutableScopeConfigInterface { + /** + * @var array + */ private $data; /** diff --git a/lib/internal/Magento/Framework/App/ReinitableConfig.php b/lib/internal/Magento/Framework/App/ReinitableConfig.php index a5838f4877061..2d50bbadabbfe 100644 --- a/lib/internal/Magento/Framework/App/ReinitableConfig.php +++ b/lib/internal/Magento/Framework/App/ReinitableConfig.php @@ -22,4 +22,3 @@ public function reinit() return $this; } } - From 4e14fb33f7aa76aa7b6b26eb61e3f029b4c07d15 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Thu, 3 Nov 2016 11:32:28 +0200 Subject: [PATCH 1614/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -remove ScopePool and ReaderPool --- .../Model/Config/Reader/Source/Deployed/SettingChecker.php | 1 + .../Test/Unit/Config/MetadataConfigTypeProcessorTest.php | 6 +++--- lib/internal/Magento/Framework/Code/GeneratedFiles.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Config/Model/Config/Reader/Source/Deployed/SettingChecker.php b/app/code/Magento/Config/Model/Config/Reader/Source/Deployed/SettingChecker.php index 510eeab6f3a1b..48b82086ad8b1 100644 --- a/app/code/Magento/Config/Model/Config/Reader/Source/Deployed/SettingChecker.php +++ b/app/code/Magento/Config/Model/Config/Reader/Source/Deployed/SettingChecker.php @@ -61,6 +61,7 @@ private function resolvePath($scope, $scopeCode) * * @param string $path * @param string $scope + * @param string $scopeCode * @return boolean */ public function isReadOnly($path, $scope, $scopeCode) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php index c51561c9ddc68..f1bedf1c3276b 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/MetadataConfigTypeProcessorTest.php @@ -30,14 +30,14 @@ class MetadataConfigTypeProcessorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_modelPoolMock = $this->getMock( - 'Magento\Framework\App\Config\Data\ProcessorFactory', + \Magento\Framework\App\Config\Data\ProcessorFactory::class, [], [], '', false ); - $this->_initialConfigMock = $this->getMock('Magento\Framework\App\Config\Initial', [], [], '', false); - $this->_backendModelMock = $this->getMock('Magento\Framework\App\Config\Data\ProcessorInterface'); + $this->_initialConfigMock = $this->getMock(\Magento\Framework\App\Config\Initial::class, [], [], '', false); + $this->_backendModelMock = $this->getMock(\Magento\Framework\App\Config\Data\ProcessorInterface::class); $this->_initialConfigMock->expects( $this->any() )->method( diff --git a/lib/internal/Magento/Framework/Code/GeneratedFiles.php b/lib/internal/Magento/Framework/Code/GeneratedFiles.php index 8111c50e1d49d..f3d3c2bd611d5 100644 --- a/lib/internal/Magento/Framework/Code/GeneratedFiles.php +++ b/lib/internal/Magento/Framework/Code/GeneratedFiles.php @@ -182,7 +182,7 @@ private function disableAllCacheTypes() * Enables apppropriate cache types in app/etc/env.php based on the passed in $cacheTypes array * TODO: to be removed in scope of MAGETWO-53476 * - * @param string[] + * @param string[] $cacheTypes * @return void */ private function enableCacheTypes($cacheTypes) From 5730dcea7c0b732350bc1e0d9b6b9cca8f368fbd Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 3 Nov 2016 11:30:00 +0200 Subject: [PATCH 1615/3232] MAGETWO-60237: [Dev Experience] Eav AttributeManagement API uses Attribute Collection incorrectly --- app/code/Magento/Eav/Model/AttributeManagement.php | 5 ++++- .../Magento/Eav/Test/Unit/Model/AttributeManagementTest.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Eav/Model/AttributeManagement.php b/app/code/Magento/Eav/Model/AttributeManagement.php index ab8a886a68dbc..3d909f37648a1 100644 --- a/app/code/Magento/Eav/Model/AttributeManagement.php +++ b/app/code/Magento/Eav/Model/AttributeManagement.php @@ -20,6 +20,7 @@ class AttributeManagement implements \Magento\Eav\Api\AttributeManagementInterfa /** * @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection + * @deprecated please use instead \Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory */ protected $attributeCollection; @@ -168,8 +169,10 @@ public function getAttributes($entityType, $attributeSetId) } /** + * Retrieve collection factory + * * @deprecated - * @return ResourceModel\Entity\Attribute\CollectionFactory + * @return \Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory */ private function getCollectionFactory() { diff --git a/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php b/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php index 20e72ec16d41b..c45c575dffc2f 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php @@ -373,7 +373,7 @@ public function testGetAttributes() $attributeCollectionFactoryMock = $this->getMock( \Magento\Eav\Model\ResourceModel\Entity\Attribute\CollectionFactory::class, - [], + ['create'], [], '', false From d33722c0767acaef2388c66fb5923fcc8671f931 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 3 Nov 2016 12:00:40 +0200 Subject: [PATCH 1616/3232] MAGETWO-59486: [FT] CreateProductAttributeEntityTest fails due to AssertAddedProductAttributeOnProductForm --- .../Constraint/AssertAddedProductAttributeOnProductForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php index 91533717bac48..da1ec8f71a112 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php @@ -17,6 +17,7 @@ /** * Check attribute on product form. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AssertAddedProductAttributeOnProductForm extends AbstractConstraint { @@ -76,7 +77,6 @@ public function processAssert( CatalogAttributeSet $attributeSet, BrowserInterface $browser, CatalogProductAttribute $productAttributeOriginal = null - ) { $this->fixtureFactory = $fixtureFactory; $this->catalogProductIndex = $catalogProductIndex; From 22c208be8669ae68023ea1ccbc25857dcf373b28 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 3 Nov 2016 12:01:07 +0200 Subject: [PATCH 1617/3232] MAGETWO-60045: Images are improperly matched with products --- .../Magento/Swatches/Test/Unit/Helper/DataTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php index 44f07b060e174..a4f839a411fd6 100644 --- a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php @@ -111,7 +111,13 @@ protected function setUp() '', false ); - $this->metaDataPoolMock = $this->getMock(\Magento\Framework\EntityManager\MetadataPool::class, [], [], '', false); + $this->metaDataPoolMock = $this->getMock( + \Magento\Framework\EntityManager\MetadataPool::class, + [], + [], + '', + false + ); $this->swatchHelperObject = $this->objectManager->getObject( \Magento\Swatches\Helper\Data::class, [ @@ -124,7 +130,8 @@ protected function setUp() ] ); $this->objectManager->setBackwardCompatibleProperty( - $this->swatchHelperObject, 'metadataPool', $this->metaDataPoolMock + $this->swatchHelperObject, 'metadataPool', + $this->metaDataPoolMock ); } From 003e6518e3e9a97f62c4d385c7a6b95859a3d737 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 3 Nov 2016 12:18:35 +0200 Subject: [PATCH 1618/3232] MAGETWO-60237: [Dev Experience] Eav AttributeManagement API uses Attribute Collection incorrectly --- app/code/Magento/Eav/Model/AttributeManagement.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Eav/Model/AttributeManagement.php b/app/code/Magento/Eav/Model/AttributeManagement.php index 3d909f37648a1..102aafbd39fb1 100644 --- a/app/code/Magento/Eav/Model/AttributeManagement.php +++ b/app/code/Magento/Eav/Model/AttributeManagement.php @@ -11,6 +11,9 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class AttributeManagement implements \Magento\Eav\Api\AttributeManagementInterface { /** From 8347df14fdbba445fb84c73764dbf29c237c487c Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 3 Nov 2016 12:19:01 +0200 Subject: [PATCH 1619/3232] MAGETWO-60045: Images are improperly matched with products --- app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php index a4f839a411fd6..e5f2f887836ef 100644 --- a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php @@ -130,7 +130,8 @@ protected function setUp() ] ); $this->objectManager->setBackwardCompatibleProperty( - $this->swatchHelperObject, 'metadataPool', + $this->swatchHelperObject, + 'metadataPool', $this->metaDataPoolMock ); } From d2b5e097d81c7eb50f423b78b3d2824da965ffbc Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Thu, 3 Nov 2016 12:19:38 +0200 Subject: [PATCH 1620/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -change copyright --- .../CatalogUrlRewrite/Model/Category/Plugin/Store/View.php | 3 ++- .../testsuite/Magento/Quote/Api/CartManagementTest.php | 3 ++- .../Magento/TestFramework/ObjectManager/Configurator.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php index ea3a0f5fb8da4..01ef3e4ff8be2 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php @@ -1,6 +1,7 @@ Date: Thu, 3 Nov 2016 12:39:03 +0200 Subject: [PATCH 1621/3232] MAGETWO-60453: DeleteSavedCreditCardTest fails on bamboo --- .../tests/app/Magento/Payment/Test/Repository/CreditCard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index f6c93407a0ccd..b43173f568261 100644 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml @@ -15,7 +15,7 @@ - 378282246310005 + 371449635398431 02 - February 2021 1234 From 786c2ddad5dd9431eb6411b7f2817805c8fa38d9 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Thu, 3 Nov 2016 14:46:36 +0200 Subject: [PATCH 1622/3232] MAGETWO-59586: Excessive loaders for order with virtual product --- .../Sales/view/adminhtml/templates/order/create/data.phtml | 6 ------ .../Sales/view/adminhtml/web/order/create/scripts.js | 3 --- 2 files changed, 9 deletions(-) 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 4d2352e742edb..9eabd2ec4fcaf 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 @@ -61,12 +61,6 @@
- getChildBlock('card_validation')): ?> -
- getChildHtml('card_validation') ?> -
- - getChildHtml('gift_options') ?>
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 aed235ba4e306..6f49476350434 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 @@ -352,9 +352,6 @@ define([ }); jQuery('#edit_form').trigger('changePaymentMethod', [method]); this.setPaymentMethod(method); - var data = {}; - data['order[payment_method]'] = method; - this.loadArea(['card_validation'], true, data); }, setPaymentMethod : function(method){ From 0287de60a734f73fb46a2d0886f68947dbbd33fd Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Thu, 3 Nov 2016 15:26:38 +0200 Subject: [PATCH 1623/3232] MAGETWO-59715: Impossible to import additional_images with labels which have a comma separator --- .../Model/Import/Product.php | 48 +++++++++++++------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 4e60c2a8212cb..de2b2ff8160a7 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1436,7 +1436,10 @@ protected function getExistingImages($bunch) )->joinInner( ['mgvte' => $this->mediaGalleryEntityToValueTableName], '(mg.value_id = mgvte.value_id)', - [$this->getProductEntityLinkField() => 'mgvte.' . $this->getProductEntityLinkField()] + [ + $this->getProductEntityLinkField() => 'mgvte.' . $this->getProductEntityLinkField(), + 'value_id' => 'mgvte.value_id' + ] )->joinLeft( ['mgv' => $this->mediaGalleryValueTableName], sprintf( @@ -1446,8 +1449,7 @@ protected function getExistingImages($bunch) \Magento\Store\Model\Store::DEFAULT_STORE_ID ), [ - 'label' => 'mgv.label', - 'value_id' => 'mgv.value_id' + 'label' => 'mgv.label' ] )->joinInner( ['pe' => $this->productEntityTableName], @@ -2787,22 +2789,38 @@ private function updateMediaGalleryLabels(array $labels) return; } - $updateData = []; + $insertData = []; foreach ($labels as $label) { $imageData = $label['imageData']; - $updateData[] = [ - 'label' => $label['label'], - $this->getProductEntityLinkField() => $imageData[$this->getProductEntityLinkField()], - 'value_id' => $imageData['value_id'], - 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID - ]; + + if ($imageData['label'] === null) { + $insertData[] = [ + 'label' => $label['label'], + $this->getProductEntityLinkField() => $imageData[$this->getProductEntityLinkField()], + 'value_id' => $imageData['value_id'], + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID + ]; + } else { + $this->_connection->update( + $this->mediaGalleryValueTableName, + [ + 'label' => $label['label'] + ], + [ + $this->getProductEntityLinkField() . ' = ?' => $imageData[$this->getProductEntityLinkField()], + 'value_id = ?' => $imageData['value_id'], + 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID + ] + ); + } } - $this->_connection->insertOnDuplicate( - $this->mediaGalleryValueTableName, - $updateData, - ['label'] - ); + if (!empty($insertData)) { + $this->_connection->insertMultiple( + $this->mediaGalleryValueTableName, + $insertData + ); + } } /** From 206ebb35ec395cd2354206cc62d363c4151153e5 Mon Sep 17 00:00:00 2001 From: Alex Bomko Date: Tue, 1 Nov 2016 20:20:12 +0200 Subject: [PATCH 1624/3232] MAGETWO-55605: Security Issue with referrer --- .../Customer/Model/Account/Redirect.php | 14 ++++- app/code/Magento/Customer/Model/Url.php | 39 ++++++++++-- .../Test/Unit/Model/Account/RedirectTest.php | 15 ++++- .../Magento/Framework/Test/Unit/UrlTest.php | 21 ++++--- lib/internal/Magento/Framework/Url.php | 27 ++++---- .../Magento/Framework/Url/HostChecker.php | 48 ++++++++++++++ .../Url/Test/Unit/HostCheckerTest.php | 63 +++++++++++++++++++ 7 files changed, 199 insertions(+), 28 deletions(-) create mode 100644 lib/internal/Magento/Framework/Url/HostChecker.php create mode 100644 lib/internal/Magento/Framework/Url/Test/Unit/HostCheckerTest.php diff --git a/app/code/Magento/Customer/Model/Account/Redirect.php b/app/code/Magento/Customer/Model/Account/Redirect.php index ac03bd02553c7..5a1470959b60d 100644 --- a/app/code/Magento/Customer/Model/Account/Redirect.php +++ b/app/code/Magento/Customer/Model/Account/Redirect.php @@ -9,6 +9,7 @@ use Magento\Customer\Model\Url as CustomerUrl; use Magento\Framework\App\RequestInterface; use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Url\HostChecker; use Magento\Framework\UrlInterface; use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\StoreManagerInterface; @@ -53,6 +54,7 @@ class Redirect protected $customerUrl; /** + * @deprecated * @var UrlInterface */ protected $url; @@ -67,6 +69,11 @@ class Redirect */ protected $cookieManager; + /** + * @var HostChecker + */ + private $hostChecker; + /** * @param RequestInterface $request * @param Session $customerSession @@ -76,6 +83,7 @@ class Redirect * @param DecoderInterface $urlDecoder * @param CustomerUrl $customerUrl * @param ResultFactory $resultFactory + * @param HostChecker|null $hostChecker */ public function __construct( RequestInterface $request, @@ -85,7 +93,8 @@ public function __construct( UrlInterface $url, DecoderInterface $urlDecoder, CustomerUrl $customerUrl, - ResultFactory $resultFactory + ResultFactory $resultFactory, + HostChecker $hostChecker = null ) { $this->request = $request; $this->session = $customerSession; @@ -95,6 +104,7 @@ public function __construct( $this->urlDecoder = $urlDecoder; $this->customerUrl = $customerUrl; $this->resultFactory = $resultFactory; + $this->hostChecker = $hostChecker ?: ObjectManager::getInstance()->get(HostChecker::class); } /** @@ -196,7 +206,7 @@ protected function processLoggedCustomer() $referer = $this->request->getParam(CustomerUrl::REFERER_QUERY_PARAM_NAME); if ($referer) { $referer = $this->urlDecoder->decode($referer); - if ($this->url->isOwnOriginUrl()) { + if ($this->hostChecker->isOwnOrigin($referer)) { $this->applyRedirect($referer); } } diff --git a/app/code/Magento/Customer/Model/Url.php b/app/code/Magento/Customer/Model/Url.php index fa2ff49aafd3a..470093717549a 100644 --- a/app/code/Magento/Customer/Model/Url.php +++ b/app/code/Magento/Customer/Model/Url.php @@ -56,25 +56,43 @@ class Url */ protected $urlEncoder; + /** + * @var \Magento\Framework\Url\DecoderInterface + */ + private $urlDecoder; + + /** + * @var \Magento\Framework\Url\HostChecker + */ + private $hostChecker; + /** * @param Session $customerSession * @param ScopeConfigInterface $scopeConfig * @param RequestInterface $request * @param UrlInterface $urlBuilder * @param EncoderInterface $urlEncoder + * @param \Magento\Framework\Url\DecoderInterface|null $urlDecoder + * @param \Magento\Framework\Url\HostChecker|null $hostChecker */ public function __construct( Session $customerSession, ScopeConfigInterface $scopeConfig, RequestInterface $request, UrlInterface $urlBuilder, - EncoderInterface $urlEncoder + EncoderInterface $urlEncoder, + \Magento\Framework\Url\DecoderInterface $urlDecoder = null, + \Magento\Framework\Url\HostChecker $hostChecker = null ) { $this->request = $request; $this->urlBuilder = $urlBuilder; $this->scopeConfig = $scopeConfig; $this->customerSession = $customerSession; $this->urlEncoder = $urlEncoder; + $this->urlDecoder = $urlDecoder ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Url\DecoderInterface::class); + $this->hostChecker = $hostChecker ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Url\HostChecker::class); } /** @@ -95,7 +113,7 @@ public function getLoginUrl() public function getLoginUrlParams() { $params = []; - $referer = $this->request->getParam(self::REFERER_QUERY_PARAM_NAME); + $referer = $this->getRequestReferrer(); if (!$referer && !$this->scopeConfig->isSetFlag( self::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD, @@ -122,9 +140,10 @@ public function getLoginUrlParams() public function getLoginPostUrl() { $params = []; - if ($this->request->getParam(self::REFERER_QUERY_PARAM_NAME)) { + $referer = $this->getRequestReferrer(); + if ($referer) { $params = [ - self::REFERER_QUERY_PARAM_NAME => $this->request->getParam(self::REFERER_QUERY_PARAM_NAME), + self::REFERER_QUERY_PARAM_NAME => $referer, ]; } return $this->urlBuilder->getUrl('customer/account/loginPost', $params); @@ -220,4 +239,16 @@ public function getEmailConfirmationUrl($email = null) { return $this->urlBuilder->getUrl('customer/account/confirmation', ['email' => $email]); } + + /** + * @return mixed|null + */ + private function getRequestReferrer() + { + $referer = $this->request->getParam(self::REFERER_QUERY_PARAM_NAME); + if ($referer && $this->hostChecker->isOwnOrigin($this->urlDecoder->decode($referer))) { + return $referer; + } + return null; + } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Account/RedirectTest.php b/app/code/Magento/Customer/Test/Unit/Model/Account/RedirectTest.php index 5d512bcc6bda1..47b7ea669de30 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Account/RedirectTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Account/RedirectTest.php @@ -13,6 +13,7 @@ use Magento\Customer\Model\Account\Redirect; use Magento\Customer\Model\Url as CustomerUrl; use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Url\HostChecker; use Magento\Store\Model\ScopeInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -81,6 +82,11 @@ class RedirectTest extends \PHPUnit_Framework_TestCase */ protected $resultFactory; + /** + * @var HostChecker | \PHPUnit_Framework_MockObject_MockObject + */ + private $hostChecker; + protected function setUp() { $this->request = $this->getMockForAbstractClass(\Magento\Framework\App\RequestInterface::class); @@ -134,6 +140,10 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); + $this->hostChecker = $this->getMockBuilder(HostChecker::class) + ->disableOriginalConstructor() + ->getMock(); + $objectManager = new ObjectManager($this); $this->model = $objectManager->getObject( \Magento\Customer\Model\Account\Redirect::class, @@ -145,7 +155,8 @@ protected function setUp() 'url' => $this->url, 'urlDecoder' => $this->urlDecoder, 'customerUrl' => $this->customerUrl, - 'resultFactory' => $this->resultFactory + 'resultFactory' => $this->resultFactory, + 'hostChecker' => $this->hostChecker ] ); } @@ -254,6 +265,7 @@ public function testGetRedirect( $this->resultRedirect->expects($this->once()) ->method('setUrl') + ->with($beforeAuthUrl) ->willReturnSelf(); $this->resultFactory->expects($this->once()) @@ -286,6 +298,7 @@ public function getRedirectDataProvider() return [ // Loggend In, Redirect by Referer [1, 2, 'referer', 'base', '', '', 'account', '', '', '', true, false], + [1, 2, 'http://referer.com/', 'http://base.com/', '', '', 'account', '', '', 'dashboard', true, false], // Loggend In, Redirect by AfterAuthUrl [1, 2, 'referer', 'base', '', 'defined', 'account', '', '', '', true, true], // Not logged In, Redirect by LoginUrl diff --git a/lib/internal/Magento/Framework/Test/Unit/UrlTest.php b/lib/internal/Magento/Framework/Test/Unit/UrlTest.php index 36fce179395b5..939e9a39bea58 100644 --- a/lib/internal/Magento/Framework/Test/Unit/UrlTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/UrlTest.php @@ -7,6 +7,7 @@ // @codingStandardsIgnoreFile namespace Magento\Framework\Test\Unit; +use Magento\Framework\Url\HostChecker; /** * Test class for Magento\Framework\Url @@ -59,6 +60,11 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ protected $urlModifier; + /** + * @var HostChecker|\PHPUnit_Framework_MockObject_MockObject + */ + private $hostChecker; + protected function setUp() { $this->routeParamsResolverMock = $this->getMock( @@ -549,18 +555,17 @@ public function testAddSessionParam() /** * @param bool $result - * @param string $baseUrl * @param string $referrer * @dataProvider isOwnOriginUrlDataProvider */ - public function testIsOwnOriginUrl($result, $baseUrl, $referrer) + public function testIsOwnOriginUrl($result, $referrer) { $requestMock = $this->getRequestMock(); - $model = $this->getUrlModel(['scopeResolver' => $this->scopeResolverMock, 'request' => $requestMock]); + $this->hostChecker = $this->getMockBuilder(HostChecker::class) + ->disableOriginalConstructor()->getMock(); + $this->hostChecker->expects($this->once())->method('isOwnOrigin')->with($referrer)->willReturn($result); + $model = $this->getUrlModel(['hostChecker' => $this->hostChecker, 'request' => $requestMock]); - $this->scopeMock->expects($this->any())->method('getBaseUrl')->will($this->returnValue($baseUrl)); - $this->scopeResolverMock->expects($this->any())->method('getScopes') - ->will($this->returnValue([$this->scopeMock])); $requestMock->expects($this->once())->method('getServer')->with('HTTP_REFERER') ->will($this->returnValue($referrer)); @@ -570,8 +575,8 @@ public function testIsOwnOriginUrl($result, $baseUrl, $referrer) public function isOwnOriginUrlDataProvider() { return [ - 'is origin url' => [true, 'http://localhost/', 'http://localhost/'], - 'is not origin url' => [false, 'http://localhost/', 'http://example.com/'], + 'is origin url' => [true, 'http://localhost/'], + 'is not origin url' => [false, 'http://example.com/'], ]; } diff --git a/lib/internal/Magento/Framework/Url.php b/lib/internal/Magento/Framework/Url.php index 7361fdb336dd8..30af3528b2bab 100644 --- a/lib/internal/Magento/Framework/Url.php +++ b/lib/internal/Magento/Framework/Url.php @@ -8,6 +8,8 @@ namespace Magento\Framework; +use Magento\Framework\Url\HostChecker; + /** * URL * @@ -178,6 +180,11 @@ class Url extends \Magento\Framework\DataObject implements \Magento\Framework\Ur */ private $escaper; + /** + * @var HostChecker + */ + private $hostChecker; + /** * @param \Magento\Framework\App\Route\ConfigInterface $routeConfig * @param \Magento\Framework\App\RequestInterface $request @@ -191,6 +198,7 @@ class Url extends \Magento\Framework\DataObject implements \Magento\Framework\Ur * @param \Magento\Framework\Url\RouteParamsPreprocessorInterface $routeParamsPreprocessor * @param string $scopeType * @param array $data + * @param HostChecker|null $hostChecker * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -205,7 +213,8 @@ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Url\RouteParamsPreprocessorInterface $routeParamsPreprocessor, $scopeType, - array $data = [] + array $data = [], + HostChecker $hostChecker = null ) { $this->_request = $request; $this->_routeConfig = $routeConfig; @@ -218,6 +227,8 @@ public function __construct( $this->_scopeConfig = $scopeConfig; $this->routeParamsPreprocessor = $routeParamsPreprocessor; $this->_scopeType = $scopeType; + $this->hostChecker = $hostChecker ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(HostChecker::class); parent::__construct($data); } @@ -1086,17 +1097,7 @@ public function useSessionIdForUrl($secure = false) */ public function isOwnOriginUrl() { - $scopeDomains = []; - $referer = parse_url($this->_request->getServer('HTTP_REFERER'), PHP_URL_HOST); - foreach ($this->_scopeResolver->getScopes() as $scope) { - $scopeDomains[] = parse_url($scope->getBaseUrl(), PHP_URL_HOST); - $scopeDomains[] = parse_url($scope->getBaseUrl(UrlInterface::URL_TYPE_LINK, true), PHP_URL_HOST); - } - $scopeDomains = array_unique($scopeDomains); - if (empty($referer) || in_array($referer, $scopeDomains)) { - return true; - } - return false; + return $this->hostChecker->isOwnOrigin($this->_request->getServer('HTTP_REFERER')); } /** @@ -1163,7 +1164,7 @@ protected function getRouteParamsResolver() private function getUrlModifier() { if ($this->urlModifier === null) { - $this->urlModifier = \Magento\Framework\App\ObjectManager::getInstance()->get( + $this->urlModifier = \Magento\Framework\App\ObjectManager::getInstance()->get( \Magento\Framework\Url\ModifierInterface::class ); } diff --git a/lib/internal/Magento/Framework/Url/HostChecker.php b/lib/internal/Magento/Framework/Url/HostChecker.php new file mode 100644 index 0000000000000..32546595a040d --- /dev/null +++ b/lib/internal/Magento/Framework/Url/HostChecker.php @@ -0,0 +1,48 @@ +scopeResolver = $scopeResolver; + } + + /** + * Check if provided URL is one of the domain URLs assigned to scopes + * + * @param string $url + * @return bool + */ + public function isOwnOrigin($url) + { + $scopeHostNames = []; + $hostName = parse_url($url, PHP_URL_HOST); + if (empty($hostName)) { + return true; + } + foreach ($this->scopeResolver->getScopes() as $scope) { + $scopeHostNames[] = parse_url($scope->getBaseUrl(), PHP_URL_HOST); + $scopeHostNames[] = parse_url($scope->getBaseUrl(UrlInterface::URL_TYPE_LINK, true), PHP_URL_HOST); + } + $scopeHostNames = array_unique($scopeHostNames); + return in_array($hostName, $scopeHostNames); + } +} diff --git a/lib/internal/Magento/Framework/Url/Test/Unit/HostCheckerTest.php b/lib/internal/Magento/Framework/Url/Test/Unit/HostCheckerTest.php new file mode 100644 index 0000000000000..a6be097ac38ea --- /dev/null +++ b/lib/internal/Magento/Framework/Url/Test/Unit/HostCheckerTest.php @@ -0,0 +1,63 @@ +scopeResolver = $this->getMockBuilder( + \Magento\Framework\Url\ScopeResolverInterface::class + )->getMock(); + + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject( + \Magento\Framework\Url\HostChecker::class, + [ + 'scopeResolver' => $this->scopeResolver + ] + ); + } + + /** + * @dataProvider isOwnOriginDataProvider + * @param string $url + * @param boolean $result + */ + public function testIsOwnOrigin($url, $result) + { + $scopes[0] = $this->getMockBuilder(\Magento\Framework\Url\ScopeInterface::class)->getMock(); + $scopes[0]->expects($this->any())->method('getBaseUrl')->willReturn('http://www.example.com'); + $scopes[1] = $this->getMockBuilder(\Magento\Framework\Url\ScopeInterface::class)->getMock(); + $scopes[1]->expects($this->any())->method('getBaseUrl')->willReturn('https://www.example2.com'); + + $this->scopeResolver->expects($this->atLeastOnce())->method('getScopes')->willReturn($scopes); + + $this->assertEquals($result, $this->object->isOwnOrigin($url)); + } + + /** + * @return array + */ + public function isOwnOriginDataProvider() + { + return [ + ['http://www.example.com/some/page/', true], + ['http://www.test.com/other/page/', false], + ]; + } +} From 6da651aad7c7ce762433f89874230db099d350ec Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 3 Nov 2016 16:04:46 +0200 Subject: [PATCH 1625/3232] MAGETWO-59916: Problem arose when applying a coupon. ~QUANS~ --- .../Checkout/Controller/Cart/CouponPost.php | 31 ++++++----------- .../Unit/Controller/Cart/CouponPostTest.php | 16 +++++++++ .../Controller/Cart/Index/CouponPostTest.php | 34 +++++++++++++++++++ 3 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php diff --git a/app/code/Magento/Checkout/Controller/Cart/CouponPost.php b/app/code/Magento/Checkout/Controller/Cart/CouponPost.php index 2b3f65728068b..0498b22d550e7 100644 --- a/app/code/Magento/Checkout/Controller/Cart/CouponPost.php +++ b/app/code/Magento/Checkout/Controller/Cart/CouponPost.php @@ -90,26 +90,17 @@ public function execute() if ($codeLength) { $escaper = $this->_objectManager->get(\Magento\Framework\Escaper::class); + $coupon = $this->couponFactory->create(); + $coupon->load($couponCode, 'code'); if (!$itemsCount) { - if ($isCodeLengthValid) { - $coupon = $this->couponFactory->create(); - $coupon->load($couponCode, 'code'); - if ($coupon->getId()) { - $this->_checkoutSession->getQuote()->setCouponCode($couponCode)->save(); - $this->messageManager->addSuccess( - __( - 'You used coupon code "%1".', - $escaper->escapeHtml($couponCode) - ) - ); - } else { - $this->messageManager->addError( - __( - 'The coupon code "%1" is not valid.', - $escaper->escapeHtml($couponCode) - ) - ); - } + if ($isCodeLengthValid && $coupon->getId()) { + $this->_checkoutSession->getQuote()->setCouponCode($couponCode)->save(); + $this->messageManager->addSuccess( + __( + 'You used coupon code "%1".', + $escaper->escapeHtml($couponCode) + ) + ); } else { $this->messageManager->addError( __( @@ -119,7 +110,7 @@ public function execute() ); } } else { - if ($isCodeLengthValid && $couponCode == $cartQuote->getCouponCode()) { + if ($isCodeLengthValid && $coupon->getId() && $couponCode == $cartQuote->getCouponCode()) { $this->messageManager->addSuccess( __( 'You used coupon code "%1".', diff --git a/app/code/Magento/Checkout/Test/Unit/Controller/Cart/CouponPostTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Cart/CouponPostTest.php index 16ffb7c2b1437..93100df3d8c32 100644 --- a/app/code/Magento/Checkout/Test/Unit/Controller/Cart/CouponPostTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Controller/Cart/CouponPostTest.php @@ -69,6 +69,16 @@ class CouponPostTest extends \PHPUnit_Framework_TestCase */ protected $quoteRepository; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $redirect; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $redirectFactory; + /** * @return void */ @@ -204,6 +214,12 @@ public function testExecuteWithGoodCouponAndItems() ->method('getCouponCode') ->willReturn('OLDCODE'); + $coupon = $this->getMock(\Magento\SalesRule\Model\Coupon::class, [], [], '', false); + $this->couponFactory->expects($this->once()) + ->method('create') + ->willReturn($coupon); + $coupon->expects($this->once())->method('load')->willReturnSelf(); + $coupon->expects($this->once())->method('getId')->willReturn(1); $this->quote->expects($this->any()) ->method('getItemsCount') ->willReturn(1); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php new file mode 100644 index 0000000000000..3ff75fb1cc601 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php @@ -0,0 +1,34 @@ +_objectManager->create(\Magento\Checkout\Model\Session::class); + $quote = $session->getQuote(); + $quote->setData('trigger_recollect', 1)->setTotalsCollectedFlag(true)->save(); + $inputData = [ + 'remove' => 0, + 'coupon_code' => 'test' + ]; + $this->getRequest()->setPostValue($inputData); + $this->dispatch( + 'checkout/cart/couponPost/' + ); + + $this->assertSessionMessages($this->equalTo(['The coupon code "test" is not valid.']), + \Magento\Framework\Message\MessageInterface::TYPE_ERROR); + } +} From eb2d4357626c9cec9f1e074e13a918e95e1546d7 Mon Sep 17 00:00:00 2001 From: aakimov Date: Thu, 3 Nov 2016 12:32:30 +0200 Subject: [PATCH 1626/3232] MAGETWO-58074: Lins are not Displayed on Frontend --- .../blank/Magento_Rma/web/css/source/_module.less | 9 +++++---- .../Magento/luma/Magento_Rma/web/css/source/_module.less | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Rma/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Rma/web/css/source/_module.less index a8d0bf8b58482..6596fe2fd7976 100644 --- a/app/design/frontend/Magento/blank/Magento_Rma/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Rma/web/css/source/_module.less @@ -158,11 +158,12 @@ .block-returns-tracking { .block-title { .action { - margin: 12px 0 0 30px; + margin: 0 0 0 30px; + } - &.track { - float: right; - } + .actions-track { + float: right; + margin-top: 12px; } } } diff --git a/app/design/frontend/Magento/luma/Magento_Rma/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Rma/web/css/source/_module.less index cfec28464244e..c7e955e69c3a6 100644 --- a/app/design/frontend/Magento/luma/Magento_Rma/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Rma/web/css/source/_module.less @@ -176,11 +176,12 @@ .block-returns-tracking { .block-title { .action { - margin: 12px 0 0 30px; + margin: 0 0 0 30px; + } - &.track { - float: right; - } + .actions-track { + float: right; + margin-top: 12px; } } } From 5822d8d078ef543684bb04c0017cefba1e278f3b Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 3 Nov 2016 16:32:21 +0200 Subject: [PATCH 1627/3232] MAGETWO-59916: Problem arose when applying a coupon. ~QUANS~ --- .../Checkout/Controller/Cart/Index/CouponPostTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php index 3ff75fb1cc601..3feb4bd061994 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php @@ -6,6 +6,9 @@ namespace Magento\Checkout\Controller\Cart\Index; +/** + * @magentoDbIsolation enabled + */ class CouponPostTest extends \Magento\TestFramework\TestCase\AbstractController { /** @@ -15,7 +18,7 @@ class CouponPostTest extends \Magento\TestFramework\TestCase\AbstractController */ public function testExecute() { - /** @var $session \Magento\Checkout\Model\Session */ + /** @var $session \Magento\Checkout\Model\Session */ $session = $this->_objectManager->create(\Magento\Checkout\Model\Session::class); $quote = $session->getQuote(); $quote->setData('trigger_recollect', 1)->setTotalsCollectedFlag(true)->save(); @@ -28,7 +31,9 @@ public function testExecute() 'checkout/cart/couponPost/' ); - $this->assertSessionMessages($this->equalTo(['The coupon code "test" is not valid.']), - \Magento\Framework\Message\MessageInterface::TYPE_ERROR); + $this->assertSessionMessages( + $this->equalTo(['The coupon code "test" is not valid.']), + \Magento\Framework\Message\MessageInterface::TYPE_ERROR + ); } } From 2f3a64b411487af1ccaf59690227c30c483713ad Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 3 Nov 2016 09:36:11 -0500 Subject: [PATCH 1628/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Refactoring tests --- app/code/Magento/Cron/Model/Config/Data.php | 4 ---- .../Magento/Cron/Model/Groups/Config/Data.php | 3 --- .../Magento/Customer/Model/Address/Config.php | 6 +----- .../Model/Customer/NotificationStorageTest.php | 6 +++--- app/code/Magento/Sales/Model/Config/Data.php | 4 ---- .../Api/ExtensionAttribute/Config.php | 3 +++ .../Magento/Framework/Config/Data/Scoped.php | 2 -- .../Config/Test/Unit/Data/ScopedTest.php | 6 +----- .../Framework/Config/Test/Unit/DataTest.php | 12 ++++++------ .../Framework/DataObject/Copy/Config/Data.php | 2 -- .../Test/Unit/PluginList/PluginListTest.php | 18 +++++++++--------- 11 files changed, 23 insertions(+), 43 deletions(-) diff --git a/app/code/Magento/Cron/Model/Config/Data.php b/app/code/Magento/Cron/Model/Config/Data.php index 5b2f638609df7..0e685aa910296 100644 --- a/app/code/Magento/Cron/Model/Config/Data.php +++ b/app/code/Magento/Cron/Model/Config/Data.php @@ -3,10 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -/** - * Prepare cron jobs data - */ namespace Magento\Cron\Model\Config; use Magento\Framework\Serialize\SerializerInterface; diff --git a/app/code/Magento/Cron/Model/Groups/Config/Data.php b/app/code/Magento/Cron/Model/Groups/Config/Data.php index 2f400c642ed33..5c69cf9667b35 100644 --- a/app/code/Magento/Cron/Model/Groups/Config/Data.php +++ b/app/code/Magento/Cron/Model/Groups/Config/Data.php @@ -7,9 +7,6 @@ use Magento\Framework\Serialize\SerializerInterface; -/** - * Prepare cron jobs data - */ class Data extends \Magento\Framework\Config\Data { /** diff --git a/app/code/Magento/Customer/Model/Address/Config.php b/app/code/Magento/Customer/Model/Address/Config.php index dc2ceede663fb..7170cf3d2383f 100644 --- a/app/code/Magento/Customer/Model/Address/Config.php +++ b/app/code/Magento/Customer/Model/Address/Config.php @@ -12,8 +12,6 @@ /** * Customer address config - * - * @author Magento Core Team */ class Config extends ConfigData { @@ -24,7 +22,7 @@ class Config extends ConfigData const DEFAULT_ADDRESS_FORMAT = 'oneline'; /** - * Customer Address Templates per store + * Customer address templates per store * * @var array */ @@ -61,8 +59,6 @@ class Config extends ConfigData protected $_scopeConfig; /** - * Config constructor - * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param \Magento\Store\Model\StoreManagerInterface $storeManager diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/NotificationStorageTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/NotificationStorageTest.php index e75cacc0781d5..644d0a2d70122 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/NotificationStorageTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/NotificationStorageTest.php @@ -45,15 +45,15 @@ public function testAdd() 'customer_id' => $customerId, 'notification_type' => $notificationType ]; - $jsonString = json_encode($data); + $serializedData = 'serialized data'; $this->serializerMock->expects($this->once()) ->method('serialize') ->with($data) - ->willReturn($jsonString); + ->willReturn($serializedData); $this->cacheMock->expects($this->once()) ->method('save') ->with( - $jsonString, + $serializedData, $this->getCacheKey($notificationType, $customerId) ); $this->notificationStorage->add($notificationType, $customerId); diff --git a/app/code/Magento/Sales/Model/Config/Data.php b/app/code/Magento/Sales/Model/Config/Data.php index 0d44c627d5552..bbd90a302f659 100644 --- a/app/code/Magento/Sales/Model/Config/Data.php +++ b/app/code/Magento/Sales/Model/Config/Data.php @@ -3,10 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -/** - * Sales configuration data container - */ namespace Magento\Sales\Model\Config; use Magento\Framework\Serialize\SerializerInterface; diff --git a/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php b/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php index 3c5dd0bf415d2..32d2b75ed5e54 100644 --- a/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php +++ b/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php @@ -14,6 +14,9 @@ */ class Config extends \Magento\Framework\Config\Data { + /** + * Cache identifier + */ const CACHE_ID = 'extension_attributes_config'; /** diff --git a/lib/internal/Magento/Framework/Config/Data/Scoped.php b/lib/internal/Magento/Framework/Config/Data/Scoped.php index 0171c97ff1e90..55a354f0d2a67 100644 --- a/lib/internal/Magento/Framework/Config/Data/Scoped.php +++ b/lib/internal/Magento/Framework/Config/Data/Scoped.php @@ -53,8 +53,6 @@ class Scoped extends \Magento\Framework\Config\Data protected $_loadedScopes = []; /** - * Constructor - * * @param \Magento\Framework\Config\ReaderInterface $reader * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php index 6e89bf9d50ab0..607977b99bb42 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php @@ -52,13 +52,9 @@ protected function setUp() 'configScope' => $this->_configScopeMock, 'cache' => $this->_cacheMock, 'cacheId' => 'tag', + 'serializer' => $this->serializerMock ] ); - $this->objectManager->setBackwardCompatibleProperty( - $this->_model, - 'serializer', - $this->serializerMock - ); } /** diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php index 5ad20aead09bd..c37d2108191b4 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php @@ -60,16 +60,16 @@ public function testGetConfigNotCached() public function testGetConfigCached() { $data = ['a' => 'b']; - $jsonString = '{"a":"b"}'; + $serializedData = '{"a":"b"}'; $cacheId = 'test'; $this->cacheMock->expects($this->once()) ->method('load') - ->willReturn($jsonString); + ->willReturn($serializedData); $this->readerMock->expects($this->never()) ->method('read'); $this->serializerMock->expects($this->once()) ->method('unserialize') - ->with($jsonString) + ->with($serializedData) ->willReturn($data); $config = new \Magento\Framework\Config\Data( $this->readerMock, @@ -83,14 +83,14 @@ public function testGetConfigCached() public function testReset() { - $jsonString = ''; + $serializedData = ''; $cacheId = 'test'; $this->cacheMock->expects($this->once()) ->method('load') - ->willReturn($jsonString); + ->willReturn($serializedData); $this->serializerMock->expects($this->once()) ->method('unserialize') - ->with($jsonString) + ->with($serializedData) ->willReturn([]); $this->cacheMock->expects($this->once()) ->method('remove') diff --git a/lib/internal/Magento/Framework/DataObject/Copy/Config/Data.php b/lib/internal/Magento/Framework/DataObject/Copy/Config/Data.php index 61802637750c6..731eb9d685d51 100644 --- a/lib/internal/Magento/Framework/DataObject/Copy/Config/Data.php +++ b/lib/internal/Magento/Framework/DataObject/Copy/Config/Data.php @@ -1,7 +1,5 @@ getMock(\Magento\Framework\ObjectManagerInterface::class); $objectManagerMock->expects($this->any())->method('get')->will($this->returnArgument(0)); + $this->serializerMock = $this->getMock(SerializerInterface::class); $definitions = new \Magento\Framework\ObjectManager\Definition\Runtime(); @@ -80,15 +85,10 @@ protected function setUp() 'objectManager' => $objectManagerMock, 'classDefinitions' => $definitions, 'scopePriorityScheme' => ['global'], - 'cacheId' => 'interception' + 'cacheId' => 'interception', + 'serializer' => $this->serializerMock ] ); - $this->serializerMock = $this->getMock(SerializerInterface::class); - $objectManagerHelper->setBackwardCompatibleProperty( - $this->object, - 'serializer', - $this->serializerMock - ); $this->loggerMock = $this->getMock(\Psr\Log\LoggerInterface::class); $objectManagerHelper->setBackwardCompatibleProperty( From 2891de9822009b25ef8c2c9807321e4dd84c72cb Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 3 Nov 2016 09:59:52 -0500 Subject: [PATCH 1629/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding SerializerInterface dependency in the constructor --- app/code/Magento/Indexer/Model/Config/Data.php | 3 +++ lib/internal/Magento/Framework/Config/Data.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Indexer/Model/Config/Data.php b/app/code/Magento/Indexer/Model/Config/Data.php index 2e1e433e4be25..cf6ea584196ce 100644 --- a/app/code/Magento/Indexer/Model/Config/Data.php +++ b/app/code/Magento/Indexer/Model/Config/Data.php @@ -6,6 +6,8 @@ namespace Magento\Indexer\Model\Config; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; +use Magento\Framework\App\ObjectManager; class Data extends \Magento\Framework\Config\Data { @@ -29,6 +31,7 @@ public function __construct( SerializerInterface $serializer = null ) { $this->stateCollection = $stateCollection; + $serializer = $serializer ?: ObjectManager::getInstance()->get(Serialize::class); $isCacheExists = $cache->test($cacheId); diff --git a/lib/internal/Magento/Framework/Config/Data.php b/lib/internal/Magento/Framework/Config/Data.php index e3e09f0fca602..0723e40dbfef3 100644 --- a/lib/internal/Magento/Framework/Config/Data.php +++ b/lib/internal/Magento/Framework/Config/Data.php @@ -1,7 +1,5 @@ Date: Thu, 3 Nov 2016 17:05:23 +0200 Subject: [PATCH 1630/3232] MAGETWO-60351: Unnecessary disabled payment methods on checkout page #4868 --- .../Plugin/PaymentConfigurationProcess.php | 74 ++++++++ .../PaymentConfigurationProcessTest.php | 131 ++++++++++++++ app/code/Magento/Payment/etc/frontend/di.xml | 3 + .../PaymentVaultConfigurationProcess.php | 92 ++++++++++ .../PaymentVaultConfigurationProcessTest.php | 162 ++++++++++++++++++ app/code/Magento/Vault/etc/frontend/di.xml | 4 + 6 files changed, 466 insertions(+) create mode 100644 app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php create mode 100644 app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php create mode 100644 app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php create mode 100644 app/code/Magento/Vault/Test/Unit/Plugin/PaymentVaultConfigurationProcessTest.php diff --git a/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php b/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php new file mode 100644 index 0000000000000..d618ba92c23f6 --- /dev/null +++ b/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php @@ -0,0 +1,74 @@ +paymentMethodList = $paymentMethodList; + $this->storeManager = $storeManager; + } + + /** + * Checkout LayoutProcessor before process plugin. + * + * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $processor + * @param array $jsLayout + * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeProcess(\Magento\Checkout\Block\Checkout\LayoutProcessor $processor, $jsLayout) + { + $configuration = &$jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children']; + + if (!isset($configuration)) { + return [$jsLayout]; + } + + $storeId = $this->storeManager->getStore()->getId(); + $activePaymentMethodList = $this->paymentMethodList->getActiveList($storeId); + $getCodeFunc = function($method) { + return $method->getCode(); + }; + $activePaymentMethodCodes = array_map($getCodeFunc, $activePaymentMethodList); + + foreach ($configuration as $paymentGroup => $groupConfig) { + foreach (array_keys($groupConfig['methods']) as $paymentCode) { + if (!in_array($paymentCode, $activePaymentMethodCodes)) { + unset($configuration[$paymentGroup]['methods'][$paymentCode]); + } + } + if (empty($configuration[$paymentGroup]['methods'])) { + unset($configuration[$paymentGroup]); + } + } + + return [$jsLayout]; + } +} diff --git a/app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php b/app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php new file mode 100644 index 0000000000000..be5755440066e --- /dev/null +++ b/app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php @@ -0,0 +1,131 @@ +storeManager = $this + ->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getStore']) + ->getMockForAbstractClass(); + $this->store = $this + ->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getId']) + ->getMockForAbstractClass(); + $this->paymentMethodList = $this + ->getMockBuilder(\Magento\Payment\Api\PaymentMethodListInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getActiveList']) + ->getMockForAbstractClass(); + $this->layoutProcessor = $this + ->getMockBuilder(\Magento\Checkout\Block\Checkout\LayoutProcessor::class) + ->disableOriginalConstructor() + ->setMethods(['process']) + ->getMockForAbstractClass(); + + $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->plugin = $objectManagerHelper->getObject( + \Magento\Payment\Plugin\PaymentConfigurationProcess::class, + [ + 'paymentMethodList' => $this->paymentMethodList, + 'storeManager' => $this->storeManager + ] + ); + } + + /** + * @param array $jsLayout + * @param array $activePaymentList + * @param array $expectedResult + * @dataProvider beforeProcessDataProvider + */ + public function testBeforeProcess($jsLayout, $activePaymentList, $expectedResult) + { + $this->store->expects($this->once())->method('getId')->willReturn(1); + $this->storeManager->expects($this->once())->method('getStore')->willReturn($this->store); + $this->paymentMethodList->expects($this->once()) + ->method('getActiveList') + ->with(1) + ->willReturn($activePaymentList); + + $result = $this->plugin->beforeProcess($this->layoutProcessor, $jsLayout); + $this->assertEquals($result[0], $expectedResult); + } + + /** + * Data provider for BeforeProcess. + * + * @return array + */ + public function beforeProcessDataProvider() + { + $jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children'] = [ + 'braintree' => [ + 'methods' => [ + 'braintree' => [], + 'braintree_paypal' => [] + ] + ] + ]; + $result['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children'] = []; + + $braintreePaymentMethod = $this + ->getMockBuilder(\Magento\Payment\Api\Data\PaymentMethodInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getCode']) + ->getMockForAbstractClass(); + $braintreePaypalPaymentMethod = $this + ->getMockBuilder(\Magento\Payment\Api\Data\PaymentMethodInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getCode']) + ->getMockForAbstractClass(); + + $braintreePaymentMethod->expects($this->any())->method('getCode')->willReturn('braintree'); + $braintreePaypalPaymentMethod->expects($this->any())->method('getCode')->willReturn('braintree_paypal'); + + return [ + [$jsLayout, [], $result], + [$jsLayout, [$braintreePaymentMethod, $braintreePaypalPaymentMethod], $jsLayout] + ]; + } +} diff --git a/app/code/Magento/Payment/etc/frontend/di.xml b/app/code/Magento/Payment/etc/frontend/di.xml index 4ff3c013b6765..471a7ce9e2de5 100644 --- a/app/code/Magento/Payment/etc/frontend/di.xml +++ b/app/code/Magento/Payment/etc/frontend/di.xml @@ -19,4 +19,7 @@ + + + \ No newline at end of file diff --git a/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php b/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php new file mode 100644 index 0000000000000..fe4b88f073828 --- /dev/null +++ b/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php @@ -0,0 +1,92 @@ +vaultPaymentList = $vaultPaymentList; + $this->paymentMethodList = $paymentMethodList; + $this->storeManager = $storeManager; + } + + /** + * Checkout LayoutProcessor before process plugin. + * + * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $processor + * @param array $jsLayout + * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeProcess(\Magento\Checkout\Block\Checkout\LayoutProcessor $processor, $jsLayout) + { + $configuration = &$jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children']; + + if (!isset($configuration)) { + return [$jsLayout]; + } + + $storeId = $this->storeManager->getStore()->getId(); + $activePaymentMethodList = $this->paymentMethodList->getActiveList($storeId); + $activeVaultList = $this->vaultPaymentList->getActiveList($storeId); + $getCodeFunc = function($method) { + return $method->getCode(); + }; + $getProviderCodeFunc = function($method) { + return $method->getProviderCode(); + }; + $activePaymentMethodCodes = array_map($getCodeFunc, $activePaymentMethodList); + $activeVaultCodes = array_map($getCodeFunc, $activeVaultList); + $activeVaultProviderCodes = array_map($getProviderCodeFunc, $activeVaultList); + $activePaymentMethodCodes = array_merge($activePaymentMethodCodes, $activeVaultCodes, $activeVaultProviderCodes); + + foreach ($configuration as $paymentGroup => $groupConfig) { + foreach (array_keys($groupConfig['methods']) as $paymentCode) { + if (!in_array($paymentCode, $activePaymentMethodCodes)) { + unset($configuration[$paymentGroup]['methods'][$paymentCode]); + } + } + if ($paymentGroup === 'vault' && !empty($activeVaultCodes)) { + continue; + } + if (empty($configuration[$paymentGroup]['methods'])) { + unset($configuration[$paymentGroup]); + } + } + + return [$jsLayout]; + } +} diff --git a/app/code/Magento/Vault/Test/Unit/Plugin/PaymentVaultConfigurationProcessTest.php b/app/code/Magento/Vault/Test/Unit/Plugin/PaymentVaultConfigurationProcessTest.php new file mode 100644 index 0000000000000..0cf64c5424740 --- /dev/null +++ b/app/code/Magento/Vault/Test/Unit/Plugin/PaymentVaultConfigurationProcessTest.php @@ -0,0 +1,162 @@ +storeManager = $this + ->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getStore']) + ->getMockForAbstractClass(); + $this->store = $this + ->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getId']) + ->getMockForAbstractClass(); + $this->vaultList = $this + ->getMockBuilder(\Magento\Vault\Api\PaymentMethodListInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getActiveList']) + ->getMockForAbstractClass(); + $this->paymentMethodList = $this + ->getMockBuilder(\Magento\Payment\Api\PaymentMethodListInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getActiveList']) + ->getMockForAbstractClass(); + $this->layoutProcessor = $this + ->getMockBuilder(\Magento\Checkout\Block\Checkout\LayoutProcessor::class) + ->disableOriginalConstructor() + ->setMethods(['process']) + ->getMockForAbstractClass(); + + $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->plugin = $objectManagerHelper->getObject( + \Magento\Vault\Plugin\PaymentVaultConfigurationProcess::class, + [ + 'vaultPaymentList' => $this->vaultList, + 'paymentMethodList' => $this->paymentMethodList, + 'storeManager' => $this->storeManager + ] + ); + } + + /** + * @param array $jsLayout + * @param array $activeVaultList + * @param array $activePaymentList + * @param array $expectedResult + * @dataProvider beforeProcessDataProvider + */ + public function testBeforeProcess($jsLayout, $activeVaultList, $activePaymentList, $expectedResult) + { + $this->store->expects($this->once())->method('getId')->willReturn(1); + $this->storeManager->expects($this->once())->method('getStore')->willReturn($this->store); + $this->vaultList->expects($this->once())->method('getActiveList')->with(1)->willReturn($activeVaultList); + $this->paymentMethodList->expects($this->once()) + ->method('getActiveList') + ->with(1) + ->willReturn($activePaymentList); + $result = $this->plugin->beforeProcess($this->layoutProcessor, $jsLayout); + $this->assertEquals($result[0], $expectedResult); + } + + /** + * Data provider for BeforeProcess. + * + * @return array + */ + public function beforeProcessDataProvider() + { + $jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children'] = [ + 'vault' => [ + 'methods' => [ + 'braintree_paypal_vault' => [] + ] + ], + 'braintree' => [ + 'methods' => [ + 'braintree_paypal' => [], + 'braintree' => [] + ] + ], + 'paypal-payments' => [ + 'methods' => [ + 'payflowpro' => [], + 'payflow_link' => [] + ] + ] + ]; + $result1['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children'] = []; + $result2['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children'] = [ + 'vault' => [ + 'methods' => [ + 'braintree_paypal_vault' => [] + ] + ], + 'braintree' => [ + 'methods' => [ + 'braintree_paypal' => [] + ] + ] + ]; + + $vaultPaymentMethod = $this + ->getMockBuilder(\Magento\Vault\Api\PaymentMethodListInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getCode', 'getProviderCode']) + ->getMockForAbstractClass(); + + $vaultPaymentMethod->expects($this->any())->method('getCode')->willReturn('braintree_paypal_vault'); + $vaultPaymentMethod->expects($this->any())->method('getProviderCode')->willReturn('braintree_paypal'); + + return [ + [$jsLayout, [], [], $result1], + [$jsLayout, [$vaultPaymentMethod], [], $result2] + ]; + } +} diff --git a/app/code/Magento/Vault/etc/frontend/di.xml b/app/code/Magento/Vault/etc/frontend/di.xml index d7f699faff53c..0af0e4cd32217 100644 --- a/app/code/Magento/Vault/etc/frontend/di.xml +++ b/app/code/Magento/Vault/etc/frontend/di.xml @@ -19,4 +19,8 @@ Magento\Customer\Model\Session + + + + From 982bed00678e5bfc90811e54528d7b19a1e6d98a Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 3 Nov 2016 10:32:44 -0500 Subject: [PATCH 1631/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding SerializerInterface dependency in the constructor --- .../Interception/PluginList/PluginList.php | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php index 3406a1395675f..f74213eaf4a06 100644 --- a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php +++ b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php @@ -92,7 +92,8 @@ class PluginList extends Scoped implements InterceptionPluginList * @param ObjectManagerInterface $objectManager * @param ClassDefinitions $classDefinitions * @param array $scopePriorityScheme - * @param string $cacheId + * @param string|null $cacheId + * @param SerializerInterface|null $serializer * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -105,9 +106,11 @@ public function __construct( ObjectManagerInterface $objectManager, ClassDefinitions $classDefinitions, array $scopePriorityScheme = ['global'], - $cacheId = 'plugins' + $cacheId = 'plugins', + SerializerInterface $serializer = null ) { - parent::__construct($reader, $configScope, $cache, $cacheId); + $serializer = $serializer ?: $objectManager->get(Serialize::class); + parent::__construct($reader, $configScope, $cache, $cacheId, $serializer); $this->_omConfig = $omConfig; $this->_relations = $relations; $this->_definitions = $definitions; @@ -277,7 +280,7 @@ protected function _loadScopedData() $cacheId = implode('|', $this->_scopePriorityScheme) . "|" . $this->_cacheId; $data = $this->_cache->load($cacheId); if ($data) { - list($this->_data, $this->_inherited, $this->_processed) = $this->getSerializer()->unserialize($data); + list($this->_data, $this->_inherited, $this->_processed) = $this->serializer->unserialize($data); foreach ($this->_scopePriorityScheme as $scope) { $this->_loadedScopes[$scope] = true; } @@ -311,7 +314,7 @@ protected function _loadScopedData() $this->_inheritPlugins($class); } $this->_cache->save( - $this->getSerializer()->serialize([$this->_data, $this->_inherited, $this->_processed]), + $this->serializer->serialize([$this->_data, $this->_inherited, $this->_processed]), $cacheId ); } @@ -389,18 +392,4 @@ private function getLogger() } return $this->logger; } - - /** - * Get serializer - * - * @return SerializerInterface - * @deprecated - */ - protected function getSerializer() - { - if (null === $this->serializer) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get(Serialize::class); - } - return $this->serializer; - } } From 79f392c4f1cf43675acc09fcc80ac248a40e1635 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Thu, 3 Nov 2016 17:40:13 +0200 Subject: [PATCH 1632/3232] MAGETWO-60351: Unnecessary disabled payment methods on checkout page #4868 --- .../Payment/Plugin/PaymentConfigurationProcess.php | 2 +- .../Vault/Plugin/PaymentVaultConfigurationProcess.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php b/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php index d618ba92c23f6..b1e36b7ae39f3 100644 --- a/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php +++ b/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php @@ -53,7 +53,7 @@ public function beforeProcess(\Magento\Checkout\Block\Checkout\LayoutProcessor $ $storeId = $this->storeManager->getStore()->getId(); $activePaymentMethodList = $this->paymentMethodList->getActiveList($storeId); - $getCodeFunc = function($method) { + $getCodeFunc = function ($method) { return $method->getCode(); }; $activePaymentMethodCodes = array_map($getCodeFunc, $activePaymentMethodList); diff --git a/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php b/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php index fe4b88f073828..666e0b186309e 100644 --- a/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php +++ b/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php @@ -62,16 +62,20 @@ public function beforeProcess(\Magento\Checkout\Block\Checkout\LayoutProcessor $ $storeId = $this->storeManager->getStore()->getId(); $activePaymentMethodList = $this->paymentMethodList->getActiveList($storeId); $activeVaultList = $this->vaultPaymentList->getActiveList($storeId); - $getCodeFunc = function($method) { + $getCodeFunc = function ($method) { return $method->getCode(); }; - $getProviderCodeFunc = function($method) { + $getProviderCodeFunc = function ($method) { return $method->getProviderCode(); }; $activePaymentMethodCodes = array_map($getCodeFunc, $activePaymentMethodList); $activeVaultCodes = array_map($getCodeFunc, $activeVaultList); $activeVaultProviderCodes = array_map($getProviderCodeFunc, $activeVaultList); - $activePaymentMethodCodes = array_merge($activePaymentMethodCodes, $activeVaultCodes, $activeVaultProviderCodes); + $activePaymentMethodCodes = array_merge( + $activePaymentMethodCodes, + $activeVaultCodes, + $activeVaultProviderCodes + ); foreach ($configuration as $paymentGroup => $groupConfig) { foreach (array_keys($groupConfig['methods']) as $paymentCode) { From e367856b986c05df920f8b10accbb70ebd3106c8 Mon Sep 17 00:00:00 2001 From: Dmytro Aponasenko Date: Thu, 3 Nov 2016 18:27:01 +0200 Subject: [PATCH 1633/3232] MTA-3603: Create 'green' functional test suite --- .../Test/TestCase/GlobalSearchEntityTest.xml | 5 ++++ ...derWithPayPalBraintreeVaultBackendTest.xml | 2 +- .../CreateBundleProductEntityTest.xml | 11 ++++++- .../UpdateBundleProductEntityTest.php | 1 + .../Category/CreateCategoryEntityTest.xml | 5 +++- .../Test/TestCase/NavigateMenuTest.xml | 2 +- .../Product/AddCompareProductsTest.php | 1 + .../Product/AddCompareProductsTest.xml | 1 + .../Product/ClearAllCompareProductsTest.xml | 1 + .../Product/CreateSimpleProductEntityTest.xml | 9 ++++++ .../CreateVirtualProductEntityTest.xml | 6 +++- .../Product/DeleteCompareProductsTest.php | 1 + .../Product/DeleteCompareProductsTest.xml | 2 ++ .../Product/DeleteProductEntityTest.xml | 1 + .../Product/DuplicateProductEntityTest.xml | 1 + .../ProductTypeSwitchingOnCreationTest.xml | 4 +++ .../ProductTypeSwitchingOnUpdateTest.xml | 11 +++++++ .../Product/UpdateSimpleProductEntityTest.xml | 10 +++++++ .../UpdateVirtualProductEntityTest.php | 1 + .../CreateAttributeSetEntityTest.xml | 1 + .../CreateProductAttributeEntityTest.xml | 10 ++++++- .../DeleteAttributeSetTest.xml | 1 + .../DeleteProductAttributeEntityTest.xml | 1 + .../UpdateAttributeSetTest.xml | 1 + .../UpdateProductAttributeEntityTest.xml | 3 ++ .../SuggestSearchingResultEntityTest.xml | 2 ++ .../AddProductsToShoppingCartEntityTest.xml | 7 +++++ .../DeleteProductsFromShoppingCartTest.xml | 2 ++ .../Test/TestCase/OnePageCheckoutTest.xml | 4 +++ ...eProductFromMiniShoppingCartEntityTest.xml | 10 +++---- .../Test/TestCase/UpdateShoppingCartTest.php | 1 + .../TestCase/DeleteCmsBlockEntityTest.xml | 2 +- .../Test/TestCase/DeleteCmsPageEntityTest.xml | 2 +- .../Test/TestCase/GridFullTextSearchTest.xml | 2 +- .../Cms/Test/TestCase/GridSortingTest.xml | 4 +-- .../Test/TestCase/UpdateCmsPageEntityTest.xml | 4 +-- .../VerifyAdminAccountSharingEntityTest.php | 3 +- .../CreateConfigurableProductEntityTest.xml | 6 ++++ .../TestCase/DuplicateProductEntityTest.xml | 1 + .../Test/TestCase/MassProductUpdateTest.xml | 1 + .../UpdateConfigurableProductEntityTest.php | 1 + .../AbstractCurrencySymbolEntityTest.php | 2 +- .../TestCase/EditCurrencySymbolEntityTest.php | 1 + .../ResetCurrencySymbolEntityTest.php | 1 + .../Customer/Test/Repository/Address.xml | 4 +-- .../CreateCustomerBackendEntityTest.xml | 3 ++ .../CreateCustomerGroupEntityTest.php | 1 + .../TestCase/DeleteCustomerAddressTest.php | 1 + .../Test/TestCase/GridSortingTest.xml | 1 + .../TestCase/MassAssignCustomerGroupTest.xml | 2 +- .../MassDeleteCustomerBackendEntityTest.xml | 1 + .../RegisterCustomerFrontendEntityTest.xml | 1 + .../UpdateCustomerBackendEntityTest.xml | 2 ++ .../UpdateCustomerGroupEntityTest.php | 1 + .../CreateDownloadableProductEntityTest.xml | 10 +++++++ .../TestCase/DuplicateProductEntityTest.xml | 1 + .../Test/TestCase/TaxCalculationTest.xml | 4 +++ .../UpdateDownloadableProductEntityTest.php | 1 + .../CreateEmailTemplateEntityTest.php | 1 + .../TestCase/CheckoutWithGiftMessagesTest.xml | 1 + .../CreateGroupedProductEntityTest.xml | 2 ++ .../DeleteProductFromMiniShoppingCartTest.xml | 1 + .../UpdateGroupedProductEntityTest.xml | 5 ++++ .../TestCase/UpdateIntegrationEntityTest.xml | 1 + .../ActionNewsletterTemplateEntityTest.php | 1 + .../PreviewNewsletterTemplateEntityTest.xml | 1 + .../Test/TestCase/AddProductVideoTest.xml | 2 ++ .../Test/TestCase/DeleteProductVideoTest.xml | 2 ++ .../Test/TestCase/UpdateProductVideoTest.php | 3 +- .../AbandonedCartsReportEntityTest.php | 1 + .../CustomersOrderCountReportEntityTest.php | 1 + .../DownloadProductsReportEntityTest.xml | 3 ++ .../TestCase/NewAccountsReportEntityTest.xml | 3 ++ .../OrderedProductsReportEntityTest.php | 1 + .../TestCase/SalesCouponReportEntityTest.php | 1 + .../TestCase/SalesInvoiceReportEntityTest.php | 1 + .../TestCase/SalesOrderReportEntityTest.xml | 2 ++ .../TestCase/SalesRefundsReportEntityTest.xml | 2 ++ .../TestCase/SalesTaxReportEntityTest.xml | 2 ++ .../ViewedProductsReportEntityTest.php | 1 + .../CreateProductReviewBackendEntityTest.php | 1 + .../CreateProductReviewFrontendEntityTest.xml | 1 + ...anageProductReviewFromCustomerPageTest.php | 1 + ...teProductReviewEntityOnProductPageTest.xml | 1 + .../UpdateProductReviewEntityTest.xml | 1 + .../Test/Block/Adminhtml/Order/Create.php | 1 + .../Test/Repository/OrderInjectable/Price.xml | 7 +++++ .../Test/TestCase/CancelCreatedOrderTest.xml | 2 ++ .../Test/TestCase/CreateInvoiceEntityTest.php | 1 + .../Test/TestCase/CreateInvoiceEntityTest.xml | 2 +- .../Test/TestCase/CreateOrderBackendTest.xml | 1 + .../Sales/Test/TestCase/GridFilteringTest.xml | 1 + .../Test/TestCase/GridFullTextSearchTest.xml | 3 ++ .../Sales/Test/TestCase/GridSortingTest.xml | 4 +++ .../Test/TestCase/MassOrdersUpdateTest.xml | 2 ++ ...MoveLastOrderedProductsOnOrderPageTest.xml | 2 ++ .../MoveProductsInComparedOnOrderPageTest.xml | 2 ++ ...ecentlyComparedProductsOnOrderPageTest.xml | 2 ++ ...eRecentlyViewedProductsOnOrderPageTest.xml | 2 ++ ...oveShoppingCartProductsOnOrderPageTest.xml | 2 ++ .../TestCase/PrintOrderFrontendGuestTest.xml | 1 + .../Test/TestCase/ReorderOrderEntityTest.xml | 1 + .../ApplySeveralSalesRuleEntityTest.xml | 3 ++ .../TestCase/CreateSalesRuleEntityTest.xml | 1 + .../Magento/SalesRule/Test/etc/testcase.xml | 4 +-- .../TestCase/CreateSynonymGroupEntityTest.xml | 2 +- .../TestCase/UpdateSynonymGroupEntityTest.xml | 2 +- .../TestCase/LockCustomerOnEditPageTest.xml | 2 +- .../TestCase/LockCustomerOnLoginPageTest.xml | 2 +- .../TestCase/DeleteStoreGroupEntityTest.xml | 2 +- .../Test/TestCase/DeleteWebsiteEntityTest.php | 1 + .../Test/TestCase/CreateTaxRuleEntityTest.xml | 2 ++ .../Tax/Test/TestCase/TaxCalculationTest.xml | 6 ++++ .../Test/TestCase/TaxWithCrossBorderTest.php | 1 + .../Test/TestCase/UpdateTaxRuleEntityTest.xml | 1 + .../Ui/Test/Block/Adminhtml/DataGrid.php | 27 +++++++++++++---- .../Ui/Test/TestCase/GridFilteringTest.php | 1 + .../Test/TestCase/GridFullTextSearchTest.php | 1 + .../TestCase/CreateAdminUserEntityTest.php | 1 + .../CreateCustomVariableEntityTest.xml | 1 + .../DeleteCustomVariableEntityTest.xml | 1 + .../Test/TestCase/CreateTaxWithFptTest.xml | 6 ++++ .../Test/TestCase/CreateWidgetEntityTest.xml | 10 ++++--- .../Block/Customer/Wishlist/Items/Product.php | 6 ++-- .../AddProductToWishlistEntityTest.xml | 3 ++ ...CartFromCustomerWishlistOnFrontendTest.php | 1 + ...CartFromCustomerWishlistOnFrontendTest.xml | 5 ++++ ...ProductInCustomerWishlistOnBackendTest.xml | 1 + ...roductInCustomerWishlistOnFrontendTest.php | 1 + ...roductInCustomerWishlistOnFrontendTest.xml | 5 ++++ ...leteProductsFromWishlistOnFrontendTest.xml | 5 ++++ ...eProductFromShoppingCartToWishlistTest.xml | 4 +++ ...ProductInCustomerWishlistOnBackendTest.xml | 1 + .../TestSuite/InjectableTests/basic_green.xml | 30 +++++++++++++++++++ 134 files changed, 354 insertions(+), 45 deletions(-) create mode 100644 dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic_green.xml diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.xml index 269bff796c7bc..accacc60fc5c0 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/GlobalSearchEntityTest.xml @@ -8,26 +8,31 @@ + stable:no search shows admin preview Some search term + stable:no search with 2 sign return no results :) + stable:no search product by sku orderInjectable::default::product::sku + stable:no search existed customer customer::johndoe_unique::lastname + stable:no search order (by order id) orderInjectable::default::id diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderWithPayPalBraintreeVaultBackendTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderWithPayPalBraintreeVaultBackendTest.xml index 03e0ba330fa3b..86b5ff79d648c 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderWithPayPalBraintreeVaultBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderWithPayPalBraintreeVaultBackendTest.xml @@ -8,7 +8,7 @@ - est_type:3rd_party_test, severity:S0 + test_type:3rd_party_test, severity:S0 catalogProductSimple::product_10_dollar default US_address_1_without_email 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 211e09861995f..7d4ccea704ec7 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 @@ -8,6 +8,7 @@ + stable:no Create default bundle with dynamic options bundle-product-%isolation% BundleProduct %isolation% @@ -44,7 +45,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes Create dynamic bundle with price randle and all types options bundle-product-%isolation% BundleProduct %isolation% @@ -74,6 +75,7 @@ + stable:no Create fixed bundle bundle-product-%isolation% BundleProduct %isolation% @@ -97,6 +99,7 @@ + stable:no Create fixed bundle with all types options bundle-product-%isolation% BundleProduct %isolation% @@ -161,6 +164,7 @@ + to_maintain:yes bundle-product-%isolation% BundleProduct %isolation% Yes @@ -187,6 +191,7 @@ + to_maintain:yes Create dynamic bundle with special price bundle-product-%isolation% Bundle Dynamic %isolation% @@ -236,6 +241,7 @@ + MAGETWO-52788: Dynamic Rows: support status being changed Create fixed product with checkout first option bundle-product-%isolation% Bundle Fixed %isolation% @@ -334,6 +340,7 @@ + stable:no bundle-product-%isolation% Bundle Fixed %isolation% No @@ -359,6 +366,7 @@ + stable:no bundle-product-%isolation% BundleProduct %isolation% Yes @@ -394,6 +402,7 @@ + to_maintain:yes bundle-product-%isolation% Bundle Fixed %isolation% No diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleProductEntityTest.php index bf17d216bcf9b..8326b1ba4d9ae 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleProductEntityTest.php @@ -73,6 +73,7 @@ public function __inject( */ public function test(BundleProduct $product, BundleProduct $originalProduct) { + $this->markTestIncomplete('MAGETWO-56584: [FT] Custom options are not created for product in test'); // Preconditions $originalProduct->persist(); $originalCategory = $originalProduct->hasData('category_ids') 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 22cdab45ac875..fa81264dd2d4b 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 @@ -16,6 +16,7 @@ + to_maintain:yes Create root category with all fields addRootCategory Yes @@ -56,6 +57,7 @@ + to_maintain:yes Create not anchor subcategory specifying all fields addSubcategory default_category @@ -90,6 +92,7 @@ + to_maintain:yes Create anchor subcategory with all fields addSubcategory default_category @@ -150,7 +153,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes Create category with three nesting addSubcategory two_nested_categories diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml index 2c8528595f44b..1b61b92beef13 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml @@ -14,7 +14,7 @@ Products > Categories - Default Category + Default Category (ID: 2) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.php index 131163311bcd2..eddb620feabb3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.php @@ -29,6 +29,7 @@ class AddCompareProductsTest extends AbstractCompareProductsTest { /* tags */ const MVP = 'yes'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.xml index 64d2a1de8a284..c29c99193b75d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/AddCompareProductsTest.xml @@ -10,6 +10,7 @@ catalogProductSimple::simple_for_composite_products No + to_maintain:yes diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.xml index 16ebdf323e592..19fc527e71ab7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.xml @@ -8,6 +8,7 @@ + stable:no compare_products catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::default,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product 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 9e410c525deef..d9ef9f0b0420d 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 @@ -137,6 +137,7 @@ simple_drop_down_with_one_option_percent_price MAGETWO-23030 MAGETWO-23002 + to_maintain:yes @@ -157,6 +158,7 @@ simple_drop_down_with_one_option_fixed_price MAGETWO-23029 MAGETWO-23002 + to_maintain:yes @@ -238,6 +240,7 @@ + stable:no Create simple product and check visibility in category simple-product-%isolation% Simple Product %isolation% @@ -255,6 +258,7 @@ + stable:no Create product with tax class and group price simple-product-%isolation% Simple Product %isolation% @@ -303,6 +307,7 @@ 66 143 default + to_maintain:yes @@ -324,6 +329,7 @@ options_suite simple_options_suite catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option + MAGETWO-58181: All kind of Custom Options have dynamic view on Bamboo @@ -333,6 +339,7 @@ + stable:no simple-product-%isolation% Simple Product %isolation% simple_sku_%isolation% @@ -349,6 +356,7 @@ + stable:no simple-product-%isolation% Simple Product %isolation% simple_sku_%isolation% @@ -401,6 +409,7 @@ simple%isolation% 10 345 + to_maintain:yes 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 bf158ce4d66b7..ed124d152d29b 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 @@ -8,6 +8,7 @@ + to_maintain:yes Create product with required fields virtual-product-%isolation% VirtualProduct %isolation% @@ -17,7 +18,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes virtual-product-%isolation% VirtualProduct %isolation% virtual_sku_%isolation% @@ -65,12 +66,14 @@ In Stock Catalog, Search default + to_maintain:yes + to_maintain:yes Create product with custom options suite and import options virtual-product-%isolation% VirtualProduct %isolation% @@ -110,6 +113,7 @@ 999 default Out of Stock + to_maintain:yes diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.php index 7026b757bb7de..81cf672344d61 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.php @@ -28,6 +28,7 @@ class DeleteCompareProductsTest extends AbstractCompareProductsTest { /* tags */ const MVP = 'yes'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.xml index 883e7cdf6032c..9d983f52c08b6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.xml @@ -8,6 +8,7 @@ + stable:no catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::default,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product 1 No @@ -15,6 +16,7 @@ + stable:no catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::default,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product 6 Yes diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteProductEntityTest.xml index 3bef2716d3572..32d534941e2b9 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteProductEntityTest.xml @@ -10,6 +10,7 @@ catalogProductSimple::default Yes + to_maintain:yes diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml index 5b81bebbc6d04..0dad886f05ed5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes catalogProductSimple::default 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 6cb89d424fee3..4ab490478958a 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 @@ -8,6 +8,7 @@ + stable:no simple configurableProduct::default @@ -44,6 +45,7 @@ + stable:no virtual configurableProduct::not_virtual_for_type_switching @@ -56,6 +58,7 @@ + stable:no virtual downloadableProduct::default @@ -73,6 +76,7 @@ downloadable configurableProduct::not_virtual_for_type_switching + to_maintain:yes 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 a2580cee9b91a..874cac5d4bc58 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 @@ -11,6 +11,7 @@ catalogProductSimple::default configurableProduct::default - + to_maintain:yes @@ -20,6 +21,7 @@ + to_maintain:yes catalogProductSimple::default catalogProductVirtual::default - @@ -27,6 +29,7 @@ + stable:no configurableProduct::default catalogProductSimple::product_without_category deleteVariations @@ -37,10 +40,12 @@ configurableProduct::default catalogProductVirtual::required_fields deleteVariations + to_maintain:yes + to_maintain:yes catalogProductVirtual::default catalogProductSimple::default - @@ -51,6 +56,7 @@ catalogProductVirtual::default configurableProduct::not_virtual_for_type_switching - + to_maintain:yes @@ -63,6 +69,7 @@ catalogProductVirtual::default downloadableProduct::default - + to_maintain:yes @@ -74,6 +81,7 @@ downloadableProduct::default catalogProductSimple::default - + to_maintain:yes @@ -81,6 +89,7 @@ downloadableProduct::default configurableProduct::not_virtual_for_type_switching - + to_maintain:yes @@ -90,6 +99,7 @@ + stable:no downloadableProduct::default catalogProductVirtual::default clearDownloadableData @@ -100,6 +110,7 @@ catalogProductSimple::default downloadableProduct::default - + to_maintain:yes 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 0395f9f5ed8cf..4d6db5e43a679 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 @@ -17,6 +17,7 @@ test-simple-product-%isolation% 120.0000 Catalog, Search + MAGETWO-58145 @@ -24,6 +25,7 @@ + stable:no Update visibility to Not Visible Individually product_with_category Test simple product %isolation% @@ -47,6 +49,7 @@ test-simple-product-%isolation% 25.0000 Catalog + to_maintain:yes @@ -64,6 +67,7 @@ test-simple-product-%isolation% 89.0000 Search + to_maintain:yes @@ -81,6 +85,7 @@ Out of Stock test-simple-product-%isolation% 125.0000 + to_maintain:yes @@ -89,6 +94,7 @@ + stable:no Update product status to offline product_with_category Test simple product %isolation% @@ -112,6 +118,7 @@ 87 test-simple-product-%isolation% 333.0000 + to_maintain:yes @@ -124,6 +131,7 @@ test_simple_product_%isolation% 133.00 test-simple-product-%isolation% + to_maintain:yes @@ -142,10 +150,12 @@ sku_simple_product_%isolation% 1.99 default + to_maintain:yes + stable:no product_with_category Test simple product %isolation% test_simple_product_%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.php index ddd788d7ee1c9..2a18f9e37f953 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.php @@ -37,6 +37,7 @@ class UpdateVirtualProductEntityTest extends Injectable { /* tags */ const MVP = 'no'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.xml index 3bc4b3c780d62..a263a70e8bfc0 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateAttributeSetEntityTest.xml @@ -8,6 +8,7 @@ + stable:no AttributeSet%isolation% default 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 2a94a12c0dbdf..543bece9331f4 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 @@ -8,6 +8,7 @@ + to_maintain:yes custom_attribute_set Text_Field_Admin_%isolation% Text Field @@ -19,6 +20,7 @@ + to_maintain:yes custom_attribute_set Text_Field_Admin_%isolation% Text Area @@ -57,6 +59,7 @@ Yes Yes Yes + to_maintain:yes @@ -65,6 +68,7 @@ + to_maintain:yes custom_attribute_set Yes/No_Admin_%isolation% Yes/No @@ -97,6 +101,7 @@ Yes Yes Yes + to_maintain:yes @@ -110,7 +115,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes custom_attribute_set Dropdown_Admin_%isolation% Dropdown @@ -148,6 +153,7 @@ + to_maintain:yes custom_attribute_set Price_Admin_%isolation% Price @@ -169,6 +175,7 @@ + to_maintain:yes custom_attribute_set Fixed_Product_Tax_Admin_%isolation% Fixed Product Tax @@ -185,6 +192,7 @@ + to_maintain:yes custom_attribute_set Text_Field_Admin_%isolation% Text Field diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAttributeSetTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAttributeSetTest.xml index 3f547daa68eb5..83b5be744f025 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAttributeSetTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteAttributeSetTest.xml @@ -8,6 +8,7 @@ + stable:no custom_attribute_set default default 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 a11e2679b27e0..83d819b7db1c4 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 @@ -15,6 +15,7 @@ + stable:no attribute_type_dropdown diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateAttributeSetTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateAttributeSetTest.xml index a7b233a7aae4b..ff80366fea097 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateAttributeSetTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateAttributeSetTest.xml @@ -8,6 +8,7 @@ + stable:no AttributeSetEdit1%isolation% Custom-group%isolation% custom_attribute_set diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml index b7e27854a8244..7077b8e852b5e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes custom_attribute_set attribute_type_text_field Text_Field_%isolation% @@ -28,6 +29,7 @@ + to_maintain:yes custom_attribute_set attribute_type_dropdown Dropdown_%isolation% @@ -60,6 +62,7 @@ FPC + to_maintain:yes diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.xml index 9359b0c402b95..3a2f2f8aa7816 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.xml @@ -8,11 +8,13 @@ + stable:no catalogProductSimple::name - + stable:no catalogProductSimple::sku 1 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 30688723ae8ed..9a539d856e708 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 @@ -8,6 +8,7 @@ + to_maintain:yes bundleProduct::bundle_dynamic_product 210 200 @@ -20,6 +21,7 @@ + to_maintain:yes bundleProduct::bundle_fixed_product 761 756 @@ -32,6 +34,7 @@ + to_maintain:yes catalogProductSimple::with_two_custom_option 345 340 @@ -44,6 +47,7 @@ + to_maintain:yes catalogProductVirtual::product_50_dollar 50 50 @@ -56,6 +60,7 @@ + to_maintain:yes configurableProduct::default 135 120 @@ -80,6 +85,7 @@ + to_maintain:yes groupedProduct::three_simple_products 1950 1920 @@ -92,6 +98,7 @@ + to_maintain:yes catalogProductSimple::with_two_custom_option catalogProductVirtual::product_50_dollar downloadableProduct::with_two_separately_links 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 2f2177c6cc7ef..033ea76a2a5ff 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 @@ -16,6 +16,7 @@ + to_maintain:yes catalogProductSimple::with_two_custom_option @@ -36,6 +37,7 @@ + to_maintain:yes catalogProductSimple::with_two_custom_option catalogProductVirtual::product_50_dollar downloadableProduct::with_two_separately_links diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml index 6a1f225bc9429..797255d4e374a 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml @@ -27,6 +27,7 @@ + stable:no catalogProductSimple::default active_sales_rule_for_all_groups default @@ -48,6 +49,7 @@ + stable:no catalogProductSimple::default default guest @@ -167,6 +169,7 @@ + stable:no catalogProductSimple::simple_with_tier_price_and_order_qty_3 default guest @@ -183,6 +186,7 @@ + stable:no catalogProductVirtual::default downloadableProduct::with_two_separately_links configurableProduct::with_one_option diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml index 1c60b0f156bae..5f9b069ab85ca 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml @@ -8,14 +8,14 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes catalogProductSimple::with_two_custom_option simple_update_mini_shopping_cart - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes configurableProduct::default configurable_update_mini_shopping_cart @@ -24,7 +24,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes bundleProduct::bundle_fixed_product bundle_update_mini_shopping_cart @@ -33,7 +33,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes downloadableProduct::with_two_separately_links downloadable_update_mini_shopping_cart @@ -42,7 +42,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes catalogProductVirtual::default virtual_update_mini_shopping_cart 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 809688cd8286a..3dba57e26e003 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php @@ -33,6 +33,7 @@ class UpdateShoppingCartTest extends Injectable { /* tags */ const MVP = 'yes'; + const STABLE = 'no'; /* 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 fc043effe5a77..34c70c9e2a33b 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,7 @@ - severity:S1 + severity:S1, stable:no diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml index 2a85425890e8e..745d60dad9f8a 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml @@ -8,7 +8,7 @@ - severity:S1 + severity:S1, stable:no default diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFullTextSearchTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFullTextSearchTest.xml index 893cfc2f0dacc..fc279aad59d3d 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFullTextSearchTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFullTextSearchTest.xml @@ -8,7 +8,7 @@ - severity:S2 + severity:S2, stable:no Verify cms page grid full text search 2 cmsPage diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridSortingTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridSortingTest.xml index d6467a53e1565..1be7e61f6bd0e 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridSortingTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridSortingTest.xml @@ -8,7 +8,7 @@ - severity:S2 + severity:S2, stable:no Verify cms page grid sorting ID @@ -19,7 +19,7 @@ - severity:S2 + severity:S2, stable:no Verify cms blocks grid sorting - diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml index 75f8cf63f645e..93d38321ab7db 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml @@ -8,7 +8,7 @@ - severity:S3 + severity:S3, to_maintain:yes CmsPageEdited%isolation% No cms_page_text_content_after_edit @@ -16,7 +16,7 @@ - severity:S1 + severity:S1, to_maintain:yes CmsPageEdited%isolation% cms_page_url_edited_%isolation% Content Heading TextEdited diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php b/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php index 30928810490d7..5df648a565dc7 100644 --- a/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Config/Test/TestCase/VerifyAdminAccountSharingEntityTest.php @@ -23,13 +23,14 @@ class VerifyAdminAccountSharingEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'PS'; + const TO_MAINTAIN = 'yes'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ /** * Admin account settings page. * - * @var adminAccountSharing + * @var AdminAccountSharing */ private $adminAccountSharing; 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 187283da4602f..14ff24f18908d 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 @@ -8,6 +8,7 @@ + to_maintain:yes configurable-product-%isolation% two_new_options configurable_two_options @@ -32,6 +33,7 @@ + to_maintain:yes configurable-product-%isolation% two_options configurable_two_options @@ -53,6 +55,7 @@ + to_maintain:yes configurable-product-%isolation% two_options_with_assigned_product_special_price configurable_two_new_options_with_special_price @@ -75,6 +78,7 @@ + stable:no configurable-product-%isolation% two_options_with_assigned_product configurable_two_options_with_assigned_product @@ -95,6 +99,7 @@ + stable:no configurable-product-%isolation% two_options_with_fixed_price Configurable Product %isolation% @@ -143,6 +148,7 @@ + to_maintain:yes configurable-product-%isolation% two_options_with_assigned_product_special_price configurable_two_new_options_with_special_price diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml index 62279a9fa579c..b069371fe5bec 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml @@ -8,6 +8,7 @@ + stable:no configurableProduct::default diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/MassProductUpdateTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/MassProductUpdateTest.xml index 3d58645d618ff..d1066de26d66c 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/MassProductUpdateTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/MassProductUpdateTest.xml @@ -8,6 +8,7 @@ + stable:no product_flat configurableProduct::out_of_stock catalogProductSimple::out_of_stock 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 7ff2be303d677..d3ab2ffa6b026 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 @@ -32,6 +32,7 @@ class UpdateConfigurableProductEntityTest extends Scenario { /* tags */ const MVP = 'yes'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/AbstractCurrencySymbolEntityTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/AbstractCurrencySymbolEntityTest.php index 4919d364dc6fa..ac6b26e85fbeb 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/AbstractCurrencySymbolEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/AbstractCurrencySymbolEntityTest.php @@ -97,7 +97,7 @@ protected function importCurrencyRate($configData) $this->currencyIndex->getCurrencyRateForm()->clickImportButton(); $this->currencyIndex->getCurrencyRateForm()->fillCurrencyUSDUAHRate(); if ($this->currencyIndex->getMessagesBlock()->isVisibleMessage('warning')) { - throw new \Exception($this->currencyIndex->getMessagesBlock()->getWarningMessages()); + throw new \Exception($this->currencyIndex->getMessagesBlock()->getWarningMessage()); } $this->currencyIndex->getFormPageActions()->save(); } 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 14a9d6f283b27..302f23104d959 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 @@ -27,6 +27,7 @@ class EditCurrencySymbolEntityTest extends AbstractCurrencySymbolEntityTest { /* tags */ const MVP = 'no'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** 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 8740b0000ff58..e49f25bc4fa18 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 @@ -28,6 +28,7 @@ class ResetCurrencySymbolEntityTest extends AbstractCurrencySymbolEntityTest { /* tags */ const MVP = 'no'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index 9802ef998048a..70191dc828af7 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -61,8 +61,8 @@ 90230 United States 555-55-555-55 - Yes - No + No + Yes diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml index 14e3a9642d1a5..766cf96b3d644 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml @@ -19,6 +19,7 @@ + to_maintain:yes save Wholesale M @@ -92,6 +93,7 @@ + to_maintain:yes saveAndContinue Main Website customer_group_retail_customer @@ -131,6 +133,7 @@ + to_maintain:yes save Main Website General 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 64051195daa32..c354e733a6913 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 @@ -29,6 +29,7 @@ class CreateCustomerGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php index 61771665c059e..1f00df69dfb57 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php @@ -30,6 +30,7 @@ class DeleteCustomerAddressTest extends Injectable { /* tags */ const MVP = 'yes'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/GridSortingTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/GridSortingTest.xml index 18791441b1d20..b967fbd184526 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/GridSortingTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/GridSortingTest.xml @@ -8,6 +8,7 @@ + stable:no Verify customer page grid sorting ID diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassAssignCustomerGroupTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassAssignCustomerGroupTest.xml index e86104e992dee..af57affcd7f07 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassAssignCustomerGroupTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassAssignCustomerGroupTest.xml @@ -8,7 +8,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, to_maintain:yes default diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.xml index 2985252d82ffa..cdbfd91ddbd49 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/MassDeleteCustomerBackendEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes default 3 2 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 31a947ad1ab02..96e78f58d78c8 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 @@ -8,6 +8,7 @@ + stable:no john doe johndoe%isolation%@example.com diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.xml index c2132672d900a..7855fb0f17dd2 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes default Wholesale %isolation%Prefix_ @@ -44,6 +45,7 @@ + to_maintain:yes default Retailer %isolation%Prefix_ 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 7fda95c0be7d2..bd21e9aca6905 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 @@ -32,6 +32,7 @@ class UpdateCustomerGroupEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** 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 e2f49d40cac73..9d12218ccf0dd 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 @@ -24,6 +24,7 @@ + stable:no Create product with default set links DownloadableProduct_%isolation% DownloadableProduct_%isolation% @@ -53,6 +54,7 @@ with_two_samples with_two_separately_links downloadableproduct-%isolation% + to_maintain:yes @@ -91,6 +93,7 @@ with_three_links two_options downloadableproduct-%isolation% + to_maintain:yes @@ -118,6 +121,7 @@ + stable:no Create product with manage stock DownloadableProduct_%isolation% DownloadableProduct_%isolation% @@ -135,6 +139,7 @@ + stable:no Create product without tax class id DownloadableProduct_%isolation% DownloadableProduct_%isolation% @@ -166,6 +171,7 @@ default catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option downloadableproduct-%isolation% + to_maintain:yes @@ -189,6 +195,7 @@ with_three_links default downloadableproduct-%isolation% + to_maintain:yes @@ -210,6 +217,7 @@ with_three_links default downloadableproduct-%isolation% + to_maintain:yes @@ -278,6 +286,7 @@ with_two_separately_links default downloadableproduct-%isolation% + to_maintain:yes @@ -285,6 +294,7 @@ + to_maintain:yes DownloadableProduct_%isolation% DownloadableProduct_%isolation% 350 diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml index be38a73902cd7..8e844fa90ddf9 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml @@ -9,6 +9,7 @@ downloadableProduct::default + to_maintain:yes diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/TaxCalculationTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/TaxCalculationTest.xml index 87a124814fc22..e2afcbeb7cce0 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/TaxCalculationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/TaxCalculationTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes total_cat_excl_ship_incl_after_disc_on_incl, display_excluding_including_tax downloadableProduct::with_two_separately_links_special_price_and_category active_sales_rule_for_all_groups_no_coupon @@ -34,6 +35,7 @@ + to_maintain:yes total_cat_excl_ship_incl_after_disc_on_incl, display_including_tax downloadableProduct::with_two_separately_links_special_price_and_category catalog_price_rule_all_groups @@ -53,6 +55,7 @@ + to_maintain:yes total_cat_incl_ship_excl_before_disc_on_excl, display_excluding_including_tax downloadableProduct::with_two_separately_links_custom_options_and_category catalog_price_rule_all_groups @@ -77,6 +80,7 @@ + to_maintain:yes total_cat_incl_ship_excl_before_disc_on_excl downloadableProduct::with_two_separately_links_custom_options_and_category catalog_price_rule_all_groups diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.php index 276cc08e8efb7..91281de3cdbda 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.php @@ -37,6 +37,7 @@ class UpdateDownloadableProductEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.php b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.php index dc86b6479757e..69bae8412db11 100644 --- a/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/CreateEmailTemplateEntityTest.php @@ -30,6 +30,7 @@ class CreateEmailTemplateEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'PS'; + const TO_MAINTAIN = 'yes'; const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ 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 3913817d8f320..6226713f316c5 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 @@ -27,6 +27,7 @@ + to_maintain:yes catalogProductSimple::default catalogProductVirtual::default default diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml index 47592328f39c1..a8a2aebbf2f25 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml @@ -57,6 +57,7 @@ + stable:no test-grouped-product-%isolation% GroupedProduct %isolation% GroupedProduct_sku%isolation% @@ -109,6 +110,7 @@ + stable:no test-grouped-product-%isolation% GroupedProduct %isolation% GroupedProduct_sku%isolation% diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml index 91c26ddb6acbc..92a842ee5a71e 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml @@ -8,6 +8,7 @@ + stable:no groupedProduct::default 0 diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml index d2ae0836e5e76..11f854749d3fd 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes grouped_product_out_of_stock GroupedProduct_edited %isolation% GroupedProduct_sku_edited %isolation% @@ -21,6 +22,7 @@ + to_maintain:yes default GroupedProduct_edited %isolation% GroupedProduct_sku_edited %isolation% @@ -31,6 +33,7 @@ + to_maintain:yes default GroupedProduct_edited %isolation% GroupedProduct_sku_edited %isolation% @@ -42,6 +45,7 @@ + to_maintain:yes default GroupedProduct_edited %isolation% GroupedProduct_sku_edited %isolation% @@ -52,6 +56,7 @@ + to_maintain:yes default GroupedProduct_edited %isolation% GroupedProduct_sku_edited %isolation% diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/UpdateIntegrationEntityTest.xml b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/UpdateIntegrationEntityTest.xml index e09d2a23559b9..5965aa7ce3c58 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/UpdateIntegrationEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/UpdateIntegrationEntityTest.xml @@ -20,6 +20,7 @@ + stable:no Integration_%isolation% - - diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php index a79ea3995eeff..0203cf89fe7d2 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/ActionNewsletterTemplateEntityTest.php @@ -31,6 +31,7 @@ class ActionNewsletterTemplateEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/PreviewNewsletterTemplateEntityTest.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/PreviewNewsletterTemplateEntityTest.xml index 13b499fca5e3c..206e2d01468e7 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/PreviewNewsletterTemplateEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/PreviewNewsletterTemplateEntityTest.xml @@ -8,6 +8,7 @@ + stable:no default diff --git a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/AddProductVideoTest.xml b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/AddProductVideoTest.xml index 9dfcc4d8bac35..0bcf0db70b2fb 100644 --- a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/AddProductVideoTest.xml +++ b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/AddProductVideoTest.xml @@ -8,6 +8,7 @@ + stable:no product_with_video_youtube youtube_api_key,play_if_base @@ -15,6 +16,7 @@ + stable:no product_with_video_vimeo play_if_base diff --git a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/DeleteProductVideoTest.xml b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/DeleteProductVideoTest.xml index 78a7fe00ab9f4..26df238f11b28 100644 --- a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/DeleteProductVideoTest.xml +++ b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/DeleteProductVideoTest.xml @@ -8,6 +8,7 @@ + stable:no product_with_video_youtube youtube_api_key,play_if_base @@ -15,6 +16,7 @@ + stable:no product_with_video_vimeo play_if_base diff --git a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/UpdateProductVideoTest.php b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/UpdateProductVideoTest.php index 30df076817dff..a02ba30f716ec 100644 --- a/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/UpdateProductVideoTest.php +++ b/dev/tests/functional/tests/app/Magento/ProductVideo/Test/TestCase/UpdateProductVideoTest.php @@ -33,8 +33,9 @@ class UpdateProductVideoTest extends Injectable { /* tags */ - const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; + const TEST_TYPE = 'extended_acceptance_test'; const MVP = 'yes'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php index 5930e63b9d3bd..95c9d518a391d 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/AbandonedCartsReportEntityTest.php @@ -34,6 +34,7 @@ class AbandonedCartsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php index cacb6e5a329bf..7dc9b6106b7bb 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomersOrderCountReportEntityTest.php @@ -31,6 +31,7 @@ class CustomersOrderCountReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/DownloadProductsReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/DownloadProductsReportEntityTest.xml index 6e37965603c78..3a25f81d37fb6 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/DownloadProductsReportEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/DownloadProductsReportEntityTest.xml @@ -8,16 +8,19 @@ + to_maintain:yes downloadable_product 1 + to_maintain:yes two_downloadable_product 2 + to_maintain:yes downloadable_product 0 diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.xml index c484c94a976f6..582d41a9d3bb2 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.xml @@ -8,6 +8,7 @@ + stable:no default 1 m/d/Y @@ -16,6 +17,7 @@ + stable:no default 1 m/d/Y @@ -24,6 +26,7 @@ + stable:no default 1 m/d/Y diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/OrderedProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/OrderedProductsReportEntityTest.php index 7d0d13862e772..dc09819ab9879 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/OrderedProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/OrderedProductsReportEntityTest.php @@ -28,6 +28,7 @@ class OrderedProductsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesCouponReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesCouponReportEntityTest.php index 0d59b989fc25f..8d686421a524b 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesCouponReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesCouponReportEntityTest.php @@ -34,6 +34,7 @@ class SalesCouponReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesInvoiceReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesInvoiceReportEntityTest.php index 3ebfd4746a858..b8e5a5276d616 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesInvoiceReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesInvoiceReportEntityTest.php @@ -37,6 +37,7 @@ class SalesInvoiceReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.xml index b1957b6315765..1d8adebd6befd 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.xml @@ -21,6 +21,7 @@ + stable:no default full_invoice Order Created @@ -34,6 +35,7 @@ + stable:no default full_invoice Order Updated diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.xml index a3b971ec5a8ca..927e461fc2181 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.xml @@ -20,6 +20,7 @@ + stable:no assert refunds month report default full_invoice @@ -32,6 +33,7 @@ + stable:no assert refund Daily report default full_invoice diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesTaxReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesTaxReportEntityTest.xml index df6eb7759fd55..69440d5f15e3f 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesTaxReportEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesTaxReportEntityTest.xml @@ -22,6 +22,7 @@ + stable:no invoice custom_rule default @@ -37,6 +38,7 @@ + stable:no invoice,shipment custom_rule default 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 905fa8fb70f0c..6c22348179897 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 @@ -33,6 +33,7 @@ class ViewedProductsReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php index 9130c5285848e..251cbd75a793f 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php @@ -34,6 +34,7 @@ class CreateProductReviewBackendEntityTest extends Injectable { /* tags */ const MVP = 'no'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.xml index 786203e93f24d..8cd4e44b7622a 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewFrontendEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes Guest name_%isolation% title_%isolation% 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 fc58266356223..3f1adc16694cc 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 @@ -43,6 +43,7 @@ class ManageProductReviewFromCustomerPageTest extends Injectable { /* tags */ const MVP = 'no'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.xml b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.xml index 5d731c736fd69..86dca577d0094 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes 3 Approved Main Website/Main Website Store/Default Store View diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.xml b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.xml index 549c3c3ddc3a8..71c40ca27fac0 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes review_for_simple_product_with_rating name_upd_%isolation% title_upd_%isolation% 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 c25b96a624bfd..9e0c1517d3d7e 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 @@ -339,6 +339,7 @@ public function selectPaymentMethod(array $paymentCode, InjectableFixture $credi $this->getTemplateBlock()->waitLoader(); $this->_rootElement->find($this->orderMethodsSelector)->click(); $this->getBillingMethodBlock()->selectPaymentMethod($paymentCode, $creditCard); + $this->_rootElement->click(); $this->getTemplateBlock()->waitLoader(); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable/Price.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable/Price.xml index 3e2dfdd712507..3da1f91925e0a 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable/Price.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable/Price.xml @@ -43,5 +43,12 @@ 110 + + + + 0 + 0 + + diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.xml index b65b9a31f72f3..e839681907c6d 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CancelCreatedOrderTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes default catalogProductSimple::default,catalogProductSimple::default Canceled @@ -17,6 +18,7 @@ + stable:no default free freeshipping_freeshipping diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php index f7cdaf74ab0f5..fc866fab6dc17 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.php @@ -31,6 +31,7 @@ class CreateInvoiceEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.xml index 8753de91d1f43..116d3cb5d4a5e 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateInvoiceEntityTest.xml @@ -68,7 +68,7 @@ default - partial_invoice + free_invoice catalogProductSimple::product_10_dollar - free diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml index ad4cc670e43cd..bd592e9d71aaa 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml @@ -69,6 +69,7 @@ + to_maintain:yes Create order with virtual product for registered UK customer using Bank Transfer payment method catalogProductVirtual::default default diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridFilteringTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridFilteringTest.xml index 4e61abb7c5d50..b4c3a7568a2a1 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridFilteringTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridFilteringTest.xml @@ -8,6 +8,7 @@ + stable:no Verify sales order grid filtering - diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridFullTextSearchTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridFullTextSearchTest.xml index abd9432fe098e..0979d0dcbff25 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridFullTextSearchTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridFullTextSearchTest.xml @@ -8,6 +8,7 @@ + stable:no Verify sales order grid full text search - @@ -23,6 +24,7 @@ + stable:no Verify sales invoice grid full text search Magento\Sales\Test\TestStep\CreateInvoiceStep @@ -55,6 +57,7 @@ + stable:no Verify sales credit memo grid full text search diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridSortingTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridSortingTest.xml index 056fa5136d433..f82f232625841 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridSortingTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/GridSortingTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes Verify sales order grid storting - @@ -26,6 +27,7 @@ + to_maintain:yes Verify sales invoince grid storting Magento\Sales\Test\TestStep\CreateInvoiceStep @@ -43,6 +45,7 @@ + to_maintain:yes Verify sales shipment grid storting Magento\Sales\Test\TestStep\CreateShipmentStep @@ -60,6 +63,7 @@ + to_maintain:yes Verify sales credit memo grid storting diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.xml index 02dbf74225ba9..4d54654a04bbb 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MassOrdersUpdateTest.xml @@ -8,6 +8,7 @@ + stable:no cancel orders in status Pending and Processing - Cancel @@ -44,6 +45,7 @@ + stable:no Try to put order in status Complete on Hold invoice, shipment Hold diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml index 8f6466b4edc4f..5f4066c1d8027 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml @@ -8,11 +8,13 @@ + stable:no default catalogProductSimple::default + MAGETWO-58762: Customer grid does not open in MoveLastOrderedProductsOnOrderPageTestVariation2 on Jenkins default configurableProduct::configurable_with_qty_1 diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml index 4fbfbe531e8fe..695948b8b10c9 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml @@ -8,11 +8,13 @@ + to_maintain:yes catalogProductSimple::default catalogProductSimple::default + to_maintain:yes configurableProduct::configurable_with_qty_1 configurableProduct::configurable_with_qty_1 diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml index e6f96da0367ca..601f550e4588b 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml @@ -8,11 +8,13 @@ + stable:no catalogProductSimple::default catalogProductSimple::default + to_maintain:yes configurableProduct::configurable_with_qty_1 configurableProduct::configurable_with_qty_1 diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.xml index 2e1c3eeea7b89..ae955b301d956 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyViewedProductsOnOrderPageTest.xml @@ -8,10 +8,12 @@ + to_maintain:yes configurableProduct::default + to_maintain:yes bundleProduct::bundle_fixed_product diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml index e29a63165ad03..53f321366de5e 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml @@ -8,10 +8,12 @@ + stable:no catalogProductSimple::default + stable:no configurableProduct::configurable_with_qty_1 diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.xml index 4dc6ae8d2fcd1..46349665259d0 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes johndoe_with_addresses diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml index 7608ec4f68ca0..8124a32c66eb1 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes Reorder placed order (update products, billing address). two_simple_product active_sales_rule_with_fixed_price_discount_coupon diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.xml index 4b837e442a4ab..b1893651726f8 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes active_sales_rule_product_subselection active_sales_rule_product_attribute 200.00 @@ -31,6 +32,7 @@ + stable:no active_sales_rule_product_attribute active_sales_total_items 250.00 @@ -43,6 +45,7 @@ + to_maintain:yes active_sales_rule_row_total active_sales_total_items simple_for_salesrule_1 diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml index bfa18c65bdcf8..d0ad41011004a 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml @@ -145,6 +145,7 @@ + stable:no United States California 95814 diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/testcase.xml index 37f8366674e05..b894aada2e2ba 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/etc/testcase.xml @@ -32,8 +32,8 @@ - - + + diff --git a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/CreateSynonymGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/CreateSynonymGroupEntityTest.xml index 21279437ea834..79a170819c506 100644 --- a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/CreateSynonymGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/CreateSynonymGroupEntityTest.xml @@ -25,7 +25,7 @@ - test_type:extended_acceptance_test + test_type:extended_acceptance_test, stable:no synonym_%isolation% custom_store diff --git a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/UpdateSynonymGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/UpdateSynonymGroupEntityTest.xml index 2e6e6cb2e4812..636cf66fd2c86 100644 --- a/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/UpdateSynonymGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Search/Test/TestCase/UpdateSynonymGroupEntityTest.xml @@ -8,9 +8,9 @@ + test_type:extended_acceptance_test, to_maintain:yes prepareMerge Update Synonym Groups Successfully - test_type:extended_acceptance_test new_synonym_%isolation% all_store_views diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.xml index eeb0dd7ab12e9..1a5443ec9e615 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.xml @@ -8,7 +8,7 @@ - severity:S1 + severity:S1, to_maintain:yes customer_max_login_failures_number default incorrect password diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.xml index a5376d73685ba..df5c5bce59fe0 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.xml @@ -8,7 +8,7 @@ - severity:S1 + severity:S1, to_maintain:yes customer_max_login_failures_number default incorrect password diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml index 16c0aeb358bb0..5d2f4a9d5f788 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml @@ -8,7 +8,7 @@ - severity:S3 + severity:S3, stable:no custom Yes diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteWebsiteEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteWebsiteEntityTest.php index 94e14b4a42317..f349131fe5848 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteWebsiteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteWebsiteEntityTest.php @@ -39,6 +39,7 @@ class DeleteWebsiteEntityTest extends Injectable /* tags */ const MVP = 'yes'; const SEVERITY = 'S3'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml index 5d338af60555f..7bbf6d29e7b9f 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml @@ -19,6 +19,7 @@ + stable:no TaxIdentifier%isolation% US-CA-Rate_1 US-NY-Rate_1 @@ -47,6 +48,7 @@ + stable:no TaxIdentifier%isolation% withZipRange US-CA-Rate_1 diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml index 9414b9a0172f1..cda7bf0665b01 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxCalculationTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes Simple product tier price with sales rule, customer tax equals store tax and catalog price including tax shipping_tax_class_taxable_goods, row_cat_incl_ship_excl_after_disc_on_excl, display_excluding_including_tax catalogProductSimple::simple_with_tier_price_and_category @@ -37,6 +38,7 @@ + to_maintain:yes Simple product special price with sales rule, customer tax less than store tax and catalog price including tax shipping_tax_class_taxable_goods, row_cat_incl_ship_excl_before_disc_on_incl, display_excluding_including_tax catalogProductSimple::product_with_special_price_and_category @@ -66,6 +68,7 @@ + to_maintain:yes Simple product tier price with sales rule, customer tax less than store tax and catalog price including tax shipping_tax_class_taxable_goods, unit_cat_incl_ship_incl_before_disc_on_incl, display_excluding_including_tax catalogProductSimple::simple_with_tier_price_and_category @@ -95,6 +98,7 @@ + to_maintain:yes Simple product special price with sales rule, customer tax equals store tax and catalog price excluding tax shipping_tax_class_taxable_goods, total_cat_excl_ship_incl_before_disc_on_incl, display_excluding_including_tax catalogProductSimple::product_with_special_price_and_category @@ -124,6 +128,7 @@ + to_maintain:yes Simple product tier price with sales rule, customer tax greater than store tax and catalog price excluding tax shipping_tax_class_taxable_goods, total_cat_excl_ship_incl_after_disc_on_incl, display_excluding_including_tax catalogProductSimple::simple_with_tier_price_and_category @@ -153,6 +158,7 @@ + to_maintain:yes Simple product special price with sales rule, customer tax greater than store tax and catalog price excluding tax shipping_tax_class_taxable_goods, unit_cat_excl_ship_incl_after_disc_on_excl, display_excluding_including_tax catalogProductSimple::product_with_special_price_and_category diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxWithCrossBorderTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxWithCrossBorderTest.php index 9517ee063ce67..09debcf5f75eb 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxWithCrossBorderTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/TaxWithCrossBorderTest.php @@ -37,6 +37,7 @@ class TaxWithCrossBorderTest extends Injectable { /* tags */ const MVP = 'yes'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml index a485579634ed9..58e7b2b038cc2 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml @@ -48,6 +48,7 @@ + stable:no tax_rule_with_custom_tax_classes United States Idaho diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php index 95240b5dba064..c5968c8e936f8 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php @@ -71,7 +71,7 @@ class DataGrid extends Grid * * @var string */ - protected $massActionToggleList = '//span[contains(@class, "action-menu-item") and .= "%s"]'; + protected $massActionToggleList = './/span[contains(@class, "action-menu-item") and .= "%s"]'; /** * Action button (located above the Grid). @@ -85,7 +85,7 @@ class DataGrid extends Grid * * @var string */ - protected $actionList = '//span[contains(@class, "action-menu-item") and .= "%s"]'; + protected $actionList = './/span[contains(@class, "action-menu-item") and .= "%s"]'; /** * Column header locator. @@ -104,6 +104,13 @@ class DataGrid extends Grid * @var string */ private $cellByHeader = "//td[count(//th[span[.='%s']][not(ancestor::*[@class='sticky-header'])]/preceding-sibling::th)+1]"; + + /** + * Admin data grid header selector. + * + * @var string + */ + private $gridHeader = './/div[@class="admin__data-grid-header"][(not(ancestor::*[@class="sticky-header"]) and not(contains(@style,"visibility: hidden"))) or (ancestor::*[@class="sticky-header" and not(contains(@style,"display: none"))])]'; // @codingStandardsIgnoreEnd /** @@ -322,12 +329,12 @@ public function selectMassAction($massActionSelection) public function selectAction($action) { $actionType = is_array($action) ? key($action) : $action; - $this->_rootElement->find($this->actionButton)->click(); - $this->_rootElement + $this->getGridHeaderElement()->find($this->actionButton)->click(); + $this->getGridHeaderElement() ->find(sprintf($this->actionList, $actionType), Locator::SELECTOR_XPATH) ->click(); if (is_array($action)) { - $this->_rootElement + $this->getGridHeaderElement() ->find(sprintf($this->actionList, end($action)), Locator::SELECTOR_XPATH) ->click(); } @@ -463,4 +470,14 @@ public function getRowsData(array $columns) return $data; } + + /** + * Returns admin data grid header element. + * + * @return \Magento\Mtf\Client\ElementInterface + */ + private function getGridHeaderElement() + { + return $this->_rootElement->find($this->gridHeader, Locator::SELECTOR_XPATH); + } } diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFilteringTest.php b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFilteringTest.php index 39a80b783a0a1..4b923dd4344a9 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFilteringTest.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFilteringTest.php @@ -28,6 +28,7 @@ class GridFilteringTest extends Injectable { /* tags */ + const STABLE = 'no'; const MVP = 'no'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php index c0049f0cc2fb3..510d2d61c0acd 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/TestCase/GridFullTextSearchTest.php @@ -28,6 +28,7 @@ class GridFullTextSearchTest extends Injectable { /* tags */ + const STABLE = 'no'; const MVP = 'no'; /* end tags */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php index 2003bb4b27770..fdf1056511776 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.php @@ -31,6 +31,7 @@ class CreateAdminUserEntityTest extends Injectable /* tags */ const MVP = 'no'; const TEST_TYPE = 'extended_acceptance_test'; + const STABLE = 'no'; /* end tags */ /** 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 index 381728cb375ae..4860c6c93696c 100644 --- a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.xml @@ -19,6 +19,7 @@ + stable:no variableCode%isolation% variableName%isolation% <p>variableName%isolation%</p> 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 index 7f2306c5154e7..7234c455fcc22 100644 --- a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.xml b/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.xml index 060d2fbc9a7e6..247b22c86a1b2 100644 --- a/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.xml +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes Check not taxed FPT display set to Excluding, Description and Including FPT on product with custom option catalog price Excluding Tax shipping_tax_class_taxable_goods,tax_with_fpt_cat_excl_disc_on_excl with_custom_option_and_fpt @@ -28,6 +29,7 @@ + to_maintain:yes Check not taxed FPT display set to Including FPT and Description on product with custom option catalog price Excluding Tax shipping_tax_class_taxable_goods,tax_with_fpt_cat_excl_disc_on_incl, display_including_tax with_custom_option_and_fpt @@ -50,6 +52,7 @@ + stable:no Check not taxed FPT display set to Excluding, Description and Including FPT on product with special price catalog price Excluding Tax shipping_tax_class_taxable_goods,tax_with_fpt_cat_excl_disc_on_incl, display_including_tax with_special_price_and_fpt @@ -72,6 +75,7 @@ + stable:no Check not taxed FPT display set to Including FPT and Description on product with special price catalog price Excluding Tax shipping_tax_class_taxable_goods,tax_with_fpt_cat_excl_disc_on_excl with_special_price_and_fpt @@ -92,6 +96,7 @@ + to_maintain:yes Check taxed FPT display set to Excluding, Description and Including FPT on product with with custom option catalog price Excluding Tax shipping_tax_class_taxable_goods,tax_with_fpt_taxed_cat_excl_disc_on_excl with_custom_option_and_fpt @@ -204,6 +209,7 @@ + MAGETWO-44968: FPT Final price includes tax on custom option, when display is set to excluding tax Check taxed FPT display set to Excluding, Description and Including FPT on product with with custom option and catalog price Including Tax shipping_tax_class_taxable_goods,tax_with_fpt_taxed_cat_incl_disc_on_excl with_custom_option_and_fpt diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml index f533e115253ed..225759df91f17 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml @@ -19,7 +19,7 @@ - test_type:extended_acceptance_test, severity:S1 + test_type:extended_acceptance_test, severity:S1, stable:no CMS Page Link Magento Luma Title_%isolation% @@ -42,7 +42,7 @@ - severity:S1 + severity:S1, stable:no Recently Compared Products Magento Luma Title_%isolation% @@ -53,7 +53,7 @@ - severity:S1 + severity:S1, stable:no Catalog Category Link Magento Luma Title_%isolation% @@ -76,6 +76,7 @@ + MAGETWO-58146: There is no cache invalidate popup after creating widget with disabled block_html cache type severity:S2 Disabled CMS Static Block @@ -91,6 +92,7 @@ + MAGETWO-58146: There is no cache invalidate popup after creating widget with disabled block_html cache type severity:S3 Invalidated Catalog Category Link @@ -106,7 +108,7 @@ - severity:S1 + severity:S1, stable:no Catalog New Products List Magento Luma Title_%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php index 683ff71e8ff72..226faf7d9ce50 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php @@ -123,14 +123,12 @@ public function getOptions() $viewDetails = $this->_rootElement->find($this->viewDetails); if ($viewDetails->isVisible()) { $this->_rootElement->find($this->footer, Locator::SELECTOR_XPATH)->click(); - $viewDetails->click(); + $viewDetails->hover(); $labels = $this->_rootElement->getElements($this->optionLabel); $values = $this->_rootElement->getElements($this->optionValue); $data = []; foreach ($labels as $key => $label) { - if (!$label->isVisible()) { - $viewDetails->click(); - } + $viewDetails->hover(); $data[] = [ 'title' => $label->getText(), 'value' => str_replace('$', '', $values[$key]->getText()), 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 550cffa488130..1a50facc1d67d 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 @@ -8,6 +8,7 @@ + stable:no catalogProductSimple::default @@ -38,12 +39,14 @@ + to_maintain:yes bundleProduct::bundle_dynamic_product + to_maintain:yes bundleProduct::bundle_fixed_product 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 cf16a045c3487..6fec88a05de28 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 @@ -28,6 +28,7 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli { /* tags */ const MVP = 'no'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.xml index 7f89b52dff618..ab33641cd0442 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.xml @@ -8,6 +8,7 @@ + stable:no catalogProductSimple::product_100_dollar 2 @@ -20,6 +21,7 @@ + stable:no catalogProductSimple::default catalogProductVirtual::product_50_dollar catalogProductSimple::default @@ -41,18 +43,21 @@ + stable:no configurableProduct::default 3 + to_maintain:yes bundleProduct::bundle_dynamic_product 2 + to_maintain:yes bundleProduct::bundle_fixed_product 2 diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.xml index ea6e122badf8b..62654bff2b7a9 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.xml @@ -8,6 +8,7 @@ + to_maintain:yes catalogProductSimple::with_two_custom_option 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 3738dd0631e82..037de4cba7bca 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 @@ -29,6 +29,7 @@ class ConfigureProductInCustomerWishlistOnFrontendTest extends AbstractWishlistT { /* tags */ const MVP = 'no'; + const STABLE = 'no'; /* end tags */ /** 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 c9da4e6ea9b2e..8708ea3c8073f 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 @@ -8,26 +8,31 @@ + to_maintain:yes catalogProductSimple::with_two_custom_option + stable:no configurableProduct::default + to_maintain:yes bundleProduct::bundle_dynamic_product + stable:no downloadableProduct::with_two_separately_links + stable:no groupedProduct::three_simple_products 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 4d410c03d6fe6..f74039110ea44 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 @@ -8,6 +8,7 @@ + stable:no catalogProductSimple::product_100_dollar catalogProductVirtual::product_50_dollar @@ -16,6 +17,7 @@ + stable:no catalogProductVirtual::product_50_dollar 1 @@ -23,6 +25,7 @@ + stable:no catalogProductSimple::default catalogProductVirtual::product_50_dollar catalogProductSimple::default @@ -57,6 +60,7 @@ + stable:no downloadableProduct::with_two_separately_links 1 @@ -64,6 +68,7 @@ + stable:no groupedProduct::three_simple_products 1 diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.xml index 3706c8f8b3085..999591d3344f9 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.xml @@ -8,6 +8,7 @@ + stable:no catalogProductSimple::default @@ -20,6 +21,7 @@ + to_maintain:yes downloadableProduct::with_two_separately_links @@ -35,6 +37,7 @@ + stable:no bundleProduct::bundle_dynamic_product @@ -42,6 +45,7 @@ + stable:no bundleProduct::bundle_fixed_product 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 82d6bf563ae62..5025cb97250d7 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 @@ -8,6 +8,7 @@ + to_maintain:yes catalogProductSimple::with_two_custom_option diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic_green.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic_green.xml new file mode 100644 index 0000000000000..cfb4fa3950612 --- /dev/null +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic_green.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 55c7ef01129e1683e2a2cb7f3ce5c107195afe2f Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Thu, 3 Nov 2016 18:53:07 +0200 Subject: [PATCH 1634/3232] MAGETWO-59586: Excessive loaders for order with virtual product - Removed unused card validation load; --- .../adminhtml/web/order/create/scripts.js | 40 ------------------- 1 file changed, 40 deletions(-) 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 6f49476350434..2c94e88c6232a 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 @@ -384,52 +384,12 @@ define([ block.show(); block.select('input', 'select', 'textarea').each(function(field) { field.disabled = false; - if (!el.include('_before') && !el.include('_after') && !field.bindChange) { - field.bindChange = true; - field.paymentContainer = form; - field.method = method; - field.observe('change', this.changePaymentData.bind(this)) - } },this); } },this); } }, - changePaymentData : function(event){ - var elem = Event.element(event); - if(elem && elem.method){ - var data = this.getPaymentData(elem.method); - if (data) { - this.loadArea(['card_validation'], true, data); - } else { - return; - } - } - }, - - getPaymentData : function(currentMethod){ - if (typeof(currentMethod) == 'undefined') { - if (this.paymentMethod) { - currentMethod = this.paymentMethod; - } else { - return false; - } - } - if (this.isPaymentValidationAvailable() == false) { - return false; - } - var data = {}; - var fields = $('payment_form_' + currentMethod).select('input', 'select'); - for(var i=0;i Date: Thu, 3 Nov 2016 12:27:38 -0500 Subject: [PATCH 1635/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Fixing tests --- .../ObjectManager/Config/Compiled.php | 1 - .../ObjectManager/Config/CompiledTest.php | 142 +++++++++--------- 2 files changed, 74 insertions(+), 69 deletions(-) diff --git a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php index dd78957f01962..0db65f3b6b5fa 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php +++ b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php @@ -1,6 +1,5 @@ objectManagerHelper = new ObjectManagerHelper($this); - } + private $objectManager; /** - * @param array $initialData - * @param array $configuration - * @param array $expectedArguments - * @param array $expectedVirtualTypes - * @param array $expectedPreferences - * - * @dataProvider extendDataProvider + * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */ - public function testExtend( - array $initialData, - array $configuration, - array $expectedArguments, - array $expectedVirtualTypes, - array $expectedPreferences - ) { - /** @var CompiledConfig $compiledConfig */ - $compiledConfig = $this->objectManagerHelper->getObject(CompiledConfig::class, ['data' => $initialData]); - $compiledConfig->extend($configuration); + private $serializerMock; - foreach ($expectedArguments as $type => $arguments) { - $this->assertEquals($arguments, $compiledConfig->getArguments($type)); - } - - $this->assertEquals($expectedVirtualTypes, $compiledConfig->getVirtualTypes()); - $this->assertEquals($expectedPreferences, $compiledConfig->getPreferences()); + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->serializerMock = $this->getMock(SerializerInterface::class); } - /** - * @return array - */ - public function extendDataProvider() + public function testExtend() { - return [ - [ - 'initialData' => [ - 'arguments' => [ - 'type1' => serialize(['argument1_1' => 'argumentValue1_1', 'argument1_2' => 'argumentValue1_2']) - ], - 'instanceTypes' => [ - 'instanceType1' => 'instanceTypeValue1', 'instanceType2' => 'instanceTypeValue2' - ], - 'preferences' => ['preference1' => 'preferenceValue1', 'preference2' => 'preferenceValue2'] - ], - 'configuration' => [ - 'arguments' => [ - 'type1' => serialize(['argument1_1' => 'newArgumentValue1_1']), - 'type2' => serialize(['argument2_1' => 'newArgumentValue2_1']) - ], - 'instanceTypes' => [ - 'instanceType2' => 'newInstanceTypeValue2', 'instanceType3' => 'newInstanceTypeValue3' - ], - 'preferences' => ['preference1' => 'newPreferenceValue1'] - ], - 'expectedArguments' => [ - 'type1' => ['argument1_1' => 'newArgumentValue1_1'], - 'type2' => ['argument2_1' => 'newArgumentValue2_1'] - ], - 'expectedVirtualTypes' => [ - 'instanceType1' => 'instanceTypeValue1', 'instanceType2' => 'newInstanceTypeValue2', - 'instanceType3' => 'newInstanceTypeValue3' - ], - 'expectedPreferences' => [ - 'preference1' => 'newPreferenceValue1', 'preference2' => 'preferenceValue2' - ] + $initialData = [ + 'arguments' => [ + 'type1' => 'initial serialized configuration for type1' + ], + 'instanceTypes' => [ + 'instanceType1' => 'instanceTypeValue1', + 'instanceType2' => 'instanceTypeValue2' + ], + 'preferences' => [ + 'preference1' => 'preferenceValue1', + 'preference2' => 'preferenceValue2' + ] + ]; + $configuration = [ + 'arguments' => [ + 'type1' => 'serialized configuration for type1', + 'type2' => 'serialized configuration for type2' + ], + 'instanceTypes' => [ + 'instanceType2' => 'newInstanceTypeValue2', + 'instanceType3' => 'newInstanceTypeValue3' + ], + 'preferences' => [ + 'preference1' => 'newPreferenceValue1' ] ]; + $expectedArguments = [ + 'type1' => [ + 'argument1_1' => 'newArgumentValue1_1' + ], + 'type2' => [ + 'argument2_1' => 'newArgumentValue2_1' + ] + ]; + $expectedVirtualTypes = [ + 'instanceType1' => 'instanceTypeValue1', + 'instanceType2' => 'newInstanceTypeValue2', + 'instanceType3' => 'newInstanceTypeValue3' + ]; + $expectedPreferences = [ + 'preference1' => 'newPreferenceValue1', + 'preference2' => 'preferenceValue2' + ]; + $this->serializerMock->expects($this->at(0)) + ->method('unserialize') + ->with($configuration['arguments']['type1']) + ->willReturn($expectedArguments['type1']); + $this->serializerMock->expects($this->at(1)) + ->method('unserialize') + ->with($configuration['arguments']['type2']) + ->willReturn($expectedArguments['type2']); + $compiled = $this->objectManager->getObject( + Compiled::class, + [ + 'data' => $initialData, + 'serializer' => $this->serializerMock + ] + ); + $compiled->extend($configuration); + foreach ($expectedArguments as $type => $arguments) { + $this->assertEquals($arguments, $compiled->getArguments($type)); + } + $this->assertEquals($expectedVirtualTypes, $compiled->getVirtualTypes()); + $this->assertEquals($expectedPreferences, $compiled->getPreferences()); } } From 586a7156ee8f7e4ba24ddfa83846f3c6406daa11 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Fri, 4 Nov 2016 11:39:42 +0200 Subject: [PATCH 1636/3232] MAGETWO-59626: Error saving configurable product after disabling child products --- .../Product/Edit/Section/BlockGallery.php | 34 ++++++++++++++ .../Block/Adminhtml/Product/ProductForm.xml | 5 ++ .../Constraint/AssertProductCanUpdate.php | 44 ++++++++++++++++++ .../Test/Fixture/CatalogProductSimple.xml | 4 +- .../Catalog/Test/Fixture/Product/Image.php | 34 ++++++++++++++ .../Product/CreateSimpleProductEntityTest.xml | 13 ++++++ .../app/Magento/Catalog/Test/_files/test1.png | Bin 0 -> 3716 bytes .../app/Magento/Catalog/Test/_files/test2.png | Bin 0 -> 4115 bytes 8 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/_files/test1.png create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/_files/test2.png diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php new file mode 100644 index 0000000000000..53f1f12ece65c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php @@ -0,0 +1,34 @@ + $imageData) { + $uploadElement = $this->_rootElement->find('[name="image"]', Locator::SELECTOR_CSS, 'upload'); + $uploadElement->setValue($imageData['file']); + $this->waitForElementNotVisible('.image.image-placeholder .file-row'); + } + } + return $this; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml index 407b5c9cb20a3..b4f2d99385cf3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml @@ -223,4 +223,9 @@ [data-index="related"] css selector + + \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\BlockGallery + [data-index="block_gallery"] + css selector + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php new file mode 100644 index 0000000000000..f126fef2a2dcd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php @@ -0,0 +1,44 @@ + $product->getSku()]; + $catalogProductIndex->open()->getProductGrid()->searchAndOpen($filter); + $catalogProductEdit->getFormPageActions()->save(); + + \PHPUnit_Framework_Assert::assertNotEmpty( + $catalogProductEdit->getMessagesBlock()->getSuccessMessage() + ); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Product with image was updated without errors.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml index b4514208a5093..a4ca27a0c9e7c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml @@ -36,8 +36,8 @@ - - + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php new file mode 100644 index 0000000000000..60ad65971ffc7 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php @@ -0,0 +1,34 @@ + &$imageData) { + if (isset($imageData['file']) && file_exists(MTF_TESTS_PATH . $imageData['file'])) { + $imageData['file'] = MTF_TESTS_PATH . $imageData['file']; + } else { + unset($data[$key]); + } + } + $this->data = $data; + } +} 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 9e410c525deef..f414f2d9b8c2f 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 @@ -500,5 +500,18 @@ + + Create product with image + Magento/Catalog/Test/_files/test1.png + Magento/Catalog/Test/_files/test2.png + simple-product-%isolation% + Simple Product %isolation% + simple_sku_%isolation% + 10 + 50 + 100 + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/_files/test1.png b/dev/tests/functional/tests/app/Magento/Catalog/Test/_files/test1.png new file mode 100644 index 0000000000000000000000000000000000000000..3077df38da2ffab3378a630914803dfad59e7961 GIT binary patch literal 3716 zcmeHK`#%%vAD_x4MOP;c5nXg*BOEq!Ny3V$QOK=mSYa~SFt^i@J4t17E0^3kIqq^x zOs*{MpT3k`Mfbm5sXn{0AYKr>e z3JMA^-`j3bq_N3g(*=>9qKBWK4-^c>;cy_F1_lmZ3uD)m=KQzW$VO#f>3&!71Pf>B(=>naHJzz`gFcJA0#w$#<4SnA ziyUPvMwE7mlhGm;v>L>n($5y5=In2~;0i1`%n}1#u;l0+ms(vd8%~&>N zyc?uCYSb{iknxS3s-fZDH^%Y%o}P;JwyM~#U>F7v+ObRQAMnp6+zdU~xjv9G{fdKp zrUFsWTVjmWBQ)G6GRqs6r@f1^>h~Ay0!lAGZmI6YAW*B%*0?=6n2F1#Bb*pjPHK>~ z-3R`9#Z9*9N&|Q}!r4spL&Rws$}w+pvCz8fv6{{dYWDZUrZaoHY>j3d%NmlcoKiUlbiS?5Y+vEB|@TOFe$=Zghd^1>r+o8Nnbmk zQhBb_sTrgSUFab;<1aI3?UTx#*UfZ8t3a^{`Z`*XE^(A}dH*1<8Jra%U*_Z2wWkpJ z$J7N9*I`+&+ z31I<25&p;sP~us7R}8$>#iRQd_I}sy zTBoeUEFb9l$kU)+YRn#7l}X99=_6(gc@hsuFy!WWH!{kf?CFj+tvUv;#t|5l@=x&w zbk(cN?MwHN)Y^jneK|szhiDm}`o1`s(*1pN9ghXLb-2GMTUp#G87Fzy?$gp1r|k8g=InPL6UTgH%NHtdvD6RhDUwOya9`YGlaKk+~J$DHMsn@Cm^sxbLC zfCwAY3(Qy(-UG8(#EYsY!h6_=>1O$aQuOpR$+h;8ccE2g&n8(p=RzlrW>CsU%B8Sm z8g#o_S`2UaFGXgn%O^dI%y|HpDPHuw#80oRa`@1d)|X(ing$(P!(O)2!QH)MLb6s> zhuD-q19RZ}Ca`F^l!1tV-VV;t|H+)lO;E(C$&So8G49;{M!!kQEgA~F6tZ*({ zgXC4yJ6GAVr3g0fy@$?@0H3*N#$oSLDzK0VxY4~hxsLQ!fd}gi5?Zm(U}_)Yq9U1{ zZiDbRl~H6*bxP`0W-k@UH+x8c=U!_|evRV3YA4qgQ@s(f{Tmcpqq9%SNB83Z0ZV2Z zr#tdT*@$i1`%Vjuha|^wEukOhG?d8X-$~$;5`$OsdOS|k3_J^f`0>u}$F5FKt0j9a z+h{L{<|Q3-ocR7gU;fxEZ+;m4Q^!5q8hf=zZMF>>MPBWgDQp9q;8Bm4Nhm|cDV zt6lP?x%GOX#^(o?4OU*rAO%;4xt%Jdws+#W$dKj?g2p#1UbboECo)Ct%e+P z;MdL5-i@~wlSu6)o3Du9ihOwI>Oi-2 zCayJizyr%|=0<>ZOepDIq~O0cez{@}L; zx)u;XPA8ZFeIa|+4Wvmiq$ekxnA3F?8Wy!d!h414SH{fC+y?g;WgI5&ienms#k)=eem;dtP&k>o7)XL_}=2F1LGrO1DsvT~NW22h)Jja6NFxj5ub8Y2CO zL^UUgKy_x{CDjbm2Ds}V$Kyvb4A!C>qDeVz#Ei8y%7>%QvsV2w4mbw4bsBHjE5Eon^n( z+kXt$7CxL$LE~sF{zgBjD6{CFC*}X~lQKNT>}%-xM~~Y(I=z>+|BLX82;(xNo4@`G DuQRz$ literal 0 HcmV?d00001 diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/_files/test2.png b/dev/tests/functional/tests/app/Magento/Catalog/Test/_files/test2.png new file mode 100644 index 0000000000000000000000000000000000000000..3d219e6ee734b983a39e041a2386117a10d762be GIT binary patch literal 4115 zcmeHKXIN8N8opRY78bCKAP9mm3alE6AS6I+RD~c2f&$V@gcL|1gc3j;5Hv6|U_k?@ zlqgYRKt*a4g-|3IdPk`eff#y8ZZ=+?eBXKR_r33V&%Mui&Ph3ku#%Bd zk^%rg#>U#*5db8_sRSVTgE+W{Jq{3uErBQPP67ZUU0UG1RXkSnwRW@vfT)825PuB- z*2GZ!7XS#?1puxW0Ko17fC83M;b1Bzx`=dg#k<OWD?HUIYMH zsEzqar$~vJe(9SYRz%=aR%IpW=Xz(ACpM9VHYXpRoQ_J&*xn!Ft65jDe@9*F8Nk9q zLc$>-{+fD6#DP91t_JGo)Q+oCn;fv)n-VXCs$}#;Hs+`sVsnV}1Rm*oTZutpo? zi*mghY}^39j7k~4<2Vd`Vss?sn+#v^hQr(Fwo(%~vG#%TL!B#Iu-DXf<9^&4aeOr` z=o39X3H0M;SE^%PPg-RZM|hTFKlK`e8GB^hU6PW}4SSC{v0f=kegOjF7aaYxn|~PE z8TS#B9z2|T;qt44gQWS?yYrXtg%MAGAa=9B!Ybs~MCZY#Hn5XXX?!aNF|ePRt3>nw zmu?$6Us}G9#E!F5iUkuLx<-PWsFomAy;aVUyXv^F*R(C0iF3aVAq6+J4BNB_`iv)M zU#}P25zxJq+quyf|KUqVRL2I-C9Ox`=UmoHVj2~nK-Y>h?SUH{9WP|IIC?Tkq~@=QKMd$>-i$GR%{x zmp|QC73x+kxd+#m&Qe|Qw3>DqDb<0y)CKx96AcX8QiFa8C4`Xt)E}x`F@R?op;nt4 z`To71`qgDkou}zwtcb%z-%g8RPO@MvT^A$KhJq2tp_@A6R&(75o#I=#7t2Z65BOBMd^D z3lgQ7l?dNzCypZZ=Ch4P3wmy}xoe4W!SDa=tX)-#`$y{gK#zHT=nHPp@>^u84 z&l_}5jyt%x04Y}T{(A<~-KC~ia3gAV06ZA3q3s)diOdX*jp`LxAltiE^)9VETZyS) zUub&i|HUptzE^#TVI_Kj7C?EaC3G4+LrK9r7SvW6?{pZlm^pis_h|l-BGSk*XDeT^ z_^TOa_6f(^V_ffnH&+!n!NVN|)Rg-Csp1i$njjO?)zJU~Mv|W?+L%xI3bI!mb~FKG{t);0RIbxqaDM z&K%s$aj4Sck{W)vZxllGb5va4+T8ZmrS8X3Rc-@?nS~i%>meyBD?7cB{Pe(-Wj-RZ zy&{;Ay2VTHKD<0laQUF2VQ)pn#$^v#J8%2gH$fKaj@K7;beC4_>g=8T{5jy7n+)}0 z_|6%W{aRvBuk@q#*OfGW+0n7D8qeuxfh5CL;}+ngAf+17T~$xwp9^z5^I z4y-71H9LPPn}Htl?<8tc2lEn&M?a`lN+X+W(o=R)(&Aeb~)3$6%kZ(QoZ$_OAW97x=ShC>q z-Ct7X^X40KuWPrE+j9?$du@WnCr&BvLY6D#h?r%OHx=j~k6};>FAU|uuKHcqP$SH3MP8FS5ke5L_9v9wy+p6fz2C0<|P zkLlxw4*8%SMqSn0^G;ap0AgXNq2V$5u-T|Awn{f4RBY6^E<`T#IF0FzjyaYdvWi_U zBXi!;BUp7s!X?)+n$r9sIqMtOOMDt1EeNCsk=dNu=JuwtxSHx3-Oj0_X@_{K(`V&o zg_iikd@wGRO$+s}n$%^;>W}{BH!c5Mvge4tbh_^?<_T_`4voE{8*81)Xgt& zpih+5c1oXO7~a3r<=?R_10<4$$1~C{y|o-ofSqg7o?^SPP1MZPM_Q`s7RmFrPgRvy zz*;BG7`ni_9^DQNjlQq+wBKzqM&ZL-K#H%fTA>UBnL?XX>TH{5En*KE| zB|woT^l;R8ym^jfZX0ZtsxpZ_Fki5MVat?_?{!G#j4T>nBEXp zAbj1mo1dkCQ5`bSMy`25PKW!jbDKn@<<`Pht#RyDTM1d0>Btt(YBi^(aDMs0**AKa zRt-Ios&zWATuW)Xc_b2*Uu~!~QR!3dx*hRp?L51lDK6n-Hya|xZfrg zD0`X3>(=>JiN$fjq7+#xq3o$yA}-$|5kXJK4eecTA6Y5Hw+Y5M&)r%zqUUfK>{WE8 zBIe*k%da9q!%<~q-0sgsd{(Wmuk*g%h{s!ND_*ZHZ_%!J4sxj3ch+sXf?i zEcLjwprHhBBbdW1p!l&lX{z$EjP>YS<3gsQoUq7Qlsz@lY=3;`A#ku88-o{rvb17e z=;bIyvL;~keo~qNIcIit?=ZLST>$8#!fEjAUST2AXz@GVgf0#*j<_6?|AxLfb!zd( z`zvXpTRkGc>7l1x z6uzfbLV4E_Ua@O0bL7S_=pnNke+yW2X_xrG6%A=Dk8}5n*b3~_sW)`$5L9klW*J;) nxK;eqUkCgDuiFhaMpB^qK`3ho&xD=dxR2XdAk2$Td0qV{t2K+- literal 0 HcmV?d00001 From 623d29d17928576b16e33010bfac4748aac5dd44 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Fri, 4 Nov 2016 11:26:51 +0200 Subject: [PATCH 1637/3232] MAGETWO-56863: [GitHub] Saving CMS page does not create URL rewrite in Magento 2.1.0 with single-store mode #5923 --- .../Test/Unit/Model/CmsPageUrlRewriteGeneratorTest.php | 10 +++++----- .../app/Magento/Backend/Test/Repository/ConfigData.xml | 2 +- .../Cms/Test/TestCase/CreateCmsPageEntityTest.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/CmsUrlRewrite/Test/Unit/Model/CmsPageUrlRewriteGeneratorTest.php b/app/code/Magento/CmsUrlRewrite/Test/Unit/Model/CmsPageUrlRewriteGeneratorTest.php index 168343b03cb46..96a964c3d2d33 100644 --- a/app/code/Magento/CmsUrlRewrite/Test/Unit/Model/CmsPageUrlRewriteGeneratorTest.php +++ b/app/code/Magento/CmsUrlRewrite/Test/Unit/Model/CmsPageUrlRewriteGeneratorTest.php @@ -11,27 +11,27 @@ class CmsPageUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ - protected $objectManager; + private $objectManager; /** * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $storeManager; + private $storeManager; /** * @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlRewriteFactory; + private $urlRewriteFactory; /** * @var \Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlPathGenerator; + private $urlPathGenerator; /** * @var \Magento\CmsUrlRewrite\Model\CmsPageUrlRewriteGenerator */ - protected $urlRewriteGenerator; + private $urlRewriteGenerator; /** * @return void 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 2616ddabb097f..fcf6e2ac0c4d0 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 @@ -213,7 +213,7 @@ - + default 0 Yes 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 061acac7a418c..4f02e7c4caf24 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 @@ -59,7 +59,7 @@ class CreateCmsPageEntityTest extends Injectable * * @var string */ - protected $configData; + private $configData; /** * Inject pages. @@ -104,7 +104,7 @@ public function test(array $data, $fixtureType, $configData = '') } /** - * Disable MAP on Config level. + * Disable single store mode on config level. * * @return void */ From 0195c22e8305d93cc893fb83fd0e28c1fc250aa6 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk Date: Fri, 4 Nov 2016 10:21:42 +0200 Subject: [PATCH 1638/3232] MAGETWO-60128: [GITHUB] Customer Addresses: Can't convert undefined to object #7115 --- .../view/frontend/web/js/model/customer-addresses.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/web/js/model/customer-addresses.js b/app/code/Magento/Customer/view/frontend/web/js/model/customer-addresses.js index f6740550efca6..a96dca0002d69 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/model/customer-addresses.js +++ b/app/code/Magento/Customer/view/frontend/web/js/model/customer-addresses.js @@ -11,11 +11,13 @@ define( ], function($, ko, address) { "use strict"; + var isLoggedIn = ko.observable(window.isCustomerLoggedIn); + return { getAddressItems: function() { var items = []; - if (isLoggedIn) { + if (isLoggedIn()) { var customerData = window.customerData; if (Object.keys(customerData).length) { $.each(customerData.addresses, function (key, item) { @@ -23,8 +25,9 @@ define( }); } } + return items; } } } -); \ No newline at end of file +); From c338f3357e7500d4a25487dbbd02569a11bf14ea Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Fri, 4 Nov 2016 11:53:41 +0200 Subject: [PATCH 1639/3232] MAGETWO-60472: Remove ApiAnnotationTest for API namespace for 2.2 --- .../Test/Integrity/ApiAnnotationTest.php | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/ApiAnnotationTest.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ApiAnnotationTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ApiAnnotationTest.php deleted file mode 100644 index a1e7c25e3d600..0000000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ApiAnnotationTest.php +++ /dev/null @@ -1,40 +0,0 @@ -getPaths(ComponentRegistrar::MODULE)); - - foreach (Files::init()->getFiles($modulePaths, '*.php', true) as $file) { - $fileContent = file_get_contents($file); - if (!preg_match($this->apiAnnotation, $fileContent)) { - $result[] = $file; - } - } - if (!empty($result)) { - $this->fail(sprintf( - 'Found %s file(s) without @api annotations under Api namespace: %s', - count($result), - PHP_EOL . implode(PHP_EOL, $result) - )); - } - } -} From 149fe6919f2e77b6212dd3f631a3de9d681d8be3 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Fri, 4 Nov 2016 11:58:03 +0200 Subject: [PATCH 1640/3232] MAGETWO-60037: User is able to create empty URL key for category which leads to numerous errors --- .../Observer/CategoryUrlPathAutogeneratorObserver.php | 1 - .../Model/CategoryUrlRewriteGeneratorTest.php | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php b/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php index 9e5a708c22e53..cb30f7abc7179 100644 --- a/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php +++ b/app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php @@ -5,7 +5,6 @@ */ namespace Magento\CatalogUrlRewrite\Observer; -use Doctrine\Instantiator\Exception\InvalidArgumentException; use Magento\Catalog\Model\Category; use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator; use Magento\CatalogUrlRewrite\Service\V1\StoreViewService; diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php index b3831d09a0dcf..93fe95f83cbc9 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php @@ -94,7 +94,7 @@ public function testGenerateUrlRewritesWithSaveHistory() * @magentoDbIsolation enabled * @magentoAppIsolation enabled * @param string $urlKey - * @dataProvider IncorrectUrlRewritesDataProvider + * @dataProvider incorrectUrlRewritesDataProvider */ public function testGenerateUrlRewritesWithIncorrectUrlKey($urlKey) { @@ -112,7 +112,7 @@ public function testGenerateUrlRewritesWithIncorrectUrlKey($urlKey) /** * @return array */ - public function IncorrectUrlRewritesDataProvider() + public function incorrectUrlRewritesDataProvider() { return [ ['#'], From 3f5d7866c2286cc9b4ffdc12ed7730a165d0ff08 Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Fri, 4 Nov 2016 12:00:27 +0200 Subject: [PATCH 1641/3232] MAGETWO-60279: Authorize.net: x_ship_to_country does not contain a value - Covered public PR changes by integration tests --- .../Model/Directpost/RequestTest.php | 102 ++++++++++++++ .../Authorizenet/Model/DirectpostTest.php | 129 ++++++++++++++++++ .../Magento/Authorizenet/_files/order.php | 70 ++++++++++ 3 files changed, 301 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Authorizenet/Model/Directpost/RequestTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Authorizenet/Model/DirectpostTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Authorizenet/_files/order.php diff --git a/dev/tests/integration/testsuite/Magento/Authorizenet/Model/Directpost/RequestTest.php b/dev/tests/integration/testsuite/Magento/Authorizenet/Model/Directpost/RequestTest.php new file mode 100644 index 0000000000000..ab35c27985da8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Authorizenet/Model/Directpost/RequestTest.php @@ -0,0 +1,102 @@ +objectManager = Bootstrap::getObjectManager(); + + $this->order = $this->getOrder(); + $this->request = $this->objectManager->get(Request::class); + } + + /** + * @covers \Magento\Authorizenet\Model\Directpost\Request::setDataFromOrder + * @magentoDataFixture Magento/Authorizenet/_files/order.php + */ + public function testSetDataFromOrder() + { + $customerEmail = 'john.doe@example.com'; + $merchantEmail = 'merchant@example.com'; + + /** @var Directpost|MockObject $payment */ + $payment = $this->getMockBuilder(Directpost::class) + ->disableOriginalConstructor() + ->setMethods(['getConfigData']) + ->getMock(); + + $payment->expects(static::exactly(2)) + ->method('getConfigData') + ->willReturnMap([ + ['email_customer', null, $customerEmail], + ['merchant_email', null, $merchantEmail] + ]); + + $result = $this->request->setDataFromOrder($this->order, $payment); + + static::assertEquals('US', $result->getXCountry()); + static::assertEquals('UK', $result->getXShipToCountry()); + static::assertEquals($customerEmail, $result->getXEmailCustomer()); + static::assertEquals($merchantEmail, $result->getXMerchantEmail()); + } + + /** + * Get stored order + * @return Order + */ + private function getOrder() + { + /** @var FilterBuilder $filterBuilder */ + $filterBuilder = $this->objectManager->get(FilterBuilder::class); + $filters = [ + $filterBuilder->setField(OrderInterface::INCREMENT_ID) + ->setValue('100000002') + ->create() + ]; + + /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ + $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); + $searchCriteria = $searchCriteriaBuilder->addFilters($filters) + ->create(); + + $orderRepository = $this->objectManager->get(OrderRepositoryInterface::class); + $orders = $orderRepository->getList($searchCriteria) + ->getItems(); + + /** @var OrderInterface $order */ + return array_pop($orders); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Authorizenet/Model/DirectpostTest.php b/dev/tests/integration/testsuite/Magento/Authorizenet/Model/DirectpostTest.php new file mode 100644 index 0000000000000..c20db43c127b4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Authorizenet/Model/DirectpostTest.php @@ -0,0 +1,129 @@ +objectManager = Bootstrap::getObjectManager(); + + $this->httpClientFactory = $this->getMockBuilder(ZendClientFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->directPost = $this->objectManager->create(Directpost::class, [ + 'httpClientFactory' => $this->httpClientFactory + ]); + } + + /** + * @covers \Magento\Authorizenet\Model\Directpost::capture + * @magentoDataFixture Magento/Authorizenet/_files/order.php + */ + public function testCapture() + { + $amount = 120.15; + /** @var Payment $payment */ + $payment = $this->getPayment(); + $transactionId = '106235225'; + + /** @var ZendClient|MockObject $httpClient */ + $httpClient = $this->getMockBuilder(ZendClient::class) + ->disableOriginalConstructor() + ->setMethods(['setUri', 'setConfig', 'setParameterPost', 'setMethod', 'request']) + ->getMock(); + + $this->httpClientFactory->expects(static::once()) + ->method('create') + ->willReturn($httpClient); + + $response = $this->getMockBuilder(Zend_Http_Response::class) + ->disableOriginalConstructor() + ->setMethods(['getBody']) + ->getMock(); + $response->expects(static::once()) + ->method('getBody') + ->willReturn( + "1(~)1(~)1(~)This transaction has been approved.(~)AWZFTG(~)P(~){$transactionId}(~)100000002(~) + (~)120.15(~)CC(~)prior_auth_capture(~)(~)Anthony(~)Nealy(~)(~)Pearl St(~)Los Angeles(~)California + (~)10020(~)US(~)22-333-44(~)(~)customer@example.com(~)John(~)Doe(~) + (~)Bourne St(~)London(~)(~)DW23W(~)UK(~)0.00(~)(~){$amount}(~)(~) + (~)74B5D54ADFE98093A0FF6446(~)(~)(~)(~)(~)(~)(~)(~)(~)(~)(~)(~)(~)XXXX1111(~)Visa(~)(~)(~)(~)(~) + (~)(~)(~)(~)(~)(~)(~)(~)(~)(~)(~)(~)" + ); + + $httpClient->expects(static::once()) + ->method('request') + ->willReturn($response); + + $this->directPost->capture($payment, $amount); + + static::assertEquals($transactionId, $payment->getTransactionId()); + static::assertFalse($payment->getIsTransactionClosed()); + static::assertEquals('US', $payment->getOrder()->getBillingAddress()->getCountryId()); + static::assertEquals('UK', $payment->getOrder()->getShippingAddress()->getCountryId()); + } + + /** + * Get order payment + * @return Payment + */ + private function getPayment() + { + /** @var FilterBuilder $filterBuilder */ + $filterBuilder = $this->objectManager->get(FilterBuilder::class); + $filters = [ + $filterBuilder->setField(OrderInterface::INCREMENT_ID) + ->setValue('100000002') + ->create() + ]; + + /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ + $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class); + $searchCriteria = $searchCriteriaBuilder->addFilters($filters) + ->create(); + + $orderRepository = $this->objectManager->get(OrderRepositoryInterface::class); + $orders = $orderRepository->getList($searchCriteria) + ->getItems(); + + /** @var OrderInterface $order */ + $order = array_pop($orders); + return $order->getPayment(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Authorizenet/_files/order.php b/dev/tests/integration/testsuite/Magento/Authorizenet/_files/order.php new file mode 100644 index 0000000000000..293715c150711 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Authorizenet/_files/order.php @@ -0,0 +1,70 @@ +get(Payment::class); +$payment + ->setMethod('authorizenet_directpost') + ->setAnetTransType('AUTH_ONLY') + ->setBaseAmountAuthorized($amount) + ->setPoNumber('10101200'); + +/** @var Address\ $billingAddress */ +$billingAddress = $objectManager->create(Address::class, [ + 'data' => [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'email' => 'customer@example.com', + 'street' => 'Pearl St', + 'city' => 'Los Angeles', + 'region' => 'CA', + 'postcode' => '10020', + 'country_id' => 'US', + 'telephone' => '22-333-44', + 'address_type' => 'billing' + ] +]); + +$shippingAddress = $objectManager->create(Address::class, [ + 'data' => [ + 'firstname' => 'John', + 'lastname' => 'Doe', + 'email' => 'customer@example.com', + 'street' => 'Bourne St', + 'city' => 'London', + 'postcode' => 'DW23W', + 'country_id' => 'UK', + 'telephone' => '22-333-44', + 'address_type' => 'billing' + ] +]); + +/** @var Order $order */ +$order = $objectManager->create(Order::class); +$order->setIncrementId('100000002') + ->setQuoteId(2) + ->setIncrementId('100000002') + ->setBaseGrandTotal($amount) + ->setBaseCurrencyCode('USD') + ->setBaseTaxAmount($amount) + ->setBaseShippingAmount($amount) + ->setCustomerEmail('customer@example.com') + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->setPayment($payment); + +/** @var OrderRepositoryInterface $orderRepository */ +$orderRepository = $objectManager->get(OrderRepositoryInterface::class); +$orderRepository->save($order); \ No newline at end of file From e4ffd59324afe92f11c1586565aa79c33cd6e357 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Fri, 4 Nov 2016 12:19:04 +0200 Subject: [PATCH 1642/3232] MAGETWO-58617: [GitHub] WYSIWYG editor loses data after show-hide editor #5811 --- lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js index 2c4ab52b896cb..306c9557e6456 100755 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js @@ -329,8 +329,9 @@ define([ encodeDirectives: function(content) { // collect all HTML tags with attributes that contain directives - return content.gsub(/<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".+?)>/i, function(match) { + return content.gsub(/\<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".*?)>/i, function(match) { var attributesString = match[2]; + // process tag attributes string attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function(m) { return m[1] + '="' + m[2] + this.makeDirectiveUrl(Base64.mageEncode(m[3])) + m[4] + '"'; From 96d9ed681b8cdb305db501969bdc25447c17c26d Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Fri, 4 Nov 2016 12:22:25 +0200 Subject: [PATCH 1643/3232] MAGETWO-58617: [GitHub] WYSIWYG editor loses data after show-hide editor #5811 --- lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js index 306c9557e6456..057f492509192 100755 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js @@ -329,7 +329,7 @@ define([ encodeDirectives: function(content) { // collect all HTML tags with attributes that contain directives - return content.gsub(/\<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".*?)>/i, function(match) { + return content.gsub(/<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".*?)>/i, function(match) { var attributesString = match[2]; // process tag attributes string From 01eca72fc4a7f474efefc399a252b0207f5a2a1c Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Fri, 4 Nov 2016 12:29:13 +0200 Subject: [PATCH 1644/3232] MAGETWO-59626: Error saving configurable product after disabling child products --- .../Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php | 2 +- .../Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php | 1 + .../tests/app/Magento/Catalog/Test/Fixture/Product/Image.php | 1 + .../Test/TestCase/Product/CreateSimpleProductEntityTest.xml | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php index 53f1f12ece65c..bc1a0ebc4ce15 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php @@ -23,7 +23,7 @@ class BlockGallery extends Section public function setFieldsData(array $data, SimpleElement $element = null) { if (isset($data['image'])) { - foreach ($data['image']['value'] as $key => $imageData) { + foreach ($data['image']['value'] as $imageData) { $uploadElement = $this->_rootElement->find('[name="image"]', Locator::SELECTOR_CSS, 'upload'); $uploadElement->setValue($imageData['file']); $this->waitForElementNotVisible('.image.image-placeholder .file-row'); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php index f126fef2a2dcd..24f1f9d7714cc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php @@ -17,6 +17,7 @@ class AssertProductCanUpdate extends \Magento\Mtf\Constraint\AbstractConstraint * @param \Magento\Mtf\Fixture\FixtureInterface $product * @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit $catalogProductEdit * @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex $catalogProductIndex + * @return void */ public function processAssert( \Magento\Mtf\Fixture\FixtureInterface $product, diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php index 60ad65971ffc7..0136c3431fe3c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php @@ -19,6 +19,7 @@ class Image extends DataSource * @param FixtureFactory $fixtureFactory * @param array $params * @param array $data + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct(FixtureFactory $fixtureFactory, array $params, $data = []) { 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 f414f2d9b8c2f..5e0a61a9c0426 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 @@ -501,7 +501,7 @@ - Create product with image + Create product with image and try to save it again Magento/Catalog/Test/_files/test1.png Magento/Catalog/Test/_files/test2.png simple-product-%isolation% @@ -509,6 +509,7 @@ simple_sku_%isolation% 10 50 + severity:S1 100 From d1e198fc281baba89f95d270b5f8a6851a96b5e4 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Fri, 4 Nov 2016 12:49:51 +0200 Subject: [PATCH 1645/3232] MAGETWO-56863: [GitHub] Saving CMS page does not create URL rewrite in Magento 2.1.0 with single-store mode #5923 --- .../app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml index de0284e409caf..fc024be14c699 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml @@ -68,7 +68,7 @@ - severity:S2 + test_type:acceptance_test, test_type:extended_acceptance_test enable_single_store_mode cmsPage Yes From 19c75745ab960ffd5ce845637a385339dfa86003 Mon Sep 17 00:00:00 2001 From: Dmytro Aponasenko Date: Fri, 4 Nov 2016 12:54:11 +0200 Subject: [PATCH 1646/3232] MTA-3603: Create 'green' functional test suite --- .../Test/TestCase/Product/UpdateSimpleProductEntityTest.xml | 2 +- .../app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.xml | 2 +- .../Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml | 2 +- .../app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php | 1 + .../Magento/Mtf/TestSuite/InjectableTests/basic_green.xml | 1 - 5 files changed, 4 insertions(+), 4 deletions(-) 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 4d6db5e43a679..31aaad654f92a 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 @@ -8,6 +8,7 @@ + stable:no Update visibility to Catalog, Search product_with_category Test simple product %isolation% @@ -17,7 +18,6 @@ test-simple-product-%isolation% 120.0000 Catalog, Search - MAGETWO-58145 diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.xml b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.xml index b888ba1f77837..2c3809e27f2ef 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreEntityTest.xml @@ -17,7 +17,7 @@ - severity:S2 + severity:S2, stable:no custom No diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml index 5d2f4a9d5f788..cfda1263ac19f 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml @@ -16,7 +16,7 @@ - severity:S3 + severity:S3, stable:no custom No diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php index 9cfa401510bc1..55a6694571ac1 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.php @@ -28,6 +28,7 @@ class CreateTaxRuleEntityTest extends Injectable /* tags */ const MVP = 'yes'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic_green.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic_green.xml index cfb4fa3950612..df7b03a994df4 100644 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic_green.xml +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/basic_green.xml @@ -9,7 +9,6 @@ xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/mtf/Magento/Mtf/TestRunner/etc/testRunner.xsd"> - From 0644f24c7d658a23733c51f670c1f6931be39a6f Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Fri, 4 Nov 2016 13:23:38 +0200 Subject: [PATCH 1647/3232] MAGETWO-60351: Unnecessary disabled payment methods on checkout page #4868 --- .../Plugin/PaymentConfigurationProcess.php | 7 +++--- .../PaymentConfigurationProcessTest.php | 23 +++++++++++++++---- .../PaymentVaultConfigurationProcess.php | 11 ++++----- .../PaymentVaultConfigurationProcessTest.php | 10 +++----- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php b/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php index b1e36b7ae39f3..5b107b74295b3 100644 --- a/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php +++ b/app/code/Magento/Payment/Plugin/PaymentConfigurationProcess.php @@ -59,10 +59,9 @@ public function beforeProcess(\Magento\Checkout\Block\Checkout\LayoutProcessor $ $activePaymentMethodCodes = array_map($getCodeFunc, $activePaymentMethodList); foreach ($configuration as $paymentGroup => $groupConfig) { - foreach (array_keys($groupConfig['methods']) as $paymentCode) { - if (!in_array($paymentCode, $activePaymentMethodCodes)) { - unset($configuration[$paymentGroup]['methods'][$paymentCode]); - } + $notActivePaymentMethodCodes = array_diff(array_keys($groupConfig['methods']), $activePaymentMethodCodes); + foreach ($notActivePaymentMethodCodes as $notActivePaymentMethodCode) { + unset($configuration[$paymentGroup]['methods'][$notActivePaymentMethodCode]); } if (empty($configuration[$paymentGroup]['methods'])) { unset($configuration[$paymentGroup]); diff --git a/app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php b/app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php index be5755440066e..3e49c8718e604 100644 --- a/app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php +++ b/app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php @@ -98,6 +98,23 @@ public function testBeforeProcess($jsLayout, $activePaymentList, $expectedResult public function beforeProcessDataProvider() { $jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children'] = [ + 'braintree' => [ + 'methods' => [ + 'braintree_paypal' => [], + 'braintree' => [] + ] + ], + 'paypal-payments' => [ + 'methods' => [ + 'payflowpro' => [], + 'payflow_link' => [] + ] + ] + ]; + $result1['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['renders']['children'] = []; + $result2['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['renders']['children'] = [ 'braintree' => [ 'methods' => [ @@ -106,8 +123,6 @@ public function beforeProcessDataProvider() ] ] ]; - $result['components']['checkout']['children']['steps']['children']['billing-step'] - ['children']['payment']['children']['renders']['children'] = []; $braintreePaymentMethod = $this ->getMockBuilder(\Magento\Payment\Api\Data\PaymentMethodInterface::class) @@ -124,8 +139,8 @@ public function beforeProcessDataProvider() $braintreePaypalPaymentMethod->expects($this->any())->method('getCode')->willReturn('braintree_paypal'); return [ - [$jsLayout, [], $result], - [$jsLayout, [$braintreePaymentMethod, $braintreePaypalPaymentMethod], $jsLayout] + [$jsLayout, [], $result1], + [$jsLayout, [$braintreePaymentMethod, $braintreePaypalPaymentMethod], $result2] ]; } } diff --git a/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php b/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php index 666e0b186309e..db38ccbed417a 100644 --- a/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php +++ b/app/code/Magento/Vault/Plugin/PaymentVaultConfigurationProcess.php @@ -69,21 +69,18 @@ public function beforeProcess(\Magento\Checkout\Block\Checkout\LayoutProcessor $ return $method->getProviderCode(); }; $activePaymentMethodCodes = array_map($getCodeFunc, $activePaymentMethodList); - $activeVaultCodes = array_map($getCodeFunc, $activeVaultList); $activeVaultProviderCodes = array_map($getProviderCodeFunc, $activeVaultList); $activePaymentMethodCodes = array_merge( $activePaymentMethodCodes, - $activeVaultCodes, $activeVaultProviderCodes ); foreach ($configuration as $paymentGroup => $groupConfig) { - foreach (array_keys($groupConfig['methods']) as $paymentCode) { - if (!in_array($paymentCode, $activePaymentMethodCodes)) { - unset($configuration[$paymentGroup]['methods'][$paymentCode]); - } + $notActivePaymentMethodCodes = array_diff(array_keys($groupConfig['methods']), $activePaymentMethodCodes); + foreach ($notActivePaymentMethodCodes as $notActivePaymentMethodCode) { + unset($configuration[$paymentGroup]['methods'][$notActivePaymentMethodCode]); } - if ($paymentGroup === 'vault' && !empty($activeVaultCodes)) { + if ($paymentGroup === 'vault' && !empty($activeVaultProviderCodes)) { continue; } if (empty($configuration[$paymentGroup]['methods'])) { diff --git a/app/code/Magento/Vault/Test/Unit/Plugin/PaymentVaultConfigurationProcessTest.php b/app/code/Magento/Vault/Test/Unit/Plugin/PaymentVaultConfigurationProcessTest.php index 0cf64c5424740..7e7a3fd0aebdf 100644 --- a/app/code/Magento/Vault/Test/Unit/Plugin/PaymentVaultConfigurationProcessTest.php +++ b/app/code/Magento/Vault/Test/Unit/Plugin/PaymentVaultConfigurationProcessTest.php @@ -112,9 +112,7 @@ public function beforeProcessDataProvider() $jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['renders']['children'] = [ 'vault' => [ - 'methods' => [ - 'braintree_paypal_vault' => [] - ] + 'methods' => [] ], 'braintree' => [ 'methods' => [ @@ -134,9 +132,7 @@ public function beforeProcessDataProvider() $result2['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['renders']['children'] = [ 'vault' => [ - 'methods' => [ - 'braintree_paypal_vault' => [] - ] + 'methods' => [] ], 'braintree' => [ 'methods' => [ @@ -156,7 +152,7 @@ public function beforeProcessDataProvider() return [ [$jsLayout, [], [], $result1], - [$jsLayout, [$vaultPaymentMethod], [], $result2] + [$jsLayout, [$vaultPaymentMethod], [$vaultPaymentMethod], $result2] ]; } } From 6d3fb44f76bad5c36b785b98dd236d5e86c62955 Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Fri, 4 Nov 2016 13:59:18 +0200 Subject: [PATCH 1648/3232] MAGETWO-59715: Impossible to import additional_images with labels which have a comma separator --- .../Magento/CatalogImportExport/Model/Import/Product.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index de2b2ff8160a7..cfa0210a429f6 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1485,7 +1485,7 @@ public function getImagesFromRow(array $rowData) ); if (!empty($rowData[$column . '_label'])) { - $labels[$column] = $this->parseImageLabels($rowData[$column . '_label']); + $labels[$column] = $this->parseMultipleValues($rowData[$column . '_label']); if (count($labels[$column]) > count($images[$column])) { $labels[$column] = array_slice($labels[$column], 0, count($images[$column])); @@ -2824,12 +2824,12 @@ private function updateMediaGalleryLabels(array $labels) } /** - * Parse labels from combined labels string + * Parse values from multiple attributes fields * * @param string $labelRow * @return array */ - private function parseImageLabels($labelRow) + private function parseMultipleValues($labelRow) { return $this->parseMultiselectValues( $labelRow, From b9c278120440a0317733e351a8229442e50d5f8d Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Fri, 4 Nov 2016 14:07:00 +0200 Subject: [PATCH 1649/3232] MAGETWO-60279: Authorize.net: x_ship_to_country does not contain a value - Fixed failed static test --- .../integration/testsuite/Magento/Authorizenet/_files/order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Authorizenet/_files/order.php b/dev/tests/integration/testsuite/Magento/Authorizenet/_files/order.php index 293715c150711..564ab84a8f852 100644 --- a/dev/tests/integration/testsuite/Magento/Authorizenet/_files/order.php +++ b/dev/tests/integration/testsuite/Magento/Authorizenet/_files/order.php @@ -67,4 +67,4 @@ /** @var OrderRepositoryInterface $orderRepository */ $orderRepository = $objectManager->get(OrderRepositoryInterface::class); -$orderRepository->save($order); \ No newline at end of file +$orderRepository->save($order); From c190f43edb1170c49a912fcab6e04fbca8bdcded Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Fri, 4 Nov 2016 15:05:46 +0200 Subject: [PATCH 1650/3232] MAGETWO-59904: [PR][Github] Update AccountLock.php #6952 --- .../Listing/Column/AccountLockTest.php | 96 ++++++++++++++----- 1 file changed, 71 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/AccountLockTest.php b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/AccountLockTest.php index c72cf9fddd0b7..c6f113d56c38f 100644 --- a/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/AccountLockTest.php +++ b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/AccountLockTest.php @@ -46,27 +46,9 @@ public function setup() */ public function testPrepareDataSource($lockExpirationDate, $expectedResult) { - $dataSource = [ - 'data' => [ - 'items' => [ - [ - 'lock_expires' => $lockExpirationDate - ], - ] - ] - ]; - $expectedDataSource = [ - 'data' => [ - 'items' => [ - [ - 'lock_expires' => $expectedResult, - ], - ] - ] - ]; - $dataSource = $this->component->prepareDataSource($dataSource); + $dataSource = $this->component->prepareDataSource($lockExpirationDate); - $this->assertEquals($expectedDataSource, $dataSource); + $this->assertEquals($expectedResult, $dataSource); } /** @@ -76,13 +58,77 @@ public function testPrepareDataSourceDataProvider() { return [ [ - 'lockExpirationDate' => date("F j, Y", strtotime('-1 days')), - 'expectedResult' => new \Magento\Framework\Phrase('Unlocked') + 'lockExpirationDate' => [ + 'data' => [ + 'items' => [['lock_expires' => null]], + ] + ], + 'expectedResult' => [ + 'data' => [ + 'items' => [ + [ + 'lock_expires' => new \Magento\Framework\Phrase('Unlocked') + ], + ] + ] + ] ], [ - 'lockExpirationDate' => date("F j, Y", strtotime('+1 days')), - 'expectedResult' => new \Magento\Framework\Phrase('Locked') - ] + 'lockExpirationDate' => [ + 'data' => [ + 'items' => [[]]//Non exist lock_expires data + ] + ], + 'expectedResult' => [ + 'data' => [ + 'items' => [ + [ + 'lock_expires' => new \Magento\Framework\Phrase('Unlocked') + ], + ] + ] + ] + ], + [ + 'lockExpirationDate' => [ + 'data' => [ + 'items' => [ + [ + 'lock_expires' => date("F j, Y", strtotime('-1 days')) + ], + ] + ] + ], + 'expectedResult' => [ + 'data' => [ + 'items' => [ + [ + 'lock_expires' => new \Magento\Framework\Phrase('Unlocked') + ], + ] + ] + ] + ], + [ + 'lockExpirationDate' => [ + 'data' => [ + 'items' => [ + [ + 'lock_expires' => date("F j, Y", strtotime('+1 days')) + ], + ] + ] + ], + 'expectedResult' => [ + 'data' => [ + 'items' => [ + [ + 'lock_expires' => new \Magento\Framework\Phrase('Locked') + ], + ] + ] + ] + ], ]; } } From 0700c5d3426477c1d8d783239ca245c0019ac2c5 Mon Sep 17 00:00:00 2001 From: Nadiya Syvokonenko Date: Fri, 4 Nov 2016 16:34:39 +0200 Subject: [PATCH 1651/3232] MAGETWO-57799: cannot upgrade 2.0 => 2.1 with auto_increment > 1 --- app/code/Magento/Cms/Setup/UpgradeData.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Setup/UpgradeData.php b/app/code/Magento/Cms/Setup/UpgradeData.php index 41a28989439af..6d22f782b25b1 100644 --- a/app/code/Magento/Cms/Setup/UpgradeData.php +++ b/app/code/Magento/Cms/Setup/UpgradeData.php @@ -13,6 +13,9 @@ class UpgradeData implements UpgradeDataInterface { + /** + * @deprecated + */ const PRIVACY_COOKIE_PAGE_ID = 4; /** @@ -234,7 +237,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
escapeHtml(__('Ratings Review Summary')); ?>
escapeHtml($_rating->getRatingCode())) ?>escapeHtml(__($_rating->getRatingCode())) ?>
diff --git a/app/code/Magento/Review/view/frontend/templates/empty.phtml b/app/code/Magento/Review/view/frontend/templates/empty.phtml index 7029fe75ca75a..9f32021c3d149 100644 --- a/app/code/Magento/Review/view/frontend/templates/empty.phtml +++ b/app/code/Magento/Review/view/frontend/templates/empty.phtml @@ -5,5 +5,7 @@ */ // @codingStandardsIgnoreFile + +/** @var \Magento\Review\Block\Rating\Entity\Detailed $block */ ?> -

+

escapeHtml(__('Be the first to review this product')) ?>

diff --git a/app/code/Magento/Review/view/frontend/templates/form.phtml b/app/code/Magento/Review/view/frontend/templates/form.phtml index 611416586ddf8..04e55e0b11866 100644 --- a/app/code/Magento/Review/view/frontend/templates/form.phtml +++ b/app/code/Magento/Review/view/frontend/templates/form.phtml @@ -9,18 +9,18 @@ /** @var \Magento\Review\Block\Form $block */ ?>
-
+
escapeHtml(__('Write Your Own Review')) ?>
getAllowWriteReviewFlag()): ?> getBlockHtml('formkey'); ?> getChildHtml('form_fields_before')?> -
- escapeHtml($block->getProductInfo()->getName()) ?>
+
+ escapeHtml(__("You're reviewing:")); ?>escapeHtml($block->getProductInfo()->getName()) ?>
getRatings() && $block->getRatings()->getSize()): ?>
-
+ escapeHtml(__('Your Rating')) ?>
getRatings() as $_rating): ?> @@ -40,9 +40,9 @@ @@ -55,19 +55,19 @@
- +
- +
- +
@@ -75,7 +75,7 @@
- +
@@ -92,7 +92,7 @@
- Sign in or create an account', $block->getLoginLink(), $block->getRegisterUrl()) ?> + escapeHtml(__('Only registered users can write reviews. Please Sign in or create an account', $block->getLoginLink(), $block->getRegisterUrl(), ['a'])) ?>
diff --git a/app/code/Magento/Review/view/frontend/templates/helper/summary.phtml b/app/code/Magento/Review/view/frontend/templates/helper/summary.phtml index cc5d8a0b6aed9..eabdb0a3e51f7 100644 --- a/app/code/Magento/Review/view/frontend/templates/helper/summary.phtml +++ b/app/code/Magento/Review/view/frontend/templates/helper/summary.phtml @@ -16,22 +16,22 @@ $urlForm = $block->getReviewsUrl() . '#review-form'; getDisplayIfEmpty()): ?> diff --git a/app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml b/app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml index 14650e7b0e0d1..90ddfda19f2c8 100644 --- a/app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml +++ b/app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml @@ -16,21 +16,21 @@ $urlForm = $block->getReviewsUrl() . '#review-form'; getDisplayIfEmpty()): ?> diff --git a/app/code/Magento/Review/view/frontend/templates/product/view/count.phtml b/app/code/Magento/Review/view/frontend/templates/product/view/count.phtml index fb7741a5ea2d9..8b515ca2b7b7b 100644 --- a/app/code/Magento/Review/view/frontend/templates/product/view/count.phtml +++ b/app/code/Magento/Review/view/frontend/templates/product/view/count.phtml @@ -5,8 +5,8 @@ */ // @codingStandardsIgnoreFile - +// @deprecated ?> - + escapeHtml(__('%1 Review(s)', $count)) ?> diff --git a/app/code/Magento/Review/view/frontend/templates/product/view/list.phtml b/app/code/Magento/Review/view/frontend/templates/product/view/list.phtml index 9eb4fd10fece1..262208b169e87 100644 --- a/app/code/Magento/Review/view/frontend/templates/product/view/list.phtml +++ b/app/code/Magento/Review/view/frontend/templates/product/view/list.phtml @@ -14,7 +14,7 @@ $format = $block->getDateFormat() ?: \IntlDateFormatter::SHORT;
- + escapeHtml(__('Customer Reviews')) ?>
@@ -45,11 +45,11 @@ $format = $block->getDateFormat() ?: \IntlDateFormatter::SHORT;

- + escapeHtml(__('Review by'))?>

- + escapeHtml(__('Posted on')) ?>

diff --git a/app/code/Magento/Review/view/frontend/templates/product/view/other.phtml b/app/code/Magento/Review/view/frontend/templates/product/view/other.phtml index 3c8d626b31748..fadc72ce7da8f 100644 --- a/app/code/Magento/Review/view/frontend/templates/product/view/other.phtml +++ b/app/code/Magento/Review/view/frontend/templates/product/view/other.phtml @@ -10,5 +10,5 @@ ?> getProduct(); ?> diff --git a/app/code/Magento/Review/view/frontend/templates/view.phtml b/app/code/Magento/Review/view/frontend/templates/view.phtml index f44d31d63f7b7..12a28ccf54063 100644 --- a/app/code/Magento/Review/view/frontend/templates/view.phtml +++ b/app/code/Magento/Review/view/frontend/templates/view.phtml @@ -11,28 +11,28 @@ getProductData()->getId()): ?>
-

+

escapeHtml(__('Review Details')) ?>

getImage($block->getProductData(), 'product_base_image', ['class' => 'product-image'])->toHtml(); ?> getRating() && $block->getRating()->getSize()): ?> -

:

+

escapeHtml(__('Average Customer Rating')) ?>:

getReviewsSummaryHtml($block->getProductData()) ?>

escapeHtml($block->getProductData()->getName()) ?>

getRating() && $block->getRating()->getSize()): ?> -

+

escapeHtml(__('Product Rating:')) ?>

- + getRating() as $_rating): ?> getPercent()): ?> - +
escapeHtml(__('Product Rating')); ?>
escapeHtml($_rating->getRatingCode())) ?>escapeHtml(__($_rating->getRatingCode())) ?>
@@ -43,13 +43,13 @@
-

dateFormat($block->getReviewData()->getCreatedAt())) ?>

+

escapeHtml(__('Product Review (submitted on %1):', $block->dateFormat($block->getReviewData()->getCreatedAt()))) ?>

escapeHtml($block->getReviewData()->getDetail())) ?>

- + escapeHtml(__('Back to Product Reviews')) ?>
From 51ac8b636d0e55e09b68a4cb06d60bc5622d1b06 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Wed, 24 Aug 2016 16:56:14 -0500 Subject: [PATCH 0273/3232] MAGETWO-57237: Eliminate @escapeNotVerified in Review Module - fixed tests --- .../Review/view/frontend/templates/customer/list.phtml | 4 ++-- app/code/Magento/Review/view/frontend/templates/form.phtml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Review/view/frontend/templates/customer/list.phtml b/app/code/Magento/Review/view/frontend/templates/customer/list.phtml index 9a17e0ff33f99..7d19e34e3687b 100644 --- a/app/code/Magento/Review/view/frontend/templates/customer/list.phtml +++ b/app/code/Magento/Review/view/frontend/templates/customer/list.phtml @@ -34,8 +34,8 @@ getSum()): ?>
escapeHtml(__('Rating')) ?>: -
- getSum() / (int)$_review->getCount()) ?>% +
+ getSum() / (int)$_review->getCount()) ?>%
diff --git a/app/code/Magento/Review/view/frontend/templates/form.phtml b/app/code/Magento/Review/view/frontend/templates/form.phtml index 04e55e0b11866..7c89fd8740c56 100644 --- a/app/code/Magento/Review/view/frontend/templates/form.phtml +++ b/app/code/Magento/Review/view/frontend/templates/form.phtml @@ -92,7 +92,7 @@
- escapeHtml(__('Only registered users can write reviews. Please Sign in or create an account', $block->getLoginLink(), $block->getRegisterUrl(), ['a'])) ?> + escapeHtml(__('Only registered users can write reviews. Please Sign in or create an account', $block->getLoginLink(), $block->getRegisterUrl()), ['a']) ?>
From cf660360b8287a9512fbfd52c3cf822bea5f176b Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Wed, 24 Aug 2016 16:16:25 -0500 Subject: [PATCH 0274/3232] MAGETWO-55869: Eliminate @escapeNotVerified in Security module - Eliminated @escapeNotVerified from entire module. --- .../templates/page/activity_link.phtml | 6 ++--- .../templates/session/activity.phtml | 26 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Security/view/adminhtml/templates/page/activity_link.phtml b/app/code/Magento/Security/view/adminhtml/templates/page/activity_link.phtml index 9709002183a4f..ee3c962a06e97 100644 --- a/app/code/Magento/Security/view/adminhtml/templates/page/activity_link.phtml +++ b/app/code/Magento/Security/view/adminhtml/templates/page/activity_link.phtml @@ -11,12 +11,12 @@ */ ?> | diff --git a/app/code/Magento/Security/view/adminhtml/templates/session/activity.phtml b/app/code/Magento/Security/view/adminhtml/templates/session/activity.phtml index 0dd5139f97f4c..9ae4c9f62afac 100644 --- a/app/code/Magento/Security/view/adminhtml/templates/session/activity.phtml +++ b/app/code/Magento/Security/view/adminhtml/templates/session/activity.phtml @@ -14,13 +14,13 @@ $sessionInfoCollection = $block->getSessionInfoCollection(); ?>
-

+

escapeHtml(__('Account Activity')) ?>

areMultipleSessionsActive()) { - /* @escapeNotVerified */ echo __( + echo $block->escapeHtml(__( 'This administrator account is open in more than one location. ' .'Note that other locations might be different browsers or sessions on the same computer.' - ); + )); } ?>
@@ -28,20 +28,20 @@ $sessionInfoCollection = $block->getSessionInfoCollection();
getLayout()->getMessagesBlock()->getGroupedHtml() ?>
-
+
escapeHtml(__('Concurrent session information:'))?>
- - + + - - + + getSessionInfoCollection(); if ($block->areMultipleSessionsActive()): ?> data-mage-init='{"confirmRedirect":{ "message": "", - "url":"getUrl('security/session/logoutAll') ?>" + echo $block->escapeJs(__('Are you sure that you want to log out all other sessions?')) ?>", + "url":"escapeJs($block->escapeUrl($block->getUrl('security/session/logoutAll'))) ?>" }}' disabled - title=""> - + title="escapeHtmlAttr(__('Log out all other sessions')) ?>"> + escapeHtml(__('Log out all other sessions')) ?>
getRemoteIp()) ?>
+ echo $block->escapeHtml(__('This computer is using IP address %1.', $block->getRemoteIp())) ?> From 5ff6c66bc1417d6be9bd0e8958631eb563845846 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 24 Aug 2016 17:24:37 -0500 Subject: [PATCH 0275/3232] MAGETWO-55589: Wrong algorithm for calculation batch size on category indexing --- .../Framework/DB/Adapter/Pdo/Mysql.php | 67 +++---- .../Framework/DB/Query/BatchIterator.php | 170 ++++++++++++++++++ .../DB/Query/BatchIteratorFactory.php | 47 +++++ .../Magento/Framework/DB/Query/Generator.php | 90 ++++++++++ 4 files changed, 331 insertions(+), 43 deletions(-) create mode 100644 lib/internal/Magento/Framework/DB/Query/BatchIterator.php create mode 100644 lib/internal/Magento/Framework/DB/Query/BatchIteratorFactory.php create mode 100644 lib/internal/Magento/Framework/DB/Query/Generator.php diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 468885548b312..6399824590a69 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -26,6 +26,7 @@ use Magento\Framework\Phrase; use Magento\Framework\Stdlib\DateTime; use Magento\Framework\Stdlib\StringUtils; +use Magento\Framework\DB\Query\Generator as QueryGenerator; /** * @SuppressWarnings(PHPMD.ExcessivePublicCount) @@ -199,6 +200,11 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface */ private $exceptionMap; + /** + * @var QueryGenerator + */ + private $queryGenerator; + /** * @param StringUtils $string * @param DateTime $dateTime @@ -3362,57 +3368,32 @@ public function insertFromSelect(Select $select, $table, array $fields = [], $mo * @param int $stepCount * @return \Magento\Framework\DB\Select[] * @throws LocalizedException + * @deprecated */ public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select, $stepCount = 100) { - $fromSelect = $select->getPart(\Magento\Framework\DB\Select::FROM); - if (empty($fromSelect)) { - throw new LocalizedException( - new \Magento\Framework\Phrase('Select object must have correct "FROM" part') - ); - } - - $tableName = []; - $correlationName = ''; - foreach ($fromSelect as $correlationName => $formPart) { - if ($formPart['joinType'] == \Magento\Framework\DB\Select::FROM) { - $tableName = $formPart['tableName']; - break; - } - } - - $selectRange = $this->select() - ->from( - $tableName, - [ - new \Zend_Db_Expr('MIN(' . $this->quoteIdentifier($rangeField) . ') AS min'), - new \Zend_Db_Expr('MAX(' . $this->quoteIdentifier($rangeField) . ') AS max'), - ] - ); - - $rangeResult = $this->fetchRow($selectRange); - $min = $rangeResult['min']; - $max = $rangeResult['max']; - + $iterator = $this->getQueryGenerator()->generate($rangeField, $select, $stepCount); $queries = []; - while ($min <= $max) { - $partialSelect = clone $select; - $partialSelect->where( - $this->quoteIdentifier($correlationName) . '.' - . $this->quoteIdentifier($rangeField) . ' >= ?', - $min - ) - ->where( - $this->quoteIdentifier($correlationName) . '.' - . $this->quoteIdentifier($rangeField) . ' < ?', - $min + $stepCount - ); - $queries[] = $partialSelect; - $min += $stepCount; + foreach ($iterator as $query) { + $queries[] = $query; } return $queries; } + /** + * Get query generator + * + * @return QueryGenerator + * @deprecated + */ + private function getQueryGenerator() + { + if ($this->queryGenerator === null) { + $this->queryGenerator = \Magento\Framework\App\ObjectManager::getInstance()->create(QueryGenerator::class); + } + return $this->queryGenerator; + } + /** * Get update table query using select object for join and update * diff --git a/lib/internal/Magento/Framework/DB/Query/BatchIterator.php b/lib/internal/Magento/Framework/DB/Query/BatchIterator.php new file mode 100644 index 0000000000000..532d823e8d55a --- /dev/null +++ b/lib/internal/Magento/Framework/DB/Query/BatchIterator.php @@ -0,0 +1,170 @@ +batchSize = $batchSize; + $this->select = $select; + $this->correlationName = $correlationName; + $this->rangeField = $rangeField; + $this->rangeFieldAlias = $rangeFieldAlias; + $this->connection = $select->getConnection(); + } + + /** + * @return Select + */ + public function current() + { + return $this->currentSelect; + } + + /** + * @return Select + */ + public function next() + { + $this->iteration++; + return $this->currentSelect; + } + + /** + * @return int + */ + public function key() + { + return $this->iteration; + } + + /** + * @return bool + */ + public function valid() + { + $this->currentSelect = $this->initSelectObject(); + $batchSize = $this->calculateBatchSize($this->currentSelect); + return $batchSize > 0; + } + + /** + * @return void + */ + public function rewind() + { + $this->minValue = 0; + $this->iteration = 0; + } + + /** + * Calculate batch size for select. + * + * @param Select $select + * @return int + */ + private function calculateBatchSize(Select $select) + { + $wrapperSelect = $this->connection->select(); + $wrapperSelect->from( + $select, + [ + new \Zend_Db_Expr('MAX(' . $this->rangeFieldAlias . ') as max'), + new \Zend_Db_Expr('COUNT(*) as cnt') + ] + ); + $row = $this->connection->fetchRow($wrapperSelect); + $this->minValue = $row['max']; + return intval($row['cnt']); + } + + /** + * Initialize select object. + * + * @return \Magento\Framework\DB\Select + */ + private function initSelectObject() + { + $object = clone $this->select; + $object->where( + $this->connection->quoteIdentifier($this->correlationName) + . '.' . $this->connection->quoteIdentifier($this->rangeField) + . ' > ?', + $this->minValue + ); + $object->limit($this->batchSize); + /** + * Reset sort order section from origin select object + */ + $object->order($this->correlationName . '.' . $this->rangeField . ' asc'); + return $object; + } +} diff --git a/lib/internal/Magento/Framework/DB/Query/BatchIteratorFactory.php b/lib/internal/Magento/Framework/DB/Query/BatchIteratorFactory.php new file mode 100644 index 0000000000000..8002bfcbf5dab --- /dev/null +++ b/lib/internal/Magento/Framework/DB/Query/BatchIteratorFactory.php @@ -0,0 +1,47 @@ +objectManager = $objectManager; + $this->instanceName = $instanceName; + } + + /** + * Create class instance with specified parameters + * + * @param array $data + * @return \Magento\Framework\DB\Query\BatchIterator + */ + public function create(array $data = array()) + { + return $this->objectManager->create($this->instanceName, $data); + } +} diff --git a/lib/internal/Magento/Framework/DB/Query/Generator.php b/lib/internal/Magento/Framework/DB/Query/Generator.php new file mode 100644 index 0000000000000..45778898a4641 --- /dev/null +++ b/lib/internal/Magento/Framework/DB/Query/Generator.php @@ -0,0 +1,90 @@ +iteratorFactory = $iteratorFactory; + } + + /** + * Generate select query list with predefined items count in each select item. + * + * @param string $rangeField + * @param \Magento\Framework\DB\Select $select + * @param int $batchSize + * @return BatchIterator + * @throws LocalizedException + */ + public function generate($rangeField, \Magento\Framework\DB\Select $select, $batchSize = 100) + { + $fromSelect = $select->getPart(\Magento\Framework\DB\Select::FROM); + if (empty($fromSelect)) { + throw new LocalizedException( + new \Magento\Framework\Phrase('Select object must have correct "FROM" part') + ); + } + + $fieldCorrelationName = ''; + foreach ($fromSelect as $correlationName => $formPart) { + if ($formPart['joinType'] == \Magento\Framework\DB\Select::FROM) { + $fieldCorrelationName = $correlationName; + break; + } + } + + $columns = $select->getPart(\Magento\Framework\DB\Select::COLUMNS); + /** + * Calculate $rangeField alias + */ + $rangeFieldAlias = null; + foreach ($columns as $column) { + list($table, $columnName, $alias) = $column; + if (is_string($table) && is_string($columnName) + && $table == $fieldCorrelationName && $columnName == $rangeField + ) { + $rangeFieldAlias = $alias; + break; + } + } + + if (!$rangeFieldAlias) { + throw new LocalizedException( + new \Magento\Framework\Phrase( + 'Select object must have correct range field name %field', + ['field' => $rangeField] + ) + ); + } + + return $this->iteratorFactory->create( + [ + 'select' => $select, + 'batchSize' => $batchSize, + 'correlationName' => $fieldCorrelationName, + 'rangeField' => $rangeField, + 'rangeFieldAlias' => $rangeFieldAlias + ] + ); + } +} From 6e82b6755df962cf7654cc783296c147ac75c55e Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 24 Aug 2016 18:00:06 -0500 Subject: [PATCH 0276/3232] MAGETWO-55589: Wrong algorithm for calculation batch size on category indexing - CR changes --- .../Magento/Framework/DB/Query/BatchIterator.php | 1 + .../Framework/DB/Query/BatchIteratorFactory.php | 6 +++++- lib/internal/Magento/Framework/DB/Query/Generator.php | 10 ++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/internal/Magento/Framework/DB/Query/BatchIterator.php b/lib/internal/Magento/Framework/DB/Query/BatchIterator.php index 532d823e8d55a..86a1a73a20c52 100644 --- a/lib/internal/Magento/Framework/DB/Query/BatchIterator.php +++ b/lib/internal/Magento/Framework/DB/Query/BatchIterator.php @@ -65,6 +65,7 @@ class BatchIterator implements \Iterator * @param int $batchSize * @param string $correlationName * @param string $rangeField + * @param string $rangeFieldAlias */ public function __construct( Select $select, diff --git a/lib/internal/Magento/Framework/DB/Query/BatchIteratorFactory.php b/lib/internal/Magento/Framework/DB/Query/BatchIteratorFactory.php index 8002bfcbf5dab..a51a650197def 100644 --- a/lib/internal/Magento/Framework/DB/Query/BatchIteratorFactory.php +++ b/lib/internal/Magento/Framework/DB/Query/BatchIteratorFactory.php @@ -1,4 +1,8 @@ objectManager->create($this->instanceName, $data); } diff --git a/lib/internal/Magento/Framework/DB/Query/Generator.php b/lib/internal/Magento/Framework/DB/Query/Generator.php index 45778898a4641..1873418968bba 100644 --- a/lib/internal/Magento/Framework/DB/Query/Generator.php +++ b/lib/internal/Magento/Framework/DB/Query/Generator.php @@ -46,8 +46,8 @@ public function generate($rangeField, \Magento\Framework\DB\Select $select, $bat } $fieldCorrelationName = ''; - foreach ($fromSelect as $correlationName => $formPart) { - if ($formPart['joinType'] == \Magento\Framework\DB\Select::FROM) { + foreach ($fromSelect as $correlationName => $fromPart) { + if ($fromPart['joinType'] == \Magento\Framework\DB\Select::FROM) { $fieldCorrelationName = $correlationName; break; } @@ -60,9 +60,7 @@ public function generate($rangeField, \Magento\Framework\DB\Select $select, $bat $rangeFieldAlias = null; foreach ($columns as $column) { list($table, $columnName, $alias) = $column; - if (is_string($table) && is_string($columnName) - && $table == $fieldCorrelationName && $columnName == $rangeField - ) { + if (is_string($columnName) && $table == $fieldCorrelationName && $columnName == $rangeField) { $rangeFieldAlias = $alias; break; } @@ -71,7 +69,7 @@ public function generate($rangeField, \Magento\Framework\DB\Select $select, $bat if (!$rangeFieldAlias) { throw new LocalizedException( new \Magento\Framework\Phrase( - 'Select object must have correct range field name %field', + 'Select object must have correct range field name "%field"', ['field' => $rangeField] ) ); From 64251deaeb79a7a9bedbbf4519d2054ffe66522f Mon Sep 17 00:00:00 2001 From: Sergey Kovalenko Date: Thu, 25 Aug 2016 10:31:47 +0300 Subject: [PATCH 0277/3232] MAGETWO-56941: CLONE - CLONE - [Github] Allowed countries for customer address in admin using storeview configuration #2946 --- .../Magento/Customer/Model/CountryHandler.php | 26 ++++++++++--------- .../Customer/Model/Customer/DataProvider.php | 6 +++++ .../Attribute/Source/CountryWithWebsites.php | 6 ++++- .../Magento/Customer/Setup/UpgradeData.php | 2 +- .../Test/Unit/Model/CountryHandlerTest.php | 9 ++++--- .../Unit/Model/Customer/DataProviderTest.php | 16 ++++++++++++ .../Model/CountryHandlerInterface.php | 6 ++--- .../ResourceModel/Country/Collection.php | 2 +- .../Adminhtml/Order/Create/Form/Address.php | 2 +- .../view/base/web/js/form/element/country.js | 2 ++ 10 files changed, 54 insertions(+), 23 deletions(-) diff --git a/app/code/Magento/Customer/Model/CountryHandler.php b/app/code/Magento/Customer/Model/CountryHandler.php index 296b0e5e78607..c0519a7d22fca 100644 --- a/app/code/Magento/Customer/Model/CountryHandler.php +++ b/app/code/Magento/Customer/Model/CountryHandler.php @@ -35,6 +35,12 @@ class CountryHandler implements CountryHandlerInterface */ private $customerConfigShare; + /** + * CountryHandler constructor. + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Customer\Model\Config\Share $configShare + */ public function __construct( ScopeConfigInterface $scopeConfig, StoreManagerInterface $storeManager, @@ -46,10 +52,7 @@ public function __construct( } /** - * Retrieve allowed countries list by filter and scope - * @param null | int | array $filter - * @param string $scope - * @return array + * @inheritdoc */ public function getAllowedCountries( $filter = null, @@ -96,13 +99,14 @@ private function makeCountriesUnique(array $allowedCountries) } /** - * @param $scope - * @param $filter + * @param string $scope + * @param int $filter * @return array */ private function getCountriesFromConfig($scope, $filter) { - return explode(',', + return explode( + ',', (string) $this->scopeConfig->getValue( self::ALLOWED_COUNTRIES_PATH, $scope, @@ -112,11 +116,9 @@ private function getCountriesFromConfig($scope, $filter) } /** - * @param $filter - * @param string $scope - * @return AbstractDb + * @inheritdoc */ - public function loadByScope($filter, $scope = ScopeInterface::SCOPE_STORE, AbstractDb $collection) + public function loadByScope(AbstractDb $collection, $filter, $scope = ScopeInterface::SCOPE_STORE) { $allowCountries = $this->getAllowedCountries($filter, $scope); @@ -128,7 +130,7 @@ public function loadByScope($filter, $scope = ScopeInterface::SCOPE_STORE, Abstr } /** - * @param $scope + * @param string $scope * @return string */ private function getSingleScope($scope) diff --git a/app/code/Magento/Customer/Model/Customer/DataProvider.php b/app/code/Magento/Customer/Model/Customer/DataProvider.php index 70bc32545ad6d..f16bcf0f1e332 100644 --- a/app/code/Magento/Customer/Model/Customer/DataProvider.php +++ b/app/code/Magento/Customer/Model/Customer/DataProvider.php @@ -120,6 +120,7 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider * @param FileProcessorFactory $fileProcessorFactory * @param array $meta * @param array $data + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( $name, @@ -237,6 +238,7 @@ private function overrideFileUploaderData($entity, array &$entityData) * @param Attribute $attribute * @param array $customerData * @return array + * @SuppressWarnings(PHPMD.NPathComplexity) */ private function getFileUploaderData( Type $entityType, @@ -347,6 +349,10 @@ private function getShareConfig() return ObjectManager::getInstance()->get(\Magento\Customer\Model\Config\Share::class); } + /** + * @param array $meta + * @return void + */ private function processWebsiteMeta(&$meta) { if (isset($meta[CustomerInterface::WEBSITE_ID]) && $this->getShareConfig()->isGlobalScope()) { diff --git a/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php b/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php index 6b1b2579c3f23..844126149f6f8 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php @@ -13,6 +13,7 @@ use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Model\Customer; +use Magento\Directory\Model\CountryHandlerInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; use Magento\Store\Model\ScopeInterface; @@ -41,15 +42,18 @@ class CountryWithWebsites extends \Magento\Eav\Model\Entity\Attribute\Source\Tab private $storeManager; /** + * CountryWithWebsites constructor. * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory $attrOptionFactory * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countriesFactory + * @param \Magento\Directory\Model\CountryHandlerInterface $countryHandler + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory $attrOptionFactory, \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countriesFactory, - \Magento\Customer\Model\CountryHandler $countryHandler, + \Magento\Directory\Model\CountryHandlerInterface $countryHandler, \Magento\Store\Model\StoreManagerInterface $storeManager ) { diff --git a/app/code/Magento/Customer/Setup/UpgradeData.php b/app/code/Magento/Customer/Setup/UpgradeData.php index 574b5a1aa1738..418d76208b94e 100644 --- a/app/code/Magento/Customer/Setup/UpgradeData.php +++ b/app/code/Magento/Customer/Setup/UpgradeData.php @@ -149,7 +149,7 @@ private function getCountryHandler() /** * @param array $countries * @param array $newCountries - * @param $identifier + * @param string $identifier * @return array */ private function mergeAllowedCountries(array $countries, array $newCountries, $identifier) diff --git a/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php b/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php index 46b1418b92fb4..fba92d6ce9dc6 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php @@ -121,9 +121,10 @@ public function testGetAllowedCountriesWithoutGlobalScope() ->method('isGlobalScope') ->willReturn(true); - - $this->assertEquals(['AM' => 'AM'], - $this->countryHandler->getAllowedCountries(1, ScopeInterface::SCOPE_WEBSITE, true)); + $this->assertEquals( + ['AM' => 'AM'], + $this->countryHandler->getAllowedCountries(1, ScopeInterface::SCOPE_WEBSITE, true) + ); } public function testLoadByScope() @@ -141,6 +142,6 @@ public function testLoadByScope() ->with('country_id', ['in' => ['AM' => 'AM']]); $this->assertEquals($collectionMock, - $this->countryHandler->loadByScope(1, ScopeInterface::SCOPE_WEBSITE, $collectionMock)); + $this->countryHandler->loadByScope($collectionMock, 1, ScopeInterface::SCOPE_WEBSITE)); } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php index a56ff1eee8c68..e594432b5bd66 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php @@ -447,6 +447,10 @@ function ($origName) { return $countryAttrMock; } + /** + * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function testGetData() { $customer = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) @@ -556,6 +560,10 @@ public function testGetData() ); } + /** + * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function testGetDataWithCustomerFormData() { $customerId = 11; @@ -669,6 +677,10 @@ public function testGetDataWithCustomerFormData() $this->assertEquals([$customerId => $customerFormData], $dataProvider->getData()); } + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @return void + */ public function testGetDataWithCustomAttributeImage() { $customerId = 1; @@ -890,6 +902,10 @@ public function testGetDataWithCustomAttributeImageNoData() $this->assertEquals($expectedData, $dataProvider->getData()); } + /** + * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function testGetAttributesMetaWithCustomAttributeImage() { $maxFileSize = 1000; diff --git a/app/code/Magento/Directory/Model/CountryHandlerInterface.php b/app/code/Magento/Directory/Model/CountryHandlerInterface.php index 0a0ec3ec6be9b..dd1bc415a16ee 100644 --- a/app/code/Magento/Directory/Model/CountryHandlerInterface.php +++ b/app/code/Magento/Directory/Model/CountryHandlerInterface.php @@ -18,7 +18,7 @@ interface CountryHandlerInterface const ALLOWED_COUNTRIES_PATH = 'general/country/allow'; /** - * Retrieve all allowed in current scope countries. + * Retrieve allowed countries list by filter and scope. * @param null $filter * @param string $scope * @param bool $ignoreGlobalScope @@ -32,10 +32,10 @@ public function getAllowedCountries( /** * Filter directory collection by allowed in website countries. + * @param \Magento\Framework\Data\Collection\AbstractDb $collection * @param $filter * @param string $scope - * @param \Magento\Framework\Data\Collection\AbstractDb $collection * @return AbstractDb */ - public function loadByScope($filter, $scope = ScopeInterface::SCOPE_STORE, AbstractDb $collection); + public function loadByScope(AbstractDb $collection, $filter, $scope = ScopeInterface::SCOPE_STORE); } diff --git a/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php b/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php index 20593cb89f1dc..d5a4883cc3049 100644 --- a/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php +++ b/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php @@ -138,7 +138,7 @@ private function getCountryHandler() */ public function loadByStore($store = null) { - $this->getCountryHandler()->loadByScope($store, ScopeInterface::SCOPE_STORE, $this); + $this->getCountryHandler()->loadByScope($this, $store, ScopeInterface::SCOPE_STORE); return $this; } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php index 78690043a1eff..ec2842fae3038 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php @@ -292,7 +292,7 @@ private function processCountryOptions(\Magento\Framework\Data\Form\Element\Abst { $storeId = $this->getBackendQuoteSession()->getStoreId(); $options = $this->getCountryHandler() - ->loadByScope($storeId, ScopeInterface::SCOPE_STORE, $this->getCountriesCollection()) + ->loadByScope($this->getCountriesCollection(), $storeId, ScopeInterface::SCOPE_STORE) ->toOptionArray(); $countryElement->setValues($options); diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/country.js b/app/code/Magento/Ui/view/base/web/js/form/element/country.js index a9380d76de009..7f8830d8f0efb 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/country.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/country.js @@ -26,6 +26,7 @@ define([ */ filter: function (value, field) { var result; + if (!field) { //validate field, if we are on update field = this.filterBy.field; } @@ -33,6 +34,7 @@ define([ this._super(value, field); result = _.filter(this.initialOptions, function (item) { + if (item[field]) { return ~item[field].indexOf(value); } From 05b7831044dbc13d8f515cfef076f97536d0daa4 Mon Sep 17 00:00:00 2001 From: Rodion Savchuk Date: Thu, 25 Aug 2016 11:08:19 +0300 Subject: [PATCH 0278/3232] MTA-3515: Add dataset for updating Simple Product with custom options --- .../Test/TestCase/Product/UpdateSimpleProductEntityTest.xml | 3 --- 1 file changed, 3 deletions(-) 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 f5c1814378dea..d1e650eb005aa 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 @@ -146,7 +146,6 @@ - Update product with custom option product_with_category Test simple product %isolation% test_simple_product_%isolation% @@ -155,8 +154,6 @@ drop_down_with_one_option_percent_price simple_drop_down_with_one_option_percent_price test-simple-product-%isolation% - 120.0000 - Catalog, Search From ce8afcf0c36ce5f7ea30076250f7d4887529c910 Mon Sep 17 00:00:00 2001 From: Sergey Kovalenko Date: Thu, 25 Aug 2016 11:20:14 +0300 Subject: [PATCH 0279/3232] MAGETWO-56941: CLONE - CLONE - [Github] Allowed countries for customer address in admin using storeview configuration #2946 --- app/code/Magento/Customer/Model/CountryHandler.php | 2 +- .../Address/Attribute/Source/CountryWithWebsites.php | 3 +-- .../Customer/Test/Unit/Model/CountryHandlerTest.php | 8 +++++--- .../Magento/Directory/Model/CountryHandlerInterface.php | 4 ++-- .../Magento/Ui/view/base/web/js/form/element/country.js | 2 +- .../Magento/Ui/view/base/web/js/form/element/website.js | 2 +- .../Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.php | 1 + .../Constraint/AssertChangingWebsiteChangeCountries.php | 7 +++++-- .../Test/TestCase/CreateCustomerBackendEntityTest.php | 9 +++------ 9 files changed, 20 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/Customer/Model/CountryHandler.php b/app/code/Magento/Customer/Model/CountryHandler.php index c0519a7d22fca..1139157ab5bab 100644 --- a/app/code/Magento/Customer/Model/CountryHandler.php +++ b/app/code/Magento/Customer/Model/CountryHandler.php @@ -65,7 +65,7 @@ public function getAllowedCountries( if ($this->customerConfigShare->isGlobalScope() && !$ignoreGlobalScope) { //Check if we have shared accounts - than merge all website allowed countries - $filter = array_map(function(WebsiteInterface $website) { + $filter = array_map(function (WebsiteInterface $website) { return $website->getId(); }, $this->storeManager->getWebsites()); $scope = ScopeInterface::SCOPE_WEBSITES; diff --git a/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php b/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php index 844126149f6f8..816bc523c0c41 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php @@ -55,8 +55,7 @@ public function __construct( \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countriesFactory, \Magento\Directory\Model\CountryHandlerInterface $countryHandler, \Magento\Store\Model\StoreManagerInterface $storeManager - ) - { + ) { $this->countriesFactory = $countriesFactory; $this->countryHandler = $countryHandler; $this->storeManager = $storeManager; diff --git a/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php b/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php index fba92d6ce9dc6..f23f1e9ea45d7 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Directory\Test\Unit\Model; +namespace Magento\Customer\Test\Unit\Model; use Magento\Customer\Model\Config\Share; use Magento\Customer\Model\CountryHandler; @@ -141,7 +141,9 @@ public function testLoadByScope() ->method('addFieldToFilter') ->with('country_id', ['in' => ['AM' => 'AM']]); - $this->assertEquals($collectionMock, - $this->countryHandler->loadByScope($collectionMock, 1, ScopeInterface::SCOPE_WEBSITE)); + $this->assertEquals( + $collectionMock, + $this->countryHandler->loadByScope($collectionMock, 1, ScopeInterface::SCOPE_WEBSITE) + ); } } diff --git a/app/code/Magento/Directory/Model/CountryHandlerInterface.php b/app/code/Magento/Directory/Model/CountryHandlerInterface.php index dd1bc415a16ee..1b8759d824b16 100644 --- a/app/code/Magento/Directory/Model/CountryHandlerInterface.php +++ b/app/code/Magento/Directory/Model/CountryHandlerInterface.php @@ -19,7 +19,7 @@ interface CountryHandlerInterface /** * Retrieve allowed countries list by filter and scope. - * @param null $filter + * @param int | null $filter * @param string $scope * @param bool $ignoreGlobalScope * @return array @@ -33,7 +33,7 @@ public function getAllowedCountries( /** * Filter directory collection by allowed in website countries. * @param \Magento\Framework\Data\Collection\AbstractDb $collection - * @param $filter + * @param int $filter * @param string $scope * @return AbstractDb */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/country.js b/app/code/Magento/Ui/view/base/web/js/form/element/country.js index 7f8830d8f0efb..8615e990296bc 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/country.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/country.js @@ -33,7 +33,7 @@ define([ this._super(value, field); - result = _.filter(this.initialOptions, function (item) { + result = _.filter(this.initialOptions, function (item) { if (item[field]) { return ~item[field].indexOf(value); diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/website.js b/app/code/Magento/Ui/view/base/web/js/form/element/website.js index 9ba9f4de3b0ed..d34008b3326f5 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/website.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/website.js @@ -23,7 +23,7 @@ define([ initialize: function () { this._super(); - if (this.customerId || this.isGlobalScope) { //disable element if customer exists + if (this.customerId || this.isGlobalScope) {//disable element if customer exists this.disable(true); } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.php index e95e29cce0404..2a8ecbf80c416 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/Tab/Addresses.php @@ -20,6 +20,7 @@ /** * Customer addresses edit block. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Addresses extends Tab { diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertChangingWebsiteChangeCountries.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertChangingWebsiteChangeCountries.php index f6e477592d105..395dac1326dc3 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertChangingWebsiteChangeCountries.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertChangingWebsiteChangeCountries.php @@ -22,8 +22,11 @@ class AssertChangingWebsiteChangeCountries extends AbstractConstraint * @param array $expectedRequiredFields * @return void */ - public function processAssert(CustomerIndexNew $customerIndexNew, Customer $customer, \Magento\Customer\Test\Fixture\Address $address, $expectedList) - { + public function processAssert( + CustomerIndexNew $customerIndexNew, + Customer $customer, + $expectedList + ) { $customerIndexNew->getCustomerForm() ->openTab('account_information'); $customerIndexNew->getCustomerForm()->fillCustomer($customer); 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 3e383866e2107..f9a9516c78497 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 @@ -48,7 +48,6 @@ class CreateCustomerBackendEntityTest extends Injectable */ private $address; - /** @var array */ private $allowedCountriesData = []; @@ -100,7 +99,7 @@ public function test( Address $address = null, array $steps = [], array $beforeActionCallback = [] - ) { + ) { ///Process initialize steps foreach ($steps as $methodName => $stepData) { if (method_exists($this, $methodName)) { @@ -127,7 +126,7 @@ public function test( * Assert that allowed countries renders in correct way. * @return void */ - private function assertAllowedCountries() + protected function assertAllowedCountries() { /** @var \Magento\Customer\Test\Constraint\AssertChangingWebsiteChangeCountries $assert */ $assert = $this->objectManager->get( @@ -146,7 +145,6 @@ private function assertAllowedCountries() $assert->processAssert( $this->pageCustomerIndexNew, $customerWithWebsite, - $this->address, $dataPerWebsite['countries'] ); } @@ -200,11 +198,10 @@ private function createWebsiteFixture() return $websiteFixture; } - /** * @param array $countryList */ - private function configureAllowedCountries(array $countryList = []) + protected function configureAllowedCountries(array $countryList = []) { foreach ($countryList as $countries) { $websiteFixture = $this->createWebsiteFixture(); From 15b1b30f373ef00e6fc145b99b3de54a1094b720 Mon Sep 17 00:00:00 2001 From: Sergey Kovalenko Date: Thu, 25 Aug 2016 11:42:46 +0300 Subject: [PATCH 0280/3232] MAGETWO-56941: CLONE - CLONE - [Github] Allowed countries for customer address in admin using storeview configuration #2946 --- .../Magento/Customer/Test/Unit/Model/CountryHandlerTest.php | 2 +- app/code/Magento/Ui/view/base/web/js/form/element/country.js | 3 +-- app/code/Magento/Ui/view/base/web/js/form/element/website.js | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php b/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php index f23f1e9ea45d7..4a32d4aff582a 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/CountryHandlerTest.php @@ -15,7 +15,7 @@ use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\StoreManagerInterface; -class CountryHandlerInterfaceTest extends \PHPUnit_Framework_TestCase +class CountryHandlerTest extends \PHPUnit_Framework_TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject | ScopeConfigInterface diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/country.js b/app/code/Magento/Ui/view/base/web/js/form/element/country.js index 8615e990296bc..85798cad31143 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/country.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/country.js @@ -32,8 +32,7 @@ define([ } this._super(value, field); - - result = _.filter(this.initialOptions, function (item) { + result = _.filter(this.initialOptions, function (item) { if (item[field]) { return ~item[field].indexOf(value); diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/website.js b/app/code/Magento/Ui/view/base/web/js/form/element/website.js index d34008b3326f5..c83046ef87346 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/website.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/website.js @@ -22,8 +22,8 @@ define([ */ initialize: function () { this._super(); - - if (this.customerId || this.isGlobalScope) {//disable element if customer exists + + if (this.customerId || this.isGlobalScope) { this.disable(true); } From 72d76280f7af27d3a037e4fcce01c2bd6208f901 Mon Sep 17 00:00:00 2001 From: Sergey Kovalenko Date: Thu, 25 Aug 2016 11:45:48 +0300 Subject: [PATCH 0281/3232] MAGETWO-56941: CLONE - CLONE - [Github] Allowed countries for customer address in admin using storeview configuration #2946 --- app/code/Magento/Ui/view/base/web/js/form/element/website.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/website.js b/app/code/Magento/Ui/view/base/web/js/form/element/website.js index c83046ef87346..095e2c4740305 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/website.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/website.js @@ -31,4 +31,3 @@ define([ } }); }); - From 79d2f4646aa7c1d3361c07b62c56c82e8dd3d131 Mon Sep 17 00:00:00 2001 From: Sergey Kovalenko Date: Thu, 25 Aug 2016 12:02:55 +0300 Subject: [PATCH 0282/3232] MAGETWO-56941: CLONE - CLONE - [Github] Allowed countries for customer address in admin using storeview configuration #2946 --- app/code/Magento/Ui/view/base/web/js/form/element/country.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/country.js b/app/code/Magento/Ui/view/base/web/js/form/element/country.js index 85798cad31143..c72d02c595bb8 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/country.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/country.js @@ -33,7 +33,7 @@ define([ this._super(value, field); result = _.filter(this.initialOptions, function (item) { - + if (item[field]) { return ~item[field].indexOf(value); } From 2833639b6d2629817ed2fd8a6072009f9b27b495 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 25 Aug 2016 12:54:00 +0300 Subject: [PATCH 0283/3232] MAGETWO-56819: Notification messages area. Pull request preparation. --- .../view/adminhtml/web/js/grid/columns/message.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/columns/message.js b/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/columns/message.js index dc80d136bb491..aa5477ebafcf0 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/columns/message.js +++ b/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/columns/message.js @@ -20,9 +20,9 @@ define([ 'message-error': false }, statusMap: { - 0: 'success', + 0: 'info', 1: 'progress', - 2: 'info', + 2: 'success', 3: 'error' } }, From f5a60e9a3bff1bae1d9b24ac225b566dca1117b2 Mon Sep 17 00:00:00 2001 From: Maksym Aposov Date: Thu, 25 Aug 2016 12:49:10 +0300 Subject: [PATCH 0284/3232] MAGETWO-54458: Scope selector on product page does not display all related websites for restricted user --- .../Magento/Backend/Block/Store/Switcher.php | 2 - .../Test/Unit/Block/Store/SwitcherTest.php | 53 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php diff --git a/app/code/Magento/Backend/Block/Store/Switcher.php b/app/code/Magento/Backend/Block/Store/Switcher.php index eb113e45c45d6..cd15704952b23 100644 --- a/app/code/Magento/Backend/Block/Store/Switcher.php +++ b/app/code/Magento/Backend/Block/Store/Switcher.php @@ -8,8 +8,6 @@ /** * Store switcher block - * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Switcher extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php b/app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php new file mode 100644 index 0000000000000..e0229d54ba233 --- /dev/null +++ b/app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php @@ -0,0 +1,53 @@ +storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class); + $objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $context = $objectHelper->getObject( + \Magento\Backend\Block\Template\Context::class, + [ + 'storeManager' => $this->storeManagerMock, + ] + ); + + $this->switcherBlock = $objectHelper->getObject( + \Magento\Backend\Block\Store\Switcher::class, + ['context' => $context] + ); + } + + public function testGetWebsites() + { + $websiteMock = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false); + $websites = [0 => $websiteMock, 1 => $websiteMock]; + $this->storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($websites)); + $this->assertEquals($websites, $this->switcherBlock->getWebsites()); + } + + public function testGetWebsitesIfSetWebsiteIds() + { + $websiteMock = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false); + $websites = [0 => $websiteMock, 1 => $websiteMock]; + $this->storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($websites)); + + $this->switcherBlock->setWebsiteIds([1]); + $expected = [1 => $websiteMock]; + $this->assertEquals($expected, $this->switcherBlock->getWebsites()); + } +} From e8376bfb9432c34c8ef70a24824b524414ab99e5 Mon Sep 17 00:00:00 2001 From: Maksym Aposov Date: Thu, 25 Aug 2016 14:39:36 +0300 Subject: [PATCH 0285/3232] MAGETWO-54458: Scope selector on product page does not display all related websites for restricted user --- app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php b/app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php index e0229d54ba233..a4ba16ea1bdaa 100644 --- a/app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php +++ b/app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Backend\Test\Unit\Block\Cache; +namespace Magento\Backend\Test\Unit\Block\Store; class SwitcherTest extends \PHPUnit_Framework_TestCase { From ddb1eea3d3db5664578bb85c739373b292226ad6 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Thu, 25 Aug 2016 14:54:41 +0300 Subject: [PATCH 0286/3232] MAGETWO-55757: Magento 2 does not work on Apache php-fpm environment --- .htaccess | 24 ++++++++++++++++++++++++ pub/.htaccess | 26 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/.htaccess b/.htaccess index f3dbe217081ac..af9470488c632 100644 --- a/.htaccess +++ b/.htaccess @@ -32,6 +32,7 @@ DirectoryIndex index.php + ############################################ ## adjust memory limit @@ -53,7 +54,30 @@ ## disable user agent verification to not break multiple image upload php_flag suhosin.session.cryptua off + + +############################################ +## adjust memory limit + + php_value memory_limit 768M + php_value max_execution_time 18000 + +############################################ +## disable automatic session start +## before autoload was initialized + + php_flag session.auto_start off + +############################################ +## enable resulting html compression + + #php_flag zlib.output_compression on +########################################### +## disable user agent verification to not break multiple image upload + + php_flag suhosin.session.cryptua off + ########################################### ## disable POST processing to not break multiple image upload diff --git a/pub/.htaccess b/pub/.htaccess index a8fc2ccf222db..ecdaf1758a92a 100644 --- a/pub/.htaccess +++ b/pub/.htaccess @@ -32,6 +32,7 @@ DirectoryIndex index.php + ############################################ ## Adjust memory limit @@ -53,6 +54,31 @@ # Disable user agent verification to not break multiple image upload php_flag suhosin.session.cryptua off + + +############################################ +## Adjust memory limit + + php_value memory_limit 768M + php_value max_execution_time 18000 + +############################################ +## Disable automatic session start +## before autoload was initialized + + php_flag session.auto_start off + +############################################ +## Enable resulting html compression + + #php_flag zlib.output_compression on + +########################################### +# Disable user agent verification to not break multiple image upload + + php_flag suhosin.session.cryptua off + + ########################################### From de9c3b8f761cc6e50f971bf75a3514e72d460f9f Mon Sep 17 00:00:00 2001 From: Yaroslav Onischenko Date: Thu, 25 Aug 2016 14:57:21 +0300 Subject: [PATCH 0287/3232] MAGETWO-55908: Prepare PR --- .../Adminhtml/Order/Create/Form/AbstractForm.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php index 6287af52bb889..45d120db4755b 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractForm.php @@ -194,12 +194,17 @@ protected function _addAttributesToForm($attributes, \Magento\Framework\Data\For if ($inputType == 'select' || $inputType == 'multiselect') { $options = []; foreach ($attribute->getOptions() as $optionData) { - $options[] = ConvertArray::toFlatArray( - $this->dataObjectProcessor->buildOutputDataArray( - $optionData, - \Magento\Customer\Api\Data\OptionInterface::class - ) + $data = $this->dataObjectProcessor->buildOutputDataArray( + $optionData, + \Magento\Customer\Api\Data\OptionInterface::class ); + foreach ($data as $key => $value) { + if (is_array($value)) { + unset($data[$key]); + $data['value'] = $value; + } + } + $options[] = $data; } $element->setValues($options); } elseif ($inputType == 'date') { From fa7261c8a525e7bdc97ab4f674178eed1d56a0a5 Mon Sep 17 00:00:00 2001 From: Ostap Smolyar Date: Thu, 25 Aug 2016 15:20:07 +0300 Subject: [PATCH 0288/3232] MTA-3451: Update dataset for CreateBundleProductEntityTest with Special price --- .../Constraint/AssertBundleProductPage.php | 24 +++++++++++++++++++ .../CreateBundleProductEntityTest.xml | 6 ++--- .../Test/TestCase/OnePageCheckoutTest.xml | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) 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 704404e665ac1..9a7dda18f7d04 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 @@ -46,4 +46,28 @@ protected function verifyPrice() return empty($errors) ? null : implode("\n", $errors); } + + /** + * Verify product special price is displayed on product page(front-end). + * + * @return string|null + */ + protected function verifySpecialPrice() + { + if (!$this->product->hasData('special_price')) { + return null; + } + + $priceBlock = $this->productView->getPriceBlock(); + + if (!$priceBlock->isVisible()) { + return "Price block for '{$this->product->getName()}' product' is not visible."; + } + + if (!$priceBlock->isOldPriceVisible()) { + return 'Bundle special price is not set.'; + } + + return null; + } } 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 be0c92fd3204c..7ce0467563bf9 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 @@ -347,7 +347,7 @@ bundle_fixed_100_dollar drop_down_with_one_option_fixed_price - + bundle-product-%isolation% @@ -361,7 +361,7 @@ catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar bundle_default - + bundle-product-%isolation% @@ -373,7 +373,7 @@ dynamic-two-special bundle_default - + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml index 63e232f3dac72..6a1f225bc9429 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml @@ -47,7 +47,7 @@ - + catalogProductSimple::default default guest From b585b7aa33d6fe4218f00700065c5808dba3c5c2 Mon Sep 17 00:00:00 2001 From: Ostap Smolyar Date: Thu, 25 Aug 2016 15:22:26 +0300 Subject: [PATCH 0289/3232] MTA-3451: Update dataset for CreateBundleProductEntityTest with Special price --- .../Bundle/Test/TestCase/CreateBundleProductEntityTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7ce0467563bf9..c019a07d2dea0 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 @@ -363,7 +363,7 @@ - + bundle-product-%isolation% Bundle Dynamic %isolation% Yes From a7cfa3ff97083249741d11e6db68010b4c6acd74 Mon Sep 17 00:00:00 2001 From: Sergey Kovalenko Date: Thu, 25 Aug 2016 15:31:52 +0300 Subject: [PATCH 0290/3232] MAGETWO-57205: CLONE - CLONE - Attribute for Send Welcome Email From shows wrong store ID --- .../Magento/Customer/view/base/ui_component/customer_form.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml index 41ffb74184bad..fdb9c3f317a4c 100644 --- a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml +++ b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml @@ -256,6 +256,10 @@ Send Welcome Email From number select + customer + + ${ $.provider }:data.customer.store_id + From 81031ad7a640344a8872b1c4172a4bcd193e2d92 Mon Sep 17 00:00:00 2001 From: Yaroslav Onischenko Date: Thu, 25 Aug 2016 15:51:49 +0300 Subject: [PATCH 0291/3232] MAGETWO-55908: Prepare PR --- app/code/Magento/Catalog/etc/extension_attributes.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/etc/extension_attributes.xml b/app/code/Magento/Catalog/etc/extension_attributes.xml index e333c13bcc61d..509c3240bb6c8 100644 --- a/app/code/Magento/Catalog/etc/extension_attributes.xml +++ b/app/code/Magento/Catalog/etc/extension_attributes.xml @@ -13,6 +13,9 @@ + + + From 4b2a9d1ec90e20f977562a24b244b157b706333b Mon Sep 17 00:00:00 2001 From: Joan He Date: Thu, 25 Aug 2016 07:55:06 -0500 Subject: [PATCH 0292/3232] MAGETWO-57234: Eliminate @escapeNotVerified in Customer Module --- .../Block/Account/AuthenticationPopup.php | 8 ++++---- .../templates/system/config/validatevat.phtml | 6 +++--- .../view/adminhtml/templates/tab/cart.phtml | 16 ++++++++-------- .../templates/account/authentication-popup.phtml | 2 +- .../view/frontend/templates/address/book.phtml | 4 ++-- .../view/frontend/templates/address/edit.phtml | 6 +++--- .../view/frontend/templates/form/register.phtml | 6 +++--- .../view/frontend/templates/logout.phtml | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/Customer/Block/Account/AuthenticationPopup.php b/app/code/Magento/Customer/Block/Account/AuthenticationPopup.php index 5eb4f7fe055e0..e09b528e9d4f6 100644 --- a/app/code/Magento/Customer/Block/Account/AuthenticationPopup.php +++ b/app/code/Magento/Customer/Block/Account/AuthenticationPopup.php @@ -43,10 +43,10 @@ public function getJsLayout() public function getConfig() { return [ - 'autocomplete' => $this->isAutocompleteEnabled(), - 'customerRegisterUrl' => $this->getCustomerRegisterUrlUrl(), - 'customerForgotPasswordUrl' => $this->getCustomerForgotPasswordUrl(), - 'baseUrl' => $this->getBaseUrl() + 'autocomplete' => $this->escapeHtml($this->isAutocompleteEnabled()), + 'customerRegisterUrl' => $this->escapeUrl($this->getCustomerRegisterUrlUrl()), + 'customerForgotPasswordUrl' => $this->escapeUrl($this->getCustomerForgotPasswordUrl()), + 'baseUrl' => $this->escapeUrl($this->getBaseUrl()) ]; } diff --git a/app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml b/app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml index 77cc24e1b8750..18f843d65661a 100644 --- a/app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml +++ b/app/code/Magento/Customer/view/adminhtml/templates/system/config/validatevat.phtml @@ -16,11 +16,11 @@ require(['prototype'], function(){ var validationMessage = $('validation_result'); params = { - country: $('escapeJs($block->getMerchantCountryField()); ?>').value, - vat: $('escapeJs($block->getMerchantVatNumberField()); ?>').value + country: $('escapeJs($block->escapeHtml($block->getMerchantCountryField())); ?>').value, + vat: $('escapeJs($block->escapeHtml($block->getMerchantVatNumberField())); ?>').value }; - new Ajax.Request('escapeUrl($block->getAjaxUrl()) ?>', { + new Ajax.Request('escapeJs($block->escapeUrl($block->getAjaxUrl())) ?>', { parameters: params, onSuccess: function(response) { var result = 'escapeJs($block->escapeHtml(__('Error during VAT Number verification.'))) ?>'; diff --git a/app/code/Magento/Customer/view/adminhtml/templates/tab/cart.phtml b/app/code/Magento/Customer/view/adminhtml/templates/tab/cart.phtml index f8ca555c2ada6..c11ea7aa3bc5c 100644 --- a/app/code/Magento/Customer/view/adminhtml/templates/tab/cart.phtml +++ b/app/code/Magento/Customer/view/adminhtml/templates/tab/cart.phtml @@ -34,14 +34,14 @@ require([ if (!params) { params = {}; } - escapeJs($block->getJsObjectName()) ?>.reloadParams = params; - escapeJs($block->getJsObjectName()) ?>.reload(); - escapeJs($block->getJsObjectName()) ?>.reloadParams = {}; + escapeJs($block->escapeHtml($block->getJsObjectName())) ?>.reloadParams = params; + escapeJs($block->escapeHtml($block->getJsObjectName())) ?>.reload(); + escapeJs($block->escapeHtml($block->getJsObjectName())) ?>.reloadParams = {}; }, configureItem: function (itemId) { - productConfigure.setOnLoadIFrameCallback('escapeJs($listType) ?>', this.cbOnLoadIframe.bind(this)); - productConfigure.showItemConfiguration('escapeJs($listType) ?>', itemId); + productConfigure.setOnLoadIFrameCallback('escapeJs($block->escapeHtml($listType)) ?>', this.cbOnLoadIframe.bind(this)); + productConfigure.showItemConfiguration('escapeJs($block->escapeHtml($listType)) ?>', itemId); return false; }, @@ -81,10 +81,10 @@ $params = [ ]; ?> productConfigure.addListType( - 'escapeJs($listType) ?>', + 'escapeJs($block->escapeHtml($listType)) ?>', { - urlFetch: 'escapeUrl($block->getUrl('customer/cart_product_composite_cart/configure', $params)) ?>', - urlConfirm: 'escapeUrl($block->getUrl('customer/cart_product_composite_cart/update', $params)) ?>' + urlFetch: 'escapeJs($block->escapeUrl($block->getUrl('customer/cart_product_composite_cart/configure', $params))) ?>', + urlConfirm: 'escapeJs($block->escapeUrl($block->getUrl('customer/cart_product_composite_cart/update', $params))) ?>' } ); diff --git a/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml b/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml index 2b62b1f6fb7aa..f34cc41344ebd 100644 --- a/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml @@ -19,7 +19,7 @@ "Magento_Ui/js/core/app": getJsLayout();?> }, "*": { - "Magento_Ui/js/block-loader": "escapeUrl($block->getViewFileUrl('images/loader-1.gif')); ?>" + "Magento_Ui/js/block-loader": "escapeJs($block->escapeUrl($block->getViewFileUrl('images/loader-1.gif'))); ?>" } } diff --git a/app/code/Magento/Customer/view/frontend/templates/address/book.phtml b/app/code/Magento/Customer/view/frontend/templates/address/book.phtml index fe45a6132b0d0..37ab2584c84d9 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/book.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/book.phtml @@ -99,9 +99,9 @@ ".page-main": { "address": { "deleteAddress": "li.item a[role='delete-address']", - "deleteUrlPrefix": "escapeUrl($block->getDeleteUrl()) ?>id/", + "deleteUrlPrefix": "escapeJs($block->escapeUrl($block->getDeleteUrl())) ?>id/", "addAddress": "button[role='add-address']", - "addAddressLocation": "escapeUrl($block->getAddAddressUrl()) ?>" + "addAddressLocation": "escapeJs($block->escapeUrl($block->getAddAddressUrl())) ?>" } } } diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 15986ca8a6c29..f721db9a39c84 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -212,9 +212,9 @@ "regionInputId": "#region", "postcodeId": "#zip", "form": "#form-validate", - "regionJson": helper('Magento\Directory\Helper\Data')->getRegionJson() ?>, - "defaultRegion": "escapeJs($block->getRegionId()) ?>", - "countriesWithOptionalZip": helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?> + "regionJson": helper(\Magento\Directory\Helper\Data::class)->getRegionJson() ?>, + "defaultRegion": "escapeJs($block->escapeHtml($block->getRegionId())) ?>", + "countriesWithOptionalZip": helper(\Magento\Directory\Helper\Data::class)->getCountriesWithOptionalZip(true) ?> } } } diff --git a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml index 892179e738a7d..fb51e056d161a 100644 --- a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml @@ -209,9 +209,9 @@ require([ "regionInputId": "#region", "postcodeId": "#zip", "form": "#form-validate", - "regionJson": helper('Magento\Directory\Helper\Data')->getRegionJson() ?>, - "defaultRegion": "escapeJs($block->getFormData()->getRegionId()) ?>", - "countriesWithOptionalZip": helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?> + "regionJson": helper(\Magento\Directory\Helper\Data::class)->getRegionJson() ?>, + "defaultRegion": "escapeJs($block->escapeHtml($block->getFormData()->getRegionId())) ?>", + "countriesWithOptionalZip": helper(\Magento\Directory\Helper\Data::class)->getCountriesWithOptionalZip(true) ?> } } } diff --git a/app/code/Magento/Customer/view/frontend/templates/logout.phtml b/app/code/Magento/Customer/view/frontend/templates/logout.phtml index 4233fd9528741..c866a0d091fc0 100644 --- a/app/code/Magento/Customer/view/frontend/templates/logout.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/logout.phtml @@ -13,7 +13,7 @@ require([ "mage/mage" ], function($){ - $($.mage.redirect("escapeUrl($block->getUrl()) ?>", "assign", 5000)); + $($.mage.redirect("escapeJs($block->escapeUrl($block->getUrl())) ?>", "assign", 5000)); }); From 8f99fd85280df6916ccefc79254813fbf61f13a2 Mon Sep 17 00:00:00 2001 From: Ostap Smolyar Date: Thu, 25 Aug 2016 16:03:51 +0300 Subject: [PATCH 0293/3232] MTA-3244: Setup: Extend existing functional automated tests --- .../lib/Magento/Mtf/Util/Command/Cli/Setup.php | 8 ++++---- .../tests/app/Magento/Install/Test/Block/Landing.php | 10 +++++----- .../app/Magento/Install/Test/TestCase/InstallTest.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Setup.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Setup.php index ee88035017037..ceb84eb46acc9 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Setup.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Setup.php @@ -9,24 +9,24 @@ use Magento\Mtf\Util\Command\Cli; /** - * Setup magento for tests executions. + * Setup Magento for tests executions. */ class Setup extends Cli { /** - * Parameter for uninstall magento command. + * Parameter for uninstall Magento command. */ const PARAM_SETUP_UNINSTALL = 'setup:uninstall'; /** - * Options for uninstall magento command. + * Options for uninstall Magento command. * * @var array */ private $options = ['-n']; /** - * Uninstall magento. + * Uninstall Magento. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/Install/Test/Block/Landing.php b/dev/tests/functional/tests/app/Magento/Install/Test/Block/Landing.php index 26f736e854061..08a9d94b4054a 100644 --- a/dev/tests/functional/tests/app/Magento/Install/Test/Block/Landing.php +++ b/dev/tests/functional/tests/app/Magento/Install/Test/Block/Landing.php @@ -15,11 +15,11 @@ class Landing extends Block { /** - * Developer Documentation link. + * Link by text. * * @var string */ - protected $devdocsLink = '//a[text()="%s"]'; + protected $linkSelector = '//a[text()="%s"]'; /** * 'Agree and Set up Magento' button. @@ -55,13 +55,13 @@ public function clickTermsAndAgreement() $this->_rootElement->find($this->termsAndAgreement, Locator::SELECTOR_CSS)->click(); } /** - * Click on Developer Documentation link. + * Click on link. * * @param string $text * @return void */ - public function clickDevdocsLink($text) + public function clickLink($text) { - $this->_rootElement->find(sprintf($this->devdocsLink, $text), Locator::SELECTOR_XPATH)->click(); + $this->_rootElement->find(sprintf($this->linkSelector, $text), Locator::SELECTOR_XPATH)->click(); } } diff --git a/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php b/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php index cf615ae1ba9a7..3ff0030a7375c 100644 --- a/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php +++ b/dev/tests/functional/tests/app/Magento/Install/Test/TestCase/InstallTest.php @@ -136,7 +136,7 @@ public function test( // Steps $this->installPage->open(); // Verify Developer Documentation link. - $this->installPage->getLandingBlock()->clickDevdocsLink(self::DEVDOCS_LINK_TEXT); + $this->installPage->getLandingBlock()->clickLink(self::DEVDOCS_LINK_TEXT); $browser->selectWindow(); $assertDevdocsLink->processAssert($this->devdocsInstallPage); $browser->closeWindow(); From 87ee82fe971cf3d8bac644d8032662564d7e1670 Mon Sep 17 00:00:00 2001 From: Joan He Date: Thu, 25 Aug 2016 08:09:32 -0500 Subject: [PATCH 0294/3232] MAGETWO-57233: Eliminate @escapeNotVerified in Captcha, Contact, Cookie, Persistent, Rss, Sendfriend Module --- .../Magento/Captcha/view/adminhtml/templates/default.phtml | 2 +- app/code/Magento/Cookie/Block/RequireCookie.php | 5 ++++- app/code/Magento/Cookie/Helper/Cookie.php | 2 +- .../Cookie/view/frontend/templates/html/notices.phtml | 2 +- .../Magento/SendFriend/view/frontend/templates/send.phtml | 6 +++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml b/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml index 2972080063c0d..1246f1f4f5df5 100644 --- a/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml +++ b/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml @@ -45,7 +45,7 @@ $captcha = $block->getCaptchaModel(); require(["prototype", "mage/captcha"], function(){ //escapeUrl($block->getRefreshUrl()) ?>', 'escapeJs($block->getFormId()) ?>'); + var captcha = new Captcha('escapeJs($block->escapeUrl($block->getRefreshUrl())) ?>', 'escapeJs($block->escapeHtml($block->getFormId())) ?>'); $('captcha-reload').observe('click', function () { captcha.refresh(this); diff --git a/app/code/Magento/Cookie/Block/RequireCookie.php b/app/code/Magento/Cookie/Block/RequireCookie.php index 94e457f4cff15..befecd2cf63af 100644 --- a/app/code/Magento/Cookie/Block/RequireCookie.php +++ b/app/code/Magento/Cookie/Block/RequireCookie.php @@ -18,7 +18,10 @@ class RequireCookie extends \Magento\Framework\View\Element\Template */ public function getScriptOptions() { - $params = ['noCookieUrl' => $this->getUrl('cookie/index/noCookies/'), 'triggers' => $this->getTriggers()]; + $params = [ + 'noCookieUrl' => $this->escapeUrl($this->getUrl('cookie/index/noCookies/')), + 'triggers' => $this->escapeHtml($this->getTriggers()) + ]; return json_encode($params); } } diff --git a/app/code/Magento/Cookie/Helper/Cookie.php b/app/code/Magento/Cookie/Helper/Cookie.php index e381162c887cf..8416165f8c75c 100644 --- a/app/code/Magento/Cookie/Helper/Cookie.php +++ b/app/code/Magento/Cookie/Helper/Cookie.php @@ -84,7 +84,7 @@ public function isUserNotAllowSaveCookie() public function getAcceptedSaveCookiesWebsiteIds() { $acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites(); - $acceptedSaveCookiesWebsites[$this->_website->getId()] = 1; + $acceptedSaveCookiesWebsites[(int)$this->_website->getId()] = 1; return json_encode($acceptedSaveCookiesWebsites); } diff --git a/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml index d34214a3f7b27..e8e6d932950d7 100644 --- a/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml +++ b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml @@ -30,7 +30,7 @@ "cookieName": "", "cookieValue": helper(\Magento\Cookie\Helper\Cookie::class)->getAcceptedSaveCookiesWebsiteIds() ?>, "cookieLifetime": helper(\Magento\Cookie\Helper\Cookie::class)->getCookieRestrictionLifetime()?>, - "noCookiesUrl": "escapeUrl($block->getUrl('cookie/index/noCookies')) ?>" + "noCookiesUrl": "escapeJs($block->escapeUrl($block->getUrl('cookie/index/noCookies'))) ?>" } } } diff --git a/app/code/Magento/SendFriend/view/frontend/templates/send.phtml b/app/code/Magento/SendFriend/view/frontend/templates/send.phtml index 4f52f5026bbe2..689027189075c 100644 --- a/app/code/Magento/SendFriend/view/frontend/templates/send.phtml +++ b/app/code/Magento/SendFriend/view/frontend/templates/send.phtml @@ -17,13 +17,13 @@
- +
@@ -31,7 +31,7 @@
escapeHtml(__('IP Address')) ?>escapeHtml(__('Time of session start')) ?>
getFormattedIp() ?>formatDateTime($item->getCreatedAt()) ?>escapeHtml($item->getFormattedIp()) ?>escapeHtml($block->formatDateTime($item->getCreatedAt())) ?>
diff --git a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml index 9228e800f34f2..a9ed1acb6cde6 100644 --- a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml +++ b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml @@ -11,7 +11,9 @@ $stores = $block->getStoresSortedBySortOrder(); ?>
- escapeHtml( __('Manage Swatch (Values of Your Attribute)')); ?> + + escapeHtml( __('Manage Swatch (Values of Your Attribute)')); ?> +
From df177be8fecda61b86d7c32045f4e732ab52138c Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 26 Aug 2016 08:43:54 -0500 Subject: [PATCH 0320/3232] MAGETWO-57233: Eliminate @escapeNotVerified in Captcha, Contact, Cookie, Persistent, Rss, Sendfriend Module --- .../Magento/Cookie/view/frontend/templates/html/notices.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml index e8e6d932950d7..d34214a3f7b27 100644 --- a/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml +++ b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml @@ -30,7 +30,7 @@ "cookieName": "", "cookieValue": helper(\Magento\Cookie\Helper\Cookie::class)->getAcceptedSaveCookiesWebsiteIds() ?>, "cookieLifetime": helper(\Magento\Cookie\Helper\Cookie::class)->getCookieRestrictionLifetime()?>, - "noCookiesUrl": "escapeJs($block->escapeUrl($block->getUrl('cookie/index/noCookies'))) ?>" + "noCookiesUrl": "escapeUrl($block->getUrl('cookie/index/noCookies')) ?>" } } } From 582fc2dc8508d9ecad5480da4c80b525dc7f3b6f Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 26 Aug 2016 08:44:07 -0500 Subject: [PATCH 0321/3232] MAGETWO-57237: Eliminate @escapeNotVerified in Review Module --- app/code/Magento/Review/view/frontend/templates/review.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Review/view/frontend/templates/review.phtml b/app/code/Magento/Review/view/frontend/templates/review.phtml index c3f64511b1512..a7459ca7e1b42 100644 --- a/app/code/Magento/Review/view/frontend/templates/review.phtml +++ b/app/code/Magento/Review/view/frontend/templates/review.phtml @@ -13,7 +13,7 @@ { "*": { "Magento_Review/js/process-reviews": { - "productReviewUrl": "escapeJs($block->escapeUrl($block->getProductReviewUrl())); ?>" + "productReviewUrl": "escapeUrl($block->getProductReviewUrl()); ?>" } } } From aa6a0b0bcace47c6eb9b9a24984ad08d80042b10 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Fri, 26 Aug 2016 16:50:40 +0300 Subject: [PATCH 0322/3232] MAGETWO-52660: Improve performance of static assets deployment - MAGETWO-54954: Quick copy static files for non-changed language --- .../Command/DeployStaticContentCommand.php | 66 ++- .../Command/DeployStaticOptionsInterface.php | 5 + .../Deploy/Model/Deploy/DeployInterface.php | 19 + .../Deploy/Model/Deploy/LocaleDeploy.php | 411 ++++++++++++++++ .../Deploy/Model/Deploy/LocaleQuickDeploy.php | 127 +++++ .../Magento/Deploy/Model/DeployManager.php | 355 ++++++++++++++ app/code/Magento/Deploy/Model/Deployer.php | 454 ++---------------- .../DeployStaticContentCommandTest.php | 4 +- app/code/Magento/Deploy/etc/di.xml | 7 + .../Framework/View/Asset/MinifierTest.php | 6 +- .../Framework/Filesystem/Directory/Write.php | 4 +- .../Filesystem/Directory/WriteInterface.php | 2 +- .../Framework/Filesystem/Driver/File.php | 19 + .../Framework/Filesystem/DriverInterface.php | 9 + 14 files changed, 1026 insertions(+), 462 deletions(-) create mode 100644 app/code/Magento/Deploy/Model/Deploy/DeployInterface.php create mode 100644 app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php create mode 100644 app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php create mode 100644 app/code/Magento/Deploy/Model/DeployManager.php diff --git a/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php b/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php index 9eda5f84e16b0..186174285159c 100644 --- a/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php +++ b/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php @@ -21,6 +21,7 @@ use Magento\Framework\Exception\LocalizedException; use Magento\Framework\App\State; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; +use Magento\Deploy\Model\DeployManager; /** * Deploy static content command @@ -220,6 +221,12 @@ protected function configure() 'Amount of jobs to which script can be paralleled.', self::DEFAULT_JOBS_AMOUNT ), + new InputOption( + Options::SYMLINK_LOCALE, + null, + InputOption::VALUE_NONE, + 'If specified, not customized locale will be symlink to base locale' + ), new InputArgument( self::LANGUAGES_ARGUMENT, InputArgument::IS_ARRAY, @@ -390,19 +397,21 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln("Requested areas: " . implode(', ', array_keys($deployableAreaThemeMap))); $output->writeln("Requested themes: " . implode(', ', $requestedThemes)); - $deployer = $this->objectManager->create( - \Magento\Deploy\Model\Deployer::class, + $deployManager = $this->objectManager->create( + DeployManager::class, [ - 'filesUtil' => $filesUtil, 'output' => $output, 'options' => $this->input->getOptions(), ] ); if ($this->isCanBeParalleled()) { - return $this->runProcessesInParallel($deployer, $deployableAreaThemeMap, $deployableLanguages); + return $this->runProcessesInParallel($deployManager, $deployableAreaThemeMap, $deployableLanguages); } else { - return $this->deploy($deployer, $deployableLanguages, $deployableAreaThemeMap); + $result = $this->deploy($deployManager, $deployableLanguages, $deployableAreaThemeMap); + $deployManager->minifyTemplates(); + $deployManager->saveDeployedVersion(); + return $result; } } @@ -466,46 +475,48 @@ private function prepareDeployableEntities($filesUtil) } /** - * @param \Magento\Deploy\Model\Deployer $deployer - * @param array $deployableLanguages + * @param DeployManager $deployManager + * @param array $deployableLocales * @param array $deployableAreaThemeMap * @return int */ - private function deploy($deployer, $deployableLanguages, $deployableAreaThemeMap) + private function deploy(DeployManager $deployManager, $deployableLocales, $deployableAreaThemeMap) { - return $deployer->deploy( - $this->objectManagerFactory, - $deployableLanguages, - $deployableAreaThemeMap - ); + foreach ($deployableAreaThemeMap as $area => $themes) { + foreach ($deployableLocales as $locale) { + foreach ($themes as $themePath) { + $deployManager->addPack($area, $themePath, $locale); + } + } + } + + return $deployManager->deploy(); } /** - * @param \Magento\Deploy\Model\Deployer $deployer + * @param DeployManager $deployManager * @param array $deployableAreaThemeMap * @param array $deployableLanguages * @return int * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - private function runProcessesInParallel($deployer, $deployableAreaThemeMap, $deployableLanguages) + private function runProcessesInParallel(DeployManager $deployManager, $deployableAreaThemeMap, $deployableLanguages) { /** @var ProcessManager $processManager */ $processManager = $this->objectManager->create(ProcessManager::class); $processNumber = 0; $processQueue = []; - foreach ($deployableAreaThemeMap as $area => &$themes) { + foreach ($deployableAreaThemeMap as $area => $themes) { foreach ($themes as $theme) { - foreach ($deployableLanguages as $lang) { - $deployerFunc = function (Process $process) use ($area, $theme, $lang, $deployer) { - return $this->deploy($deployer, [$lang], [$area => [$theme]]); - }; - if ($processNumber >= $this->getProcessesAmount()) { - $processQueue[] = $deployerFunc; - } else { - $processManager->fork($deployerFunc); - } - $processNumber++; + $deployerFunc = function (Process $process) use ($area, $theme, $deployableLanguages, $deployManager) { + return $this->deploy($deployManager, $deployableLanguages, [$area => [$theme]]); + }; + if ($processNumber >= $this->getProcessesAmount()) { + $processQueue[] = $deployerFunc; + } else { + $processManager->fork($deployerFunc); } + $processNumber++; } } $returnStatus = null; @@ -525,6 +536,9 @@ private function runProcessesInParallel($deployer, $deployableAreaThemeMap, $dep usleep(5000); } + $deployManager->minifyTemplates(); + $deployManager->saveDeployedVersion(); + return $returnStatus === Cli::RETURN_SUCCESS ?: Cli::RETURN_FAILURE; } diff --git a/app/code/Magento/Deploy/Console/Command/DeployStaticOptionsInterface.php b/app/code/Magento/Deploy/Console/Command/DeployStaticOptionsInterface.php index 729ccbe809628..25457f5505fb9 100644 --- a/app/code/Magento/Deploy/Console/Command/DeployStaticOptionsInterface.php +++ b/app/code/Magento/Deploy/Console/Command/DeployStaticOptionsInterface.php @@ -92,4 +92,9 @@ interface DeployStaticOptionsInterface * Force run of static deploy */ const FORCE_RUN = 'force'; + + /** + * Symlink locale if it not customized + */ + const SYMLINK_LOCALE = 'symlink-locale'; } diff --git a/app/code/Magento/Deploy/Model/Deploy/DeployInterface.php b/app/code/Magento/Deploy/Model/Deploy/DeployInterface.php new file mode 100644 index 0000000000000..faa49c8c79eb1 --- /dev/null +++ b/app/code/Magento/Deploy/Model/Deploy/DeployInterface.php @@ -0,0 +1,19 @@ + Options::NO_JAVASCRIPT, + 'map' => Options::NO_JAVASCRIPT, + 'css' => Options::NO_CSS, + 'less' => Options::NO_LESS, + 'html' => Options::NO_HTML, + 'htm' => Options::NO_HTML, + 'jpg' => Options::NO_IMAGES, + 'jpeg' => Options::NO_IMAGES, + 'gif' => Options::NO_IMAGES, + 'png' => Options::NO_IMAGES, + 'ico' => Options::NO_IMAGES, + 'svg' => Options::NO_IMAGES, + 'eot' => Options::NO_FONTS, + 'ttf' => Options::NO_FONTS, + 'woff' => Options::NO_FONTS, + 'woff2' => Options::NO_FONTS, + 'md' => Options::NO_MISC, + 'jbf' => Options::NO_MISC, + 'csv' => Options::NO_MISC, + 'json' => Options::NO_MISC, + 'txt' => Options::NO_MISC, + 'htc' => Options::NO_MISC, + 'swf' => Options::NO_MISC, + 'LICENSE' => Options::NO_MISC, + '' => Options::NO_MISC, + ]; + + /** + * @param OutputInterface $output + * @param JsTranslationConfig $jsTranslationConfig + * @param Minification $minification + * @param \Magento\Framework\View\Asset\Repository $assetRepo + * @param \Magento\Framework\View\Asset\RepositoryFactory $assetRepoFactory + * @param \Magento\RequireJs\Model\FileManagerFactory $fileManagerFactory + * @param \Magento\Framework\RequireJs\ConfigFactory $requireJsConfigFactory + * @param Publisher $assetPublisher + * @param \Magento\Framework\View\Template\Html\MinifierInterface $htmlMinifier + * @param \Magento\Framework\View\Asset\Bundle\Manager $bundleManager + * @param \Magento\RequireJs\Model\FileManager $fileManager + * @param ThemeProviderInterface $themeProvider + * @param LoggerInterface $logger + * @param Files $filesUtil + * @param \Magento\Framework\View\DesignInterfaceFactory $designFactory + * @param \Magento\Framework\Locale\ResolverInterface $localeResolver + * @param array $alternativeSources + */ + public function __construct( + OutputInterface $output, + JsTranslationConfig $jsTranslationConfig, + Minification $minification, + \Magento\Framework\View\Asset\Repository $assetRepo, + \Magento\Framework\View\Asset\RepositoryFactory $assetRepoFactory, + \Magento\RequireJs\Model\FileManagerFactory $fileManagerFactory, + \Magento\Framework\RequireJs\ConfigFactory $requireJsConfigFactory, + \Magento\Framework\App\View\Asset\Publisher $assetPublisher, + \Magento\Framework\View\Template\Html\MinifierInterface $htmlMinifier, + \Magento\Framework\View\Asset\Bundle\Manager $bundleManager, + \Magento\RequireJs\Model\FileManager $fileManager, + \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider, + LoggerInterface $logger, + Files $filesUtil, + \Magento\Framework\View\DesignInterfaceFactory $designFactory, + \Magento\Framework\Locale\ResolverInterface $localeResolver, + array $alternativeSources + ) { + $this->output = $output; + $this->assetRepo = $assetRepo; + $this->assetPublisher = $assetPublisher; + $this->htmlMinifier = $htmlMinifier; + $this->bundleManager = $bundleManager; + $this->fileManager = $fileManager; + $this->filesUtil = $filesUtil; + $this->jsTranslationConfig = $jsTranslationConfig; + $this->minification = $minification; + $this->logger = $logger; + $this->assetRepoFactory = $assetRepoFactory; + $this->fileManagerFactory = $fileManagerFactory; + $this->requireJsConfigFactory = $requireJsConfigFactory; + $this->themeProvider = $themeProvider; + array_map( + function (AlternativeSourceInterface $alternative) { + }, + $alternativeSources + ); + $this->alternativeSources = $alternativeSources; + $this->designFactory = $designFactory; + $this->localeResolver = $localeResolver; + } + + /** + * @param string $area + * @param string $themePath + * @return \Magento\RequireJs\Model\FileManager + */ + private function getRequireJsFileManager($area, $themePath) + { + $design = $this->designFactory->create()->setDesignTheme($themePath, $area); + $assetRepo = $this->assetRepoFactory->create(['design' => $design]); + return $this->fileManagerFactory->create( + [ + 'config' => $this->requireJsConfigFactory->create( + [ + 'assetRepo' => $assetRepo, + 'design' => $design, + ] + ), + 'assetRepo' => $assetRepo, + ] + ); + } + + /** + * {@inheritdoc} + */ + public function deploy($area, $themePath, $locale, array $options) + { + $this->output->writeln("=== {$area} -> {$themePath} -> {$locale} ==="); + + // emulate application locale needed for correct file path resolving + $this->localeResolver->setLocale($locale); + + $fileManager = $this->getRequireJsFileManager($area, $themePath); + $fileManager->createRequireJsConfigAsset(); + foreach ($this->filesUtil->getStaticPreProcessingFiles() as $info) { + list($fileArea, $fileTheme, , $module, $filePath, $fullPath) = $info; + + if ($this->checkSkip($filePath)) { + continue; + } + + if (($fileArea == $area || $fileArea == 'base') && + ($fileTheme == '' || $fileTheme == $themePath || + in_array( + $fileArea . Theme::THEME_PATH_SEPARATOR . $fileTheme, + $this->findAncestors($area . Theme::THEME_PATH_SEPARATOR . $themePath) + )) + ) { + $compiledFile = $this->deployFile( + $filePath, + $area, + $themePath, + $locale, + $module, + $fullPath + ); + if ($compiledFile !== '') { + $this->deployFile($compiledFile, $area, $themePath, $locale, $module, $fullPath); + } + } + } + + foreach ($this->filesUtil->getStaticLibraryFiles() as $filePath) { + + if ($this->checkSkip($filePath)) { + continue; + } + + $compiledFile = $this->deployFile($filePath, $area, $themePath, $locale, null); + + if ($compiledFile !== '') { + $this->deployFile($compiledFile, $area, $themePath, $locale, null); + } + } + if (!$this->getOption(Options::NO_JAVASCRIPT)) { + if ($this->jsTranslationConfig->dictionaryEnabled()) { + $dictionaryFileName = $this->jsTranslationConfig->getDictionaryFileName(); + $this->deployFile($dictionaryFileName, $area, $themePath, $locale, null); + } + if ($this->minification->isEnabled('js')) { + $fileManager->createMinResolverAsset(); + } + } + $this->bundleManager->flush(); + $this->output->writeln("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n"); + + return $this->errorCount ? Cli::RETURN_FAILURE : Cli::RETURN_SUCCESS; + } + + /** + * Deploy a static view file + * + * @param string $filePath + * @param string $area + * @param string $themePath + * @param string $locale + * @param string $module + * @param string|null $fullPath + * @return string + * @throws \InvalidArgumentException + * @throws LocalizedException + * + * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + */ + private function deployFile($filePath, $area, $themePath, $locale, $module, $fullPath = null) + { + $compiledFile = ''; + $extension = pathinfo($filePath, PATHINFO_EXTENSION); + + foreach ($this->alternativeSources as $name => $alternative) { + if (in_array($extension, $alternative->getAlternativesExtensionsNames(), true) + && strpos(basename($filePath), '_') !== 0 + ) { + $compiledFile = substr($filePath, 0, strlen($filePath) - strlen($extension) - 1); + $compiledFile = $compiledFile . '.' . $name; + } + } + + if ($this->output->isVeryVerbose()) { + $logMessage = "Processing file '$filePath' for area '$area', theme '$themePath', locale '$locale'"; + if ($module) { + $logMessage .= ", module '$module'"; + } + $this->output->writeln($logMessage); + } + + try { + $asset = $this->assetRepo->createAsset( + $filePath, + ['area' => $area, 'theme' => $themePath, 'locale' => $locale, 'module' => $module] + ); + if ($this->output->isVeryVerbose()) { + $this->output->writeln("\tDeploying the file to '{$asset->getPath()}'"); + } else { + $this->output->write('.'); + } + if ($this->getOption(Options::DRY_RUN)) { + $asset->getContent(); + } else { + $this->assetPublisher->publish($asset); + $this->bundleManager->addAsset($asset); + } + $this->count++; + } catch (ContentProcessorException $exception) { + $pathInfo = $fullPath ?: $filePath; + $errorMessage = __('Compilation from source: ') . $pathInfo . PHP_EOL . $exception->getMessage(); + $this->errorCount++; + $this->output->write(PHP_EOL . PHP_EOL . $errorMessage . PHP_EOL, true); + + $this->logger->critical($errorMessage); + } catch (\Exception $exception) { + $this->output->write('.'); + if ($this->output->isVerbose()) { + $this->output->writeln($exception->getTraceAsString()); + } + $this->errorCount++; + } + + return $compiledFile; + } + + /** + * @param string $name + * @return mixed|null + */ + private function getOption($name) + { + return isset($this->options[$name]) ? $this->options[$name] : null; + } + + /** + * Check if skip flag is affecting file by extension + * + * @param string $filePath + * @return boolean + */ + private function checkSkip($filePath) + { + if ($filePath != '.') { + $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); + $option = isset(self::$fileExtensionOptionMap[$ext]) ? self::$fileExtensionOptionMap[$ext] : null; + + return $option ? $this->getOption($option) : false; + } + + return false; + } + + /** + * Find ancestor themes' full paths + * + * @param string $themeFullPath + * @return string[] + */ + private function findAncestors($themeFullPath) + { + $theme = $this->themeProvider->getThemeByFullPath($themeFullPath); + $ancestors = $theme->getInheritedThemes(); + $ancestorThemeFullPath = []; + foreach ($ancestors as $ancestor) { + $ancestorThemeFullPath[] = $ancestor->getFullPath(); + } + return $ancestorThemeFullPath; + } +} diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php new file mode 100644 index 0000000000000..2418d4c9090d2 --- /dev/null +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php @@ -0,0 +1,127 @@ +filesystem = $filesystem; + $this->output = $output; + } + + /** + * @return WriteInterface + */ + private function getStaticDirectory() + { + if ($this->staticDirectory === null) { + $this->staticDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW); + } + + return $this->staticDirectory; + } + + /** + * {@inheritdoc} + */ + public function deploy($area, $themePath, $locale, array $options) + { + $this->output->writeln("=== {$area} -> {$themePath} -> {$locale} ==="); + + if (!isset($options[DeployManager::DEPLOY_BASE_LOCALE])) { + throw new \InvalidArgumentException('Deploy base locale must be set for Quick Deploy'); + } + $processedFiles = 0; + $errorAmount = 0; + + $baseLocale = $options[DeployManager::DEPLOY_BASE_LOCALE]; + $newLocalePath =$this->getLocalePath($area, $themePath, $locale); + $baseLocalePath = $this->getLocalePath($area, $themePath, $baseLocale); + $baseRequireJsPath = RequireJsConfig::DIR_NAME . DIRECTORY_SEPARATOR . $baseLocalePath; + $newRequireJsPath = RequireJsConfig::DIR_NAME . DIRECTORY_SEPARATOR . $newLocalePath; + + $this->getStaticDirectory()->delete($newLocalePath); + $this->getStaticDirectory()->delete($newRequireJsPath); + + if ($options[Options::SYMLINK_LOCALE]) { + $this->getStaticDirectory()->createSymlink($baseLocalePath, $newLocalePath); + $this->getStaticDirectory()->createSymlink($baseRequireJsPath, $newRequireJsPath); + + $this->output->writeln("\nSuccessful symlinked\n---\n"); + } else { + $localeFiles = Files::getFiles( + [ + $this->getStaticDirectory()->getAbsolutePath($baseLocalePath), + $this->getStaticDirectory()->getAbsolutePath($baseRequireJsPath) + ], + '*' + ); + foreach ($localeFiles as $file) { + $path = $this->getStaticDirectory()->getRelativePath($file); + $destination = $this->replaceLocaleInPath($path, $baseLocale, $locale); + $this->getStaticDirectory()->copyFile($path, $destination); + $processedFiles++; + } + + $this->output->writeln("\nSuccessful copied: {$processedFiles} files; errors: {$errorAmount}\n---\n"); + } + + return Cli::RETURN_SUCCESS; + } + + /** + * @param string $path + * @param string $search + * @param string $replace + * @return string + */ + private function replaceLocaleInPath($path, $search, $replace) + { + return preg_replace('~' . $search . '~', $replace, $path, 1); + } + + /** + * @param string $area + * @param string $themePath + * @param string $locale + * @return string + */ + private function getLocalePath($area, $themePath, $locale) + { + return $area . DIRECTORY_SEPARATOR . $themePath . DIRECTORY_SEPARATOR . $locale; + } +} diff --git a/app/code/Magento/Deploy/Model/DeployManager.php b/app/code/Magento/Deploy/Model/DeployManager.php new file mode 100644 index 0000000000000..265249b92409c --- /dev/null +++ b/app/code/Magento/Deploy/Model/DeployManager.php @@ -0,0 +1,355 @@ +rulePool = $rulePool; + $this->objectManagerFactory = $objectManagerFactory; + $this->design = $design; + $this->output = $output; + $this->options = $options; + $this->assetConfig = $assetConfig; + $this->filesUtils = $filesUtils; + $this->versionStorage = $versionStorage; + $this->htmlMinifier = $htmlMinifier; + } + + /** + * Add package tie to area and theme + * + * @param string $area + * @param string $themePath + * @param string $locale + * @reutrn void + */ + public function addPack($area, $themePath, $locale) + { + $this->packages[$area . '-' . $themePath][$locale] = [$area, $themePath]; + } + + /** + * Deploy local packages with chosen deploy strategy + * @return int + */ + public function deploy() + { + if (isset($this->options[Options::DRY_RUN]) && $this->options[Options::DRY_RUN]) { + $this->output->writeln('Dry run. Nothing will be recorded to the target directory.'); + } + + $result = 0; + foreach ($this->packages as $package) { + $locales = array_keys($package); + list($area, $themePath) = current($package); + $this->emulateApplicationArea($area); + + if (count($locales) == 1) { + $result |= $this->getDeployStrategy(self::DEPLOY_STRATEGY_STANDARD) + ->deploy($area, $themePath, current($locales), $this->options); + continue; + } + + $baseLocale = null; + foreach ($this->getDeployStrategies($area, $themePath, $locales) as $locale => $strategy) { + // base locale must processed first + $baseLocale = $baseLocale ?: $locale; + $this->options[self::DEPLOY_BASE_LOCALE] = $baseLocale; + $result |= $strategy->deploy($area, $themePath, $locale, $this->options); + } + } + + return $result; + } + + /** + * Minify template files + * @return void + */ + public function minifyTemplates() + { + $noHtmlMinify = isset($this->options[Options::NO_HTML_MINIFY]) ? $this->options[Options::NO_HTML_MINIFY] : null; + if (!($noHtmlMinify ?: !$this->assetConfig->isMinifyHtml())) { + $this->output->writeln('=== Minify templates ==='); + $count = 0; + foreach ($this->filesUtils->getPhtmlFiles(false, false) as $template) { + $this->htmlMinifier->minify($template); + if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $this->output->writeln($template . " minified\n"); + } else { + $this->output->write('.'); + } + $count++; + } + $this->output->writeln("\nSuccessful: {$count} files modified\n---\n"); + } + } + + /** + * Save version of deployed files + * @return void + */ + public function saveDeployedVersion() + { + $version = (new \DateTime())->getTimestamp(); + $this->output->writeln("New version of deployed files: {$version}"); + if (isset($this->options[Options::DRY_RUN]) && !$this->options[Options::DRY_RUN]) { + $this->versionStorage->save($version); + } + } + + /** + * Emulate application area + * + * @param string $areaCode + * @return void + */ + private function emulateApplicationArea($areaCode) + { + $this->objectManager = $this->objectManagerFactory->create([State::PARAM_MODE => State::MODE_PRODUCTION]); + $this->objectManager->get(State::class)->setAreaCode($areaCode); + } + + /** + * @param array $params + * @return array + */ + private function getLocaleDirectories($params) + { + $dirs = $this->getFallbackRule()->getPatternDirs($params); + + return array_filter($dirs, function ($dir) { + return strpos($dir, 'i18n'); + }); + } + + /** + * Get directories which can contains theme customization + * @param string $area + * @param string $themePath + * @param string $locale + * @return array + */ + private function getCustomizationDirectories($area, $themePath, $locale) + { + $customizationDirectories = []; + $this->design->setDesignTheme($themePath, $area); + + $params = ['area' => $area, 'theme' => $this->design->getDesignTheme(), 'locale' => $locale]; + foreach ($this->getLocaleDirectories($params) as $patternDir) { + $customizationDirectories[] = $patternDir; + } + + if ($this->moduleDirectories === null) { + $this->moduleDirectories = []; + $componentRegistrar = new ComponentRegistrar(); + $this->moduleDirectories = array_keys($componentRegistrar->getPaths(ComponentRegistrar::MODULE)); + } + + foreach ($this->moduleDirectories as $moduleDir) { + $params['module_name'] = $moduleDir; + $patternDirs = $this->getLocaleDirectories($params); + foreach ($patternDirs as $patternDir) { + $customizationDirectories[] = $patternDir; + } + } + + return $customizationDirectories; + } + + /** + * @param string $area + * @param string $themePath + * @param array $locales + * @return DeployInterface[] + */ + private function getDeployStrategies($area, $themePath, array $locales) + { + $baseLocale = null; + $deployStrategies = []; + + foreach ($locales as $locale) { + $hasCustomization = false; + foreach ($this->getCustomizationDirectories($area, $themePath, $locale) as $directory) { + if (glob($directory . DIRECTORY_SEPARATOR . '*', GLOB_NOSORT)) { + $hasCustomization = true; + break; + } + } + if ($baseLocale === null && !$hasCustomization) { + $baseLocale = $locale; + } else { + $deployStrategies[$locale] = $this->getDeployStrategy( + $hasCustomization ? self::DEPLOY_STRATEGY_STANDARD : self::DEPLOY_STRATEGY_QUICK + ); + + } + } + $deployStrategies = array_merge( + [$baseLocale => $this->getDeployStrategy(self::DEPLOY_STRATEGY_STANDARD)], + $deployStrategies + ); + + return $deployStrategies; + } + + + /** + * @return \Magento\Framework\View\Design\Fallback\Rule\RuleInterface + */ + private function getFallbackRule() + { + if (null === $this->fallBackRule) { + $this->fallBackRule = $this->rulePool->getRule(RulePool::TYPE_STATIC_FILE); + } + + return $this->fallBackRule; + } + + /** + * @param string $type + * @return DeployInterface + */ + private function getDeployStrategy($type) + { + if (!isset($this->deployStrategies[$type])) { + $strategyMap = [ + self::DEPLOY_STRATEGY_STANDARD => Deploy\LocaleDeploy::class, + self::DEPLOY_STRATEGY_QUICK => Deploy\LocaleQuickDeploy::class, + ]; + + if (!isset($strategyMap[$type])) { + throw new \InvalidArgumentException('Wrong deploy strategy type: ' . $type); + } + $this->deployStrategies[$type] = $this->objectManager->create( + $strategyMap[$type], + ['output' => $this->output] + ); + } + + return $this->deployStrategies[$type]; + } +} diff --git a/app/code/Magento/Deploy/Model/Deployer.php b/app/code/Magento/Deploy/Model/Deployer.php index c4e886306dccf..2648b321edd06 100644 --- a/app/code/Magento/Deploy/Model/Deployer.php +++ b/app/code/Magento/Deploy/Model/Deployer.php @@ -6,63 +6,29 @@ namespace Magento\Deploy\Model; -use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\View\Asset\ContentProcessorException; +use Magento\Deploy\Console\Command\DeployStaticOptionsInterface; use Magento\Framework\View\Asset\PreProcessor\AlternativeSourceInterface; use Magento\Framework\App\ObjectManagerFactory; use Magento\Framework\App\View\Deployment\Version; -use Magento\Framework\App\View\Asset\Publisher; use Magento\Framework\App\Utility\Files; -use Magento\Framework\Config\Theme; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Translate\Js\Config as JsTranslationConfig; -use Magento\Framework\View\Design\Theme\ThemeProviderInterface; use Symfony\Component\Console\Output\OutputInterface; -use Psr\Log\LoggerInterface; -use Magento\Framework\View\Asset\Minification; use Magento\Framework\App\ObjectManager; -use Magento\Framework\View\Asset\ConfigInterface; -use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; +use Magento\Deploy\Model\DeployManagerFactory; +use Magento\Framework\View\Template\Html\MinifierInterface; /** * A service for deploying Magento static view files for production mode * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - * @SuppressWarnings(PHPMD.TooManyFields) + * @deprecated + * @see Use DeployManager::deploy instead */ class Deployer { - /** @var Files */ - private $filesUtil; - - /** @var ObjectManagerFactory */ - private $omFactory; - /** @var OutputInterface */ private $output; - /** @var Version\StorageInterface */ - private $versionStorage; - - /** @var \Magento\Framework\View\Asset\Repository */ - private $assetRepo; - - /** @var Publisher */ - private $assetPublisher; - - /** @var \Magento\Framework\View\Asset\Bundle\Manager */ - private $bundleManager; - - /** @var int */ - private $count; - - /** @var int */ - private $errorCount; - - /** @var \Magento\Framework\View\Template\Html\MinifierInterface */ - private $htmlMinifier; - /** * @var ObjectManagerInterface */ @@ -73,64 +39,15 @@ class Deployer */ protected $jsTranslationConfig; - /** - * @var AlternativeSourceInterface[] - */ - private $alternativeSources; - - /** - * @var ThemeProviderInterface - */ - private $themeProvider; - /** * @var array */ - private static $fileExtensionOptionMap = [ - 'js' => Options::NO_JAVASCRIPT, - 'map' => Options::NO_JAVASCRIPT, - 'css' => Options::NO_CSS, - 'less' => Options::NO_LESS, - 'html' => Options::NO_HTML, - 'htm' => Options::NO_HTML, - 'jpg' => Options::NO_IMAGES, - 'jpeg' => Options::NO_IMAGES, - 'gif' => Options::NO_IMAGES, - 'png' => Options::NO_IMAGES, - 'ico' => Options::NO_IMAGES, - 'svg' => Options::NO_IMAGES, - 'eot' => Options::NO_FONTS, - 'ttf' => Options::NO_FONTS, - 'woff' => Options::NO_FONTS, - 'woff2' => Options::NO_FONTS, - 'md' => Options::NO_MISC, - 'jbf' => Options::NO_MISC, - 'csv' => Options::NO_MISC, - 'json' => Options::NO_MISC, - 'txt' => Options::NO_MISC, - 'htc' => Options::NO_MISC, - 'swf' => Options::NO_MISC, - 'LICENSE' => Options::NO_MISC, - '' => Options::NO_MISC, - ]; - - /** - * @var Minification - */ - private $minification; + private $options; /** - * @var LoggerInterface + * @var DeployManagerFactory */ - private $logger; - - /** @var ConfigInterface */ - private $assetConfig; - - /** - * @var array - */ - private $options; + private $deployManagerFactory; /** * Constructor @@ -141,6 +58,7 @@ class Deployer * @param JsTranslationConfig $jsTranslationConfig * @param AlternativeSourceInterface[] $alternativeSources * @param array $options + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( Files $filesUtil, @@ -148,56 +66,18 @@ public function __construct( Version\StorageInterface $versionStorage, JsTranslationConfig $jsTranslationConfig, array $alternativeSources, + MinifierInterface $htmlMinifier, + DeployManagerFactory $deployManagerFactory = null, $options = [] ) { - $this->filesUtil = $filesUtil; $this->output = $output; - $this->versionStorage = $versionStorage; - $this->jsTranslationConfig = $jsTranslationConfig; + $this->deployManagerFactory = $deployManagerFactory; if (is_array($options)) { $this->options = $options; } else { // backward compatibility support - $this->options = [Options::DRY_RUN => (bool)$options]; + $this->options = [DeployStaticOptionsInterface::DRY_RUN => (bool)$options]; } - $this->parentTheme = []; - - array_map( - function (AlternativeSourceInterface $alternative) { - }, - $alternativeSources - ); - $this->alternativeSources = $alternativeSources; - - } - - /** - * @param string $name - * @return mixed|null - */ - private function getOption($name) - { - return isset($this->options[$name]) ? $this->options[$name] : null; - } - - /** - * Check if skip flag is affecting file by extension - * - * @param string $filePath - * @return boolean - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - private function checkSkip($filePath) - { - if ($filePath != '.') { - $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); - $option = isset(self::$fileExtensionOptionMap[$ext]) ? self::$fileExtensionOptionMap[$ext] : null; - - return $option ? $this->getOption($option) : false; - } - - return false; } /** @@ -207,170 +87,31 @@ private function checkSkip($filePath) * @param array $locales * @param array $deployableAreaThemeMap * @return int - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @deprecated */ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $deployableAreaThemeMap = []) { - $this->omFactory = $omFactory; - - if ($this->getOption(Options::DRY_RUN)) { - $this->output->writeln('Dry run. Nothing will be recorded to the target directory.'); + if (null === $this->deployManagerFactory) { + $this->deployManagerFactory = ObjectManager::getInstance()->get(DeployManagerFactory::class); } - $libFiles = $this->filesUtil->getStaticLibraryFiles(); - $appFiles = $this->filesUtil->getStaticPreProcessingFiles(); + /** @var DeployManager $deployerManager */ + $deployerManager = $this->deployManagerFactory->create( + ['options' => $this->options, 'output' => $this->output] + ); foreach ($deployableAreaThemeMap as $area => $themes) { - $this->emulateApplicationArea($area); foreach ($locales as $locale) { - $this->emulateApplicationLocale($locale, $area); foreach ($themes as $themePath) { - - $this->output->writeln("=== {$area} -> {$themePath} -> {$locale} ==="); - $this->count = 0; - $this->errorCount = 0; - - /** @var \Magento\Theme\Model\View\Design $design */ - $design = $this->objectManager->create(\Magento\Theme\Model\View\Design::class); - $design->setDesignTheme($themePath, $area); - - $assetRepo = $this->objectManager->create( - \Magento\Framework\View\Asset\Repository::class, - [ - 'design' => $design, - ] - ); - /** @var \Magento\RequireJs\Model\FileManager $fileManager */ - $fileManager = $this->objectManager->create( - \Magento\RequireJs\Model\FileManager::class, - [ - 'config' => $this->objectManager->create( - \Magento\Framework\RequireJs\Config::class, - [ - 'assetRepo' => $assetRepo, - 'design' => $design, - ] - ), - 'assetRepo' => $assetRepo, - ] - ); - $fileManager->createRequireJsConfigAsset(); - - foreach ($appFiles as $info) { - list($fileArea, $fileTheme, , $module, $filePath, $fullPath) = $info; - - if ($this->checkSkip($filePath)) { - continue; - } - - if (($fileArea == $area || $fileArea == 'base') && - ($fileTheme == '' || $fileTheme == $themePath || - in_array( - $fileArea . Theme::THEME_PATH_SEPARATOR . $fileTheme, - $this->findAncestors($area . Theme::THEME_PATH_SEPARATOR . $themePath) - )) - ) { - $compiledFile = $this->deployFile( - $filePath, - $area, - $themePath, - $locale, - $module, - $fullPath - ); - if ($compiledFile !== '') { - $this->deployFile($compiledFile, $area, $themePath, $locale, $module, $fullPath); - } - } - } - foreach ($libFiles as $filePath) { - - if ($this->checkSkip($filePath)) { - continue; - } - - $compiledFile = $this->deployFile($filePath, $area, $themePath, $locale, null); - - if ($compiledFile !== '') { - $this->deployFile($compiledFile, $area, $themePath, $locale, null); - } - } - if (!$this->getOption(Options::NO_JAVASCRIPT)) { - if ($this->jsTranslationConfig->dictionaryEnabled()) { - $dictionaryFileName = $this->jsTranslationConfig->getDictionaryFileName(); - $this->deployFile($dictionaryFileName, $area, $themePath, $locale, null); - } - if ($this->getMinification()->isEnabled('js')) { - $fileManager->createMinResolverAsset(); - } - } - $this->bundleManager->flush(); - $this->output->writeln("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n"); - } - } - } - if (!($this->getOption(Options::NO_HTML_MINIFY) ?: !$this->getAssetConfig()->isMinifyHtml())) { - $this->output->writeln('=== Minify templates ==='); - $this->count = 0; - foreach ($this->filesUtil->getPhtmlFiles(false, false) as $template) { - $this->htmlMinifier->minify($template); - if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $this->output->writeln($template . " minified\n"); - } else { - $this->output->write('.'); + $deployerManager->addPack($area, $themePath, $locale); } - $this->count++; } - $this->output->writeln("\nSuccessful: {$this->count} files modified\n---\n"); - } - - $version = (new \DateTime())->getTimestamp(); - $this->output->writeln("New version of deployed files: {$version}"); - if (!$this->getOption(Options::DRY_RUN)) { - $this->versionStorage->save($version); - } - - if ($this->errorCount > 0) { - // we must have an exit code higher than zero to indicate something was wrong - return \Magento\Framework\Console\Cli::RETURN_FAILURE; - } - return \Magento\Framework\Console\Cli::RETURN_SUCCESS; - } - - /** - * Get Minification instance - * - * @deprecated - * @return Minification - */ - private function getMinification() - { - if (null === $this->minification) { - $this->minification = ObjectManager::getInstance()->get(Minification::class); } + $result = $deployerManager->deploy(); + $deployerManager->minifyTemplates(); + $deployerManager->saveDeployedVersion(); - return $this->minification; - } - - /** - * Emulate application area and various services that are necessary for populating files - * - * @param string $areaCode - * @return void - */ - private function emulateApplicationArea($areaCode) - { - $this->objectManager = $this->omFactory->create( - [\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_PRODUCTION] - ); - /** @var \Magento\Framework\App\State $appState */ - $appState = $this->objectManager->get(\Magento\Framework\App\State::class); - $appState->setAreaCode($areaCode); - $this->assetRepo = $this->objectManager->get(\Magento\Framework\View\Asset\Repository::class); - $this->assetPublisher = $this->objectManager->create(\Magento\Framework\App\View\Asset\Publisher::class); - $this->htmlMinifier = $this->objectManager->get(\Magento\Framework\View\Template\Html\MinifierInterface::class); - $this->bundleManager = $this->objectManager->get(\Magento\Framework\View\Asset\Bundle\Manager::class); + return $result; } /** @@ -379,6 +120,7 @@ private function emulateApplicationArea($areaCode) * @param string $locale * @param string $area * @return void + * @deprecated */ protected function emulateApplicationLocale($locale, $area) { @@ -390,146 +132,4 @@ protected function emulateApplicationLocale($locale, $area) $localeResolver = $this->objectManager->get(\Magento\Framework\Locale\ResolverInterface::class); $localeResolver->setLocale($locale); } - - /** - * Deploy a static view file - * - * @param string $filePath - * @param string $area - * @param string $themePath - * @param string $locale - * @param string $module - * @param string|null $fullPath - * @return string - * @throws \InvalidArgumentException - * @throws LocalizedException - * - * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - */ - private function deployFile($filePath, $area, $themePath, $locale, $module, $fullPath = null) - { - $compiledFile = ''; - $extension = pathinfo($filePath, PATHINFO_EXTENSION); - - foreach ($this->alternativeSources as $name => $alternative) { - if (in_array($extension, $alternative->getAlternativesExtensionsNames(), true) - && strpos(basename($filePath), '_') !== 0 - ) { - $compiledFile = substr($filePath, 0, strlen($filePath) - strlen($extension) - 1); - $compiledFile = $compiledFile . '.' . $name; - } - } - - if ($this->output->isVeryVerbose()) { - $logMessage = "Processing file '$filePath' for area '$area', theme '$themePath', locale '$locale'"; - if ($module) { - $logMessage .= ", module '$module'"; - } - $this->output->writeln($logMessage); - } - - try { - $asset = $this->assetRepo->createAsset( - $filePath, - ['area' => $area, 'theme' => $themePath, 'locale' => $locale, 'module' => $module] - ); - if ($this->output->isVeryVerbose()) { - $this->output->writeln("\tDeploying the file to '{$asset->getPath()}'"); - } else { - $this->output->write('.'); - } - if ($this->getOption(Options::DRY_RUN)) { - $asset->getContent(); - } else { - $this->assetPublisher->publish($asset); - $this->bundleManager->addAsset($asset); - } - $this->count++; - } catch (ContentProcessorException $exception) { - $pathInfo = $fullPath ?: $filePath; - $errorMessage = __('Compilation from source: ') . $pathInfo - . PHP_EOL . $exception->getMessage(); - $this->errorCount++; - $this->output->write(PHP_EOL . PHP_EOL . $errorMessage . PHP_EOL, true); - - $this->getLogger()->critical($errorMessage); - } catch (\Exception $exception) { - $this->output->write('.'); - $this->verboseLog($exception->getTraceAsString()); - $this->errorCount++; - } - - return $compiledFile; - } - - /** - * Find ancestor themes' full paths - * - * @param string $themeFullPath - * @return string[] - */ - private function findAncestors($themeFullPath) - { - $theme = $this->getThemeProvider()->getThemeByFullPath($themeFullPath); - $ancestors = $theme->getInheritedThemes(); - $ancestorThemeFullPath = []; - foreach ($ancestors as $ancestor) { - $ancestorThemeFullPath[] = $ancestor->getFullPath(); - } - return $ancestorThemeFullPath; - } - - - /** - * @return ThemeProviderInterface - */ - private function getThemeProvider() - { - if (null === $this->themeProvider) { - $this->themeProvider = ObjectManager::getInstance()->get(ThemeProviderInterface::class); - } - - return $this->themeProvider; - } - - /** - * @return \Magento\Framework\View\Asset\ConfigInterface - * @deprecated - */ - private function getAssetConfig() - { - if (null === $this->assetConfig) { - $this->assetConfig = ObjectManager::getInstance()->get(ConfigInterface::class); - } - return $this->assetConfig; - } - - /** - * Verbose log - * - * @param string $message - * @return void - */ - private function verboseLog($message) - { - if ($this->output->isVerbose()) { - $this->output->writeln($message); - } - } - - /** - * Retrieves LoggerInterface instance - * - * @return LoggerInterface - * @deprecated - */ - private function getLogger() - { - if (!$this->logger) { - $this->logger = $this->objectManager->get(LoggerInterface::class); - } - - return $this->logger; - } } diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/DeployStaticContentCommandTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/DeployStaticContentCommandTest.php index 24ccf34bb894c..c8fa2138e7c81 100644 --- a/app/code/Magento/Deploy/Test/Unit/Console/Command/DeployStaticContentCommandTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/DeployStaticContentCommandTest.php @@ -16,7 +16,7 @@ class DeployStaticContentCommandTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Deploy\Model\Deployer|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Deploy\Model\DeployManager|\PHPUnit_Framework_MockObject_MockObject */ private $deployer; @@ -60,7 +60,7 @@ protected function setUp() '', false ); - $this->deployer = $this->getMock(\Magento\Deploy\Model\Deployer::class, [], [], '', false); + $this->deployer = $this->getMock(\Magento\Deploy\Model\DeployManager::class, [], [], '', false); $this->filesUtil = $this->getMock(\Magento\Framework\App\Utility\Files::class, [], [], '', false); $this->appState = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false); diff --git a/app/code/Magento/Deploy/etc/di.xml b/app/code/Magento/Deploy/etc/di.xml index e1a0295a0fe32..52c880c28d0a7 100644 --- a/app/code/Magento/Deploy/etc/di.xml +++ b/app/code/Magento/Deploy/etc/di.xml @@ -13,6 +13,13 @@ + + + + AlternativeSourceProcessors + + + diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php index d88f79fef597b..c155ef8a5c9c9 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Asset/MinifierTest.php @@ -235,13 +235,13 @@ public function testDeploymentWithMinifierEnabled() ] )); - /** @var \Magento\Deploy\Model\Deployer $deployer */ + /** @var \Magento\Deploy\Model\Deploy\LocaleDeploy $deployer */ $deployer = $this->objectManager->create( - \Magento\Deploy\Model\Deployer::class, + \Magento\Deploy\Model\Deploy\LocaleDeploy::class, ['filesUtil' => $filesUtil, 'output' => $output] ); - $deployer->deploy($omFactory, ['en_US'], ['frontend' => ['FrameworkViewMinifier/default']]); + $deployer->deploy('frontend', 'FrameworkViewMinifier/default', 'en_US', []); $this->assertFileExists($fileToBePublished); $this->assertEquals( diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php index 1f69922b79989..2e89f89b3fe76 100644 --- a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php +++ b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php @@ -144,8 +144,6 @@ public function copyFile($path, $destination, WriteInterface $targetDirectory = */ public function createSymlink($path, $destination, WriteInterface $targetDirectory = null) { - $this->assertIsFile($path); - $targetDirectory = $targetDirectory ?: $this; $parentDirectory = $this->driver->getParentDirectory($destination); if (!$targetDirectory->isExist($parentDirectory)) { @@ -170,7 +168,7 @@ public function delete($path = null) return true; } $absolutePath = $this->driver->getAbsolutePath($this->path, $path); - if ($this->driver->isFile($absolutePath)) { + if ($this->driver->isFile($absolutePath) || $this->driver->isLink($absolutePath)) { $this->driver->deleteFile($absolutePath); } else { $this->driver->deleteDirectory($absolutePath); diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/WriteInterface.php b/lib/internal/Magento/Framework/Filesystem/Directory/WriteInterface.php index 472c54a08d202..3fa0513dd21a0 100644 --- a/lib/internal/Magento/Framework/Filesystem/Directory/WriteInterface.php +++ b/lib/internal/Magento/Framework/Filesystem/Directory/WriteInterface.php @@ -48,7 +48,7 @@ public function renameFile($path, $newPath, WriteInterface $targetDirectory = nu public function copyFile($path, $destination, WriteInterface $targetDirectory = null); /** - * Creates symlink on a file and places it to destination + * Creates symlink on a file or directory and places it to destination * * @param string $path * @param string $destination diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/File.php b/lib/internal/Magento/Framework/Filesystem/Driver/File.php index 8f7d888544f50..ec48af4999b6c 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/File.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/File.php @@ -113,6 +113,25 @@ public function isFile($path) return $result; } + /** + * Tells whether the filename is a symbolic link + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function isLink($path) + { + clearstatcache(); + $result = @is_link($this->getScheme() . $path); + if ($result === null) { + throw new FileSystemException( + new \Magento\Framework\Phrase('Error occurred during execution %1', [$this->getWarningMessage()]) + ); + } + return $result; + } + /** * Tells whether the filename is a regular directory * diff --git a/lib/internal/Magento/Framework/Filesystem/DriverInterface.php b/lib/internal/Magento/Framework/Filesystem/DriverInterface.php index 8b30fe398f08c..b06ec8407ad34 100644 --- a/lib/internal/Magento/Framework/Filesystem/DriverInterface.php +++ b/lib/internal/Magento/Framework/Filesystem/DriverInterface.php @@ -65,6 +65,15 @@ public function isReadable($path); */ public function isFile($path); + /** + * Tells whether the filename is a symbolic link + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function isLink($path); + /** * Tells whether the filename is a regular directory * From 3ee655a31d78a9c9aaa82b0c1a396a61d73c4229 Mon Sep 17 00:00:00 2001 From: Yaroslav Onischenko Date: Fri, 26 Aug 2016 17:22:55 +0300 Subject: [PATCH 0323/3232] MAGETWO-55908: Prepare PR --- .../Product/Form/Modifier/AdvancedPricing.php | 11 ++++----- .../Customer/Model/Config/Source/Group.php | 18 +++++++-------- .../Model/Config/Source/Group/Multiselect.php | 18 ++++++++++++--- .../Model/Customer/Attribute/Source/Group.php | 3 +-- .../GroupSourceLoggedInOnlyInterface.php} | 4 ++-- .../Customer/Model/Customer/Source/Group.php | 19 ++++----------- .../Customer/Source/GroupSourceInterface.php | 1 - .../GroupSourceWithAllGroupsInterface.php | 12 ---------- .../Source/GroupWithoutAllSources.php | 15 ------------ .../Config/Source/Group/MultiselectTest.php | 23 +++++++++++++------ .../Unit/Model/Config/Source/GroupTest.php | 6 ++--- app/code/Magento/Customer/etc/di.xml | 8 +++---- 12 files changed, 59 insertions(+), 79 deletions(-) rename app/code/Magento/Customer/Model/Customer/{Source/GroupSourceForLoggedInCustomersInterface.php => Attribute/Source/GroupSourceLoggedInOnlyInterface.php} (57%) delete mode 100644 app/code/Magento/Customer/Model/Customer/Source/GroupSourceWithAllGroupsInterface.php delete mode 100644 app/code/Magento/Customer/Model/Customer/Source/GroupWithoutAllSources.php diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php index 1f85d81a5df6c..071bc8d796781 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php @@ -7,11 +7,10 @@ use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Catalog\Model\Locator\LocatorInterface; -use Magento\Customer\Model\Customer\Source\GroupSourceWithAllGroupsInterface; +use Magento\Customer\Model\Customer\Source\GroupSourceInterface; use Magento\Directory\Helper\Data; use Magento\Framework\App\ObjectManager; use Magento\Store\Model\StoreManagerInterface; -use Magento\Customer\Api\Data\GroupInterface; use Magento\Customer\Api\GroupManagementInterface; use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Framework\Api\SearchCriteriaBuilder; @@ -84,7 +83,7 @@ class AdvancedPricing extends AbstractModifier protected $meta = []; /** - * @var GroupSourceWithAllGroupsInterface + * @var GroupSourceInterface */ private $customerGroupSource; @@ -98,7 +97,7 @@ class AdvancedPricing extends AbstractModifier * @param Data $directoryHelper * @param ArrayManager $arrayManager * @param string $scopeName - * @param GroupSourceWithAllGroupsInterface $customerGroupSource + * @param GroupSourceInterface $customerGroupSource * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -111,7 +110,7 @@ public function __construct( Data $directoryHelper, ArrayManager $arrayManager, $scopeName = '', - GroupSourceWithAllGroupsInterface $customerGroupSource = null + GroupSourceInterface $customerGroupSource = null ) { $this->locator = $locator; $this->storeManager = $storeManager; @@ -123,7 +122,7 @@ public function __construct( $this->arrayManager = $arrayManager; $this->scopeName = $scopeName; $this->customerGroupSource = $customerGroupSource - ?: ObjectManager::getInstance()->get(GroupSourceWithAllGroupsInterface::class); + ?: ObjectManager::getInstance()->get(GroupSourceInterface::class); } /** diff --git a/app/code/Magento/Customer/Model/Config/Source/Group.php b/app/code/Magento/Customer/Model/Config/Source/Group.php index 76f0b142da01d..e693bf7a3c45e 100644 --- a/app/code/Magento/Customer/Model/Config/Source/Group.php +++ b/app/code/Magento/Customer/Model/Config/Source/Group.php @@ -6,7 +6,7 @@ namespace Magento\Customer\Model\Config\Source; use Magento\Customer\Api\GroupManagementInterface; -use Magento\Customer\Model\Customer\Source\GroupSourceForLoggedInCustomersInterface; +use Magento\Customer\Model\Customer\Attribute\Source\GroupSourceLoggedInOnlyInterface; use Magento\Framework\App\ObjectManager; class Group implements \Magento\Framework\Option\ArrayInterface @@ -29,33 +29,33 @@ class Group implements \Magento\Framework\Option\ArrayInterface protected $_converter; /** - * @var GroupSourceForLoggedInCustomersInterface + * @var GroupSourceLoggedInOnlyInterface */ - private $groupSourceForLoggedInCustomers; + private $groupSourceLoggedInOnly; /** * @param GroupManagementInterface $groupManagement * @param \Magento\Framework\Convert\DataObject $converter - * @param GroupSourceForLoggedInCustomersInterface $groupSourceForLoggedInCustomers + * @param GroupSourceLoggedInOnlyInterface $groupSourceForLoggedInCustomers */ public function __construct( GroupManagementInterface $groupManagement, \Magento\Framework\Convert\DataObject $converter, - GroupSourceForLoggedInCustomersInterface $groupSourceForLoggedInCustomers = null + GroupSourceLoggedInOnlyInterface $groupSourceForLoggedInCustomers = null ) { $this->_groupManagement = $groupManagement; $this->_converter = $converter; - $this->groupSourceForLoggedInCustomers = $groupSourceForLoggedInCustomers - ?: ObjectManager::getInstance()->get(GroupSourceForLoggedInCustomersInterface::class); + $this->groupSourceLoggedInOnly = $groupSourceForLoggedInCustomers + ?: ObjectManager::getInstance()->get(GroupSourceLoggedInOnlyInterface::class); } /** - * @return array + * @inheritdoc */ public function toOptionArray() { if (!$this->_options) { - $this->_options = $this->groupSourceForLoggedInCustomers->toOptionArray(); + $this->_options = $this->groupSourceLoggedInOnly->toOptionArray(); array_unshift($this->_options, ['value' => '', 'label' => __('-- Please Select --')]); } diff --git a/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php b/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php index 708e3243e2699..adfc78448cdfc 100644 --- a/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php +++ b/app/code/Magento/Customer/Model/Config/Source/Group/Multiselect.php @@ -5,7 +5,9 @@ */ namespace Magento\Customer\Model\Config\Source\Group; +use Magento\Customer\Model\Customer\Attribute\Source\GroupSourceLoggedInOnlyInterface; use Magento\Customer\Api\GroupManagementInterface; +use Magento\Framework\App\ObjectManager; class Multiselect implements \Magento\Framework\Option\ArrayInterface { @@ -17,25 +19,36 @@ class Multiselect implements \Magento\Framework\Option\ArrayInterface protected $_options; /** + * @deprecated * @var GroupManagementInterface */ protected $_groupManagement; /** + * @deprecated * @var \Magento\Framework\Convert\DataObject */ protected $_converter; + /** + * @var GroupSourceLoggedInOnlyInterface + */ + private $groupSourceLoggedInOnly; + /** * @param GroupManagementInterface $groupManagement * @param \Magento\Framework\Convert\DataObject $converter + * @param GroupSourceLoggedInOnlyInterface|null $groupSourceLoggedInOnly */ public function __construct( GroupManagementInterface $groupManagement, - \Magento\Framework\Convert\DataObject $converter + \Magento\Framework\Convert\DataObject $converter, + GroupSourceLoggedInOnlyInterface $groupSourceLoggedInOnly = null ) { $this->_groupManagement = $groupManagement; $this->_converter = $converter; + $this->groupSourceLoggedInOnly = $groupSourceLoggedInOnly + ?: ObjectManager::getInstance()->get(GroupSourceLoggedInOnlyInterface::class); } /** @@ -46,8 +59,7 @@ public function __construct( public function toOptionArray() { if (!$this->_options) { - $groups = $this->_groupManagement->getLoggedInGroups(); - $this->_options = $this->_converter->toOptionArray($groups, 'id', 'code'); + $this->_options = $this->groupSourceLoggedInOnly->toOptionArray(); } return $this->_options; } diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php index 22f196d0c2b95..9af4b7fc67340 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php @@ -6,14 +6,13 @@ namespace Magento\Customer\Model\Customer\Attribute\Source; use Magento\Customer\Api\GroupManagementInterface; -use Magento\Customer\Model\Customer\Source\GroupSourceForLoggedInCustomersInterface; /** * Customer group attribute source * * @author Magento Core Team */ -class Group extends \Magento\Eav\Model\Entity\Attribute\Source\Table implements GroupSourceForLoggedInCustomersInterface +class Group extends \Magento\Eav\Model\Entity\Attribute\Source\Table implements GroupSourceLoggedInOnlyInterface { /** * @var GroupManagementInterface diff --git a/app/code/Magento/Customer/Model/Customer/Source/GroupSourceForLoggedInCustomersInterface.php b/app/code/Magento/Customer/Model/Customer/Attribute/Source/GroupSourceLoggedInOnlyInterface.php similarity index 57% rename from app/code/Magento/Customer/Model/Customer/Source/GroupSourceForLoggedInCustomersInterface.php rename to app/code/Magento/Customer/Model/Customer/Attribute/Source/GroupSourceLoggedInOnlyInterface.php index be44b12314b4b..93df78a1be133 100644 --- a/app/code/Magento/Customer/Model/Customer/Source/GroupSourceForLoggedInCustomersInterface.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Source/GroupSourceLoggedInOnlyInterface.php @@ -4,11 +4,11 @@ * See COPYING.txt for license details. */ -namespace Magento\Customer\Model\Customer\Source; +namespace Magento\Customer\Model\Customer\Attribute\Source; use Magento\Framework\Option\ArrayInterface as OptionArrayInterface; -interface GroupSourceForLoggedInCustomersInterface extends OptionArrayInterface +interface GroupSourceLoggedInOnlyInterface extends OptionArrayInterface { } diff --git a/app/code/Magento/Customer/Model/Customer/Source/Group.php b/app/code/Magento/Customer/Model/Customer/Source/Group.php index 068d960ea777e..5973ec6ffaab3 100644 --- a/app/code/Magento/Customer/Model/Customer/Source/Group.php +++ b/app/code/Magento/Customer/Model/Customer/Source/Group.php @@ -11,7 +11,7 @@ use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Framework\Api\SearchCriteriaBuilder; -class Group implements GroupSourceWithAllGroupsInterface +class Group implements GroupSourceInterface { /** * @var ModuleManager @@ -28,12 +28,6 @@ class Group implements GroupSourceWithAllGroupsInterface */ protected $searchCriteriaBuilder; - /** - * Defines is 'ALL GROUPS' value should be added to options - * @var bool - */ - protected $isShowAllGroupsValue = true; - /** * @param ModuleManager $moduleManager * @param GroupRepositoryInterface $groupRepository @@ -60,13 +54,10 @@ public function toOptionArray() return []; } $customerGroups = []; - - if ($this->isShowAllGroupsValue) { - $customerGroups[] = [ - 'label' => __('ALL GROUPS'), - 'value' => GroupInterface::CUST_GROUP_ALL, - ]; - } + $customerGroups[] = [ + 'label' => __('ALL GROUPS'), + 'value' => GroupInterface::CUST_GROUP_ALL, + ]; /** @var GroupSearchResultsInterface $groups */ $groups = $this->groupRepository->getList($this->searchCriteriaBuilder->create()); diff --git a/app/code/Magento/Customer/Model/Customer/Source/GroupSourceInterface.php b/app/code/Magento/Customer/Model/Customer/Source/GroupSourceInterface.php index 9d0cfe08af83e..d180ad4d491e3 100644 --- a/app/code/Magento/Customer/Model/Customer/Source/GroupSourceInterface.php +++ b/app/code/Magento/Customer/Model/Customer/Source/GroupSourceInterface.php @@ -5,7 +5,6 @@ */ namespace Magento\Customer\Model\Customer\Source; - use Magento\Framework\Option\ArrayInterface as OptionArrayInterface; interface GroupSourceInterface extends OptionArrayInterface diff --git a/app/code/Magento/Customer/Model/Customer/Source/GroupSourceWithAllGroupsInterface.php b/app/code/Magento/Customer/Model/Customer/Source/GroupSourceWithAllGroupsInterface.php deleted file mode 100644 index 75150ef813e97..0000000000000 --- a/app/code/Magento/Customer/Model/Customer/Source/GroupSourceWithAllGroupsInterface.php +++ /dev/null @@ -1,12 +0,0 @@ -groupServiceMock = $this->getMock(\Magento\Customer\Api\GroupManagementInterface::class); $this->converterMock = $this->getMock(\Magento\Framework\Convert\DataObject::class, [], [], '', false); - $this->model = - new \Magento\Customer\Model\Config\Source\Group\Multiselect($this->groupServiceMock, $this->converterMock); + $this->groupSourceLoggedInOnly = $this->getMockBuilder(GroupSourceLoggedInOnlyInterface::class)->getMock(); + $this->model = new \Magento\Customer\Model\Config\Source\Group\Multiselect( + $this->groupServiceMock, + $this->converterMock, + $this->groupSourceLoggedInOnly + ); } public function testToOptionArray() { $expectedValue = ['General', 'Retail']; - $this->groupServiceMock->expects($this->once()) - ->method('getLoggedInGroups') - ->will($this->returnValue($expectedValue)); - $this->converterMock->expects($this->once())->method('toOptionArray') - ->with($expectedValue, 'id', 'code')->will($this->returnValue($expectedValue)); + $this->groupServiceMock->expects($this->never())->method('getLoggedInGroups'); + $this->converterMock->expects($this->never())->method('toOptionArray'); + $this->groupSourceLoggedInOnly->expects($this->once())->method('toOptionArray')->willReturn($expectedValue); $this->assertEquals($expectedValue, $this->model->toOptionArray()); } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Config/Source/GroupTest.php b/app/code/Magento/Customer/Test/Unit/Model/Config/Source/GroupTest.php index d7693a256539d..55b495f9c419b 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Config/Source/GroupTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Config/Source/GroupTest.php @@ -8,14 +8,14 @@ use Magento\Customer\Api\GroupManagementInterface; use Magento\Customer\Model\Config\Source\Group; -use Magento\Customer\Model\Customer\Source\GroupSourceForLoggedInCustomersInterface; +use Magento\Customer\Model\Customer\Attribute\Source\GroupSourceLoggedInOnlyInterface; use Magento\Framework\Convert\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class GroupTest extends \PHPUnit_Framework_TestCase { /** - * @var GroupSourceForLoggedInCustomersInterface|\PHPUnit_Framework_MockObject_MockObject + * @var GroupSourceLoggedInOnlyInterface|\PHPUnit_Framework_MockObject_MockObject */ private $groupSource; @@ -38,7 +38,7 @@ protected function setUp() { $this->groupServiceMock = $this->getMock(GroupManagementInterface::class); $this->converterMock = $this->getMock(DataObject::class, [], [], '', false); - $this->groupSource = $this->getMockBuilder(GroupSourceForLoggedInCustomersInterface::class) + $this->groupSource = $this->getMockBuilder(GroupSourceLoggedInOnlyInterface::class) ->getMockForAbstractClass(); $this->model = (new ObjectManager($this))->getObject( Group::class, diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 5229a709ed4dd..ebde958f75bc1 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -51,12 +51,10 @@ type="Magento\Customer\Helper\View" /> - - + type="Magento\Customer\Model\Customer\Source\Group" /> + Magento\Customer\Model\Config\Share\Proxy From 53de3d04217b88dacb5fab691f79260bea3571b6 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 26 Aug 2016 09:23:14 -0500 Subject: [PATCH 0324/3232] MAGETWO-57271: Modify escapeHtml function to filter not allowed attributes and tags Modifying function to filter not allowed tags and attributes --- lib/internal/Magento/Framework/Escaper.php | 2 +- .../Framework/Test/Unit/EscaperTest.php | 47 ++++++++++++------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index 9ee3b0aa9d4a8..ab9186821e24b 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -74,7 +74,7 @@ function($errorNumber, $errorString, $errorFile, $errorLine) { $nodes = $xpath->query('//node()[name() != \'' . implode('\' and name() != \'', array_merge($allowedTags, ['html', 'body'])) . '\']'); foreach ($nodes as $node) { - if ($node->nodeName != '#text') { + if ($node->nodeName != '#text' && $node->nodeName != '#comment') { $node->parentNode->replaceChild($dom->createTextNode($node->textContent), $node); } } diff --git a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php index a0b8b238a1e7d..493dd4742f02d 100644 --- a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php @@ -46,20 +46,31 @@ public function testEscapeHtml($data, $expected, $allowedTags = null) */ public function escapeHtmlDataProvider() { - $zendEscaper = new \Magento\Framework\ZendEscaper(); return [ 'array data' => [ - 'data' => ['one', 'three'], - 'expected' => ['one', '<two>three</two>'], - null, + 'data' => [ + 'one', + 'three' + ], + 'expected' => [ + 'one', + '<two>three</two>' + ], + [], ], 'string data conversion' => [ 'data' => 'three', 'expected' => '<two>three</two>', - null, + [], + ], + 'string data no conversion' => [ + 'data' => 'one', + 'expected' => 'one' + ], + 'string data with special chars' => [ + 'data' => '&<>"\'', + 'expected' => '&<>"'' ], - 'string data no conversion' => ['data' => 'one', 'expected' => 'one'], - 'string data with special chars' => ['data' => '&<>"\'', 'expected' => '&<>"''], 'string data with allowed tags' => [ 'data' => 'some text in tags', 'expected' => 'some text in tags', @@ -90,11 +101,13 @@ public function escapeHtmlDataProvider() 'expected' => 'Only 2 in stock', 'allowedTags' => ['span', 'b'], ], -// 'string data with allowed tags with attributes 6' => [ -// 'data' => 'Only ")>2 in stock', -// 'expected' => 'Only 2 in stock', -// 'allowedTags' => ['span', 'b'], -// ], + /* + 'string data with allowed tags with attributes 6' => [ + 'data' => 'Only ")>2 in stock', + 'expected' => 'Only 2 in stock', + 'allowedTags' => ['span', 'b'], + ], + */ 'string data with allowed tags with attributes and not allowed tags' => [ 'data' => 'Only registered users can write reviews. Please Sign inthree or create an account', 'expected' => 'Only registered users can write reviews. Please Sign inthree or create an account', @@ -105,11 +118,11 @@ public function escapeHtmlDataProvider() 'expected' => 'Some test text in span tag text in strong tag Click herealert(1)', 'allowedTags' => ['a', 'span'], ], -// 'string data with allowed tags and html comment' => [ -// 'data' => 'Only 2 in stock ', -// 'expected' => 'Only 2 in stock ', -// 'allowedTags' => ['span', 'b'], -// ], + 'string data with allowed tags and html comment' => [ + 'data' => 'Only 2 in stock ', + 'expected' => 'Only 2 in stock ', + 'allowedTags' => ['span', 'b'], + ], ]; } From f27635e8244fc20061a399a73915c082ec28489f Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 26 Aug 2016 09:33:46 -0500 Subject: [PATCH 0325/3232] MAGETWO-57271: Modify escapeHtml function to filter not allowed attributes and tags Modifying function to filter not allowed tags and attributes --- lib/internal/Magento/Framework/Escaper.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index ab9186821e24b..60bc084ef55eb 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -36,7 +36,7 @@ public function escapeHtml($data, $allowedTags = []) } } elseif (strlen($data)) { if (is_array($allowedTags) && !empty($allowedTags)) { - $result = $this->escapeHtmlTagsAndAttributes($data, $allowedTags); + $result = $this->filterHtmlTagsAndAttributes($data, $allowedTags); } else { $result = htmlspecialchars($data, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', false); } @@ -47,18 +47,21 @@ public function escapeHtml($data, $allowedTags = []) } /** - * Escape not allowed HTML entities + * Filter not allowed HTML entities * * @param string $string * @param string[] $allowedTags * @return string */ - private function escapeHtmlTagsAndAttributes($string, $allowedTags) + private function filterHtmlTagsAndAttributes($string, $allowedTags) { $wrapperElementId = uniqid(); $dom = new \DOMDocument('1.0', 'UTF-8'); set_error_handler( - function($errorNumber, $errorString, $errorFile, $errorLine) { + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + function ($errorNumber, $errorString, $errorFile, $errorLine) { throw new \Exception($errorString, $errorNumber); } ); From 8bf6a8596182137b3d37011364b5558ced754925 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 26 Aug 2016 09:40:20 -0500 Subject: [PATCH 0326/3232] MAGETWO-57271: Modify escapeHtml function to filter not allowed attributes and tags Modifying function to filter not allowed tags and attributes --- lib/internal/Magento/Framework/Escaper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index 60bc084ef55eb..19ffe83fa362a 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -47,7 +47,7 @@ public function escapeHtml($data, $allowedTags = []) } /** - * Filter not allowed HTML entities + * Filter not allowed tags and attribtues * * @param string $string * @param string[] $allowedTags From 0e71b9b4eb8b44b97b67c43403d1f80545c8f67b Mon Sep 17 00:00:00 2001 From: Rodion Savchuk Date: Fri, 26 Aug 2016 18:34:34 +0300 Subject: [PATCH 0327/3232] MTA-3450: Update dataset for CreateBundleProductEntityTest with Tier price --- .../Test/TestCase/CreateBundleProductEntityTest.xml | 2 +- .../Catalog/Test/Constraint/AssertProductInCart.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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 feaec78cd996d..a9b9ba948e28f 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 @@ -337,7 +337,7 @@ bundle-product-%isolation% Bundle Fixed %isolation% No - sku_bundle_fixed_%isolation%% + sku_bundle_fixed_%isolation% No 100 fixed-100 diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php index fad2003c23d66..199d471687395 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php @@ -78,8 +78,8 @@ public function processAssert( */ protected function countPrices(FixtureInterface $product, CheckoutCart $checkoutCart) { - $this->getFormPrice($product, $checkoutCart); - $this->getFixturePrice($product); + $this->setFormPrice($product, $checkoutCart); + $this->setFixturePrice($product); $this->countSpecialPrice($product); $this->countCheckoutCartItemPrice($product); $this->countCustomOptionsPrice($product); @@ -91,7 +91,7 @@ protected function countPrices(FixtureInterface $product, CheckoutCart $checkout * @param FixtureInterface $product * @return void */ - protected function getFixturePrice(FixtureInterface $product) + protected function setFixturePrice(FixtureInterface $product) { /** @var CatalogProductSimple $product */ $this->fixturePrice = $product->getPrice(); @@ -119,7 +119,7 @@ protected function countSpecialPrice(FixtureInterface $product) * @param CheckoutCart $checkoutCart * @return void */ - protected function getFormPrice(FixtureInterface $product, CheckoutCart $checkoutCart) + protected function setFormPrice(FixtureInterface $product, CheckoutCart $checkoutCart) { $checkoutCart->open(); $cartItem = $checkoutCart->getCartBlock()->getCartItem($product); From a54e5d6a386f49481e0ea5ca131704c72dd33579 Mon Sep 17 00:00:00 2001 From: Rodion Savchuk Date: Fri, 26 Aug 2016 19:06:04 +0300 Subject: [PATCH 0328/3232] MTA-3450: Update dataset for CreateBundleProductEntityTest with Tier price --- .../Test/Constraint/AssertProductInCart.php | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php index 199d471687395..e698691faa64d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCart.php @@ -78,25 +78,14 @@ public function processAssert( */ protected function countPrices(FixtureInterface $product, CheckoutCart $checkoutCart) { - $this->setFormPrice($product, $checkoutCart); - $this->setFixturePrice($product); + /** @var CatalogProductSimple $product */ + $this->fixturePrice = $product->getPrice(); + $this->prepareFormPrice($product, $checkoutCart); $this->countSpecialPrice($product); $this->countCheckoutCartItemPrice($product); $this->countCustomOptionsPrice($product); } - /** - * Get fixture price. - * - * @param FixtureInterface $product - * @return void - */ - protected function setFixturePrice(FixtureInterface $product) - { - /** @var CatalogProductSimple $product */ - $this->fixturePrice = $product->getPrice(); - } - /** * Count count special price. * @@ -113,13 +102,13 @@ protected function countSpecialPrice(FixtureInterface $product) } /** - * Get form price. + * Prepare form price. * * @param FixtureInterface $product * @param CheckoutCart $checkoutCart * @return void */ - protected function setFormPrice(FixtureInterface $product, CheckoutCart $checkoutCart) + protected function prepareFormPrice(FixtureInterface $product, CheckoutCart $checkoutCart) { $checkoutCart->open(); $cartItem = $checkoutCart->getCartBlock()->getCartItem($product); From c05445091520c011ba538dc0a61fd84b5a342e5f Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Fri, 26 Aug 2016 19:10:35 +0300 Subject: [PATCH 0329/3232] MAGETWO-54460: Admin user with access to only one website is unable to edit a product - added test --- .../Collection/AbstractCollectionTest.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/app/code/Magento/Rule/Test/Unit/Model/ResourceModel/Rule/Collection/AbstractCollectionTest.php b/app/code/Magento/Rule/Test/Unit/Model/ResourceModel/Rule/Collection/AbstractCollectionTest.php index 1ea2a5205a51f..b67eee9fd9ec6 100644 --- a/app/code/Magento/Rule/Test/Unit/Model/ResourceModel/Rule/Collection/AbstractCollectionTest.php +++ b/app/code/Magento/Rule/Test/Unit/Model/ResourceModel/Rule/Collection/AbstractCollectionTest.php @@ -45,6 +45,16 @@ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase */ protected $_db; + /** + * @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $connectionMock; + + /** + * @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject + */ + private $selectMock; + protected function setUp() { $this->_entityFactoryMock = $this->getMock(\Magento\Framework\Data\Collection\EntityFactoryInterface::class); @@ -152,6 +162,30 @@ public function testAddWebsiteFilter() ); } + public function testAddWebsiteFilterArray() + { + $this->selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->connectionMock->expects($this->atLeastOnce()) + ->method('quoteInto') + ->with($this->equalTo('website. IN (?)'), $this->equalTo(['2', '3'])) + ->willReturn(true); + + $this->abstractCollection->expects($this->atLeastOnce())->method('getSelect')->willReturn($this->selectMock); + $this->abstractCollection->expects($this->atLeastOnce())->method('getConnection') + ->willReturn($this->connectionMock); + + $this->assertInstanceOf( + \Magento\Rule\Model\ResourceModel\Rule\Collection\AbstractCollection::class, + $this->abstractCollection->addWebsiteFilter(['2', '3']) + ); + } + public function testAddFieldToFilter() { $this->_prepareAddFilterStubs(); From 79b59294b56cf9e43130544b57da1aa62b946518 Mon Sep 17 00:00:00 2001 From: Ostap Smolyar Date: Fri, 26 Aug 2016 19:10:51 +0300 Subject: [PATCH 0330/3232] MTA-3451: Update dataset for CreateBundleProductEntityTest with Special price --- dev/tests/functional/credentials.xml.dist | 32 +++++++++++++++++++ .../Constraint/AssertBundleProductPage.php | 8 +++-- .../BundleProduct/BundleSelections.xml | 2 +- .../CreateBundleProductEntityTest.xml | 6 ++-- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/dev/tests/functional/credentials.xml.dist b/dev/tests/functional/credentials.xml.dist index 3c61630fb148d..88794d183e878 100644 --- a/dev/tests/functional/credentials.xml.dist +++ b/dev/tests/functional/credentials.xml.dist @@ -27,4 +27,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 f3c2a1e38af1f..8e113996bda07 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 @@ -69,9 +69,13 @@ protected function verifySpecialPrice() } $regularPrice = $priceBlock->getOldPrice(); - $expectedRegularPrice = $this->product->getDataFieldConfig('price')['source']->getPriceData()['regular_from']; + $priceData = $this->product->getDataFieldConfig('price')['source']->getPriceData(); + + if (!isset($priceData['regular_from'])) { + return 'Regular from price not set.'; + } - if ($expectedRegularPrice != $regularPrice) { + if ($priceData['regular_from'] != $regularPrice) { return 'Bundle regular price on product view page is not correct.'; } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml index 57037eb026b2c..69c0a7c771699 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml @@ -605,7 +605,7 @@ - + Drop-down Option 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 9a3c2224a5e4c..80d3156f1a41d 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 @@ -7,7 +7,7 @@ --> - + bundle-product-%isolation% Bundle Fixed %isolation% @@ -368,7 +368,7 @@ sku_bundle_dynamic_%isolation% Yes dynamic-18 - dynamic-two-special + dynamic_with_two_required_options_assigned_products_with_special_price From bebb2ceb000b9296f9b04ecd5424ef66cd723fbf Mon Sep 17 00:00:00 2001 From: dvilchynskyi Date: Fri, 26 Aug 2016 19:13:43 +0300 Subject: [PATCH 0331/3232] MAGETWO-55594: Urgent - Opening product in Admin is very slow - fix related functional test --- .../Product/Form/Modifier/CategoriesTest.php | 35 ++ .../Product/Form/Modifier/Categories.php | 48 ++- .../base/web/js/form/components/fieldset.js | 28 +- .../base/web/js/form/element/ui-select.js | 343 +++++++++++------- .../base/web/templates/form/fieldset.html | 12 +- .../filters/elements/ui-select-optgroup.html | 2 + .../grid/filters/elements/ui-select.html | 2 +- .../web/templates/modal/modal-component.html | 7 +- .../Adminhtml/Category/Edit/CategoryForm.xml | 22 +- ...sertAddedProductAttributeOnProductForm.php | 8 +- .../Promo/Catalog/Edit/PromoForm.xml | 13 +- .../Promo/Quote/Edit/PromoQuoteForm.xml | 12 +- .../Ui/Test/Block/Adminhtml/FormSections.php | 86 ++--- 13 files changed, 383 insertions(+), 235 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php index f913779fc526e..2070a64884b11 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php @@ -8,6 +8,7 @@ use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection; +use Magento\Framework\App\CacheInterface; use Magento\Framework\DB\Helper as DbHelper; use Magento\Framework\UrlInterface; use Magento\Store\Model\Store; @@ -112,4 +113,38 @@ public function testModifyMeta() $this->assertArrayHasKey($groupCode, $this->getModel()->modifyMeta($meta)); } + + public function testModifyMetaWithCaching() + { + $this->arrayManagerMock->expects($this->exactly(2)) + ->method('findPath') + ->willReturn(true); + $cacheManager = $this->getMockBuilder(CacheInterface::class) + ->getMockForAbstractClass(); + $cacheManager->expects($this->once()) + ->method('load') + ->with(Categories::CATEGORY_TREE_ID . '_'); + $cacheManager->expects($this->once()) + ->method('save'); + + $modifier = $this->createModel(); + $cacheContextProperty = new \ReflectionProperty( + Categories::class, + 'cacheManager' + ); + $cacheContextProperty->setAccessible(true); + $cacheContextProperty->setValue($modifier, $cacheManager); + + $groupCode = 'test_group_code'; + $meta = [ + $groupCode => [ + 'children' => [ + 'category_ids' => [ + 'sortOrder' => 10, + ], + ], + ], + ]; + $modifier->modifyMeta($meta); + } } diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index b0e663532e869..0e46b5899851f 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -7,6 +7,8 @@ use Magento\Catalog\Model\Locator\LocatorInterface; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\CacheInterface; use Magento\Framework\DB\Helper as DbHelper; use Magento\Catalog\Model\Category as CategoryModel; use Magento\Framework\UrlInterface; @@ -14,9 +16,16 @@ /** * Data provider for categories field of product page + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Categories extends AbstractModifier { + /**#@+ + * Category tree cache id + */ + const CATEGORY_TREE_ID = 'CATALOG_PRODUCT_CATEGORY_TREE'; + /**#@-*/ + /** * @var CategoryCollectionFactory */ @@ -29,6 +38,7 @@ class Categories extends AbstractModifier /** * @var array + * @deprecated */ protected $categoriesTrees = []; @@ -47,6 +57,11 @@ class Categories extends AbstractModifier */ protected $arrayManager; + /** + * @var CacheInterface + */ + private $cacheManager; + /** * @param LocatorInterface $locator * @param CategoryCollectionFactory $categoryCollectionFactory @@ -68,6 +83,21 @@ public function __construct( $this->arrayManager = $arrayManager; } + /** + * Retrieve cache interface + * + * @return CacheInterface + * @deprecated + */ + private function getCacheManager() + { + if (!$this->cacheManager) { + $this->cacheManager = ObjectManager::getInstance() + ->get(CacheInterface::class); + } + return $this->cacheManager; + } + /** * {@inheritdoc} */ @@ -254,8 +284,9 @@ protected function customizeCategoriesField(array $meta) */ protected function getCategoriesTree($filter = null) { - if (isset($this->categoriesTrees[$filter])) { - return $this->categoriesTrees[$filter]; + $categoryTree = $this->getCacheManager()->load(self::CATEGORY_TREE_ID . '_' . $filter); + if ($categoryTree) { + return unserialize($categoryTree); } $storeId = $this->locator->getStore()->getId(); @@ -307,9 +338,16 @@ protected function getCategoriesTree($filter = null) $categoryById[$category->getId()]['label'] = $category->getName(); $categoryById[$category->getParentId()]['optgroup'][] = &$categoryById[$category->getId()]; } + + $this->getCacheManager()->save( + serialize($categoryById[CategoryModel::TREE_ROOT_ID]['optgroup']), + self::CATEGORY_TREE_ID . '_' . $filter, + [ + \Magento\Catalog\Model\Category::CACHE_TAG, + \Magento\Framework\App\Cache\Type\Block::CACHE_TAG + ] + ); - $this->categoriesTrees[$filter] = $categoryById[CategoryModel::TREE_ROOT_ID]['optgroup']; - - return $this->categoriesTrees[$filter]; + return $categoryById[CategoryModel::TREE_ROOT_ID]['optgroup']; } } diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js b/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js index c400fcac43a9a..d3de0062f6b5b 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js @@ -19,6 +19,9 @@ define([ level: 0, visible: true, disabled: false, + listens: { + 'opened': 'onVisibilityChange' + }, additionalClasses: {} }, @@ -30,7 +33,19 @@ define([ _.bindAll(this, 'onChildrenUpdate', 'onChildrenError', 'onContentLoading'); return this._super() - ._setClasses(); + ._setClasses(); + }, + + /** + * Initializes components' configuration. + * + * @returns {Fieldset} Chainable. + */ + initConfig: function () { + this._super(); + this._wasOpened = this.opened || !this.collapsible; + + return this; }, /** @@ -116,6 +131,17 @@ define([ return this; }, + /** + * Handler of the "opened" property changes. + * + * @param {Boolean} isOpened + */ + onVisibilityChange: function (isOpened) { + if (!this._wasOpened) { + this._wasOpened = isOpened; + } + }, + /** * Is being invoked on children validation error. * Sets error property to one incoming. diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js b/app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js index 393b0f04e512c..fdaf675f674fa 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js @@ -9,7 +9,8 @@ define([ 'Magento_Ui/js/lib/key-codes', 'mage/translate', 'ko', - 'jquery' + 'jquery', + 'Magento_Ui/js/lib/view/utils/async' ], function (_, Abstract, keyCodes, $t, ko, $) { 'use strict'; @@ -148,9 +149,14 @@ define([ showPath: true, labelsDecoration: false, disableLabel: false, + filterRateLimit: 500, closeBtnLabel: $t('Done'), optgroupTmpl: 'ui/grid/filters/elements/ui-select-optgroup', quantityPlaceholder: $t('options'), + hoverClass: '_hover', + rootListSelector: 'ul.admin__action-multiselect-menu-inner._root', + visibleOptionSelector: 'li.admin__action-multiselect-menu-inner-item:visible', + actionTargetSelector: '.action-menu-item', selectedPlaceholders: { defaultPlaceholder: $t('Select...'), lotPlaceholders: $t('Selected') @@ -179,6 +185,23 @@ define([ } }, + /** + * Initializes UISelect component. + * + * @returns {UISelect} Chainable. + */ + initialize: function () { + this._super(); + + $.async( + this.rootListSelector, + this, + this.onRootListRender.bind(this) + ); + + return this; + }, + /** * Parses options and merges the result with instance * Set defaults according to mode and levels configuration @@ -281,6 +304,8 @@ define([ 'filterOptionsFocus' ]); + this.filterInputValue.extend({rateLimit: this.filterRateLimit}); + return this; }, @@ -307,17 +332,22 @@ define([ * @returns {Boolean} level visibility. */ showLevels: function (data) { - var curLevel = ++data.level; + var curLevel = ++data.level, + isVisible; - if (!data.visible) { - data.visible = ko.observable(!!data.hasOwnProperty(this.separator) && + if (data.visible) { + isVisible = data.visible(); + } else { + isVisible = !!data.hasOwnProperty(this.separator) && _.isBoolean(this.levelsVisibility) && this.levelsVisibility || - data.hasOwnProperty(this.separator) && parseInt(this.levelsVisibility, 10) >= curLevel); + data.hasOwnProperty(this.separator) && parseInt(this.levelsVisibility, 10) >= curLevel; + data.visible = ko.observable(isVisible); + data.isVisited = isVisible; } - return data.visible(); + return isVisible; }, /** @@ -398,7 +428,11 @@ define([ var value = this.filterInputValue().trim().toLowerCase(), array = []; - if (value === '') { + if (value && value.length < 2) { + return false; + } + + if (!value) { this.renderPath = false; this.options(this.cacheOptions.tree); this._setItemsQuantity(false); @@ -509,8 +543,12 @@ define([ * @returns {Object} Chainable */ cleanHoveredElement: function () { - if (!_.isNull(this.hoverElIndex())) { - this.hoverElIndex(null); + if (this.hoveredElement) { + $(this.hoveredElement) + .children(this.actionTargetSelector) + .removeClass(this.hoverClass); + + this.hoveredElement = null; } return this; @@ -543,14 +581,16 @@ define([ * @return {Boolean} */ isHovered: function (data) { - var index = this.getOptionIndex(data), - status = this.hoverElIndex() === index; + var element = this.hoveredElement, + elementData; - if (this.selectType === 'optgroup' && data.hasOwnProperty(this.separator)) { + if (!element) { return false; } - return status; + elementData = ko.dataFor(this.hoveredElement); + + return data.value === elementData.value; }, /** @@ -612,10 +652,10 @@ define([ * Change visibility to child level * * @param {Object} data - element data - * @param {Object} elem - element */ - openChildLevel: function (data, elem) { - var contextElement; + openChildLevel: function (data) { + var contextElement = data, + isVisible; if ( this.openLevelsAction && @@ -623,8 +663,13 @@ define([ this.openLevelsAction && data.hasOwnProperty(this.separator) && parseInt(this.levelsVisibility, 10) <= data.level ) { - contextElement = ko.contextFor($(elem).parents('li').children('ul')[0]).$data.current; - contextElement.visible(!contextElement.visible()); + isVisible = !contextElement.visible(); + + if (isVisible && !contextElement.isVisited) { + contextElement.isVisited = true; + } + + contextElement.visible(isVisible); } }, @@ -642,25 +687,23 @@ define([ }, /** - * Add hover to some list element and clears element ID to variable + * @deprecated + */ + onMousemove: function () {}, + + /** + * Handles hover on list items. * - * @param {Object} data - object with data about this element - * @param {Number} index - element index * @param {Object} event - mousemove event */ - onMousemove: function (data, index, event) { - var id, - context = ko.contextFor(event.target); + onDelegatedMouseMouve: function (event) { + var target = $(event.currentTarget).closest(this.visibleOptionSelector)[0]; - if (this.isCursorPositionChange(event)) { - return false; + if (this.isCursorPositionChange(event) || this.hoveredElement === target) { + return; } - if (typeof context.$data === 'object') { - id = this.getOptionIndex(context.$data); - } - - id !== this.hoverElIndex() ? this.hoverElIndex(id) : false; + this._hoverTo(target); this.setCursorPosition(event); }, @@ -736,8 +779,8 @@ define([ } if (this.listVisible()) { - if (!_.isNull(this.hoverElIndex())) { - this.toggleOptionSelected(this.cacheOptions.plain[this.hoverElIndex()]); + if (this.hoveredElement) { + this.toggleOptionSelected(ko.dataFor(this.hoveredElement)); } } else { this.setListVisible(true); @@ -756,35 +799,7 @@ define([ * selected first option in list */ pageDownKeyHandler: function () { - var el, - nextEl, - nextData, - nextIndex; - - if (!this.listVisible()) { - return false; - } - - if (this.filterInputValue()) { - el = !_.isNull(this.hoverElIndex()) ? - this._getElemByData(this.cacheOptions.plain[this.hoverElIndex()]) : false; - nextEl = el ? el.next() : $(this.cacheUiSelect).find('li:visible').eq(0); - nextIndex = nextEl.length ? nextEl.index() : 0; - nextData = this.options()[nextIndex]; - this.hoverElIndex(this.getOptionIndex(nextData)); - - return false; - } - - if (!_.isNull(this.hoverElIndex()) && this.hoverElIndex() !== this.cacheOptions.plain.length - 1) { - this._setHoverToElement(1); - this._scrollTo(this.hoverElIndex()); - - return false; - } - - this._setHoverToElement(1, -1); - this._scrollTo(this.hoverElIndex()); + this._setHoverToElement(1); }, /** @@ -813,28 +828,19 @@ define([ * Set hover to visible element * * @param {Number} direction - iterator - * @param {Number} index - current hovered element - * @param {Array} list - collection items */ - _setHoverToElement: function (direction, index, list) { - var modifiedIndex, - curData, - canBeHovered = true; - - list = list || $(this.cacheUiSelect).find('li'); - index = index || _.isNumber(index) ? index : this.hoverElIndex(); - modifiedIndex = index + direction; - modifiedIndex < 0 ? modifiedIndex = this.cacheOptions.plain.length - 1 : false; - curData = this.cacheOptions.plain[modifiedIndex]; + _setHoverToElement: function (direction) { + var element; - if (this.selectType === 'optgroup' && !_.findWhere(this.cacheOptions.lastOptions, {value: curData.value})) { - canBeHovered = false; + if (direction === 1) { + element = this._getNextElement(); + } else if (direction === -1) { + element = this._getPreviousElement(); } - if (list.eq(modifiedIndex).is(':visible') && canBeHovered) { - this.hoverElIndex(modifiedIndex); - } else { - this._setHoverToElement(direction, modifiedIndex, list); + if (element) { + this._hoverTo(element); + this._scrollTo(element); } }, @@ -844,18 +850,15 @@ define([ * * @param {Number} index - element index */ - _scrollTo: function (index) { - var curEl, - parents, - wrapper, + _scrollTo: function (element) { + var curEl = $(element).children(this.actionTargetSelector), + wrapper = $(this.rootList), curElPos = {}, wrapperPos = {}; - curEl = $(this.cacheUiSelect).find('li').eq(index); - parents = curEl.parents('ul'); - wrapper = parents.eq(parents.length - 1); curElPos.start = curEl.offset().top; - curElPos.end = curElPos.start + curEl.height(); + curElPos.end = curElPos.start + curEl.outerHeight(); + wrapperPos.start = wrapper.offset().top; wrapperPos.end = wrapperPos.start + wrapper.height(); @@ -871,46 +874,7 @@ define([ * selected last option in list */ pageUpKeyHandler: function () { - var el, - nextEl, - nextIndex, - nextData; - - if (!this.listVisible()) { - return false; - } - - if (this.filterInputValue()) { - el = !_.isNull(this.hoverElIndex()) ? - this._getElemByData(this.cacheOptions.plain[this.hoverElIndex()]) : false; - nextEl = el ? el.prev() : $(this.cacheUiSelect).find('li:visible').eq(this.options().length-1); - nextIndex = nextEl.length ? nextEl.index() : this.options().length-1; - nextData = this.options()[nextIndex]; - this.hoverElIndex(this.getOptionIndex(nextData)); - - return false; - } - - - if (this.filterInputValue()) { - el = !_.isNull(this.hoverElIndex()) ? - this._getElemByData(this.cacheOptions.plain[this.hoverElIndex()]) : false; - nextEl = el ? el.next() : $(this.cacheUiSelect).find('li:visible').eq(0); - nextIndex = nextEl.length ? nextEl.index() : 0; - nextData = this.options()[nextIndex]; - this.hoverElIndex(this.getOptionIndex(nextData)); - - return false; - } - - if (this.hoverElIndex()) { - this._setHoverToElement(-1); - this._scrollTo(this.hoverElIndex()); - - return false; - } - this._setHoverToElement(-1, this.cacheOptions.plain.length); - this._scrollTo(this.hoverElIndex()); + this._setHoverToElement(-1); }, /** @@ -990,6 +954,129 @@ define([ return selected.map(function (option) { return option.label; }).join(', '); + }, + + /** + * Defines previous option element to + * the one that is currently hovered. + * + * @returns {Element} + */ + _getPreviousElement: function () { + var currentElement = this.hoveredElement, + lastElement = this._getLastIn(this.rootList), + previousElement; + + if (!currentElement) { + return lastElement; + } + + previousElement = $(currentElement).prev()[0]; + + return ( + this._getLastIn(previousElement) || + previousElement || + this._getFirstParentOf(currentElement) || + lastElement + ); + }, + + /** + * Defines next option element to + * the one that is currently hovered. + * + * @returns {Element} + */ + _getNextElement: function () { + var currentElement = this.hoveredElement, + firstElement = this._getFirstIn(this.rootList); + + if (!currentElement) { + return firstElement; + } + + return ( + this._getFirstIn(currentElement) || + $(currentElement).next()[0] || + this._getParentsOf(currentElement).next()[0] || + firstElement + ); + }, + + /** + * Returns first option element in provided scope. + * + * @param {Element} scope + * @returns {Element} + */ + _getFirstIn: function (scope) { + return $(scope).find(this.visibleOptionSelector)[0]; + }, + + /** + * Returns last descendant option element in provided scope. + * + * @param {Element} scope + * @returns {Element} + */ + _getLastIn: function (scope) { + return $(scope).find(this.visibleOptionSelector).last()[0]; + }, + + /** + * Returns a collection of parent option elements. + * + * @param {Element} scope + * @returns {jQueryCollection} + */ + _getParentsOf: function (scope) { + return $(scope).parents(this.visibleOptionSelector); + }, + + /** + * Returns first parent option element. + * + * @param {Element} scope + * @returns {Element} + */ + _getFirstParentOf: function (scope) { + return this._getParentsOf(scope)[0]; + }, + + /** + * Sets hover class to provided option element. + * + * @param {Element} element + */ + _hoverTo: function(element) { + if (this.hoveredElement) { + $(this.hoveredElement) + .children(this.actionTargetSelector) + .removeClass(this.hoverClass); + } + + $(element) + .children(this.actionTargetSelector) + .addClass(this.hoverClass); + + this.hoveredElement = element; + }, + + /** + * Callback which fires when root list element is rendered. + * + * @param {Element} element + */ + onRootListRender: function (element) { + var targetSelector = 'li > ' + this.actionTargetSelector; + + this.rootList = element; + + $(this.rootList).on( + 'mousemove', + targetSelector, + this.onDelegatedMouseMouve.bind(this) + ); } }); }); diff --git a/app/code/Magento/Ui/view/base/web/templates/form/fieldset.html b/app/code/Magento/Ui/view/base/web/templates/form/fieldset.html index b45e5385d037a..6cb7fb62b3a91 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/fieldset.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/fieldset.html @@ -9,7 +9,8 @@ attr="'data-level': $data.level, 'data-index': index" data-bind="visible: $data.visible === undefined ? true: $data.visible">
@@ -30,7 +31,7 @@ + data-bind="i18n: 'This tab contains invalid data. Please resolve this before saving.'"> @@ -43,7 +44,10 @@
-
+ css="'admin__collapsible-content': collapsible, '_show': opened, '_hide': !opened()"> +
diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/filters/elements/ui-select-optgroup.html b/app/code/Magento/Ui/view/base/web/templates/grid/filters/elements/ui-select-optgroup.html index 506aa4381c9b8..5f938b6e34312 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/filters/elements/ui-select-optgroup.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/filters/elements/ui-select-optgroup.html @@ -10,6 +10,7 @@ attr: { 'data-level': $data.current.level++ }"> +
  • @@ -56,4 +57,5 @@
  • + \ No newline at end of file diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/filters/elements/ui-select.html b/app/code/Magento/Ui/view/base/web/templates/grid/filters/elements/ui-select.html index a913d27c8aa5a..fae89160e138e 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/filters/elements/ui-select.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/filters/elements/ui-select.html @@ -178,4 +178,4 @@ - + \ No newline at end of file diff --git a/app/code/Magento/Ui/view/base/web/templates/modal/modal-component.html b/app/code/Magento/Ui/view/base/web/templates/modal/modal-component.html index c856f9fd68d07..8b45955b5a480 100644 --- a/app/code/Magento/Ui/view/base/web/templates/modal/modal-component.html +++ b/app/code/Magento/Ui/view/base/web/templates/modal/modal-component.html @@ -4,9 +4,6 @@ * See COPYING.txt for license details. */ --> - -
    - - - +
    +
    diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml index 593ab70e100ff..1617b710fd51f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml @@ -8,7 +8,7 @@ \Magento\Ui\Test\Block\Adminhtml\Section - div[class=fieldset-wrapper] + [data-index="general"] css selector @@ -31,8 +31,8 @@ \Magento\Ui\Test\Block\Adminhtml\Section - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::select[@name='landing_page']] - xpath + [data-index="content"] + css selector textarea @@ -45,8 +45,8 @@ \Magento\Ui\Test\Block\Adminhtml\Section - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::input[@name='is_anchor']] - xpath + [data-index="display_settings"] + css selector select @@ -83,8 +83,8 @@ \Magento\Ui\Test\Block\Adminhtml\Section - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::input[@name='meta_title']] - xpath + [data-index="search_engine_optimization"] + css selector input @@ -98,13 +98,13 @@ \Magento\Catalog\Test\Block\Adminhtml\Category\Edit\Section\Products - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::div[@id='catalog_category_products']] - xpath + [data-index="assign_products"] + css selector \Magento\Ui\Test\Block\Adminhtml\Section - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::select[@name='page_layout']] - xpath + [data-index="design"] + css selector checkbox diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php index 78e28abebe44b..26cbeb2abae06 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php @@ -67,7 +67,8 @@ public function processAssert( CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null - ) { + ) + { $this->fixtureFactory = $fixtureFactory; $this->catalogProductIndex = $catalogProductIndex; $this->catalogProductEdit = $catalogProductEdit; @@ -92,9 +93,8 @@ public function processAssert( $catalogProductAttribute = ($productAttributeOriginal !== null) ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData(); - if ($catalogProductEdit->getProductForm()->isSectionVisible(self::ATTRIBUTES)) { - $catalogProductEdit->getProductForm()->openSection(self::ATTRIBUTES); - } + $catalogProductEdit->getProductForm()->openSection(self::ATTRIBUTES); + \PHPUnit_Framework_Assert::assertTrue( $catalogProductEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form." diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml index 25e8617faf112..4474370eebbc7 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml @@ -8,8 +8,8 @@ \Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Section\RuleInformation - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::input[@name='name']] - xpath + [data-index="rule_information"] + css selector select @@ -26,19 +26,20 @@ \Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Section\Conditions - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::div[@class='rule-tree']] - xpath + [data-index="block_promo_catalog_edit_tab_conditions"] + css selector [id^="catalog_rule_formrule_conditions_fieldset_"] + css selector conditions \Magento\Ui\Test\Block\Adminhtml\Section - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::select[@name='simple_action']] - xpath + [data-index="actions"] + css selector select diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.xml index cc48c0fc1cfb5..6dcb041efa070 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.xml +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/PromoQuoteForm.xml @@ -40,8 +40,8 @@ \Magento\Ui\Test\Block\Adminhtml\Section - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::div[@class='rule-tree']] - xpath + [data-index="conditions"] + css selector .fieldset[id^="sales_rule_formrule_conditions_fieldset_"] @@ -51,8 +51,8 @@ \Magento\Ui\Test\Block\Adminhtml\Section - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::select[@name='simple_action']] - xpath + [data-index="actions"] + css selector select @@ -77,7 +77,7 @@ \Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit\Section\Labels - //div[contains(@class,'admin__collapsible-block-wrapper')][descendant::input[@name='store_labels[0]']] - xpath + [data-index="labels"] + css selector diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/FormSections.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/FormSections.php index 6a5919b8cb1cf..b5edbc6c79193 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/FormSections.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/FormSections.php @@ -6,50 +6,26 @@ namespace Magento\Ui\Test\Block\Adminhtml; -use Magento\Mtf\Client\Locator; -use Magento\Mtf\Client\ElementInterface; use Magento\Mtf\Fixture\InjectableFixture; /** - * Is used to represent a new unified form with collapsible sections on the page. + * Is used to represent a new unified form with collapsible sections inside. */ class FormSections extends AbstractFormContainers { /** - * CSS locator of the section collapsible title + * CSS locator of collapsed section. * * @var string */ - protected $sectionTitle = '.fieldset-wrapper-title'; + protected $collapsedSection = '[data-state-collapsible="closed"]'; /** - * CSS locator of the section content + * CSS locator of expanded section. * * @var string */ - protected $content = '.admin__fieldset-wrapper-content'; - - /** - * XPath locator of the collapsible fieldset - * - * @var string - */ - protected $collapsible = - 'div[contains(@class,"fieldset-wrapper")][contains(@class,"admin__collapsible-block-wrapper")]'; - - /** - * Locator for opened collapsible tab. - * - * @var string - */ - protected $opened = '._show'; - - /** - * Locator for error messages. - * - * @var string - */ - protected $errorMessages = '[data-ui-id="messages-message-error"]'; + protected $expandedSection = '[data-state-collapsible="open"]'; /** * Get Section class. @@ -72,58 +48,39 @@ protected function openContainer($sectionName) } /** - * Get the section title element - * - * @param string $sectionName - * @return ElementInterface - */ - protected function getSectionTitleElement($sectionName) - { - $container = $this->getContainerElement($sectionName); - return $container->find($this->sectionTitle); - } - - /** - * Opens the section. + * Expand section by its name. * * @param string $sectionName * @return $this */ public function openSection($sectionName) { - if ($this->isCollapsible($sectionName) && !$this->isCollapsed($sectionName)) { - $this->getSectionTitleElement($sectionName)->click(); - } else { - //Scroll to the top of the page so that the page actions header does not overlap any controls - $this->browser->find($this->header)->hover(); + $section = $this->getContainerElement($sectionName)->find($this->collapsedSection); + if ($section->isVisible()) { + $section->click(); } + return $this; } /** - * Checks if the section is collapsible on the form. + * Check if section is collapsible. * + * @deprecated * @param string $sectionName * @return bool */ public function isCollapsible($sectionName) { - $title = $this->getSectionTitleElement($sectionName); - if (!$title->isVisible()) { - return false; - }; - return $title->find('parent::' . $this->collapsible, Locator::SELECTOR_XPATH)->isVisible(); - } + $section = $this->getContainerElement($sectionName); - /** - * Check if collapsible section is opened. - * - * @param string $sectionName - * @return bool - */ - private function isCollapsed($sectionName) - { - return $this->getContainerElement($sectionName)->find($this->opened)->isVisible(); + if ($section->find($this->collapsedSection)->isVisible()) { + return true; + } elseif ($section->find($this->expandedSection)->isVisible()) { + return true; + } else { + return false; + } } /** @@ -151,11 +108,12 @@ public function getRequireNoticeFields(InjectableFixture $product) /** * Check if section is visible. * + * @deprecated * @param string $sectionName * @return bool */ public function isSectionVisible($sectionName) { - return ($this->isCollapsible($sectionName) && !$this->isCollapsed($sectionName)); + return !$this->getContainerElement($sectionName)->find($this->collapsedSection)->isVisible(); } } From a88ff22e6c240a86675ed6e2b9675468aa024f2f Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Fri, 26 Aug 2016 19:30:51 +0300 Subject: [PATCH 0332/3232] MAGETWO-56534: CLONE - Price in cart does not update correctly when price is changed in admin. --- .../Model/Product/Plugin/UpdateQuoteItems.php | 44 +++++++++++++ .../Product/Plugin/UpdateQuoteItemsTest.php | 61 +++++++++++++++++++ app/code/Magento/Quote/etc/di.xml | 3 + 3 files changed, 108 insertions(+) create mode 100644 app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php create mode 100644 app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php diff --git a/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php b/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php new file mode 100644 index 0000000000000..94fe077741feb --- /dev/null +++ b/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php @@ -0,0 +1,44 @@ +resource = $resource; + } + + /** + * @param \Magento\Catalog\Model\ResourceModel\Product $subject + * @param \Closure $proceed + * @param \Magento\Catalog\Api\Data\ProductInterface $product + * @return mixed + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundSave( + \Magento\Catalog\Model\ResourceModel\Product $subject, + \Closure $proceed, + \Magento\Catalog\Api\Data\ProductInterface $product + ) { + $result = $proceed($product); + $originalPrice = $product->getOrigData('price'); + if (!empty($originalPrice) && ($originalPrice != $product->getPrice())) { + $this->resource->markQuotesRecollect($product->getId()); + } + return $result; + } +} diff --git a/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php b/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php new file mode 100644 index 0000000000000..12d79a6da5efc --- /dev/null +++ b/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php @@ -0,0 +1,61 @@ +quoteResource = $this->getMockBuilder(\Magento\Quote\Model\ResourceModel\Quote::class) + ->disableOriginalConstructor() + ->getMock(); + $this->model = new \Magento\Quote\Model\Product\Plugin\UpdateQuoteItems($this->quoteResource); + } + + /** + * @dataProvider aroundUpdateDataProvider + * @param int $originalPrice + * @param int $newPrice + * @param bool $callMethod + */ + public function testAroundUpdate($originalPrice, $newPrice, $callMethod) + { + $productResourceMock = $this->getMock(\Magento\Catalog\Model\ResourceModel\Product::class, [], [], '', false); + $productMock = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getOrigData']) + ->getMockForAbstractClass(); + $closure = function () use ($productResourceMock) { + return $productResourceMock; + }; + $productId = 1; + $productMock->expects($this->any())->method('getOrigData')->with('price')->willReturn($originalPrice); + $productMock->expects($this->any())->method('getPrice')->willReturn($newPrice); + $productMock->expects($this->any())->method('getId')->willReturn($productId); + $this->quoteResource->expects($this->$callMethod())->method('markQuotesRecollect')->with($productId); + $result = $this->model->aroundSave($productResourceMock, $closure, $productMock); + $this->assertEquals($result, $productResourceMock); + } + + public function aroundUpdateDataProvider() + { + return [ + [10, 20, 'once'], + [null, 10, 'never'], + [10, 10, 'never'] + ]; + } +} diff --git a/app/code/Magento/Quote/etc/di.xml b/app/code/Magento/Quote/etc/di.xml index 384f5ca143b86..c4b1f9d1ce802 100644 --- a/app/code/Magento/Quote/etc/di.xml +++ b/app/code/Magento/Quote/etc/di.xml @@ -93,4 +93,7 @@ + + + From 72f684498d763588fdf9f0ee863d6bd211ce19aa Mon Sep 17 00:00:00 2001 From: dvilchynskyi Date: Fri, 26 Aug 2016 19:31:38 +0300 Subject: [PATCH 0333/3232] MAGETWO-55594: Urgent - Opening product in Admin is very slow - fix related static test --- .../Test/Constraint/AssertAddedProductAttributeOnProductForm.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php index 26cbeb2abae06..b98d2a21cb85c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php @@ -68,6 +68,7 @@ public function processAssert( CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null ) + { $this->fixtureFactory = $fixtureFactory; $this->catalogProductIndex = $catalogProductIndex; From 61e834798f6f585936288e1637cc7bb4e92c42c0 Mon Sep 17 00:00:00 2001 From: dvilchynskyi Date: Fri, 26 Aug 2016 19:43:23 +0300 Subject: [PATCH 0334/3232] MAGETWO-55594: Urgent - Opening product in Admin is very slow - fix related static test --- .../Constraint/AssertAddedProductAttributeOnProductForm.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php index b98d2a21cb85c..54bf06f70b5f1 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddedProductAttributeOnProductForm.php @@ -67,9 +67,7 @@ public function processAssert( CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null - ) - - { + ) { $this->fixtureFactory = $fixtureFactory; $this->catalogProductIndex = $catalogProductIndex; $this->catalogProductEdit = $catalogProductEdit; From 343dc7d259e2d9de96efc91b7a1a3c803727cb75 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Fri, 26 Aug 2016 15:13:40 -0500 Subject: [PATCH 0335/3232] MAGETWO-55589: Wrong algorithm for calculation batch size on category indexing - covered changes with unit tests --- .../Framework/DB/Query/BatchIterator.php | 31 ++- .../Test/DB/Query/BatchIteratorTest.php | 182 ++++++++++++++++++ .../Framework/Test/DB/Query/GeneratorTest.php | 141 ++++++++++++++ 3 files changed, 349 insertions(+), 5 deletions(-) create mode 100644 lib/internal/Magento/Framework/Test/DB/Query/BatchIteratorTest.php create mode 100644 lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php diff --git a/lib/internal/Magento/Framework/DB/Query/BatchIterator.php b/lib/internal/Magento/Framework/DB/Query/BatchIterator.php index 86a1a73a20c52..cf5e88c1b9944 100644 --- a/lib/internal/Magento/Framework/DB/Query/BatchIterator.php +++ b/lib/internal/Magento/Framework/DB/Query/BatchIterator.php @@ -58,6 +58,11 @@ class BatchIterator implements \Iterator */ private $rangeFieldAlias; + /** + * @var bool + */ + private $isValid = true; + /** * Initialize dependencies. * @@ -87,6 +92,11 @@ public function __construct( */ public function current() { + if (null == $this->currentSelect) { + $this->currentSelect = $this->initSelectObject(); + $itemsCount = $this->calculateBatchSize($this->currentSelect); + $this->isValid = $itemsCount > 0; + } return $this->currentSelect; } @@ -95,7 +105,18 @@ public function current() */ public function next() { - $this->iteration++; + if (null == $this->currentSelect) { + $this->current(); + } + $select = $this->initSelectObject(); + $itemsCountInSelect = $this->calculateBatchSize($select); + $this->isValid = $itemsCountInSelect > 0; + if ($this->isValid) { + $this->iteration++; + $this->currentSelect = $select; + } else { + $this->currentSelect = null; + } return $this->currentSelect; } @@ -112,9 +133,7 @@ public function key() */ public function valid() { - $this->currentSelect = $this->initSelectObject(); - $batchSize = $this->calculateBatchSize($this->currentSelect); - return $batchSize > 0; + return $this->isValid; } /** @@ -123,7 +142,9 @@ public function valid() public function rewind() { $this->minValue = 0; + $this->currentSelect = null; $this->iteration = 0; + $this->isValid = true; } /** @@ -165,7 +186,7 @@ private function initSelectObject() /** * Reset sort order section from origin select object */ - $object->order($this->correlationName . '.' . $this->rangeField . ' asc'); + $object->order($this->correlationName . '.' . $this->rangeField . ' ' . \Magento\Framework\DB\Select::SQL_ASC); return $object; } } diff --git a/lib/internal/Magento/Framework/Test/DB/Query/BatchIteratorTest.php b/lib/internal/Magento/Framework/Test/DB/Query/BatchIteratorTest.php new file mode 100644 index 0000000000000..f7adfce36a951 --- /dev/null +++ b/lib/internal/Magento/Framework/Test/DB/Query/BatchIteratorTest.php @@ -0,0 +1,182 @@ +batchSize = 10; + $this->correlationName = 'correlationName'; + $this->rangeField = 'rangeField'; + $this->rangeFieldAlias = 'rangeFieldAlias'; + + $this->selectMock = $this->getMock(Select::class, [], [], '', false, false); + $this->wrapperSelectMock = $this->getMock(Select::class, [], [], '', false, false); + $this->connectionMock = $this->getMock(AdapterInterface::class); + $this->connectionMock->expects($this->any())->method('select')->willReturn($this->wrapperSelectMock); + $this->selectMock->expects($this->once())->method('getConnection')->willReturn($this->connectionMock); + $this->connectionMock->expects($this->any())->method('quoteIdentifier')->willReturnArgument(0); + + $this->model = new BatchIterator( + $this->selectMock, + $this->batchSize, + $this->correlationName, + $this->rangeField, + $this->rangeFieldAlias + ); + } + + /** + * Test steps: + * 1. $iterator->current(); + * 2. $iterator->current(); + * 3. $iterator->key(); + */ + public function testCurrent() + { + $filed = $this->correlationName . '.' . $this->rangeField; + + $this->selectMock->expects($this->once())->method('where')->with($filed . ' > ?', 0); + $this->selectMock->expects($this->once())->method('limit')->with($this->batchSize); + $this->selectMock->expects($this->once())->method('order')->with($filed . ' ASC'); + $this->assertEquals($this->selectMock, $this->model->current()); + $this->assertEquals($this->selectMock, $this->model->current()); + $this->assertEquals(0, $this->model->key()); + } + + /** + * SQL: select * from users + * Batch size: 10 + * IDS: [1 - 25] + * Items count: 25 + * Expected batches: [1-10, 11-20, 20-25] + * + * Test steps: + * 1. $iterator->rewind(); + * 2. $iterator->valid(); + * 3. $iterator->current(); + * 4. $iterator->key(); + * + * 1. $iterator->next() + * 2. $iterator->valid(); + * 3. $iterator->current(); + * 4. $iterator->key(); + * + * 1. $iterator->next() + * 2. $iterator->valid(); + * 3. $iterator->current(); + * 4. $iterator->key(); + * + * + * 1. $iterator->next() + * 2. $iterator->valid(); + * + */ + public function testIterations() + { + $startCallIndex = 3; + $stepCall = 4; + + $this->connectionMock->expects($this->at($startCallIndex)) + ->method('fetchRow') + ->willReturn(['max' => 10, 'cnt' => 10]); + + $this->connectionMock->expects($this->at($startCallIndex += $stepCall)) + ->method('fetchRow') + ->willReturn(['max' => 20, 'cnt' => 10]); + + $this->connectionMock->expects($this->at($startCallIndex += $stepCall)) + ->method('fetchRow') + ->willReturn(['max' => 25, 'cnt' => 5]); + + $this->connectionMock->expects($this->at($startCallIndex += $stepCall)) + ->method('fetchRow') + ->willReturn(['max' => null, 'cnt' => 0]); + + /** + * Test 3 iterations + * [1-10, 11-20, 20-25] + */ + $iteration = 0; + $result = []; + foreach ($this->model as $key => $select) { + $result[] = $select; + $this->assertEquals($iteration, $key); + $iteration++; + } + $this->assertCount(3, $result); + } + + /** + * Test steps: + * 1. $iterator->next(); + * 2. $iterator->key() + * 3. $iterator->next(); + * 4. $iterator->current() + * 5. $iterator->key() + */ + public function testNext() + { + $filed = $this->correlationName . '.' . $this->rangeField; + $this->selectMock->expects($this->at(0))->method('where')->with($filed . ' > ?', 0); + $this->selectMock->expects($this->exactly(3))->method('limit')->with($this->batchSize); + $this->selectMock->expects($this->exactly(3))->method('order')->with($filed . ' ASC'); + $this->selectMock->expects($this->at(3))->method('where')->with($filed . ' > ?', 25); + + $this->wrapperSelectMock->expects($this->exactly(3))->method('from')->with( + $this->selectMock, + [ + new \Zend_Db_Expr('MAX(' . $this->rangeFieldAlias . ') as max'), + new \Zend_Db_Expr('COUNT(*) as cnt') + ] + ); + $this->connectionMock->expects($this->exactly(3)) + ->method('fetchRow') + ->with($this->wrapperSelectMock) + ->willReturn([ + 'max' => 25, + 'cnt' => 10 + ] + ); + + $this->assertEquals($this->selectMock, $this->model->next()); + $this->assertEquals(1, $this->model->key()); + + $this->assertEquals($this->selectMock, $this->model->next()); + $this->assertEquals($this->selectMock, $this->model->current()); + $this->assertEquals(2, $this->model->key()); + } +} diff --git a/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php b/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php new file mode 100644 index 0000000000000..dc54ef3033178 --- /dev/null +++ b/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php @@ -0,0 +1,141 @@ +factoryMock = $this->getMock(BatchIteratorFactory::class, [], [], '', false, false); + $this->selectMock = $this->getMock(Select::class, [], [], '', false, false); + $this->iteratorMock = $this->getMock(BatchIterator::class, [], [], '', false, false); + $this->model = new Generator($this->factoryMock); + } + + public function testGenerate() + { + $map = [ + [ + Select::FROM, + [ + 'cp' => ['joinType' => Select::FROM] + ] + ], + [ + Select::COLUMNS, + [ + ['cp', 'entity_id', 'product_id'] + ] + ] + ]; + $this->selectMock->expects($this->exactly(2))->method('getPart')->willReturnMap($map); + $this->factoryMock->expects($this->once())->method('create')->with( + [ + 'select' => $this->selectMock, + 'batchSize' => 100, + 'correlationName' => 'cp', + 'rangeField' => 'entity_id', + 'rangeFieldAlias' => 'product_id' + ] + )->willReturn($this->iteratorMock); + $this->assertEquals($this->iteratorMock, $this->model->generate('entity_id', $this->selectMock, 100)); + } + + /** + * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedExceptionMessage Select object must have correct "FROM" part + */ + public function testGenerateWithoutFromPart() + { + $map = [ + [Select::FROM, []], + [ + Select::COLUMNS, + [ + ['cp', 'entity_id', 'product_id'] + ] + ] + ]; + $this->selectMock->expects($this->any())->method('getPart')->willReturnMap($map); + $this->factoryMock->expects($this->never())->method('create'); + $this->model->generate('entity_id', $this->selectMock, 100); + } + + /** + * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedExceptionMessage Select object must have correct range field name "entity_id" + */ + public function testGenerateWithInvalidRangeField() + { + $map = [ + [ + Select::FROM, + [ + 'cp' => ['joinType' => Select::FROM] + ] + ], + [ + Select::COLUMNS, + [ + ['cp', 'row_id', 'product_id'] + ] + ] + ]; + $this->selectMock->expects($this->exactly(2))->method('getPart')->willReturnMap($map); + $this->factoryMock->expects($this->never())->method('create'); + $this->model->generate('entity_id', $this->selectMock, 100); + } + + /** + * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedExceptionMessage Select object must have correct range field name "entity_id" + */ + public function testGenerateWithInvalidRangeFieldValue() + { + $map = [ + [ + Select::FROM, + [ + 'cp' => ['joinType' => Select::FROM] + ] + ], + [ + Select::COLUMNS, + [ + ['cp', new \Zend_Db_Expr('MAX(entity_id) as max'), 'product_id'] + ] + ] + ]; + $this->selectMock->expects($this->exactly(2))->method('getPart')->willReturnMap($map); + $this->factoryMock->expects($this->never())->method('create'); + $this->model->generate('entity_id', $this->selectMock, 100); + } +} From 0266e6b02bf750ed9b53e4cda087fac5c6901a0c Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Fri, 26 Aug 2016 15:18:33 -0500 Subject: [PATCH 0336/3232] MAGETWO-55871: Eliminate @escapeNotVerified in Email module - Eliminated all instances. - Fixed indentation. --- .../adminhtml/templates/template/edit.phtml | 40 +++++++++---------- .../templates/template/preview.phtml | 2 +- .../templates/session/activity.phtml | 3 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml index 26a70c64188a9..66be7b59ad1a3 100644 --- a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml +++ b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml @@ -11,20 +11,20 @@ use Magento\Framework\App\TemplateTypesInterface; /** @var $block \Magento\Email\Block\Adminhtml\Template\Edit */ ?> getEditMode()): ?> -
    + getBlockHtml('formkey')?>
    -
    + escapeHtml(__('Load default template')) ?>
    - +
    - - getFormHtml() ?> + + getFormHtml() ?> -
    - getBlockHtml('formkey')?> + + getBlockHtml('formkey')?>
    - +
    @@ -93,7 +93,7 @@ require([ this.bindEvents(); - this.renderPaths(getCurrentlyUsedForPaths(); ?>, 'currently_used_for'); + this.renderPaths(getCurrentlyUsedForPaths(); ?>, 'currently_used_for'); }, bindEvents: function(){ @@ -115,7 +115,7 @@ require([ }, stripTags: function () { - if(!window.confirm("")) { + if(!window.confirm("escapeJs($block->escapeHtml(__('Are you sure you want to strip tags?'))) ?>")) { return false; } this.unconvertedText = $('template_text').value; @@ -146,9 +146,9 @@ require([ }, preview: function() { if (this.typeChange) { - $('preview_type').value = ; + $('preview_type').value = ; } else { - $('preview_type').value = getTemplateType() ?>; + $('preview_type').value = getTemplateType() ?>; } if (typeof tinyMCE == 'undefined' || !tinyMCE.getInstanceById('template_text')) { $('preview_text').value = $('template_text').value; @@ -166,8 +166,8 @@ require([ }, deleteTemplate: function() { - if(window.confirm("")) { - window.location.href = 'getDeleteUrl() ?>'; + if(window.confirm("escapeJs($block->escapeHtml(__('Are you sure you want to delete this template?'))) ?>")) { + window.location.href = 'escapeJs($block->escapeUrl($block->getDeleteUrl())) ?>'; } }, @@ -212,7 +212,7 @@ require([ }.bind(this)); } else { alert({ - content: '' + content: 'escapeJs($block->escapeHtml(__('The template did not load. Please review the log for details.'))) ?>' }); } }.bind(this) diff --git a/app/code/Magento/Email/view/adminhtml/templates/template/preview.phtml b/app/code/Magento/Email/view/adminhtml/templates/template/preview.phtml index 53340c2e2a71f..f030b67557736 100644 --- a/app/code/Magento/Email/view/adminhtml/templates/template/preview.phtml +++ b/app/code/Magento/Email/view/adminhtml/templates/template/preview.phtml @@ -10,7 +10,7 @@ - <?php /* @escapeNotVerified */ echo __('Email Preview'); ?> + <?php echo $block->escapeHtml(__('Email Preview')); ?> getChildHtml('content') ?> diff --git a/app/code/Magento/Security/view/adminhtml/templates/session/activity.phtml b/app/code/Magento/Security/view/adminhtml/templates/session/activity.phtml index 9ae4c9f62afac..d29147ae7f490 100644 --- a/app/code/Magento/Security/view/adminhtml/templates/session/activity.phtml +++ b/app/code/Magento/Security/view/adminhtml/templates/session/activity.phtml @@ -56,7 +56,8 @@ $sessionInfoCollection = $block->getSessionInfoCollection(); data-mage-init='{"confirmRedirect":{ "message": "escapeJs(__('Are you sure that you want to log out all other sessions?')) ?>", - "url":"escapeJs($block->escapeUrl($block->getUrl('security/session/logoutAll'))) ?>" + "url":"escapeJs($block->escapeUrl($block->getUrl('security/session/logoutAll'))) ?>" }}' disabled Date: Fri, 26 Aug 2016 15:46:06 -0500 Subject: [PATCH 0337/3232] MAGETWO-55589: Wrong algorithm for calculation batch size on category indexing --- .../Magento/Framework/DB/Query/Generator.php | 15 ++------ .../Framework/Test/DB/Query/GeneratorTest.php | 36 +++++++++++-------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/lib/internal/Magento/Framework/DB/Query/Generator.php b/lib/internal/Magento/Framework/DB/Query/Generator.php index 1873418968bba..43f8388d3f449 100644 --- a/lib/internal/Magento/Framework/DB/Query/Generator.php +++ b/lib/internal/Magento/Framework/DB/Query/Generator.php @@ -57,24 +57,15 @@ public function generate($rangeField, \Magento\Framework\DB\Select $select, $bat /** * Calculate $rangeField alias */ - $rangeFieldAlias = null; + $rangeFieldAlias = $rangeField; foreach ($columns as $column) { list($table, $columnName, $alias) = $column; - if (is_string($columnName) && $table == $fieldCorrelationName && $columnName == $rangeField) { - $rangeFieldAlias = $alias; + if ($table == $fieldCorrelationName && $columnName == $rangeField) { + $rangeFieldAlias = $alias ?: $rangeField; break; } } - if (!$rangeFieldAlias) { - throw new LocalizedException( - new \Magento\Framework\Phrase( - 'Select object must have correct range field name "%field"', - ['field' => $rangeField] - ) - ); - } - return $this->iteratorFactory->create( [ 'select' => $select, diff --git a/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php b/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php index dc54ef3033178..0278871d808f4 100644 --- a/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php +++ b/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php @@ -89,10 +89,6 @@ public function testGenerateWithoutFromPart() $this->model->generate('entity_id', $this->selectMock, 100); } - /** - * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Select object must have correct range field name "entity_id" - */ public function testGenerateWithInvalidRangeField() { $map = [ @@ -105,19 +101,23 @@ public function testGenerateWithInvalidRangeField() [ Select::COLUMNS, [ - ['cp', 'row_id', 'product_id'] + ['cp', 'entity_id', null] ] ] ]; $this->selectMock->expects($this->exactly(2))->method('getPart')->willReturnMap($map); - $this->factoryMock->expects($this->never())->method('create'); - $this->model->generate('entity_id', $this->selectMock, 100); + $this->factoryMock->expects($this->once())->method('create')->with( + [ + 'select' => $this->selectMock, + 'batchSize' => 100, + 'correlationName' => 'cp', + 'rangeField' => 'entity_id', + 'rangeFieldAlias' => 'entity_id' + ] + )->willReturn($this->iteratorMock); + $this->assertEquals($this->iteratorMock, $this->model->generate('entity_id', $this->selectMock, 100)); } - /** - * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Select object must have correct range field name "entity_id" - */ public function testGenerateWithInvalidRangeFieldValue() { $map = [ @@ -130,12 +130,20 @@ public function testGenerateWithInvalidRangeFieldValue() [ Select::COLUMNS, [ - ['cp', new \Zend_Db_Expr('MAX(entity_id) as max'), 'product_id'] + ['cp', '*', null] ] ] ]; $this->selectMock->expects($this->exactly(2))->method('getPart')->willReturnMap($map); - $this->factoryMock->expects($this->never())->method('create'); - $this->model->generate('entity_id', $this->selectMock, 100); + $this->factoryMock->expects($this->once())->method('create')->with( + [ + 'select' => $this->selectMock, + 'batchSize' => 100, + 'correlationName' => 'cp', + 'rangeField' => 'entity_id', + 'rangeFieldAlias' => 'entity_id' + ] + )->willReturn($this->iteratorMock); + $this->assertEquals($this->iteratorMock, $this->model->generate('entity_id', $this->selectMock, 100)); } } From 41a493b36258ccfa0cb6d0c10a52d993efa071c6 Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Fri, 26 Aug 2016 16:05:14 -0500 Subject: [PATCH 0338/3232] MAGETWO-55871: Eliminate @escapeNotVerified in Email module - Removed module from list of exempt modules. - Corrected placement of annotation. --- .../Magento/Email/view/adminhtml/templates/template/edit.phtml | 2 +- .../Magento/Test/Php/_files/whitelist/exempt_modules/ce.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml index 66be7b59ad1a3..91b4300ddad98 100644 --- a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml +++ b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml @@ -24,7 +24,7 @@ use Magento\Framework\App\TemplateTypesInterface; - + diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php index 18491844df0d7..c0316a435662e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php @@ -21,7 +21,6 @@ 'Magento_ConfigurableProduct', 'Magento_CurrencySymbol', 'Magento_Downloadable', - 'Magento_Email', 'Magento_GiftMessage', 'Magento_GoogleAdwords', 'Magento_GoogleAnalytics', From a65e7da7047eb1d4601127b915272e84fd6a2f98 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Fri, 26 Aug 2016 16:16:44 -0500 Subject: [PATCH 0339/3232] MAGETWO-55589: Wrong algorithm for calculation batch size on category indexing - fixed static tests --- .../{ => Unit}/DB/Query/BatchIteratorTest.php | 29 +++++++++++++++---- .../{ => Unit}/DB/Query/GeneratorTest.php | 23 +++++++++++++-- 2 files changed, 45 insertions(+), 7 deletions(-) rename lib/internal/Magento/Framework/Test/{ => Unit}/DB/Query/BatchIteratorTest.php (94%) rename lib/internal/Magento/Framework/Test/{ => Unit}/DB/Query/GeneratorTest.php (90%) diff --git a/lib/internal/Magento/Framework/Test/DB/Query/BatchIteratorTest.php b/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php similarity index 94% rename from lib/internal/Magento/Framework/Test/DB/Query/BatchIteratorTest.php rename to lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php index f7adfce36a951..4ad7b8567e272 100644 --- a/lib/internal/Magento/Framework/Test/DB/Query/BatchIteratorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php @@ -31,11 +31,31 @@ class BatchIteratorTest extends \PHPUnit_Framework_TestCase */ private $connectionMock; + /** + * @var int + */ private $batchSize; + + /** + * @var string + */ private $correlationName; + + /** + * @var string + */ private $rangeField; + + /** + * @var string + */ private $rangeFieldAlias; + /** + * Setup test dependencies. + * + * @return void + */ protected function setUp() { $this->batchSize = 10; @@ -64,6 +84,7 @@ protected function setUp() * 1. $iterator->current(); * 2. $iterator->current(); * 3. $iterator->key(); + * @return void */ public function testCurrent() { @@ -103,7 +124,7 @@ public function testCurrent() * * 1. $iterator->next() * 2. $iterator->valid(); - * + * @return void */ public function testIterations() { @@ -147,6 +168,7 @@ public function testIterations() * 3. $iterator->next(); * 4. $iterator->current() * 5. $iterator->key() + * @return void */ public function testNext() { @@ -166,10 +188,7 @@ public function testNext() $this->connectionMock->expects($this->exactly(3)) ->method('fetchRow') ->with($this->wrapperSelectMock) - ->willReturn([ - 'max' => 25, - 'cnt' => 10 - ] + ->willReturn(['max' => 25, 'cnt' => 10] ); $this->assertEquals($this->selectMock, $this->model->next()); diff --git a/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php b/lib/internal/Magento/Framework/Test/Unit/DB/Query/GeneratorTest.php similarity index 90% rename from lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php rename to lib/internal/Magento/Framework/Test/Unit/DB/Query/GeneratorTest.php index 0278871d808f4..4be22eb14ca85 100644 --- a/lib/internal/Magento/Framework/Test/DB/Query/GeneratorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/DB/Query/GeneratorTest.php @@ -32,6 +32,9 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase */ private $iteratorMock; + /** + * Setup test dependencies. + */ protected function setUp() { $this->factoryMock = $this->getMock(BatchIteratorFactory::class, [], [], '', false, false); @@ -40,6 +43,10 @@ protected function setUp() $this->model = new Generator($this->factoryMock); } + /** + * Test success generate. + * @return void + */ public function testGenerate() { $map = [ @@ -70,8 +77,11 @@ public function testGenerate() } /** + * Test batch generation with invalid select object. + * * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage Select object must have correct "FROM" part + * @return void */ public function testGenerateWithoutFromPart() { @@ -89,7 +99,11 @@ public function testGenerateWithoutFromPart() $this->model->generate('entity_id', $this->selectMock, 100); } - public function testGenerateWithInvalidRangeField() + /** + * Test generate batches with rangeField without alias. + * @return void + */ + public function testGenerateWithRangeFieldWithoutAlias() { $map = [ [ @@ -118,7 +132,12 @@ public function testGenerateWithInvalidRangeField() $this->assertEquals($this->iteratorMock, $this->model->generate('entity_id', $this->selectMock, 100)); } - public function testGenerateWithInvalidRangeFieldValue() + /** + * Test generate batches with wild-card. + * + * @return void + */ + public function testGenerateWithInvalidWithWildcard() { $map = [ [ From 2b42bb956ea8bc98ae9ff946e3e9042ce3fa0609 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Fri, 26 Aug 2016 16:22:26 -0500 Subject: [PATCH 0340/3232] MAGETWO-56104: Build stablization - fixed unit and static tests --- .../Test/Unit/Block/CurrencyTest.php | 27 ++++++++++++------- lib/internal/Magento/Framework/Escaper.php | 5 ++-- .../Framework/Test/Unit/EscaperTest.php | 19 ++++++++----- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Directory/Test/Unit/Block/CurrencyTest.php b/app/code/Magento/Directory/Test/Unit/Block/CurrencyTest.php index 9abf5a87857f7..cfe5e2aacd3ef 100644 --- a/app/code/Magento/Directory/Test/Unit/Block/CurrencyTest.php +++ b/app/code/Magento/Directory/Test/Unit/Block/CurrencyTest.php @@ -34,16 +34,25 @@ protected function setUp() ); $this->urlBuilder->expects($this->any())->method('getUrl')->will($this->returnArgument(0)); - /** @var \Magento\Framework\View\Element\Template\Context $context */ - $context = $this->getMock( - \Magento\Framework\View\Element\Template\Context::class, - ['getUrlBuilder'], - [], - '', - false - ); + /** @var $context \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject */ + $context = $this->getMockBuilder(\Magento\Framework\View\Element\Template\Context::class) + ->disableOriginalConstructor() + ->getMock(); $context->expects($this->any())->method('getUrlBuilder')->will($this->returnValue($this->urlBuilder)); + $escaperMock = $this->getMockBuilder(\Magento\Framework\Escaper::class) + ->disableOriginalConstructor() + ->getMock(); + $escaperMock->method('escapeUrl') + ->willReturnCallback( + function ($string) { + return 'escapeUrl' . $string; + } + ); + $context->expects($this->once()) + ->method('getEscaper') + ->willReturn($escaperMock); + /** @var \Magento\Directory\Model\CurrencyFactory $currencyFactory */ $currencyFactory = $this->getMock(\Magento\Directory\Model\CurrencyFactory::class, [], [], '', false); $this->postDataHelper = $this->getMock(\Magento\Framework\Data\Helper\PostHelper::class, [], [], '', false); @@ -63,7 +72,7 @@ public function testGetSwitchCurrencyPostData() { $expectedResult = 'post_data'; $expectedCurrencyCode = 'test'; - $switchUrl = 'directory/currency/switch'; + $switchUrl = 'escapeUrldirectory/currency/switch'; $this->postDataHelper->expects($this->once()) ->method('getPostData') diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index 19ffe83fa362a..7f63e485f0cc9 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -59,9 +59,10 @@ private function filterHtmlTagsAndAttributes($string, $allowedTags) $dom = new \DOMDocument('1.0', 'UTF-8'); set_error_handler( /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - function ($errorNumber, $errorString, $errorFile, $errorLine) { + function ($errorNumber, $errorString, $errorFile, $errorLine) + { throw new \Exception($errorString, $errorNumber); } ); diff --git a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php index 493dd4742f02d..20af43aa1d7b2 100644 --- a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php @@ -87,8 +87,10 @@ public function escapeHtmlDataProvider() 'allowedTags' => ['span', 'b'], ], 'string data with allowed tags with attributes 3' => [ - 'data' => 'Only registered users can write reviews. Please Sign in or create an account', - 'expected' => 'Only registered users can write reviews. Please Sign in or create an account', + 'data' => 'Only registered users can write reviews. ' + . 'Please Sign in or create an account', + 'expected' => 'Only registered users can write reviews. ' + . 'Please Sign in or create an account', 'allowedTags' => ['a'], ], 'string data with allowed tags with attributes 4' => [ @@ -109,13 +111,18 @@ public function escapeHtmlDataProvider() ], */ 'string data with allowed tags with attributes and not allowed tags' => [ - 'data' => 'Only registered users can write reviews. Please Sign inthree or create an account', - 'expected' => 'Only registered users can write reviews. Please Sign inthree or create an account', + 'data' => 'Only registered users can write reviews. Please Sign inthree ' + . 'or create an account', + 'expected' => 'Only registered users can write reviews. Please Sign inthree ' + . 'or create an account', 'allowedTags' => ['a'], ], 'string data with allowed tags with attributes and not allowed tags 2' => [ - 'data' => 'Some test text in span tag text in strong tag Click here', - 'expected' => 'Some test text in span tag text in strong tag Click herealert(1)', + 'data' => 'Some test text in span tag text in strong tag ' + . '' + . 'Click here', + 'expected' => 'Some test text in span tag text in strong tag ' + .'Click herealert(1)', 'allowedTags' => ['a', 'span'], ], 'string data with allowed tags and html comment' => [ From f13585fe6560d7ade4e4f79bf716d66b1fab0d8c Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Fri, 26 Aug 2016 16:25:47 -0500 Subject: [PATCH 0341/3232] MAGETWO-55589: Wrong algorithm for calculation batch size on category indexing - fixed static tests --- .../Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php b/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php index 4ad7b8567e272..e522daf97a802 100644 --- a/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php @@ -188,8 +188,7 @@ public function testNext() $this->connectionMock->expects($this->exactly(3)) ->method('fetchRow') ->with($this->wrapperSelectMock) - ->willReturn(['max' => 25, 'cnt' => 10] - ); + ->willReturn(['max' => 25, 'cnt' => 10]); $this->assertEquals($this->selectMock, $this->model->next()); $this->assertEquals(1, $this->model->key()); From 1e83f01cf1db7f47a949af34fd33f47b88b2020b Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Mon, 29 Aug 2016 09:08:22 +0300 Subject: [PATCH 0342/3232] MAGETWO-57129: Identity srvice fix --- .../Framework/DataObject/IdentityService.php | 92 +++++++++---------- 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/lib/internal/Magento/Framework/DataObject/IdentityService.php b/lib/internal/Magento/Framework/DataObject/IdentityService.php index c8ea4c86ab821..b16d0a249ea5a 100644 --- a/lib/internal/Magento/Framework/DataObject/IdentityService.php +++ b/lib/internal/Magento/Framework/DataObject/IdentityService.php @@ -1,47 +1,45 @@ -uuidFactory = $uuidFactory; - } - - /** - * @inheritDoc - */ - public function generateId() - { - $uuid = $this->uuidFactory->uuid4(); - return $uuid->toString(); - } - - /** - * @inheritDoc - */ - public function generateIdForData($data) - { - $uuid = $this->uuidFactory->uuid3(Uuid::NAMESPACE_DNS, $data); - return $uuid->toString(); - } -} +uuidFactory = new \Ramsey\Uuid\UuidFactory(); + } + + /** + * @inheritDoc + */ + public function generateId() + { + $uuid = $this->uuidFactory->uuid4(); + return $uuid->toString(); + } + + /** + * @inheritDoc + */ + public function generateIdForData($data) + { + $uuid = $this->uuidFactory->uuid3(Uuid::NAMESPACE_DNS, $data); + return $uuid->toString(); + } +} From 60add52752126b002f1598e3f979f0196480d40b Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk Date: Mon, 29 Aug 2016 12:42:24 +0300 Subject: [PATCH 0343/3232] MAGETWO-57726: Exception is created but not thrown #6320 --- app/code/Magento/Reports/Block/Product/AbstractProduct.php | 2 +- .../Reports/Model/ResourceModel/Product/Lowstock/Collection.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Reports/Block/Product/AbstractProduct.php b/app/code/Magento/Reports/Block/Product/AbstractProduct.php index 9a142b2f98217..1bd340cd71847 100644 --- a/app/code/Magento/Reports/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Reports/Block/Product/AbstractProduct.php @@ -90,7 +90,7 @@ public function getModel() try { $model = $this->_indexFactory->get($this->_indexType); } catch (\InvalidArgumentException $e) { - new \Magento\Framework\Exception\LocalizedException(__('Index type is not valid')); + throw new \Magento\Framework\Exception\LocalizedException(__('Index type is not valid')); } return $model; diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php index c5fd7b09fa252..f3a142a12e596 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php @@ -249,7 +249,7 @@ public function joinInventoryItem($fields = []) public function filterByProductType($typeFilter) { if (!is_string($typeFilter) && !is_array($typeFilter)) { - new \Magento\Framework\Exception\LocalizedException(__('The product type filter specified is incorrect.')); + throw new \Magento\Framework\Exception\LocalizedException(__('The product type filter specified is incorrect.')); } $this->addAttributeToFilter('type_id', $typeFilter); return $this; From eca95fd58b38bb0c12d53ba290b123b55eccc55c Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Mon, 29 Aug 2016 12:50:32 +0300 Subject: [PATCH 0344/3232] MAGETWO-52660: Improve performance of static assets deployment - MAGETWO-54954: Quick copy static files for non-changed language --- .../Deploy/Model/Deploy/LocaleDeploy.php | 74 +++++++++++-------- .../Deploy/Model/Deploy/LocaleQuickDeploy.php | 20 ++++- .../Magento/Deploy/Model/DeployManager.php | 9 ++- app/code/Magento/Deploy/Model/Deployer.php | 17 +---- app/code/Magento/Deploy/composer.json | 1 - .../Instruction/MagentoImport.php | 2 + .../Framework/Filesystem/Directory/Write.php | 2 +- .../Framework/Filesystem/Driver/File.php | 19 ----- .../Framework/Filesystem/DriverInterface.php | 9 --- 9 files changed, 74 insertions(+), 79 deletions(-) diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php index 83e91920ba5ec..cba7a0c10ecb9 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php @@ -20,6 +20,10 @@ use Psr\Log\LoggerInterface; use Magento\Framework\Console\Cli; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) + */ class LocaleDeploy implements DeployInterface { /** @var int */ @@ -42,14 +46,6 @@ class LocaleDeploy implements DeployInterface /** @var \Magento\Framework\View\Asset\Bundle\Manager */ private $bundleManager; - /** @var \Magento\Framework\View\Template\Html\MinifierInterface */ - private $htmlMinifier; - - /** - * @var \Magento\RequireJs\Model\FileManager - */ - private $fileManager; - /** * @var Files */ @@ -150,15 +146,14 @@ class LocaleDeploy implements DeployInterface * @param \Magento\RequireJs\Model\FileManagerFactory $fileManagerFactory * @param \Magento\Framework\RequireJs\ConfigFactory $requireJsConfigFactory * @param Publisher $assetPublisher - * @param \Magento\Framework\View\Template\Html\MinifierInterface $htmlMinifier * @param \Magento\Framework\View\Asset\Bundle\Manager $bundleManager - * @param \Magento\RequireJs\Model\FileManager $fileManager * @param ThemeProviderInterface $themeProvider * @param LoggerInterface $logger * @param Files $filesUtil * @param \Magento\Framework\View\DesignInterfaceFactory $designFactory * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param array $alternativeSources + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( OutputInterface $output, @@ -169,9 +164,7 @@ public function __construct( \Magento\RequireJs\Model\FileManagerFactory $fileManagerFactory, \Magento\Framework\RequireJs\ConfigFactory $requireJsConfigFactory, \Magento\Framework\App\View\Asset\Publisher $assetPublisher, - \Magento\Framework\View\Template\Html\MinifierInterface $htmlMinifier, \Magento\Framework\View\Asset\Bundle\Manager $bundleManager, - \Magento\RequireJs\Model\FileManager $fileManager, \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider, LoggerInterface $logger, Files $filesUtil, @@ -182,9 +175,7 @@ public function __construct( $this->output = $output; $this->assetRepo = $assetRepo; $this->assetPublisher = $assetPublisher; - $this->htmlMinifier = $htmlMinifier; $this->bundleManager = $bundleManager; - $this->fileManager = $fileManager; $this->filesUtil = $filesUtil; $this->jsTranslationConfig = $jsTranslationConfig; $this->minification = $minification; @@ -193,12 +184,12 @@ public function __construct( $this->fileManagerFactory = $fileManagerFactory; $this->requireJsConfigFactory = $requireJsConfigFactory; $this->themeProvider = $themeProvider; - array_map( - function (AlternativeSourceInterface $alternative) { + $this->alternativeSources = array_map( + function (AlternativeSourceInterface $alternativeSource) { + return $alternativeSource; }, $alternativeSources ); - $this->alternativeSources = $alternativeSources; $this->designFactory = $designFactory; $this->localeResolver = $localeResolver; } @@ -237,6 +228,33 @@ public function deploy($area, $themePath, $locale, array $options) $fileManager = $this->getRequireJsFileManager($area, $themePath); $fileManager->createRequireJsConfigAsset(); + + $this->deployAppFiles($area, $themePath, $locale); + $this->deployLibFiles($area, $themePath, $locale); + + if (!$this->getOption(Options::NO_JAVASCRIPT)) { + if ($this->jsTranslationConfig->dictionaryEnabled()) { + $dictionaryFileName = $this->jsTranslationConfig->getDictionaryFileName(); + $this->deployFile($dictionaryFileName, $area, $themePath, $locale, null); + } + if ($this->minification->isEnabled('js')) { + $fileManager->createMinResolverAsset(); + } + } + $this->bundleManager->flush(); + $this->output->writeln("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n"); + + return $this->errorCount ? Cli::RETURN_FAILURE : Cli::RETURN_SUCCESS; + } + + /** + * @param string $area + * @param string $themePath + * @param string $locale + * @return void + */ + private function deployAppFiles($area, $themePath, $locale) + { foreach ($this->filesUtil->getStaticPreProcessingFiles() as $info) { list($fileArea, $fileTheme, , $module, $filePath, $fullPath) = $info; @@ -264,7 +282,16 @@ public function deploy($area, $themePath, $locale, array $options) } } } + } + /** + * @param string $area + * @param string $themePath + * @param string $locale + * @return void + */ + private function deployLibFiles($area, $themePath, $locale) + { foreach ($this->filesUtil->getStaticLibraryFiles() as $filePath) { if ($this->checkSkip($filePath)) { @@ -277,19 +304,6 @@ public function deploy($area, $themePath, $locale, array $options) $this->deployFile($compiledFile, $area, $themePath, $locale, null); } } - if (!$this->getOption(Options::NO_JAVASCRIPT)) { - if ($this->jsTranslationConfig->dictionaryEnabled()) { - $dictionaryFileName = $this->jsTranslationConfig->getDictionaryFileName(); - $this->deployFile($dictionaryFileName, $area, $themePath, $locale, null); - } - if ($this->minification->isEnabled('js')) { - $fileManager->createMinResolverAsset(); - } - } - $this->bundleManager->flush(); - $this->output->writeln("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n"); - - return $this->errorCount ? Cli::RETURN_FAILURE : Cli::RETURN_SUCCESS; } /** diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php index 2418d4c9090d2..407f2770a9a8d 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php @@ -74,8 +74,8 @@ public function deploy($area, $themePath, $locale, array $options) $baseRequireJsPath = RequireJsConfig::DIR_NAME . DIRECTORY_SEPARATOR . $baseLocalePath; $newRequireJsPath = RequireJsConfig::DIR_NAME . DIRECTORY_SEPARATOR . $newLocalePath; - $this->getStaticDirectory()->delete($newLocalePath); - $this->getStaticDirectory()->delete($newRequireJsPath); + $this->deleteLocaleResource($newLocalePath); + $this->deleteLocaleResource($newRequireJsPath); if ($options[Options::SYMLINK_LOCALE]) { $this->getStaticDirectory()->createSymlink($baseLocalePath, $newLocalePath); @@ -103,6 +103,22 @@ public function deploy($area, $themePath, $locale, array $options) return Cli::RETURN_SUCCESS; } + /** + * @param string $path + * @return void + */ + private function deleteLocaleResource($path) + { + $absolutePath = $this->getStaticDirectory()->getAbsolutePath($path); + if ($this->getStaticDirectory()->isExist($path)) { + if (is_link($absolutePath)) { + $this->getStaticDirectory()->getDriver()->deleteFile($absolutePath); + } else { + $this->getStaticDirectory()->getDriver()->deleteDirectory($absolutePath); + } + } + } + /** * @param string $path * @param string $search diff --git a/app/code/Magento/Deploy/Model/DeployManager.php b/app/code/Magento/Deploy/Model/DeployManager.php index 265249b92409c..85bd42bd6aa2a 100644 --- a/app/code/Magento/Deploy/Model/DeployManager.php +++ b/app/code/Magento/Deploy/Model/DeployManager.php @@ -21,6 +21,9 @@ use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; use Magento\Framework\App\Utility\Files; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class DeployManager { /** @@ -92,14 +95,17 @@ class DeployManager * @var AssetConfig */ private $assetConfig; + /** * @var Files */ private $filesUtils; + /** * @var StorageInterface */ private $versionStorage; + /** * @var MinifierInterface */ @@ -144,7 +150,7 @@ public function __construct( * @param string $area * @param string $themePath * @param string $locale - * @reutrn void + * @return void */ public function addPack($area, $themePath, $locale) { @@ -316,7 +322,6 @@ private function getDeployStrategies($area, $themePath, array $locales) return $deployStrategies; } - /** * @return \Magento\Framework\View\Design\Fallback\Rule\RuleInterface */ diff --git a/app/code/Magento/Deploy/Model/Deployer.php b/app/code/Magento/Deploy/Model/Deployer.php index 2648b321edd06..061f7b71fc3be 100644 --- a/app/code/Magento/Deploy/Model/Deployer.php +++ b/app/code/Magento/Deploy/Model/Deployer.php @@ -11,12 +11,10 @@ use Magento\Framework\App\ObjectManagerFactory; use Magento\Framework\App\View\Deployment\Version; use Magento\Framework\App\Utility\Files; -use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Translate\Js\Config as JsTranslationConfig; use Symfony\Component\Console\Output\OutputInterface; use Magento\Framework\App\ObjectManager; use Magento\Deploy\Model\DeployManagerFactory; -use Magento\Framework\View\Template\Html\MinifierInterface; /** * A service for deploying Magento static view files for production mode @@ -29,11 +27,6 @@ class Deployer /** @var OutputInterface */ private $output; - /** - * @var ObjectManagerInterface - */ - private $objectManager; - /** * @var JsTranslationConfig */ @@ -57,6 +50,7 @@ class Deployer * @param Version\StorageInterface $versionStorage * @param JsTranslationConfig $jsTranslationConfig * @param AlternativeSourceInterface[] $alternativeSources + * @param DeployManagerFactory $deployManagerFactory * @param array $options * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -66,7 +60,6 @@ public function __construct( Version\StorageInterface $versionStorage, JsTranslationConfig $jsTranslationConfig, array $alternativeSources, - MinifierInterface $htmlMinifier, DeployManagerFactory $deployManagerFactory = null, $options = [] ) { @@ -120,16 +113,10 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $d * @param string $locale * @param string $area * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @deprecated */ protected function emulateApplicationLocale($locale, $area) { - /** @var \Magento\Framework\TranslateInterface $translator */ - $translator = $this->objectManager->get(\Magento\Framework\TranslateInterface::class); - $translator->setLocale($locale); - $translator->loadData($area, true); - /** @var \Magento\Framework\Locale\ResolverInterface $localeResolver */ - $localeResolver = $this->objectManager->get(\Magento\Framework\Locale\ResolverInterface::class); - $localeResolver->setLocale($locale); } } diff --git a/app/code/Magento/Deploy/composer.json b/app/code/Magento/Deploy/composer.json index 05db53f039027..856e0d8b3e542 100644 --- a/app/code/Magento/Deploy/composer.json +++ b/app/code/Magento/Deploy/composer.json @@ -5,7 +5,6 @@ "php": "~5.6.0|7.0.2|7.0.4|~7.0.6", "magento/framework": "100.2.*", "magento/module-store": "100.2.*", - "magento/module-theme": "100.2.*", "magento/module-require-js": "100.2.*", "magento/module-user": "100.2.*" }, diff --git a/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/MagentoImport.php b/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/MagentoImport.php index e0ea45b9c9c09..ab5db005978b1 100644 --- a/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/MagentoImport.php +++ b/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/MagentoImport.php @@ -16,6 +16,7 @@ /** * @magento_import instruction preprocessor + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) Must be deleted after moving themeProvider to construct */ class MagentoImport implements PreProcessorInterface { @@ -137,6 +138,7 @@ protected function getTheme(LocalInterface $asset) /** * @return ThemeProviderInterface + * @deprecated */ private function getThemeProvider() { diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php index 2e89f89b3fe76..b7752ddccf886 100644 --- a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php +++ b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php @@ -168,7 +168,7 @@ public function delete($path = null) return true; } $absolutePath = $this->driver->getAbsolutePath($this->path, $path); - if ($this->driver->isFile($absolutePath) || $this->driver->isLink($absolutePath)) { + if ($this->driver->isFile($absolutePath)) { $this->driver->deleteFile($absolutePath); } else { $this->driver->deleteDirectory($absolutePath); diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/File.php b/lib/internal/Magento/Framework/Filesystem/Driver/File.php index ec48af4999b6c..8f7d888544f50 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/File.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/File.php @@ -113,25 +113,6 @@ public function isFile($path) return $result; } - /** - * Tells whether the filename is a symbolic link - * - * @param string $path - * @return bool - * @throws FileSystemException - */ - public function isLink($path) - { - clearstatcache(); - $result = @is_link($this->getScheme() . $path); - if ($result === null) { - throw new FileSystemException( - new \Magento\Framework\Phrase('Error occurred during execution %1', [$this->getWarningMessage()]) - ); - } - return $result; - } - /** * Tells whether the filename is a regular directory * diff --git a/lib/internal/Magento/Framework/Filesystem/DriverInterface.php b/lib/internal/Magento/Framework/Filesystem/DriverInterface.php index b06ec8407ad34..8b30fe398f08c 100644 --- a/lib/internal/Magento/Framework/Filesystem/DriverInterface.php +++ b/lib/internal/Magento/Framework/Filesystem/DriverInterface.php @@ -65,15 +65,6 @@ public function isReadable($path); */ public function isFile($path); - /** - * Tells whether the filename is a symbolic link - * - * @param string $path - * @return bool - * @throws FileSystemException - */ - public function isLink($path); - /** * Tells whether the filename is a regular directory * From df47e15f3655ef3b1ecc250f3698017813ce9d21 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Mon, 29 Aug 2016 13:48:35 +0300 Subject: [PATCH 0345/3232] MAGETWO-56092: Pagination is absent on Order Status grid --- .../Sales/view/adminhtml/layout/sales_order_status_index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml index f3c7408bb6c2b..6929c7ad9963d 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_status_index.xml @@ -15,7 +15,7 @@ Magento\Sales\Model\ResourceModel\Status\Collection state desc - 0 + 1 From 873a1231b7ae64beda1b46e6ff06ae6fd1c3d315 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk Date: Mon, 29 Aug 2016 14:05:29 +0300 Subject: [PATCH 0346/3232] MAGETWO-57726: Exception is created but not thrown #6320 - Updated DocBlock --- app/code/Magento/Reports/Block/Product/AbstractProduct.php | 2 +- .../Reports/Model/ResourceModel/Product/Lowstock/Collection.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Reports/Block/Product/AbstractProduct.php b/app/code/Magento/Reports/Block/Product/AbstractProduct.php index 1bd340cd71847..1fdcc297b28e9 100644 --- a/app/code/Magento/Reports/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Reports/Block/Product/AbstractProduct.php @@ -82,7 +82,7 @@ protected function _getProductsToSkip() /** * Public method for retrieve Product Index model - * + * @throws \Magento\Framework\Exception\LocalizedException * @return \Magento\Reports\Model\Product\Index\AbstractIndex */ public function getModel() diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php index f3a142a12e596..9c8afd21cd6ef 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Lowstock/Collection.php @@ -244,6 +244,7 @@ public function joinInventoryItem($fields = []) * Add filter by product type(s) * * @param array|string $typeFilter + * @throws \Magento\Framework\Exception\LocalizedException * @return $this */ public function filterByProductType($typeFilter) From 10b5b42e6f175fe7443421605ca0499f2a3ae357 Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Mon, 29 Aug 2016 14:06:08 +0300 Subject: [PATCH 0347/3232] MAGETWO-56530: Magento\ConfigurableImportExport\Model\ConfigurableTest::testImportReplace integration test fail --- .../ImportExport/Model/Export/Entity/AbstractEntity.php | 8 ++++++++ .../ConfigurableImportExport/Model/ConfigurableTest.php | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php index cff55867975af..f76200a576abc 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php @@ -544,4 +544,12 @@ public function setWriter(AbstractAdapter $writer) return $this; } + + /** + * Clean cached values + */ + public function __destruct() + { + self::$attrCodes = null; + } } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableImportExport/Model/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableImportExport/Model/ConfigurableTest.php index 1b9a4d5eabcaa..2d355b53f6ad2 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableImportExport/Model/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableImportExport/Model/ConfigurableTest.php @@ -107,7 +107,6 @@ public function importReplaceDataProvider() */ public function testImportReplace($fixtures, $skus, $skippedAttributes = []) { - $this->markTestSkipped('MAGETWO-56530'); parent::testImportReplace($fixtures, $skus, $skippedAttributes); } } From 830888c64279e9072db098afb5035ff2d895841f Mon Sep 17 00:00:00 2001 From: Yaroslav Onischenko Date: Mon, 29 Aug 2016 14:28:05 +0300 Subject: [PATCH 0348/3232] MAGETWO-55908: Prepare PR --- .../tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php index bd7d10a7cf04e..3c2a9ed9c9b0f 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php @@ -96,7 +96,7 @@ public function getPurchasePointStoreGroups() $this->openFilterBlock(); $storeGroupElements = $this->_rootElement->find($this->filters['purchase_point']['selector']) - ->getElements('//option/preceding-sibling::optgroup[1]', Locator::SELECTOR_XPATH); + ->getElements('.//option/preceding-sibling::optgroup[1]', Locator::SELECTOR_XPATH); $result = []; foreach ($storeGroupElements as $storeGroupElement) { From 36b75cab7907e63057dc1489d31fbf268f5ef6cd Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Mon, 29 Aug 2016 15:05:21 +0300 Subject: [PATCH 0349/3232] MAGETWO-52660: Improve performance of static assets deployment - MAGETWO-54954: Quick copy static files for non-changed language --- .../Deploy/Model/Deploy/LocaleDeploy.php | 4 +- .../Magento/Deploy/Model/DeployManager.php | 77 ++++++------------- .../Deploy/Model/DeployStrategyFactory.php | 59 ++++++++++++++ .../Unit/Model/DeployStrategyFactoryTest.php | 75 ++++++++++++++++++ 4 files changed, 157 insertions(+), 58 deletions(-) create mode 100644 app/code/Magento/Deploy/Model/DeployStrategyFactory.php create mode 100644 app/code/Magento/Deploy/Test/Unit/Model/DeployStrategyFactoryTest.php diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php index cba7a0c10ecb9..36a929f8cf3ca 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php @@ -8,7 +8,6 @@ use Magento\Framework\App\Utility\Files; use Magento\Framework\App\View\Asset\Publisher; -use Magento\Framework\Exception\LocalizedException; use Magento\Framework\View\Asset\ContentProcessorException; use Magento\Framework\View\Asset\PreProcessor\AlternativeSourceInterface; use Magento\Framework\View\Design\Theme\ThemeProviderInterface; @@ -221,6 +220,7 @@ private function getRequireJsFileManager($area, $themePath) */ public function deploy($area, $themePath, $locale, array $options) { + $this->options = $options; $this->output->writeln("=== {$area} -> {$themePath} -> {$locale} ==="); // emulate application locale needed for correct file path resolving @@ -316,8 +316,6 @@ private function deployLibFiles($area, $themePath, $locale) * @param string $module * @param string|null $fullPath * @return string - * @throws \InvalidArgumentException - * @throws LocalizedException * * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.CyclomaticComplexity) diff --git a/app/code/Magento/Deploy/Model/DeployManager.php b/app/code/Magento/Deploy/Model/DeployManager.php index 85bd42bd6aa2a..827a2aebd422b 100644 --- a/app/code/Magento/Deploy/Model/DeployManager.php +++ b/app/code/Magento/Deploy/Model/DeployManager.php @@ -7,16 +7,13 @@ namespace Magento\Deploy\Model; use Magento\Deploy\Model\Deploy\DeployInterface; -use Magento\Framework\App\ObjectManager; use Magento\Framework\App\View\Deployment\Version\StorageInterface; use Magento\Framework\Component\ComponentRegistrar; use Magento\Framework\View\Design\Fallback\Rule\RuleInterface; use Magento\Framework\View\DesignInterface; use Magento\Framework\View\Design\Fallback\RulePool; -use Magento\Framework\App\ObjectManagerFactory; use Magento\Framework\View\Template\Html\MinifierInterface; use Symfony\Component\Console\Output\OutputInterface; -use Magento\Framework\App\State; use Magento\Framework\View\Asset\ConfigInterface as AssetConfig; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; use Magento\Framework\App\Utility\Files; @@ -26,16 +23,6 @@ */ class DeployManager { - /** - * Standard deploy strategy - */ - const DEPLOY_STRATEGY_STANDARD = 'standard'; - - /** - * Quick deploy strategy - */ - const DEPLOY_STRATEGY_QUICK = 'quick'; - /** * Base locale without customizations */ @@ -66,16 +53,6 @@ class DeployManager */ private $moduleDirectories; - /** - * @var ObjectManagerFactory - */ - private $objectManagerFactory; - - /** - * @var ObjectManager - */ - private $objectManager; - /** * @var DesignInterface */ @@ -112,7 +89,11 @@ class DeployManager private $htmlMinifier; /** - * @param ObjectManagerFactory $objectManagerFactory + * @var DeployStrategyFactory + */ + private $deployStrategyFactory; + + /** * @param OutputInterface $output * @param RulePool $rulePool * @param DesignInterface $design @@ -120,10 +101,10 @@ class DeployManager * @param Files $filesUtils * @param StorageInterface $versionStorage * @param MinifierInterface $htmlMinifier + * @param DeployStrategyFactory $deployStrategyFactory * @param array $options */ public function __construct( - ObjectManagerFactory $objectManagerFactory, OutputInterface $output, RulePool $rulePool, DesignInterface $design, @@ -131,10 +112,10 @@ public function __construct( Files $filesUtils, StorageInterface $versionStorage, MinifierInterface $htmlMinifier, + DeployStrategyFactory $deployStrategyFactory, array $options ) { $this->rulePool = $rulePool; - $this->objectManagerFactory = $objectManagerFactory; $this->design = $design; $this->output = $output; $this->options = $options; @@ -142,6 +123,7 @@ public function __construct( $this->filesUtils = $filesUtils; $this->versionStorage = $versionStorage; $this->htmlMinifier = $htmlMinifier; + $this->deployStrategyFactory = $deployStrategyFactory; } /** @@ -171,10 +153,9 @@ public function deploy() foreach ($this->packages as $package) { $locales = array_keys($package); list($area, $themePath) = current($package); - $this->emulateApplicationArea($area); if (count($locales) == 1) { - $result |= $this->getDeployStrategy(self::DEPLOY_STRATEGY_STANDARD) + $result |= $this->getDeployStrategy($area, DeployStrategyFactory::DEPLOY_STRATEGY_STANDARD) ->deploy($area, $themePath, current($locales), $this->options); continue; } @@ -227,18 +208,6 @@ public function saveDeployedVersion() } } - /** - * Emulate application area - * - * @param string $areaCode - * @return void - */ - private function emulateApplicationArea($areaCode) - { - $this->objectManager = $this->objectManagerFactory->create([State::PARAM_MODE => State::MODE_PRODUCTION]); - $this->objectManager->get(State::class)->setAreaCode($areaCode); - } - /** * @param array $params * @return array @@ -309,13 +278,16 @@ private function getDeployStrategies($area, $themePath, array $locales) $baseLocale = $locale; } else { $deployStrategies[$locale] = $this->getDeployStrategy( - $hasCustomization ? self::DEPLOY_STRATEGY_STANDARD : self::DEPLOY_STRATEGY_QUICK + $area, + $hasCustomization + ? DeployStrategyFactory::DEPLOY_STRATEGY_STANDARD + : DeployStrategyFactory::DEPLOY_STRATEGY_QUICK ); } } $deployStrategies = array_merge( - [$baseLocale => $this->getDeployStrategy(self::DEPLOY_STRATEGY_STANDARD)], + [$baseLocale => $this->getDeployStrategy($area, DeployStrategyFactory::DEPLOY_STRATEGY_STANDARD)], $deployStrategies ); @@ -335,26 +307,21 @@ private function getFallbackRule() } /** + * @param string $area * @param string $type * @return DeployInterface */ - private function getDeployStrategy($type) + private function getDeployStrategy($area, $type) { - if (!isset($this->deployStrategies[$type])) { - $strategyMap = [ - self::DEPLOY_STRATEGY_STANDARD => Deploy\LocaleDeploy::class, - self::DEPLOY_STRATEGY_QUICK => Deploy\LocaleQuickDeploy::class, - ]; - - if (!isset($strategyMap[$type])) { - throw new \InvalidArgumentException('Wrong deploy strategy type: ' . $type); - } - $this->deployStrategies[$type] = $this->objectManager->create( - $strategyMap[$type], + $key = $area . '-' . $type; + if (!isset($this->deployStrategies[$key])) { + $this->deployStrategies[$key] = $this->deployStrategyFactory->create( + $area, + $type, ['output' => $this->output] ); } - return $this->deployStrategies[$type]; + return $this->deployStrategies[$key]; } } diff --git a/app/code/Magento/Deploy/Model/DeployStrategyFactory.php b/app/code/Magento/Deploy/Model/DeployStrategyFactory.php new file mode 100644 index 0000000000000..17e4f538d3253 --- /dev/null +++ b/app/code/Magento/Deploy/Model/DeployStrategyFactory.php @@ -0,0 +1,59 @@ +objectManagerFactory = $objectManagerFactory; + } + + /** + * @param string $areaCode + * @param string $type + * @param array $arguments + * @return DeployInterface + */ + public function create($areaCode, $type, array $arguments = []) + { + $strategyMap = [ + self::DEPLOY_STRATEGY_STANDARD => Deploy\LocaleDeploy::class, + self::DEPLOY_STRATEGY_QUICK => Deploy\LocaleQuickDeploy::class, + ]; + + if (!isset($strategyMap[$type])) { + throw new \InvalidArgumentException('Wrong deploy strategy type: ' . $type); + } + $objectManager = $this->objectManagerFactory->create([State::PARAM_MODE => State::MODE_PRODUCTION]); + $objectManager->get(State::class)->setAreaCode($areaCode); + + return $objectManager->create($strategyMap[$type], $arguments); + } +} diff --git a/app/code/Magento/Deploy/Test/Unit/Model/DeployStrategyFactoryTest.php b/app/code/Magento/Deploy/Test/Unit/Model/DeployStrategyFactoryTest.php new file mode 100644 index 0000000000000..525d6a3d20534 --- /dev/null +++ b/app/code/Magento/Deploy/Test/Unit/Model/DeployStrategyFactoryTest.php @@ -0,0 +1,75 @@ +objectManagerFactoryMock = $this->getMock( + ObjectManagerFactory::class, + [], + [], + '', + false + ); + + $this->unit = (new ObjectManager($this))->getObject( + DeployStrategyFactory::class, + [ + 'objectManagerFactory' => $this->objectManagerFactoryMock, + ] + ); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Wrong deploy strategy type: wrong-type + */ + public function testCreateWithWrongStrategyType() + { + $this->unit->create('adminhtml', 'wrong-type'); + } + + public function testCreate() + { + $areaCode = 'adminhtml'; + + $objectManagerMock = $this->getMockBuilder(\Magento\Framework\App\ObjectManager::class) + ->disableOriginalConstructor() + ->getMock(); + $stateMock = $this->getMockBuilder(State::class) + ->disableOriginalConstructor() + ->getMock(); + $stateMock->expects(self::once())->method('setAreaCode')->with($areaCode)->willReturnSelf(); + + $this->objectManagerFactoryMock->expects(self::once())->method('create') + ->with([State::PARAM_MODE => State::MODE_PRODUCTION]) + ->willReturn($objectManagerMock); + + $objectManagerMock->expects(self::once())->method('get')->willReturn($stateMock); + $objectManagerMock->expects(self::once())->method('create') + ->with(LocaleDeploy::class, ['arg1' => 1]); + + $this->unit->create($areaCode, DeployStrategyFactory::DEPLOY_STRATEGY_STANDARD, ['arg1' => 1]); + } +} From c935e781e684123301687b2ae5699b17c12ae220 Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Mon, 29 Aug 2016 15:17:58 +0300 Subject: [PATCH 0350/3232] MAGETWO-57119: Sample Data Tests fails randomly --- .../Catalog/Test/Block/Product/View.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) 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 9b57ce34f4eea..3134fda0d2b2b 100644 --- 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 @@ -567,12 +567,19 @@ public function clickBaseImage() */ public function closeFullImage() { - $element = $this->browser->find($this->fullImageClose, Locator::SELECTOR_CSS); - if (!$element->isVisible()) { - $element->hover(); - $this->waitForElementVisible($this->fullImageClose); - } - $element->click(); + $this->_rootElement->waitUntil( + function () { + $this->browser->find($this->fullImage)->hover(); + + if ($this->browser->find($this->fullImageClose)->isVisible()) { + $this->browser->find($this->fullImageClose)->click(); + + return true; + } + + return null; + } + ); } /** From e972fc8b9bcf91825fa7c9fc68d89d49b7c25aef Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Mon, 29 Aug 2016 15:26:25 +0300 Subject: [PATCH 0351/3232] MAGETWO-56343: Setup tool check PHP extensions does not check for all needed extensions --- composer.json | 1 + composer.lock | 7 +++-- .../Magento/Setup/Model/PhpReadinessCheck.php | 30 ++++++++++++++++++- .../Test/Unit/Model/PhpReadinessCheckTest.php | 23 ++++++++++++-- 4 files changed, 54 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 8053b76a01a22..a0813c8462066 100644 --- a/composer.json +++ b/composer.json @@ -64,6 +64,7 @@ "ext-mbstring": "*", "ext-openssl": "*", "ext-zip": "*", + "ext-pdo_mysql": "*", "sjparkinson/static-review": "~4.1", "ramsey/uuid": "3.4" }, diff --git a/composer.lock b/composer.lock index 6fd73ef405c82..4d1f23dad9b51 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ad3de2234f78fd4b353ae6a1b22401fc", - "content-hash": "25dcf96ed1d8b12a25111e8b3af61317", + "hash": "c8f9e4332a46ace884514d9843021898", + "content-hash": "fa9bd2b88f3c2e1bf562c439cecca917", "packages": [ { "name": "braintree/braintree_php", @@ -4597,7 +4597,8 @@ "ext-xsl": "*", "ext-mbstring": "*", "ext-openssl": "*", - "ext-zip": "*" + "ext-zip": "*", + "ext-pdo_mysql": "*" }, "platform-dev": [] } diff --git a/setup/src/Magento/Setup/Model/PhpReadinessCheck.php b/setup/src/Magento/Setup/Model/PhpReadinessCheck.php index 06e8b34471dad..bcf942687a45a 100644 --- a/setup/src/Magento/Setup/Model/PhpReadinessCheck.php +++ b/setup/src/Magento/Setup/Model/PhpReadinessCheck.php @@ -102,7 +102,8 @@ public function checkPhpSettings() $settings = array_merge( $this->checkXDebugNestedLevel(), - $this->checkPopulateRawPostSetting() + $this->checkPopulateRawPostSetting(), + $this->checkFunctionsExistence() ); foreach ($settings as $setting) { @@ -316,6 +317,33 @@ private function checkPopulateRawPostSetting() return $data; } + /** + * Check whether all special functions exists + * + * @return array + */ + private function checkFunctionsExistence() + { + $data = []; + $requiredFunctions = [ + [ + 'name' => 'imagecreatefromjpeg', + 'message' => 'You must have installed GD library wuth --with-jpeg-dir=DIR option.', + 'helpUrl' => 'http://php.net/manual/en/image.installation.php', + ], + ]; + + foreach ($requiredFunctions as $function) { + $data['missed_function_' . $function['name']] = [ + 'message' => $function['message'], + 'helpUrl' => $function['helpUrl'], + 'error' => !function_exists($function['name']), + ]; + } + + return $data; + } + /** * Normalize PHP Version * diff --git a/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php b/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php index c24e1792331ef..785674dbae390 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php @@ -222,7 +222,12 @@ public function testCheckPhpSettings() 'message' => $xdebugMessage, 'error' => false, ], - ] + 'missed_function_imagecreatefromjpeg' => [ + 'message' => 'You must have installed GD library wuth --with-jpeg-dir=DIR option.', + 'helpUrl' => 'http://php.net/manual/en/image.installation.php', + 'error' => false, + ], + ], ]; if (!$this->isPhp7OrHhvm()) { $this->setUpNoPrettyVersionParser(); @@ -261,8 +266,13 @@ public function testCheckPhpSettingsFailed() 'xdebug_max_nesting_level' => [ 'message' => $xdebugMessage, 'error' => true, - ] - ] + ], + 'missed_function_imagecreatefromjpeg' => [ + 'message' => 'You must have installed GD library wuth --with-jpeg-dir=DIR option.', + 'helpUrl' => 'http://php.net/manual/en/image.installation.php', + 'error' => false, + ], + ], ]; if (!$this->isPhp7OrHhvm()) { $this->setUpNoPrettyVersionParser(); @@ -301,6 +311,13 @@ public function testCheckPhpSettingsNoXDebug() ] ]; } + + $expected['data']['missed_function_imagecreatefromjpeg'] = [ + 'message' => 'You must have installed GD library wuth --with-jpeg-dir=DIR option.', + 'helpUrl' => 'http://php.net/manual/en/image.installation.php', + 'error' => false, + ]; + $this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings()); } From aa98f6831171a324201be19a7dfdc1695ce68639 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Mon, 29 Aug 2016 15:28:59 +0300 Subject: [PATCH 0352/3232] MAGETWO-56826: Notification messages area. Bug fixing activities --- .../web/css/source/_module.less | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_AdminNotification/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_AdminNotification/web/css/source/_module.less index e753eaa8650aa..bdb94e3a8202f 100644 --- a/app/design/adminhtml/Magento/backend/Magento_AdminNotification/web/css/source/_module.less +++ b/app/design/adminhtml/Magento/backend/Magento_AdminNotification/web/css/source/_module.less @@ -11,7 +11,7 @@ @message-system__border-color: @color-gray82; @message-system__border-width: .1rem; @message-system__color: @color-gray20; -@message-system-short-message__padding-vertical: 1.5rem; +@message-system-short__padding-vertical: 1.5rem; @message-system-short-wrapper__height: 5rem; // Triangle marker @@ -38,7 +38,7 @@ background: none; margin: 0 0 -3px; overflow: hidden; - padding: @message-system-short-message__padding-vertical 0 @message-system-short-message__padding-vertical 3.3rem; + padding: @message-system-short__padding-vertical 0 @message-system-short__padding-vertical 3.3rem; &:before { left: .3rem; @@ -55,7 +55,7 @@ } float: right; - padding: @message-system-short-message__padding-vertical 0 0; + padding: @message-system-short__padding-vertical 0 0; vertical-align: top; } } @@ -92,7 +92,7 @@ border-top: 0; display: none; left: -1px; - padding: 0 @indent__l @message-system-short-message__padding-vertical; + padding: 0 @indent__l @message-system-short__padding-vertical; position: absolute; right: -1px; top: 100%; @@ -106,7 +106,7 @@ .message-system-action-dropdown { .lib-button-reset(); float: right; - margin: @message-system-short-message__padding-vertical 0; + margin: @message-system-short__padding-vertical 0; position: relative; .action-toggle-triangle ( From 84bca457e7340dc00848e5074a23574296375c43 Mon Sep 17 00:00:00 2001 From: Yaroslav Onischenko Date: Mon, 29 Aug 2016 16:12:38 +0300 Subject: [PATCH 0353/3232] MAGETWO-55908: Prepare PR --- .../Backend/GroupPrice/AbstractGroupPrice.php | 13 ++++++++----- .../Magento/Catalog/Model/Product/TierPrice.php | 9 --------- 2 files changed, 8 insertions(+), 14 deletions(-) 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 9edb3e81c8ff2..3c5cef0e6ce78 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 @@ -339,6 +339,8 @@ public function setPriceData($object, $priceData) } /** + * Perform price modification + * * @param \Magento\Catalog\Model\Product $object * @param array $data * @return array @@ -346,12 +348,13 @@ public function setPriceData($object, $priceData) */ protected function modifyPriceData($object, $data) { - foreach ($data as $k => $v) { - if (isset($v['price']) && $v['price'] > 0) { - $data[$k]['website_price'] = $v['price']; + /** @var array $priceItem */ + foreach ($data as $key => $priceItem) { + if (isset($priceItem['price']) && $priceItem['price'] > 0) { + $data[$key]['website_price'] = $priceItem['price']; } - if ($v['all_groups']) { - $data[$k]['cust_group'] = $this->_groupManagement->getAllCustomersGroup()->getId(); + if ($priceItem['all_groups']) { + $data[$key]['cust_group'] = $this->_groupManagement->getAllCustomersGroup()->getId(); } } return $data; diff --git a/app/code/Magento/Catalog/Model/Product/TierPrice.php b/app/code/Magento/Catalog/Model/Product/TierPrice.php index 985853314c4e3..e40b24631359c 100644 --- a/app/code/Magento/Catalog/Model/Product/TierPrice.php +++ b/app/code/Magento/Catalog/Model/Product/TierPrice.php @@ -1,14 +1,11 @@ _getExtensionAttributes())) { - $this->setExtensionAttributes( - ObjectManager::getInstance()->get(\Magento\Framework\Api\ExtensionAttributesFactory::class) - ->create(\Magento\Catalog\Api\Data\ProductTierPriceInterface::class) - ); - } return $this->_getExtensionAttributes(); } From c84bb00ab00e738efe22763d22846eb081e50606 Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Mon, 29 Aug 2016 16:49:55 +0300 Subject: [PATCH 0354/3232] MAGETWO-56343: Setup tool check PHP extensions does not check for all needed extensions --- setup/src/Magento/Setup/Model/PhpReadinessCheck.php | 2 +- .../Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup/src/Magento/Setup/Model/PhpReadinessCheck.php b/setup/src/Magento/Setup/Model/PhpReadinessCheck.php index bcf942687a45a..74b2afd1419c4 100644 --- a/setup/src/Magento/Setup/Model/PhpReadinessCheck.php +++ b/setup/src/Magento/Setup/Model/PhpReadinessCheck.php @@ -328,7 +328,7 @@ private function checkFunctionsExistence() $requiredFunctions = [ [ 'name' => 'imagecreatefromjpeg', - 'message' => 'You must have installed GD library wuth --with-jpeg-dir=DIR option.', + 'message' => 'You must have installed GD library with --with-jpeg-dir=DIR option.', 'helpUrl' => 'http://php.net/manual/en/image.installation.php', ], ]; diff --git a/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php b/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php index 785674dbae390..a77bd46c79f25 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php @@ -223,7 +223,7 @@ public function testCheckPhpSettings() 'error' => false, ], 'missed_function_imagecreatefromjpeg' => [ - 'message' => 'You must have installed GD library wuth --with-jpeg-dir=DIR option.', + 'message' => 'You must have installed GD library with --with-jpeg-dir=DIR option.', 'helpUrl' => 'http://php.net/manual/en/image.installation.php', 'error' => false, ], @@ -268,7 +268,7 @@ public function testCheckPhpSettingsFailed() 'error' => true, ], 'missed_function_imagecreatefromjpeg' => [ - 'message' => 'You must have installed GD library wuth --with-jpeg-dir=DIR option.', + 'message' => 'You must have installed GD library with --with-jpeg-dir=DIR option.', 'helpUrl' => 'http://php.net/manual/en/image.installation.php', 'error' => false, ], @@ -313,7 +313,7 @@ public function testCheckPhpSettingsNoXDebug() } $expected['data']['missed_function_imagecreatefromjpeg'] = [ - 'message' => 'You must have installed GD library wuth --with-jpeg-dir=DIR option.', + 'message' => 'You must have installed GD library with --with-jpeg-dir=DIR option.', 'helpUrl' => 'http://php.net/manual/en/image.installation.php', 'error' => false, ]; From 2c67f26f5d7a9a150928024e8476912ee26694ed Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Mon, 29 Aug 2016 09:22:22 -0500 Subject: [PATCH 0355/3232] MAGETWO-55872: Eliminate @escapeNotVerified in Store, Translation and PageCache modules Escaping translation --- .../Magento/Store/view/frontend/templates/switch/flags.phtml | 4 ++-- .../Store/view/frontend/templates/switch/languages.phtml | 2 +- .../Magento/Store/view/frontend/templates/switch/stores.phtml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Store/view/frontend/templates/switch/flags.phtml b/app/code/Magento/Store/view/frontend/templates/switch/flags.phtml index f2e6220bdefbb..53d4428172aa0 100644 --- a/app/code/Magento/Store/view/frontend/templates/switch/flags.phtml +++ b/app/code/Magento/Store/view/frontend/templates/switch/flags.phtml @@ -9,8 +9,8 @@ ?> getStores())>1): ?>
    - - getStores() as $_lang): ?> getId() == $block->getCurrentStoreId()) ? ' selected="selected"' : '' ?> diff --git a/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml b/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml index 6d77072e66668..5f32021de3471 100644 --- a/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml +++ b/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml @@ -16,7 +16,7 @@ getStores())>1): ?> getIdModifier() ? '-' . $block->getIdModifier() : ''?>
    - + escapeHtml(__('Language')) ?>
    - - + + - - + + getSessionInfoCollection(); if ($block->areMultipleSessionsActive()): ?> data-mage-init='{"confirmRedirect":{ "message": "", - "url":"getUrl('security/session/logoutAll') ?>" + echo $block->escapeJs(__('Are you sure that you want to log out all other sessions?')) ?>", + "url":"escapeJs($block->escapeUrl($block->getUrl('security/session/logoutAll'))) ?>" }}' disabled - title=""> - + title="escapeHtmlAttr(__('Log out all other sessions')) ?>"> + escapeHtml(__('Log out all other sessions')) ?>
    getRemoteIp()) ?>
    + echo $block->escapeHtml(__('This computer is using IP address %1.', $block->getRemoteIp())) ?> diff --git a/app/code/Magento/Store/view/frontend/templates/switch/flags.phtml b/app/code/Magento/Store/view/frontend/templates/switch/flags.phtml index f2e6220bdefbb..cb151bded68b9 100644 --- a/app/code/Magento/Store/view/frontend/templates/switch/flags.phtml +++ b/app/code/Magento/Store/view/frontend/templates/switch/flags.phtml @@ -6,14 +6,15 @@ // @codingStandardsIgnoreFile +// @deprecated ?> getStores())>1): ?>
    - - getStores() as $_lang): ?> getId() == $block->getCurrentStoreId()) ? ' selected="selected"' : '' ?> - +
    diff --git a/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml b/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml index 6d77072e66668..3b55304b2808f 100644 --- a/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml +++ b/app/code/Magento/Store/view/frontend/templates/switch/languages.phtml @@ -6,27 +6,22 @@ // @codingStandardsIgnoreFile +/** @var \Magento\Store\Block\Switcher $block */ ?> - - getStores())>1): ?> -getIdModifier() ? '-' . $block->getIdModifier() : ''?> -
    - +getIdModifier() ? '-' . $block->getIdModifier() : '' ?> +
    + escapeHtml(__('Language')) ?>
    + canRemoveItems()): ?> From cfc1401ca2a90d00fb8fed793f96b0cfd8b78508 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Mon, 5 Sep 2016 16:50:33 +0300 Subject: [PATCH 0528/3232] MAGETWO-57774: Update Creditmemo/InvoiceValidator - only online invoice allowed --- .../Order/Invoice/Validation/CanRefund.php | 85 +++++++++++++++++-- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Validation/CanRefund.php b/app/code/Magento/Sales/Model/Order/Invoice/Validation/CanRefund.php index 21910c8a5b126..8e68cade3caa7 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Validation/CanRefund.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Validation/CanRefund.php @@ -5,6 +5,11 @@ */ namespace Magento\Sales\Model\Order\Invoice\Validation; +use Magento\Payment\Model\InfoInterface; +use Magento\Payment\Model\MethodInterface; +use Magento\Sales\Api\Data\InvoiceInterface; +use Magento\Sales\Api\OrderPaymentRepositoryInterface; +use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Model\Order\Invoice; use Magento\Sales\Model\ValidatorInterface; @@ -13,19 +18,89 @@ */ class CanRefund implements ValidatorInterface { + /** + * @var OrderPaymentRepositoryInterface + */ + private $paymentRepository; + + /** + * @var OrderRepositoryInterface + */ + private $orderRepository; + + /** + * CanRefund constructor. + * + * @param OrderPaymentRepositoryInterface $paymentRepository + * @param OrderRepositoryInterface $orderRepository + */ + public function __construct( + OrderPaymentRepositoryInterface $paymentRepository, + OrderRepositoryInterface $orderRepository + ) { + $this->paymentRepository = $paymentRepository; + $this->orderRepository = $orderRepository; + } + /** * @inheritdoc */ public function validate($entity) { - $messages = []; if ( - $entity->getState() != Invoice::STATE_PAID || - abs($entity->getBaseGrandTotal() - $entity->getBaseTotalRefunded()) < .0001 + $entity->getState() == Invoice::STATE_PAID && + $this->isGrandTotalEnoughToRefund($entity) && + $this->isPaymentAllowRefund($entity) ) { - $messages[] = __('We can\'t create creditmemo for the invoice.'); + return []; } - return $messages; + return [__('We can\'t create creditmemo for the invoice.')]; + } + + /** + * @param InvoiceInterface $invoice + * @return bool + */ + private function isPaymentAllowRefund(InvoiceInterface $invoice) + { + $order = $this->orderRepository->get($invoice->getOrderId()); + $payment = $order->getPayment(); + if (!$payment instanceof InfoInterface) { + return false; + } + $method = $payment->getMethodInstance(); + return $this->canPartialRefund($method, $payment) || $this->canFullRefund($invoice, $method); + } + + /** + * @param InvoiceInterface $entity + * @return bool + */ + private function isGrandTotalEnoughToRefund(InvoiceInterface $entity) + { + return abs($entity->getBaseGrandTotal() - $entity->getBaseTotalRefunded()) >= .0001; + } + + /** + * @param MethodInterface $method + * @param InfoInterface $payment + * @return bool + */ + private function canPartialRefund(MethodInterface $method, InfoInterface $payment) + { + return $method->canRefund() && + $method->canRefundPartialPerInvoice() && + $payment->getAmountPaid() > $payment->getAmountRefunded(); + } + + /** + * @param InvoiceInterface $invoice + * @param MethodInterface $method + * @return bool + */ + private function canFullRefund(InvoiceInterface $invoice, MethodInterface $method) + { + return $method->canRefund() && !$invoice->getIsUsedForRefund(); } } From 22557ca9bf675142031ac6dc5ba461390ab1bfe2 Mon Sep 17 00:00:00 2001 From: Olga Nakonechna Date: Mon, 5 Sep 2016 17:47:25 +0300 Subject: [PATCH 0529/3232] MAGETWO-57933: Product quantity is not updated on 'cart/configure' page second time --- .../Checkout/CustomerData/DefaultItem.php | 1 + .../layout/checkout_cart_configure.xml | 3 + .../view/configure/product-customer-data.js | 59 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js diff --git a/app/code/Magento/Checkout/CustomerData/DefaultItem.php b/app/code/Magento/Checkout/CustomerData/DefaultItem.php index 4cdc4c59b9726..9c35265d03ff1 100644 --- a/app/code/Magento/Checkout/CustomerData/DefaultItem.php +++ b/app/code/Magento/Checkout/CustomerData/DefaultItem.php @@ -70,6 +70,7 @@ protected function doGetItemData() 'item_id' => $this->item->getId(), 'configure_url' => $this->getConfigureUrl(), 'is_visible_in_site_visibility' => $this->item->getProduct()->isVisibleInSiteVisibility(), + 'product_id' => $this->item->getProduct()->getId(), 'product_name' => $this->item->getProduct()->getName(), 'product_sku' => $this->item->getProduct()->getSku(), 'product_url' => $this->getProductUrl(), diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml index 403e07c64d3ed..151b079220de7 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml @@ -6,6 +6,9 @@ */ --> + + + diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js b/app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js new file mode 100644 index 0000000000000..a612b5e2dc6b7 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js @@ -0,0 +1,59 @@ +require([ + 'jquery', + 'Magento_Customer/js/customer-data' +], function ($, customerData) { + 'use strict'; + + var selectors = { + qtySelector: '#product_addtocart_form [name="qty"]', + productIdSelector: '#product_addtocart_form [name="product"]' + }, + cartData = customerData.get('cart'), + productId = $(selectors.productIdSelector).val(), + productQty, + productQtyInput, + + /** + * Updates product's qty input value according to actual data + */ + updateQty = function () { + + if (productQty || productQty === 0) { + productQtyInput = productQtyInput || $(selectors.qtySelector); + + if (productQtyInput && productQty.toString() !== productQtyInput.val()) { + productQtyInput.val(productQty); + } + } + }, + + /** + * Sets productQty according to cart data from customer-data + * + * @param {Object} data - cart data from customer-data + */ + setProductQty = function (data) { + var product; + + if (!(data && data.items && data.items.length && productId)) { + return; + } + product = data.items.find(function (item) { + return item['product_id'] === productId || + item['item_id'] === productId; + }); + + if (!product) { + return; + } + productQty = product.qty; + }; + + cartData.subscribe(function (updateCartData) { + setProductQty(updateCartData); + updateQty(); + }); + + setProductQty(cartData()); + updateQty(); +}); From cc5cd5606745e6050de5074b21b7d3a7bae79e02 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Mon, 5 Sep 2016 18:14:59 +0300 Subject: [PATCH 0530/3232] MAGETWO-57820: [GITHUB] php bin/magento i18n:pack creates unwanted dir #6260 --- .../src/Magento/Setup/Module/I18n/Context.php | 6 ++++ .../I18n/Pack/Writer/File/AbstractFile.php | 3 ++ .../I18n/UnregisteredComponentException.php | 13 +++++++ .../Test/Unit/Module/I18n/ContextTest.php | 34 +++++++++++++------ 4 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 setup/src/Magento/Setup/Module/I18n/UnregisteredComponentException.php diff --git a/setup/src/Magento/Setup/Module/I18n/Context.php b/setup/src/Magento/Setup/Module/I18n/Context.php index 9db97153972cb..0dbdbb0248607 100644 --- a/setup/src/Magento/Setup/Module/I18n/Context.php +++ b/setup/src/Magento/Setup/Module/I18n/Context.php @@ -95,6 +95,7 @@ private function getComponentName($componentType, $path) * @param array $value * @return string * @throws \InvalidArgumentException + * @throws UnregisteredComponentException */ public function buildPathToLocaleDirectoryByContext($type, $value) { @@ -111,6 +112,11 @@ public function buildPathToLocaleDirectoryByContext($type, $value) default: throw new \InvalidArgumentException(sprintf('Invalid context given: "%s".', $type)); } + + if (null === $path) { + throw new UnregisteredComponentException(); + } + return $path . '/' . self::LOCALE_DIRECTORY . '/'; } } diff --git a/setup/src/Magento/Setup/Module/I18n/Pack/Writer/File/AbstractFile.php b/setup/src/Magento/Setup/Module/I18n/Pack/Writer/File/AbstractFile.php index 00a1361c3c761..817e783999a33 100644 --- a/setup/src/Magento/Setup/Module/I18n/Pack/Writer/File/AbstractFile.php +++ b/setup/src/Magento/Setup/Module/I18n/Pack/Writer/File/AbstractFile.php @@ -10,6 +10,7 @@ use Magento\Setup\Module\I18n\Factory; use Magento\Setup\Module\I18n\Locale; use Magento\Setup\Module\I18n\Pack\WriterInterface; +use Magento\Setup\Module\I18n\UnregisteredComponentException; /** * Abstract pack writer @@ -120,6 +121,8 @@ protected function _buildPackFilesData(Dictionary $dictionary) $path = $this->_context->buildPathToLocaleDirectoryByContext($phrase->getContextType(), $context); } catch (\InvalidArgumentException $e) { throw new \InvalidArgumentException($e->getMessage() . ' Row #' . ($key + 1) . '.'); + } catch (UnregisteredComponentException $e) { + continue; } $filename = $path . $this->_locale . '.' . $this->_getFileExtension(); $files[$filename][$phrase->getPhrase()] = $phrase; diff --git a/setup/src/Magento/Setup/Module/I18n/UnregisteredComponentException.php b/setup/src/Magento/Setup/Module/I18n/UnregisteredComponentException.php new file mode 100644 index 0000000000000..ff47e683476e1 --- /dev/null +++ b/setup/src/Magento/Setup/Module/I18n/UnregisteredComponentException.php @@ -0,0 +1,13 @@ +componentRegistrar->expects($this->any()) ->method('getPaths') - ->will($this->returnValueMap($pathValues)); + ->willReturnMap($pathValues); $this->context = new Context($this->componentRegistrar); $this->assertEquals($context, $this->context->getContextByPath($path)); } @@ -108,10 +108,8 @@ public function testBuildPathToLocaleDirectoryByContext($path, $context, $regist $paths[$module[1]] = $module[2]; } $this->componentRegistrar->expects($this->any()) - ->method('getPaths') - ->with(ComponentRegistrar::MODULE) - ->willReturn($paths); - $this->componentRegistrar->expects($this->any())->method('getPath')->will($this->returnValueMap($registrar)); + ->method('getPath') + ->willReturnMap($registrar); $this->context = new Context($this->componentRegistrar); $this->assertEquals($path, $this->context->buildPathToLocaleDirectoryByContext($context[0], $context[1])); } @@ -127,7 +125,11 @@ public function dataProviderPathToLocaleDirectoryByContext() [Context::CONTEXT_TYPE_MODULE, 'Magento_Module'], [[ComponentRegistrar::MODULE, 'Magento_Module', BP . '/app/code/Magento/Module']] ], - ['/i18n/', [Context::CONTEXT_TYPE_THEME, 'theme/test.phtml'], []], + [ + BP . '/app/design/frontend/Magento/luma/i18n/', + [Context::CONTEXT_TYPE_THEME, 'rontend/Magento/luma'], + [[ComponentRegistrar::THEME, 'rontend/Magento/luma', BP . '/app/design/frontend/Magento/luma']] + ], [BP . '/lib/web/i18n/', [Context::CONTEXT_TYPE_LIB, 'lib/web/module/test.phtml'], []], ]; } @@ -138,11 +140,23 @@ public function dataProviderPathToLocaleDirectoryByContext() */ public function testBuildPathToLocaleDirectoryByContextWithInvalidType() { - $this->componentRegistrar->expects($this->any()) - ->method('getPaths') - ->with(ComponentRegistrar::MODULE) - ->willReturn(['module' => '/path/to/module']); + $this->componentRegistrar->expects($this->never()) + ->method('getPath'); $this->context = new Context($this->componentRegistrar); $this->context->buildPathToLocaleDirectoryByContext('invalid_type', 'Magento_Module'); } + + /** + * @expectedException \Magento\Setup\Module\I18n\UnregisteredComponentException + */ + public function testBuildPathToLocaleDirectoryByContextWithUnregisteredComponent() + { + $moduleName = 'Magento_Module'; + $this->componentRegistrar->expects($this->once()) + ->method('getPath') + ->with(ComponentRegistrar::MODULE, $moduleName) + ->willReturn(null); + $this->context = new Context($this->componentRegistrar); + $this->context->buildPathToLocaleDirectoryByContext(ComponentRegistrar::MODULE, $moduleName); + } } From 629a4a4599620b119348efd37b1b99bb18bda8eb Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Mon, 5 Sep 2016 18:39:29 +0300 Subject: [PATCH 0531/3232] MAGETWO-56534: CLONE - Price in cart does not update correctly when price is changed in admin. --- app/code/Magento/Quote/etc/di.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Quote/etc/di.xml b/app/code/Magento/Quote/etc/di.xml index c4b1f9d1ce802..7ff9a385fca72 100644 --- a/app/code/Magento/Quote/etc/di.xml +++ b/app/code/Magento/Quote/etc/di.xml @@ -92,8 +92,7 @@ - - + From 24ae3a4085cc5bc9b6026714e942e11678122aa5 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Mon, 5 Sep 2016 18:46:57 +0300 Subject: [PATCH 0532/3232] MAGETWO-56534: CLONE - Price in cart does not update correctly when price is changed in admin. --- app/code/Magento/Quote/etc/di.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Quote/etc/di.xml b/app/code/Magento/Quote/etc/di.xml index 7ff9a385fca72..6fb039213963f 100644 --- a/app/code/Magento/Quote/etc/di.xml +++ b/app/code/Magento/Quote/etc/di.xml @@ -94,5 +94,4 @@ - From fe0aecc6b6740b005a419f57e37ea580fea3694b Mon Sep 17 00:00:00 2001 From: Rodion Savchuk Date: Mon, 5 Sep 2016 18:53:32 +0300 Subject: [PATCH 0533/3232] MTA-3519: Update Products Using Mass Action change Stock Availability --- .../Product/Edit/Action/Attribute.xml | 17 ----- .../Edit/Action/Tab/AdvancedInventory.php | 24 +++++++ .../{Attribute.php => Tab/Attributes.php} | 8 +-- .../Product/Edit/Action/UpdateAttribute.php | 72 +++++++++++++++++++ .../Product/Edit/Action/UpdateAttribute.xml | 36 ++++++++++ .../Test/Block/Adminhtml/Product/Grid.php | 19 ++++- .../AssertMassProductUpdateSuccessMessage.php | 7 +- .../Test/Constraint/AssertProductsInStock.php | 47 ++++++++++++ .../CatalogProductActionAttributeEdit.xml | 2 +- .../Product/MassProductUpdateTest.php | 61 +++++++++++----- .../Product/MassProductUpdateTest.xml | 17 ++++- .../Test/Block/Adminhtml/Product/Grid.php | 33 +++++++++ .../Page/Adminhtml/CatalogProductIndex.xml | 14 ++++ .../Test/Repository/ConfigurableProduct.xml | 34 +++++++++ .../Adminhtml/AbstractFormContainers.php | 2 +- .../Ui/Test/Block/Adminhtml/DataGrid.php | 4 +- 16 files changed, 347 insertions(+), 50 deletions(-) delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Attribute.xml create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Tab/AdvancedInventory.php rename dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/{Attribute.php => Tab/Attributes.php} (87%) create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.xml create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductsInStock.php create mode 100644 dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php create mode 100644 dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductIndex.xml diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Attribute.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Attribute.xml deleted file mode 100644 index 59b367e49bd66..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Attribute.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - attributes - - - [name='toggle_price'] - checkbox - - - - diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Tab/AdvancedInventory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Tab/AdvancedInventory.php new file mode 100644 index 0000000000000..b43923841625b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Tab/AdvancedInventory.php @@ -0,0 +1,24 @@ +_rootElement->find($this->advancedInventoryTab)->isVisible()) { + $this->_rootElement->find($this->advancedInventoryTab)->click(); + } + + return parent::fillTabs($fields, $element); + } + + /** + * Fill form with containers. + * + * @param FixtureInterface $product + * @param array $checkbox [optional] + * @return $this + */ + public function fillForm(FixtureInterface $product, $checkbox = null) + { + $fields = $product->getData(); + foreach ($checkbox as $key => $value) { + $fields[$key] = $value; + } + $fields = array_reverse($fields); + $this->unassignedFields = $fields; + $this->fillMissedFields(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.xml new file mode 100644 index 0000000000000..ce33473cadb29 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.xml @@ -0,0 +1,36 @@ + + + + + Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Action\Tab\Attributes + #attributes_update_tabs_attributes + + + [name='toggle_price'] + checkbox + + + #price + + + + + \Magento\Backend\Test\Block\Widget\Tab + #attributes_update_tabs_inventory + + + [id=inventory_stock_availability_checkbox] + checkbox + + + [id=inventory_stock_availability] + select + + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php index d5e81ad56fd32..3925877bdb530 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php @@ -7,6 +7,7 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Product; use Magento\Ui\Test\Block\Adminhtml\DataGrid; +use Magento\Mtf\Fixture\FixtureInterface; /** * Backend catalog product grid. @@ -72,12 +73,26 @@ class Grid extends DataGrid /** * Update attributes for selected items. * - * @param array $items [optional] + * @param array $items * @return void */ public function updateAttributes(array $items = []) { - $this->massaction($items, 'Update attributes'); + $productsSku = []; + /** @var FixtureInterface $product */ + foreach ($items as $product) { + $dataConfig = $product->getDataConfig(); + $typeId = isset($dataConfig['type_id']) ? $dataConfig['type_id'] : null; + if ($this->hasRender($typeId)) { + $renderArguments = [ + 'product' => $product, + ]; + $productsSku = $this->callRender($typeId, 'updateAttributes', $renderArguments); + } else { + $productsSku[] = ["sku" => $product->getSku()]; + } + } + $this->massaction($productsSku, 'Update attributes'); } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php index 1666244802ed2..6d1b90e84ea51 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php @@ -23,13 +23,12 @@ class AssertMassProductUpdateSuccessMessage extends AbstractConstraint * Assert that after mass update successful message appears. * * @param CatalogProductIndex $productGrid - * @param array $products + * @param $productsCount * @return void */ - public function processAssert(CatalogProductIndex $productGrid, $products = []) + public function processAssert(CatalogProductIndex $productGrid, $productsCount) { - $countProducts = count($products) ? count($products) : 1; - $expectedMessage = sprintf(self::SUCCESS_MESSAGE, $countProducts); + $expectedMessage = sprintf(self::SUCCESS_MESSAGE, $productsCount); $actualMessage = $productGrid->getMessagesBlock()->getSuccessMessage(); \PHPUnit_Framework_Assert::assertEquals( $expectedMessage, diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductsInStock.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductsInStock.php new file mode 100644 index 0000000000000..73ff98c582e7d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductsInStock.php @@ -0,0 +1,47 @@ +processAssert($catalogProductView, $browser, $product); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'In stock control is visible.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductActionAttributeEdit.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductActionAttributeEdit.xml index e875bdc0817e9..1910f34e6fbcd 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductActionAttributeEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductActionAttributeEdit.xml @@ -7,7 +7,7 @@ --> - + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php index 36c04d0bbbdf6..38fa9e0143b92 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php @@ -6,10 +6,13 @@ namespace Magento\Catalog\Test\TestCase\Product; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\TestCase\Injectable; use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductActionAttributeEdit; +use Magento\Mtf\TestStep\TestStepFactory; /** * Precondition: @@ -59,35 +62,58 @@ class MassProductUpdateTest extends Injectable */ protected $configData; + /** + * @var TestStepFactory + */ + private $testStepFactory; + + /** + * @var FixtureFactory + */ + private $fixtureFactory; + /** * Injection data. * * @param CatalogProductIndex $productGrid * @param CatalogProductActionAttributeEdit $attributeMassActionPage - * @return void + * @param TestStepFactory $testStepFactory + * @param FixtureFactory $fixtureFactory */ public function __inject( CatalogProductIndex $productGrid, - CatalogProductActionAttributeEdit $attributeMassActionPage + CatalogProductActionAttributeEdit $attributeMassActionPage, + TestStepFactory $testStepFactory, + FixtureFactory $fixtureFactory ) { $this->productGrid = $productGrid; $this->attributeMassActionPage = $attributeMassActionPage; + $this->testStepFactory = $testStepFactory; + $this->fixtureFactory = $fixtureFactory; } /** * Run mass update product simple entity test. * - * @param CatalogProductSimple $initialProduct * @param CatalogProductSimple $product * @param string $configData + * @param array $initialProducts + * @param string $checkbox * @return array */ - public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData) - { + public function test( + CatalogProductSimple $product, + $configData, + array $initialProducts, + $checkbox + ) { $this->configData = $configData; // Preconditions - $initialProduct->persist(); + $products = $this->testStepFactory->create( + \Magento\Catalog\Test\TestStep\CreateProductsStep::class, + ['products' => $initialProducts] + )->run()['products']; $this->objectManager->create( \Magento\Config\Test\TestStep\SetupConfigurationStep::class, @@ -96,19 +122,20 @@ public function test(CatalogProductSimple $initialProduct, CatalogProductSimple // Steps $this->productGrid->open(); - $this->productGrid->getProductGrid()->updateAttributes([['sku' => $initialProduct->getSku()]]); - $this->attributeMassActionPage->getAttributesBlockForm()->fill($product); + $this->productGrid->getProductGrid()->updateAttributes($products); + $this->attributeMassActionPage->getAttributesBlockForm()->fillForm($product, $checkbox); $this->attributeMassActionPage->getFormPageActions()->save(); - $data = array_merge($initialProduct->getData(), $product->getData()); - $product = $this->objectManager->create( - \Magento\Catalog\Test\Fixture\CatalogProductSimple::class, - ['data' => $data] - ); - return [ - 'category' => $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0], - 'product' => $product, - ]; + $productsReturn = []; + /** @var FixtureInterface $item */ + foreach ($products as $item) { + $productsReturn[] = $this->fixtureFactory->create( + get_class($item), + ['data' => array_merge($item->getData(), $product->getData())] + ); + } + + return ['products' => $productsReturn]; } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml index 6f937999f3c34..3f61b38add2d8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml @@ -9,11 +9,24 @@ product_flat - simple_10_dollar + catalogProductSimple::simple_10_dollar + catalogProductSimple::simple_10_dollar + 2 + Yes 1.99 - + + + product_flat + configurableProduct::out_of_stock + catalogProductSimple::out_of_stock + 3 + Yes + In Stock + + + diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php new file mode 100644 index 0000000000000..5d64683aa677b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php @@ -0,0 +1,33 @@ +getConfigurableAttributesData(); + $productItems[] = ['sku' => $product->getSku()]; + foreach ($configurableAttributesData['matrix'] as $variation) { + $productItems[] = ['sku' => $variation['sku']]; + } + + return $productItems; + } +} diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductIndex.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductIndex.xml new file mode 100644 index 0000000000000..1c93ec6b2b96a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Page/Adminhtml/CatalogProductIndex.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml index 2a3703a106075..9e05cd812aa5d 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml @@ -41,6 +41,40 @@ + + Test configurable product %isolation% + sku_test_configurable_product_%isolation% + + 40 + price_40 + + This item has weight + 30 + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + one_variation + + + Out of Stock + + + + default + + + + default + + + configurable_default + + + Test configurable product %isolation% sku_test_configurable_product_%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/AbstractFormContainers.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/AbstractFormContainers.php index b6ed37af715be..180afa8fe7ec6 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/AbstractFormContainers.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/AbstractFormContainers.php @@ -158,7 +158,7 @@ protected function getFixtureFieldsByContainers(InjectableFixture $fixture) /** * Fill specified form with containers data. - * + * * Input data in format * [[container => [field => [attribute_name => attribute_value, ..], ..], ..] * where container name can be empty if a field is not assigned to any container. diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php index eae09d72a47b9..4eba91896a1e5 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php @@ -142,7 +142,7 @@ class DataGrid extends Grid * * @var string */ - protected $currentPage = '[data-ui-id="current-page-input"]'; + protected $currentPage = ".//*[@data-ui-id='current-page-input'][not(ancestor::*[@class='sticky-header'])]"; /** * Clear all applied Filters. @@ -347,7 +347,7 @@ public function selectItems(array $items, $isSortable = true) $this->sortGridByField('ID'); } foreach ($items as $item) { - $this->_rootElement->find($this->currentPage)->setValue(''); + $this->_rootElement->find($this->currentPage, Locator::SELECTOR_XPATH)->setValue(''); $this->waitLoader(); $selectItem = $this->getRow($item)->find($this->selectItem); do { From 36000fe370f484fcb30e52a7f6b3a351c5583110 Mon Sep 17 00:00:00 2001 From: Oleksandr Radchenko Date: Mon, 5 Sep 2016 18:53:28 +0300 Subject: [PATCH 0534/3232] MAGETWO-54680: Fixed online refund --- .../Order/Creditmemo/RefundOperation.php | 5 ++-- .../Order/Creditmemo/RefundOperationTest.php | 25 +++++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/RefundOperation.php b/app/code/Magento/Sales/Model/Order/Creditmemo/RefundOperation.php index ef60ad2ce51be..f01dd0dc3732e 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/RefundOperation.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/RefundOperation.php @@ -114,9 +114,8 @@ public function execute(CreditmemoInterface $creditmemo, OrderInterface $order, $order->getBaseTotalInvoicedCost() - $creditmemo->getBaseCost() ); - if ($online) { - $order->getPayment()->refund($creditmemo); - } + $creditmemo->setDoTransaction($online); + $order->getPayment()->refund($creditmemo); $this->eventManager->dispatch('sales_order_creditmemo_refund', ['creditmemo' => $creditmemo]); } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/RefundOperationTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/RefundOperationTest.php index 1b8d40d042716..2c5173507d997 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/RefundOperationTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/RefundOperationTest.php @@ -50,7 +50,7 @@ protected function setUp() $this->creditmemoMock = $this->getMockBuilder(\Magento\Sales\Api\Data\CreditmemoInterface::class) ->disableOriginalConstructor() - ->setMethods(['getBaseCost']) + ->setMethods(['getBaseCost', 'setDoTransaction']) ->getMockForAbstractClass(); $this->paymentMock = $this->getMockBuilder(\Magento\Framework\Pricing\PriceCurrencyInterface::class) @@ -142,6 +142,7 @@ public function testExecuteWithWrongOrder() public function testExecuteOffline($amounts) { $orderId = 1; + $online = false; $this->creditmemoMock->expects($this->once()) ->method('getState') ->willReturn(Creditmemo::STATE_REFUNDED); @@ -174,8 +175,17 @@ public function testExecuteOffline($amounts) $this->orderMock->expects($this->never()) ->method('setTotalOnlineRefunded'); - $this->orderMock->expects($this->never()) - ->method('getPayment'); + $this->orderMock->expects($this->once()) + ->method('getPayment') + ->willReturn($this->paymentMock); + + $this->paymentMock->expects($this->once()) + ->method('refund') + ->with($this->creditmemoMock); + + $this->creditmemoMock->expects($this->once()) + ->method('setDoTransaction') + ->with($online); $this->eventManagerMock->expects($this->once()) ->method('dispatch') @@ -186,7 +196,7 @@ public function testExecuteOffline($amounts) $this->assertEquals( $this->orderMock, - $this->subject->execute($this->creditmemoMock, $this->orderMock, false) + $this->subject->execute($this->creditmemoMock, $this->orderMock, $online) ); } @@ -197,6 +207,7 @@ public function testExecuteOffline($amounts) public function testExecuteOnline($amounts) { $orderId = 1; + $online = true; $this->creditmemoMock->expects($this->once()) ->method('getState') ->willReturn(Creditmemo::STATE_REFUNDED); @@ -229,6 +240,10 @@ public function testExecuteOnline($amounts) $this->orderMock->expects($this->never()) ->method('setTotalOfflineRefunded'); + $this->creditmemoMock->expects($this->once()) + ->method('setDoTransaction') + ->with($online); + $this->orderMock->expects($this->once()) ->method('getPayment') ->willReturn($this->paymentMock); @@ -238,7 +253,7 @@ public function testExecuteOnline($amounts) $this->assertEquals( $this->orderMock, - $this->subject->execute($this->creditmemoMock, $this->orderMock, true) + $this->subject->execute($this->creditmemoMock, $this->orderMock, $online) ); } From 783645893332cdff897fc53f294d8bd2191bf6e0 Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Mon, 5 Sep 2016 18:15:36 +0300 Subject: [PATCH 0535/3232] =?UTF-8?q?MAGETWO-57923:=20=E2=80=9CNo=20Paymen?= =?UTF-8?q?t=20method=20available=E2=80=9D=20when=20customer=20tries=20to?= =?UTF-8?q?=20ship=20his=20items=20to=20billing=20restricted=20country?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added configuration option for billing address displays on payment step - Added validator pool for Braintree PayPal - Fixed vault payments comparator callback - Updated checkout layout processor for new configuration option --- app/code/Magento/Braintree/Helper/Country.php | 2 - app/code/Magento/Braintree/etc/di.xml | 19 +- .../Block/Checkout/LayoutProcessor.php | 222 +++++++++----- app/code/Magento/Checkout/Helper/Data.php | 14 + .../BillingAddressDisplayOptions.php | 39 +++ .../Checkout/Model/DefaultConfigProvider.php | 1 + .../Block/Checkout/LayoutProcessorTest.php | 276 ++++++++++++++++++ .../Magento/Checkout/etc/adminhtml/system.xml | 4 + .../frontend/web/js/view/billing-address.js | 37 ++- .../web/template/billing-address.html | 4 +- .../CanUseForCountry/CountryProvider.php | 4 +- .../CanUseForCountry/CountryProviderTest.php | 130 +++++++-- .../Vault/Model/Ui/TokensConfigProvider.php | 6 +- .../Model/Ui/TokensConfigProviderTest.php | 2 +- .../frontend/web/js/view/payment/vault.js | 3 +- .../Model/Ui/TokensConfigProviderTest.php | 2 +- 16 files changed, 637 insertions(+), 128 deletions(-) create mode 100644 app/code/Magento/Checkout/Model/Adminhtml/BillingAddressDisplayOptions.php create mode 100644 app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php diff --git a/app/code/Magento/Braintree/Helper/Country.php b/app/code/Magento/Braintree/Helper/Country.php index 3a3116b0d9ac0..3067c95d5e373 100644 --- a/app/code/Magento/Braintree/Helper/Country.php +++ b/app/code/Magento/Braintree/Helper/Country.php @@ -5,8 +5,6 @@ */ namespace Magento\Braintree\Helper; -use Magento\Directory\Model\ResourceModel\Country\CollectionFactory; - /** * Class Country */ diff --git a/app/code/Magento/Braintree/etc/di.xml b/app/code/Magento/Braintree/etc/di.xml index 849a3039fc361..d051ef78cfcd2 100644 --- a/app/code/Magento/Braintree/etc/di.xml +++ b/app/code/Magento/Braintree/etc/di.xml @@ -22,6 +22,7 @@ Magento\Braintree\Model\Ui\PayPal\ConfigProvider::PAYPAL_CODE BraintreePayPalInfo BraintreePayPalValueHandlerPool + BraintreePayPalValidatorPool BraintreePayPalCommandPool @@ -474,7 +475,7 @@ - + Magento\Braintree\Gateway\Config\Config @@ -487,6 +488,22 @@ + + + + + + Magento\Braintree\Gateway\Config\PayPal\Config + + + + + + BraintreePayPalCountryValidator + + + + diff --git a/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php index 646137310cb51..1b2c744419891 100644 --- a/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php +++ b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php @@ -5,6 +5,7 @@ */ namespace Magento\Checkout\Block\Checkout; +use Magento\Checkout\Helper\Data; use Magento\Framework\App\ObjectManager; class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcessorInterface @@ -29,6 +30,11 @@ class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcesso */ private $options; + /** + * @var Data + */ + private $checkoutDataHelper; + /** * @param \Magento\Customer\Model\AttributeMetadataDataProvider $attributeMetadataDataProvider * @param \Magento\Ui\Component\Form\AttributeMapper $attributeMapper @@ -133,23 +139,12 @@ public function process($jsLayout) if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children'] )) { - if (!isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['payments-list']['children'])) { - $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['payments-list']['children'] = []; - } - $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['payments-list']['children'] = - array_merge_recursive( - $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['payments-list']['children'], - $this->processPaymentConfiguration( - $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['renders']['children'], - $elements - ) - ); + ['payment']['children'] = $this->processPaymentChildrenComponents( + $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children'], + $elements + ); } if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step'] @@ -168,6 +163,44 @@ public function process($jsLayout) return $jsLayout; } + /** + * Appends billing address form component to payment layout + * @param array $paymentLayout + * @param array $elements + * @return array + */ + private function processPaymentChildrenComponents(array $paymentLayout, array $elements) + { + if (!isset($paymentLayout['payments-list']['children'])) { + $paymentLayout['payments-list']['children'] = []; + } + + if (!isset($paymentLayout['afterMethods']['children'])) { + $paymentLayout['afterMethods']['children'] = []; + } + + // The if billing address should be displayed on Payment method or page + if ($this->getCheckoutDataHelper()->isDisplayBillingOnPaymentMethodAvailable()) { + $paymentLayout['payments-list']['children'] = + array_merge_recursive( + $paymentLayout['payments-list']['children'], + $this->processPaymentConfiguration( + $paymentLayout['renders']['children'], + $elements + ) + ); + } else { + $component['billing-address-form'] = $this->getBillingAddressComponent('shared', $elements); + $paymentLayout['afterMethods']['children'] = + array_merge_recursive( + $component, + $paymentLayout['afterMethods']['children'] + ); + } + + return $paymentLayout; + } + /** * Inject billing address component into every payment component * @@ -183,75 +216,102 @@ private function processPaymentConfiguration(array &$configuration, array $eleme if (empty($paymentComponent['isBillingAddressRequired'])) { continue; } - $output[$paymentCode . '-form'] = [ - 'component' => 'Magento_Checkout/js/view/billing-address', - 'displayArea' => 'billing-address-form-' . $paymentCode, - 'provider' => 'checkoutProvider', - 'deps' => 'checkoutProvider', - 'dataScopePrefix' => 'billingAddress' . $paymentCode, - 'sortOrder' => 1, - 'children' => [ - 'form-fields' => [ - 'component' => 'uiComponent', - 'displayArea' => 'additional-fieldsets', - 'children' => $this->merger->merge( - $elements, - 'checkoutProvider', - 'billingAddress' . $paymentCode, - [ - 'country_id' => [ - 'sortOrder' => 115, - ], - 'region' => [ - 'visible' => false, - ], - 'region_id' => [ - 'component' => 'Magento_Ui/js/form/element/region', - 'config' => [ - 'template' => 'ui/form/field', - 'elementTmpl' => 'ui/form/element/select', - 'customEntry' => 'billingAddress' . $paymentCode . '.region', - ], - 'validation' => [ - 'required-entry' => true, - ], - 'filterBy' => [ - 'target' => '${ $.provider }:${ $.parentScope }.country_id', - 'field' => 'country_id', - ], - ], - 'postcode' => [ - 'component' => 'Magento_Ui/js/form/element/post-code', - 'validation' => [ - 'required-entry' => true, - ], - ], - 'company' => [ - 'validation' => [ - 'min_text_length' => 0, - ], - ], - 'fax' => [ - 'validation' => [ - 'min_text_length' => 0, - ], - ], - 'telephone' => [ - 'config' => [ - 'tooltip' => [ - 'description' => __('For delivery questions.'), - ], - ], - ], - ] - ), - ], - ], - ]; + $output[$paymentCode . '-form'] = $this->getBillingAddressComponent($paymentCode, $elements); } unset($configuration[$paymentGroup]['methods']); } return $output; } + + /** + * Gets billing address component details + * + * @param string $paymentCode + * @param array $elements + * @return array + */ + private function getBillingAddressComponent($paymentCode, $elements) + { + return [ + 'component' => 'Magento_Checkout/js/view/billing-address', + 'displayArea' => 'billing-address-form-' . $paymentCode, + 'provider' => 'checkoutProvider', + 'deps' => 'checkoutProvider', + 'dataScopePrefix' => 'billingAddress' . $paymentCode, + 'sortOrder' => 1, + 'children' => [ + 'form-fields' => [ + 'component' => 'uiComponent', + 'displayArea' => 'additional-fieldsets', + 'children' => $this->merger->merge( + $elements, + 'checkoutProvider', + 'billingAddress' . $paymentCode, + [ + 'country_id' => [ + 'sortOrder' => 115, + ], + 'region' => [ + 'visible' => false, + ], + 'region_id' => [ + 'component' => 'Magento_Ui/js/form/element/region', + 'config' => [ + 'template' => 'ui/form/field', + 'elementTmpl' => 'ui/form/element/select', + 'customEntry' => 'billingAddress' . $paymentCode . '.region', + ], + 'validation' => [ + 'required-entry' => true, + ], + 'filterBy' => [ + 'target' => '${ $.provider }:${ $.parentScope }.country_id', + 'field' => 'country_id', + ], + ], + 'postcode' => [ + 'component' => 'Magento_Ui/js/form/element/post-code', + 'validation' => [ + 'required-entry' => true, + ], + ], + 'company' => [ + 'validation' => [ + 'min_text_length' => 0, + ], + ], + 'fax' => [ + 'validation' => [ + 'min_text_length' => 0, + ], + ], + 'telephone' => [ + 'config' => [ + 'tooltip' => [ + 'description' => __('For delivery questions.'), + ], + ], + ], + ] + ), + ], + ], + ]; + } + + /** + * Get checkout data helper instance + * + * @return Data + * @deprecated + */ + private function getCheckoutDataHelper() + { + if (!$this->checkoutDataHelper) { + $this->checkoutDataHelper = ObjectManager::getInstance()->get(Data::class); + } + + return $this->checkoutDataHelper; + } } diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 2073ffe87d4d6..b54d3187949e4 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -8,6 +8,7 @@ use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Quote\Model\Quote\Item\AbstractItem; use Magento\Store\Model\Store; +use Magento\Store\Model\ScopeInterface; /** * Checkout default helper @@ -400,4 +401,17 @@ public function isCustomerMustBeLogged() \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } + + /** + * Checks if display billing address on payment method is available, otherwise + * billing address should be display on payment page + * @return bool + */ + public function isDisplayBillingOnPaymentMethodAvailable() + { + return (bool) !$this->scopeConfig->getValue( + 'checkout/options/display_billing_address_on', + ScopeInterface::SCOPE_STORE + ); + } } diff --git a/app/code/Magento/Checkout/Model/Adminhtml/BillingAddressDisplayOptions.php b/app/code/Magento/Checkout/Model/Adminhtml/BillingAddressDisplayOptions.php new file mode 100644 index 0000000000000..831d4b41ec904 --- /dev/null +++ b/app/code/Magento/Checkout/Model/Adminhtml/BillingAddressDisplayOptions.php @@ -0,0 +1,39 @@ + 'Payment Method', 'value' => 0], + * ['label' => 'Payment Page', 'value' => 1] + * ] + */ + public function toOptionArray() + { + return [ + [ + 'label' => __('Payment Method'), + 'value' => 0 + ], + [ + 'label' => __('Payment Page'), + 'value' => 1 + ] + ]; + } +} diff --git a/app/code/Magento/Checkout/Model/DefaultConfigProvider.php b/app/code/Magento/Checkout/Model/DefaultConfigProvider.php index 923e54aac9378..0544f3aae3912 100644 --- a/app/code/Magento/Checkout/Model/DefaultConfigProvider.php +++ b/app/code/Magento/Checkout/Model/DefaultConfigProvider.php @@ -296,6 +296,7 @@ public function getConfig() $output['originCountryCode'] = $this->getOriginCountryCode(); $output['paymentMethods'] = $this->getPaymentMethods(); $output['autocomplete'] = $this->isAutocompleteEnabled(); + $output['displayBillingOnPaymentMethod'] = $this->checkoutHelper->isDisplayBillingOnPaymentMethodAvailable(); return $output; } diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php new file mode 100644 index 0000000000000..1351213f990b5 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php @@ -0,0 +1,276 @@ +attributeDataProvider = $this->getMockBuilder(AttributeMetadataDataProvider::class) + ->disableOriginalConstructor() + ->setMethods(['loadAttributesCollection']) + ->getMock(); + + $this->attributeMapper = $this->getMockBuilder(AttributeMapper::class) + ->disableOriginalConstructor() + ->setMethods(['map']) + ->getMock(); + + $this->attributeMerger = $this->getMockBuilder(AttributeMerger::class) + ->disableOriginalConstructor() + ->setMethods(['merge']) + ->getMock(); + + $this->dataHelper = $this->getMockBuilder(Data::class) + ->disableOriginalConstructor() + ->setMethods(['isDisplayBillingOnPaymentMethodAvailable']) + ->getMock(); + + $options = $this->getMockBuilder(Options::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->layoutProcessor = new LayoutProcessor( + $this->attributeDataProvider, + $this->attributeMapper, + $this->attributeMerger + ); + + $objectManager->setBackwardCompatibleProperty($this->layoutProcessor, 'checkoutDataHelper', $this->dataHelper); + $objectManager->setBackwardCompatibleProperty($this->layoutProcessor, 'options', $options); + } + + /** + * @covers \Magento\Checkout\Block\Checkout\LayoutProcessor::process + */ + public function testProcess() + { + $jsLayout = $this->getLayoutData(); + + $this->attributeDataProvider->expects(static::once()) + ->method('loadAttributesCollection') + ->willReturn([]); + + $this->dataHelper->expects(static::once()) + ->method('isDisplayBillingOnPaymentMethodAvailable') + ->willReturn(true); + + $this->attributeMerger->expects(static::exactly(2)) + ->method('merge') + ->willReturnMap([ + ['payment1_1' => $this->getBillingComponent('payment1_1')], + ['payment2_1' => $this->getBillingComponent('payment2_1')], + ]); + + $actual = $this->layoutProcessor->process($jsLayout); + + static::assertArrayHasKey( + 'payment1_1-form', + $actual['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['payments-list']['children'] + ); + static::assertArrayHasKey( + 'payment2_1-form', + $actual['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['payments-list']['children'] + ); + static::assertArrayNotHasKey( + 'payment2_2-form', + $actual['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['payments-list']['children'] + ); + static::assertArrayHasKey( + 'afterMethods', + $actual['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children'] + ); + static::assertEmpty( + $actual['components']['checkout']['children']['steps']['children']['billing-step'] + ['children']['payment']['children']['afterMethods']['children'] + ); + } + + /** + * @covers \Magento\Checkout\Block\Checkout\LayoutProcessor::process + */ + public function testProcessWithBillingAddressOnPaymentPage() + { + $jsLayout = $this->getLayoutData(); + + $this->attributeDataProvider->expects(static::once()) + ->method('loadAttributesCollection') + ->willReturn([]); + + $this->dataHelper->expects(static::once()) + ->method('isDisplayBillingOnPaymentMethodAvailable') + ->willReturn(false); + + $this->attributeMerger->expects(static::once()) + ->method('merge') + ->willReturn($this->getBillingComponent('shared')); + + $actual = $this->layoutProcessor->process($jsLayout); + + static::assertEmpty( + $actual['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['payments-list']['children'] + ); + + static::assertNotEmpty( + $actual['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['afterMethods']['children'] + ); + static::assertArrayHasKey( + 'billing-address-form', + $actual['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment'] + ['children']['afterMethods']['children'] + ); + } + + /** + * Get mock layout data for testing + * @return array + */ + private function getLayoutData() + { + return [ + 'components' => [ + 'checkout' => [ + 'children' => [ + 'steps' => [ + 'children' => [ + 'billing-step' => [ + 'children' => [ + 'payment' => [ + 'children' => [ + 'renders' => [ + 'children' => [ + 'payment1' => [ + 'methods' => [ + 'payment1_1' => [ + 'isBillingAddressRequired' => true + ] + ] + ], + 'payment2' => [ + 'methods' => [ + 'payment2_1' => [ + 'isBillingAddressRequired' => true + ], + 'payment2_2' => [ + 'isBillingAddressRequired' => false + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ]; + } + + /** + * Get mock data for billing component + * @param string $paymentCode + * @return array + */ + private function getBillingComponent($paymentCode) + { + return [ + 'country_id' => [ + 'sortOrder' => 115, + ], + 'region' => [ + 'visible' => false, + ], + 'region_id' => [ + 'component' => 'Magento_Ui/js/form/element/region', + 'config' => [ + 'template' => 'ui/form/field', + 'elementTmpl' => 'ui/form/element/select', + 'customEntry' => 'billingAddress' . $paymentCode . '.region', + ], + 'validation' => [ + 'required-entry' => true, + ], + 'filterBy' => [ + 'target' => '${ $.provider }:${ $.parentScope }.country_id', + 'field' => 'country_id', + ], + ], + 'postcode' => [ + 'component' => 'Magento_Ui/js/form/element/post-code', + 'validation' => [ + 'required-entry' => true, + ], + ], + 'company' => [ + 'validation' => [ + 'min_text_length' => 0, + ], + ], + 'fax' => [ + 'validation' => [ + 'min_text_length' => 0, + ], + ], + 'telephone' => [ + 'config' => [ + 'tooltip' => [ + 'description' => __('For delivery questions.'), + ], + ], + ], + ]; + } +} diff --git a/app/code/Magento/Checkout/etc/adminhtml/system.xml b/app/code/Magento/Checkout/etc/adminhtml/system.xml index d4567a4382539..b3b3d11b568a3 100644 --- a/app/code/Magento/Checkout/etc/adminhtml/system.xml +++ b/app/code/Magento/Checkout/etc/adminhtml/system.xml @@ -21,6 +21,10 @@ Magento\Config\Model\Config\Source\Yesno + + + \Magento\Checkout\Model\Adminhtml\BillingAddressDisplayOptions + diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index b9cf58b51b133..17dbf158d50be 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -17,6 +17,7 @@ define( 'Magento_Checkout/js/model/checkout-data-resolver', 'Magento_Customer/js/customer-data', 'Magento_Checkout/js/action/set-billing-address', + 'Magento_Checkout/js/action/set-shipping-information', 'Magento_Ui/js/model/messageList', 'mage/translate' ], @@ -32,6 +33,7 @@ define( checkoutDataResolver, customerData, setBillingAddressAction, + setShippingInformationAction, globalMessageList, $t ) { @@ -39,9 +41,13 @@ define( var lastSelectedBillingAddress = null, newAddressOption = { + /** + * Get new address label + * @returns {String} + */ getAddressInline: function () { - return $t('New Address'); - }, + return $t('New Address'); + }, customerAddressId: null }, countryData = customerData.get('directory-data'), @@ -121,6 +127,7 @@ define( useShippingAddress: function () { if (this.isAddressSameAsShipping()) { selectBillingAddress(quote.shippingAddress()); + if (window.checkoutConfig.reloadOnBillingAddress) { setBillingAddressAction(globalMessageList); } @@ -142,15 +149,18 @@ define( if (this.selectedAddress() && this.selectedAddress() != newAddressOption) { selectBillingAddress(this.selectedAddress()); checkoutData.setSelectedBillingAddress(this.selectedAddress().getKey()); + if (window.checkoutConfig.reloadOnBillingAddress) { setBillingAddressAction(globalMessageList); } + this.updateAddresses(); } else { this.source.set('params.invalid', false); this.source.trigger(this.dataScopePrefix + '.data.validate'); + if (this.source.get(this.dataScopePrefix + '.custom_attributes')) { this.source.trigger(this.dataScopePrefix + '.custom_attributes.data.validate'); - }; + } if (!this.source.get('params.invalid')) { var addressData = this.source.get(this.dataScopePrefix), @@ -159,7 +169,7 @@ define( if (customer.isLoggedIn() && !this.customerHasAddresses) { this.saveInAddressBook(1); } - addressData.save_in_address_book = this.saveInAddressBook() ? 1 : 0; + addressData['save_in_address_book'] = this.saveInAddressBook() ? 1 : 0; newBillingAddress = createBillingAddress(addressData); // New address must be selected as a billing address @@ -170,6 +180,7 @@ define( if (window.checkoutConfig.reloadOnBillingAddress) { setBillingAddressAction(globalMessageList); } + this.updateAddresses(); } } }, @@ -222,6 +233,24 @@ define( */ getCountryName: function (countryId) { return countryData()[countryId] != undefined ? countryData()[countryId].name : ''; + }, + + /** + * Trigger action to update shipping and billing addresses + */ + updateAddresses: function () { + if (!window.checkoutConfig.displayBillingOnPaymentMethod) { + setShippingInformationAction(); + } + }, + + /** + * Get code + * @param {Object} $parent + * @returns {String} + */ + getCode: function ($parent) { + return $parent.getCode === 'function' ? $parent.getCode() : 'shared'; } }); } diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html index 377208aa1b8ee..dd1b3731b9dcb 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html @@ -5,8 +5,8 @@ */ -->
    - - + +
    diff --git a/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php b/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php index 8342b181d5e6f..cb7791cbc6d2d 100644 --- a/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php +++ b/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php @@ -31,8 +31,8 @@ public function __construct(DirectoryHelper $directoryHelper) */ public function getCountry(Quote $quote) { - $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress(); - return $address + $address = $quote->getBillingAddress() ? : $quote->getShippingAddress(); + return (!empty($address) && !empty($address->getCountry())) ? $address->getCountry() : $this->directoryHelper->getDefaultCountry(); } diff --git a/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php b/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php index 5b14cc57a3035..02cfd0387c3e5 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php @@ -5,55 +5,123 @@ */ namespace Magento\Payment\Test\Unit\Model\Checks\CanUseForCountry; +use Magento\Directory\Helper\Data; +use Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\Quote\Address; +use PHPUnit_Framework_MockObject_MockObject as MockObject; + +/** + * CountryProviderTest contains tests for CountryProvider class + */ class CountryProviderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider + * @var CountryProvider */ - protected $model; + private $countryProvider; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Data|MockObject */ - protected $directoryMock; + private $directory; + + /** + * @var Quote|MockObject + */ + private $quote; protected function setUp() { - $this->directoryMock = $this->getMock(\Magento\Directory\Helper\Data::class, [], [], '', false, false); - $this->model = new \Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider($this->directoryMock); + $this->directory = $this->getMockBuilder(Data::class) + ->disableOriginalConstructor() + ->setMethods(['getDefaultCountry']) + ->getMock(); + + $this->quote = $this->getMockBuilder(Quote::class) + ->disableOriginalConstructor() + ->setMethods(['getBillingAddress', 'getShippingAddress']) + ->getMock(); + + $this->countryProvider = new CountryProvider($this->directory); } - public function testGetCountryForNonVirtualQuote() + /** + * @covers \Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider::getCountry + */ + public function testGetCountry() { - $quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false, false); - $quoteMock->expects($this->once())->method('isVirtual')->willReturn(false); - $addressMock = $this->getMock(\Magento\Quote\Model\Quote\Address::class, [], [], '', false, false); - $addressMock->expects($this->once())->method('getCountry')->will($this->returnValue(1)); - $quoteMock->expects($this->once())->method('getShippingAddress')->will($this->returnValue($addressMock)); - $this->assertEquals(1, $this->model->getCountry($quoteMock)); + $address = $this->getMockBuilder(Address::class) + ->disableOriginalConstructor() + ->setMethods(['getCountry']) + ->getMock(); + + $this->quote->expects(static::once()) + ->method('getBillingAddress') + ->willReturn($address); + + $this->quote->expects(static::never()) + ->method('getShippingAddress'); + + $address->expects(static::exactly(2)) + ->method('getCountry') + ->willReturn('UK'); + $this->directory->expects(static::never()) + ->method('getDefaultCountry'); + + static::assertEquals('UK', $this->countryProvider->getCountry($this->quote)); } - public function testGetCountryForVirtualQuoteWhenBillingAddressNotExist() + /** + * @covers \Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider::getCountry + */ + public function testGetCountryForBillingAddressWithoutCountry() { - $quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false, false); - $quoteMock->expects($this->once())->method('isVirtual')->willReturn(true); - $addressMock = $this->getMock(\Magento\Quote\Model\Quote\Address::class, [], [], '', false, false); - $addressMock->expects($this->never())->method('getCountry'); - $quoteMock->expects($this->never())->method('getShippingAddress'); - $quoteMock->expects($this->once())->method('getBillingAddress')->willReturn(null); - $this->directoryMock->expects($this->once())->method('getDefaultCountry')->willReturn(10); - $this->assertEquals(10, $this->model->getCountry($quoteMock)); + $address = $this->getMockBuilder(Address::class) + ->disableOriginalConstructor() + ->setMethods(['getCountry']) + ->getMock(); + + $this->quote->expects(static::never()) + ->method('getShippingAddress'); + $this->quote->expects(static::once()) + ->method('getBillingAddress') + ->willReturn($address); + + $address->expects(static::once()) + ->method('getCountry') + ->willReturn(null); + $this->directory->expects(static::once()) + ->method('getDefaultCountry') + ->willReturn('US'); + static::assertEquals('US', $this->countryProvider->getCountry($this->quote)); } - public function testGetCountryForVirtualQuoteWhenBillingAddressExist() + /** + * @covers \Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider::getCountry + */ + public function testGetCountryShippingAddress() { - $quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false, false); - $quoteMock->expects($this->once())->method('isVirtual')->willReturn(true); - $addressMock = $this->getMock(\Magento\Quote\Model\Quote\Address::class, [], [], '', false, false); - $addressMock->expects($this->once())->method('getCountry')->willReturn(10); - $quoteMock->expects($this->never())->method('getShippingAddress'); - $quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($addressMock); - $this->directoryMock->expects($this->never())->method('getDefaultCountry'); - $this->assertEquals(10, $this->model->getCountry($quoteMock)); + $address = $this->getMockBuilder(Address::class) + ->disableOriginalConstructor() + ->setMethods(['getCountry']) + ->getMock(); + + $this->quote->expects(static::once()) + ->method('getBillingAddress') + ->willReturn(null); + + $this->quote->expects(static::once()) + ->method('getShippingAddress') + ->willReturn($address); + + $address->expects(static::exactly(2)) + ->method('getCountry') + ->willReturn('CA'); + + $this->directory->expects(static::never()) + ->method('getDefaultCountry'); + + static::assertEquals('CA', $this->countryProvider->getCountry($this->quote)); } } diff --git a/app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php b/app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php index 434a5875b5bb1..f65f9a0c749d3 100644 --- a/app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php +++ b/app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php @@ -84,8 +84,10 @@ public function getConfig() $componentProvider = $providers[$paymentCode]; $component = $componentProvider->getComponentForToken($token); - $vaultPayments[$paymentCode . '_item_' . $i] = [ - 'config' => $component->getConfig(), + $config = $component->getConfig(); + $vaultPaymentCode = !empty($config['code']) ? $config['code'] : $paymentCode; + $vaultPayments[$vaultPaymentCode . '_' . $i] = [ + 'config' => $config, 'component' => $component->getName() ]; } diff --git a/app/code/Magento/Vault/Test/Unit/Model/Ui/TokensConfigProviderTest.php b/app/code/Magento/Vault/Test/Unit/Model/Ui/TokensConfigProviderTest.php index e64fff27ff14c..cdc2004ec6a28 100644 --- a/app/code/Magento/Vault/Test/Unit/Model/Ui/TokensConfigProviderTest.php +++ b/app/code/Magento/Vault/Test/Unit/Model/Ui/TokensConfigProviderTest.php @@ -81,7 +81,7 @@ public function testGetConfig() $expectedConfig = [ 'payment' => [ 'vault' => [ - $vaultProviderCode . '_item_' . '0' => [ + $vaultProviderCode . '_' . '0' => [ 'config' => ['token_code' => 'code'], 'component' => 'Vendor_Module/js/vault_component' ] diff --git a/app/code/Magento/Vault/view/frontend/web/js/view/payment/vault.js b/app/code/Magento/Vault/view/frontend/web/js/view/payment/vault.js index cba9256f2a563..c4e6c12834b09 100644 --- a/app/code/Magento/Vault/view/frontend/web/js/view/payment/vault.js +++ b/app/code/Magento/Vault/view/frontend/web/js/view/payment/vault.js @@ -31,7 +31,8 @@ define( * @return {Boolean} */ typeComparatorCallback: function (typeA, typeB) { - return typeA.indexOf(typeB) === 0; + // vaults items have the same name as vault payment without index + return typeA.substring(0, typeA.length - 2) === typeB; } } ); diff --git a/dev/tests/integration/testsuite/Magento/Braintree/Model/Ui/TokensConfigProviderTest.php b/dev/tests/integration/testsuite/Magento/Braintree/Model/Ui/TokensConfigProviderTest.php index b8550ae205429..440f7674f1227 100644 --- a/dev/tests/integration/testsuite/Magento/Braintree/Model/Ui/TokensConfigProviderTest.php +++ b/dev/tests/integration/testsuite/Magento/Braintree/Model/Ui/TokensConfigProviderTest.php @@ -72,7 +72,7 @@ public function testGetConfig() /** @var PaymentTokenManagement $tokenManagement */ $tokenManagement = $this->objectManager->get(PaymentTokenManagement::class); $paymentToken = $tokenManagement->getByGatewayToken($token, PayPalConfigProvider::PAYPAL_CODE, $customerId); - $item = PayPalConfigProvider::PAYPAL_CODE . '_item_' . $paymentToken->getEntityId(); + $item = PayPalConfigProvider::PAYPAL_VAULT_CODE . '_' . $paymentToken->getEntityId(); /** @var Session $session */ $session = $this->objectManager->get(Session::class); From ad677791a0f47aa957e2f75c142e1fd5488ff365 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Mon, 5 Sep 2016 11:43:49 -0500 Subject: [PATCH 0536/3232] MAGETWO-56104: Build stablization - fixed MCHI --- .../Test/Unit/Block/Account/AuthenticationPopupTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php b/app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php index f0ec5ec9148ac..10191c68485d0 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php @@ -14,15 +14,12 @@ use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\StoreManagerInterface; -/** - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ class AuthenticationPopupTest extends \PHPUnit_Framework_TestCase { - /** @var AuthenticationPopup */ + /** @var \Magento\Customer\Block\Account\AuthenticationPopup */ private $model; - /** @var Context|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject */ private $contextMock; /** @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ From a22846cae1904c7a399d34f0565b03d1fa2c019a Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Mon, 5 Sep 2016 19:51:34 +0300 Subject: [PATCH 0537/3232] MAGETWO-56534: CLONE - Price in cart does not update correctly when price is changed in admin. --- .../Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php | 4 ++-- .../Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php b/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php index efc7f8c5b0a87..c3fff34420573 100644 --- a/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php +++ b/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php @@ -24,14 +24,14 @@ public function __construct( /** * @param \Magento\Catalog\Model\ResourceModel\Product $subject * @param \Closure $proceed - * @param \Magento\Catalog\Api\Data\ProductInterface $product + * @param \Magento\Framework\Model\AbstractModel $product * @return mixed * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundSave( \Magento\Catalog\Model\ResourceModel\Product $subject, \Closure $proceed, - \Magento\Catalog\Api\Data\ProductInterface $product + \Magento\Framework\Model\AbstractModel $product ) { $result = $proceed($product); $originalPrice = $product->getOrigData('price'); diff --git a/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php b/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php index 12d79a6da5efc..41a14b0f78fcc 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php @@ -34,9 +34,9 @@ protected function setUp() public function testAroundUpdate($originalPrice, $newPrice, $callMethod) { $productResourceMock = $this->getMock(\Magento\Catalog\Model\ResourceModel\Product::class, [], [], '', false); - $productMock = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class) + $productMock = $this->getMockBuilder(\Magento\Framework\Model\AbstractModel::class) ->disableOriginalConstructor() - ->setMethods(['getOrigData']) + ->setMethods(['getOrigData', 'getPrice', 'getId']) ->getMockForAbstractClass(); $closure = function () use ($productResourceMock) { return $productResourceMock; From 05d2b3aa67925772414f860213d55333b7012c98 Mon Sep 17 00:00:00 2001 From: Illia Grybkov Date: Tue, 24 May 2016 16:13:26 +0300 Subject: [PATCH 0538/3232] MAGETWO-51447: CatalogSearch Fulltext Collection not allows to use filters with multiple values --- .../Product/Indexer/Eav/AbstractEav.php | 2 + .../ResourceModel/Fulltext/Collection.php | 4 +- .../Model/Search/IndexBuilder.php | 2 +- .../Model/Search/TableMapper.php | 47 ++++- .../ResourceModel/Fulltext/CollectionTest.php | 176 ++++++++++++++---- .../Unit/Model/Search/IndexBuilderTest.php | 2 +- .../Unit/Model/Search/TableMapperTest.php | 28 ++- .../Framework/Search/Adapter/Mysql/Mapper.php | 1 + .../Test/Unit/Adapter/Mysql/MapperTest.php | 8 +- 9 files changed, 205 insertions(+), 65 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php index 3cc635a3c1b86..d9612f18c9111 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php @@ -263,6 +263,8 @@ protected function _getIndexableAttributesCondition() 'ca.is_filterable_in_search > 0', 'ca.is_visible_in_advanced_search > 0', 'ca.is_filterable > 0', + // Visibility is attribute that isn't used by search, but required to determine is product should be shown + "ea.attribute_code = 'visibility'" ]; return implode(' OR ', $conditions); diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php index a563bfab62efd..8a9e2b1917407 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php @@ -265,7 +265,7 @@ public function addFieldToFilter($field, $condition = null) $this->getSearchCriteriaBuilder(); $this->getFilterBuilder(); - if (!is_array($condition) || !in_array(key($condition), ['from', 'to'])) { + if (!is_array($condition) || !in_array(key($condition), ['from', 'to'], true)) { $this->filterBuilder->setField($field); $this->filterBuilder->setValue($condition); $this->searchCriteriaBuilder->addFilter($this->filterBuilder->create()); @@ -371,7 +371,7 @@ protected function _renderFilters() public function setOrder($attribute, $dir = Select::SQL_DESC) { $this->order = ['field' => $attribute, 'dir' => $dir]; - if ($attribute != 'relevance') { + if ($attribute !== 'relevance') { parent::setOrder($attribute, $dir); } return $this; diff --git a/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php b/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php index c332332beb7f4..1d30bb4a14d23 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php +++ b/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php @@ -123,7 +123,7 @@ public function build(RequestInterface $request) ScopeInterface::SCOPE_STORE ); if ($isShowOutOfStock === false) { - $select->joinLeft( + $select->joinInner( ['stock_index' => $this->resource->getTableName('cataloginventory_stock_status')], 'search_index.entity_id = stock_index.product_id' . $this->resource->getConnection()->quoteInto( diff --git a/app/code/Magento/CatalogSearch/Model/Search/TableMapper.php b/app/code/Magento/CatalogSearch/Model/Search/TableMapper.php index d4f371e965e07..712afeeb2959f 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/TableMapper.php +++ b/app/code/Magento/CatalogSearch/Model/Search/TableMapper.php @@ -6,8 +6,11 @@ namespace Magento\CatalogSearch\Model\Search; +use Magento\Catalog\Model\Product; use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory; +use Magento\Eav\Model\Config as EavConfig; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ResourceConnection as AppResource; use Magento\Framework\DB\Select; use Magento\Framework\Search\Request\FilterInterface; @@ -34,41 +37,64 @@ class TableMapper /** * @var \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection + * @deprecated */ private $attributeCollection; + /** + * @var EavConfig + */ + private $eavConfig; + /** * @param AppResource $resource * @param StoreManagerInterface $storeManager * @param CollectionFactory $attributeCollectionFactory + * @param EavConfig $eavConfig */ public function __construct( AppResource $resource, StoreManagerInterface $storeManager, - CollectionFactory $attributeCollectionFactory + CollectionFactory $attributeCollectionFactory, + EavConfig $eavConfig = null ) { $this->resource = $resource; $this->storeManager = $storeManager; $this->attributeCollection = $attributeCollectionFactory->create(); + $this->eavConfig = $eavConfig !== null ? $eavConfig : ObjectManager::getInstance()->get(EavConfig::class); } /** * @param Select $select * @param RequestInterface $request * @return Select + * @throws \LogicException */ public function addTables(Select $select, RequestInterface $request) { $mappedTables = []; $filters = $this->getFilters($request->getQuery()); foreach ($filters as $filter) { - list($alias, $table, $mapOn, $mappedFields) = $this->getMappingData($filter); + list($alias, $table, $mapOn, $mappedFields, $joinType) = $this->getMappingData($filter); if (!array_key_exists($alias, $mappedTables)) { - $select->joinLeft( - [$alias => $table], - $mapOn, - $mappedFields - ); + switch ($joinType) { + case \Magento\Framework\DB\Select::INNER_JOIN: + $select->joinInner( + [$alias => $table], + $mapOn, + $mappedFields + ); + break; + case \Magento\Framework\DB\Select::LEFT_JOIN: + $select->joinLeft( + [$alias => $table], + $mapOn, + $mappedFields + ); + break; + default: + throw new \LogicException(__('Unsupported join type: %1', $joinType)); + } $mappedTables[$alias] = $table; } } @@ -102,6 +128,7 @@ private function getMappingData(FilterInterface $filter) $mapOn = null; $mappedFields = null; $field = $filter->getField(); + $joinType = \Magento\Framework\DB\Select::INNER_JOIN; $fieldToTableMap = $this->getFieldToTableMap($field); if ($fieldToTableMap) { list($alias, $table, $mapOn, $mappedFields) = $fieldToTableMap; @@ -110,6 +137,7 @@ private function getMappingData(FilterInterface $filter) if ($filter->getType() === FilterInterface::TYPE_TERM && in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true) ) { + $joinType = \Magento\Framework\DB\Select::LEFT_JOIN; $table = $this->resource->getTableName('catalog_product_index_eav'); $alias = $field . RequestGenerator::FILTER_SUFFIX; $mapOn = sprintf( @@ -127,7 +155,7 @@ private function getMappingData(FilterInterface $filter) } } - return [$alias, $table, $mapOn, $mappedFields]; + return [$alias, $table, $mapOn, $mappedFields, $joinType]; } /** @@ -242,10 +270,11 @@ private function getFieldToTableMap($field) /** * @param string $field * @return \Magento\Catalog\Model\ResourceModel\Eav\Attribute + * @throws \Magento\Framework\Exception\LocalizedException */ private function getAttributeByCode($field) { - $attribute = $this->attributeCollection->getItemByColumnValue('attribute_code', $field); + $attribute = $this->eavConfig->getAttribute(Product::ENTITY, $field); return $attribute; } } diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/ResourceModel/Fulltext/CollectionTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/ResourceModel/Fulltext/CollectionTest.php index fc75aec23d63f..84430c56476c0 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/ResourceModel/Fulltext/CollectionTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/ResourceModel/Fulltext/CollectionTest.php @@ -6,12 +6,49 @@ namespace Magento\CatalogSearch\Test\Unit\Model\ResourceModel\Fulltext; use Magento\CatalogSearch\Test\Unit\Model\ResourceModel\BaseCollectionTest; +use Magento\Framework\Search\Adapter\Mysql\TemporaryStorageFactory; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class CollectionTest extends BaseCollectionTest { + /** + * @var \Magento\Framework\Search\Adapter\Mysql\TemporaryStorage|\PHPUnit_Framework_MockObject_MockObject + */ + private $temporaryStorage; + + /** + * @var \Magento\Search\Api\SearchInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $search; + + /** + * @var MockObject + */ + private $criteriaBuilder; + + /** + * @var MockObject + */ + private $storeManager; + + /** + * @var MockObject + */ + private $universalFactory; + + /** + * @var MockObject + */ + private $scopeConfig; + + /** + * @var MockObject + */ + private $filterBuilder; + /** * @var \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection */ @@ -29,32 +66,48 @@ protected function setUp() { $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $storeManager = $this->getStoreManager(); - $universalFactory = $this->getUniversalFactory(); - $scopeConfig = $this->getScopeConfig(); - $criteriaBuilder = $this->getCriteriaBuilder(); - $filterBuilder = $this->getFilterBuilder(); + $this->storeManager = $this->getStoreManager(); + $this->universalFactory = $this->getUniversalFactory(); + $this->scopeConfig = $this->getScopeConfig(); + $this->criteriaBuilder = $this->getCriteriaBuilder(); + $this->filterBuilder = $this->getFilterBuilder(); + + $this->prepareObjectManager( + [ + [ + \Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitation::class, + $this->getMock(\Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitation::class) + ], + ] + ); - $this->prepareObjectManager([ - [\Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitation::class, - $this->getMock(\Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitation::class) - ], - ]); + $this->temporaryStorage = $this->getMockBuilder(\Magento\Framework\Search\Adapter\Mysql\TemporaryStorage::class) + ->disableOriginalConstructor() + ->getMock(); + $temporaryStorageFactory = $this->getMockBuilder(TemporaryStorageFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $temporaryStorageFactory->expects($this->any()) + ->method('create') + ->willReturn($this->temporaryStorage); $this->model = $helper->getObject( \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection::class, [ - 'storeManager' => $storeManager, - 'universalFactory' => $universalFactory, - 'scopeConfig' => $scopeConfig, + 'storeManager' => $this->storeManager, + 'universalFactory' => $this->universalFactory, + 'scopeConfig' => $this->scopeConfig, + 'temporaryStorageFactory' => $temporaryStorageFactory ] ); - $search = $this->getMockForAbstractClass(\Magento\Search\Api\SearchInterface::class); - $this->model->setSearchCriteriaBuilder($criteriaBuilder); - $this->model->setSearch($search); - $this->model->setFilterBuilder($filterBuilder); - + $this->search = $this->getMockBuilder(\Magento\Search\Api\SearchInterface::class) + ->setMethods(['search']) + ->getMockForAbstractClass(); + $this->model->setSearchCriteriaBuilder($this->criteriaBuilder); + $this->model->setSearch($this->search); + $this->model->setFilterBuilder($this->filterBuilder); } /** @@ -62,13 +115,50 @@ protected function setUp() * @expectedExceptionCode 333 * @expectedExceptionMessage setRequestName */ - public function testGetFacetedData() + public function testGetFacetedDataWithException() + { + $criteria = $this->getMock(\Magento\Framework\Api\Search\SearchCriteria::class, [], [], '', false); + $this->criteriaBuilder->expects($this->once())->method('create')->willReturn($criteria); + $criteria->expects($this->once()) + ->method('setRequestName') + ->withConsecutive(['catalog_view_container']) + ->willThrowException(new \Exception('setRequestName', 333)); + $this->model->getFacetedData('field'); + } + + public function testGetFacetedDataWithEmptyAggregations() { + $criteria = $this->getMock(\Magento\Framework\Api\Search\SearchCriteria::class, [], [], '', false); + $this->criteriaBuilder->expects($this->once())->method('create')->willReturn($criteria); + $criteria->expects($this->once()) + ->method('setRequestName') + ->withConsecutive(['catalog_view_container']); + $searchResult = $this->getMockBuilder(\Magento\Framework\Api\Search\SearchResultInterface::class) + ->getMockForAbstractClass(); + $table = $this->getMockBuilder(\Magento\Framework\DB\Ddl\Table::class) + ->setMethods(['getName']) + ->getMock(); + $this->temporaryStorage->expects($this->once()) + ->method('storeApiDocuments') + ->willReturn($table); + $this->search->expects($this->once()) + ->method('search') + ->willReturn($searchResult); $this->model->getFacetedData('field'); } + public function testAddFieldToFilter() + { + $this->filter = $this->createFilter(); + $this->criteriaBuilder->expects($this->once()) + ->method('addFilter') + ->with($this->filter); + $this->filterBuilder->expects($this->once())->method('create')->willReturn($this->filter); + $this->model->addFieldToFilter('someMultiselectValue', [3, 5, 8]); + } + /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function getScopeConfig() { @@ -76,15 +166,12 @@ protected function getScopeConfig() ->setMethods(['getValue']) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $scopeConfig->expects($this->once()) - ->method('getValue') - ->willReturn(1); return $scopeConfig; } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function getCriteriaBuilder() { @@ -92,31 +179,32 @@ protected function getCriteriaBuilder() ->setMethods(['addFilter', 'create', 'setRequestName']) ->disableOriginalConstructor() ->getMock(); - $this->filter = new \Magento\Framework\Api\Filter(); - $this->filter->setField('price_dynamic_algorithm'); - $this->filter->setValue(1); - $criteriaBuilder->expects($this->once()) - ->method('addFilter') - ->with($this->filter); - $criteria = $this->getMock(\Magento\Framework\Api\Search\SearchCriteria::class, [], [], '', false); - $criteriaBuilder->expects($this->once())->method('create')->willReturn($criteria); - $criteria->expects($this->once()) - ->method('setRequestName') - ->withConsecutive(['catalog_view_container']) - ->willThrowException(new \Exception('setRequestName', 333)); return $criteriaBuilder; } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function getFilterBuilder() { $filterBuilder = $this->getMock(\Magento\Framework\Api\FilterBuilder::class, [], [], '', false); - $filterBuilder->expects($this->once())->method('setField')->with('price_dynamic_algorithm'); - $filterBuilder->expects($this->once())->method('setValue')->with(1); - $filterBuilder->expects($this->once())->method('create')->willReturn($this->filter); + return $filterBuilder; + } + + protected function addFiltersToFilterBuilder(MockObject $filterBuilder, array $filters) + { + $i = 1; + foreach ($filters as $field => $value) { + $filterBuilder->expects($this->at($i++)) + ->method('setField') + ->with($field) + ->willReturnSelf(); + $filterBuilder->expects($this->at($i++)) + ->method('setValue') + ->with($value) + ->willReturnSelf(); + } return $filterBuilder; } @@ -135,4 +223,12 @@ private function prepareObjectManager($map) $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($objectManagerMock); } + + protected function createFilter() + { + $filter = $this->getMockBuilder(\Magento\Framework\Api\Filter::class) + ->disableOriginalConstructor() + ->getMock(); + return $filter; + } } diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php index 1356df9e18cb4..8b98ab9c4cc32 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php @@ -226,7 +226,7 @@ public function testBuildWithoutOutOfStock() ->with('(someName=someValue)') ->willReturnSelf(); $this->select->expects($this->at(3)) - ->method('joinLeft') + ->method('joinInner') ->with( ['stock_index' => 'cataloginventory_stock_status'], 'search_index.entity_id = stock_index.product_id' diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php index 9c117dc7dcf82..bf4205a5dd07a 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php @@ -19,6 +19,11 @@ class TableMapperTest extends \PHPUnit_Framework_TestCase const WEBSITE_ID = 4512; const STORE_ID = 2514; + /** + * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject + */ + private $eavConfig; + /** * @var \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection|\PHPUnit_Framework_MockObject_MockObject */ @@ -127,12 +132,19 @@ function ($table) { $attributeCollectionFactory->expects($this->once()) ->method('create') ->willReturn($this->attributeCollection); + $this->attributeCollection->expects($this->never()) + ->method('getItemByColumnValue'); + $this->eavConfig = $this->getMockBuilder(\Magento\Eav\Model\Config::class) + ->setMethods(['getAttribute']) + ->disableOriginalConstructor() + ->getMock(); $this->target = $objectManager->getObject( \Magento\CatalogSearch\Model\Search\TableMapper::class, [ 'resource' => $this->resource, 'storeManager' => $this->storeManager, - 'attributeCollectionFactory' => $attributeCollectionFactory + 'attributeCollectionFactory' => $attributeCollectionFactory, + 'eavConfig' => $this->eavConfig, ] ); @@ -152,7 +164,7 @@ public function testAddPriceFilter() ->method('getQuery') ->willReturn($query); $this->select->expects($this->once()) - ->method('joinLeft') + ->method('joinInner') ->with( ['price_index' => 'prefix_catalog_product_index_price'], 'search_index.entity_id = price_index.entity_id AND price_index.website_id = ' . self::WEBSITE_ID, @@ -172,7 +184,7 @@ public function testAddStaticAttributeFilter() ->method('getQuery') ->willReturn($query); $this->select->expects($this->once()) - ->method('joinLeft') + ->method('joinInner') ->with( ['static_filter' => 'backend_table'], 'search_index.entity_id = static_filter.entity_id', @@ -191,7 +203,7 @@ public function testAddCategoryIds() ->method('getQuery') ->willReturn($query); $this->select->expects($this->once()) - ->method('joinLeft') + ->method('joinInner') ->with( ['category_ids_index' => 'prefix_catalog_category_product_index'], 'search_index.entity_id = category_ids_index.product_id', @@ -309,7 +321,7 @@ public function testAddBoolQueryWithTermAndPriceFiltersInside() ) ->willReturnSelf(); $this->select->expects($this->at(1)) - ->method('joinLeft') + ->method('joinInner') ->with( ['price_index' => 'prefix_catalog_product_index_price'], 'search_index.entity_id = price_index.entity_id AND price_index.website_id = ' . self::WEBSITE_ID, @@ -586,9 +598,9 @@ private function createAttributeMock( ->willReturn($backendTable); $attribute->method('getFrontendInput') ->willReturn($frontendInput); - $this->attributeCollection->expects($this->at($positionInCollection)) - ->method('getItemByColumnValue') - ->with('attribute_code', $code) + $this->eavConfig->expects($this->at($positionInCollection)) + ->method('getAttribute') + ->with(\Magento\Catalog\Model\Product::ENTITY, $code) ->willReturn($attribute); } } diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php index 0db1e3ff76333..064271f189ba4 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php @@ -158,6 +158,7 @@ public function buildQuery(RequestInterface $request) private function createAroundSelect(Select $select, ScoreBuilder $scoreBuilder) { $parentSelect = $this->getConnection()->select(); + $select->limit(10000000000); // MySQL 5.7 workaround $parentSelect->from( ['main_select' => $select], [ diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/MapperTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/MapperTest.php index 4f2a931f1b462..ef1d7a6ee54be 100644 --- a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/MapperTest.php +++ b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/MapperTest.php @@ -145,7 +145,7 @@ public function testBuildMatchQuery() $this->request->expects($this->once())->method('getQuery')->will($this->returnValue($query)); - $select->expects($this->any())->method('columns')->will($this->returnValue($select)); + $select->expects($this->any())->method('columns')->willReturnSelf(); $response = $this->mapper->buildQuery($this->request); @@ -165,7 +165,7 @@ public function testBuildFilterQuery() ->method('getSize') ->willReturn(self::REQUEST_LIMIT); - $select->expects($this->any())->method('columns')->will($this->returnValue($select)); + $select->expects($this->any())->method('columns')->willReturnSelf(); $this->request->expects($this->once())->method('getQuery')->will($this->returnValue($query)); @@ -522,9 +522,9 @@ private function createSelectMock(Select $from = null, $isInternal = true, $isGr ->willReturnSelf(); } - $select->expects($isInternal ? $this->once() : $this->never()) + $select->expects($this->any()) ->method('limit') - ->with(self::REQUEST_LIMIT) + ->with($isInternal ? self::REQUEST_LIMIT : 10000000000) ->willReturnSelf(); $select->expects($isInternal ? $this->once() : $this->never()) ->method('order') From 22b078aedcad4e04d66522eb533ccc6f9b58c112 Mon Sep 17 00:00:00 2001 From: Illia Grybkov Date: Wed, 25 May 2016 13:56:28 +0300 Subject: [PATCH 0539/3232] MAGETWO-51447: CatalogSearch Fulltext Collection not allows to use filters with multiple values --- .../CatalogSearch/Model/Search/TableMapper.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Model/Search/TableMapper.php b/app/code/Magento/CatalogSearch/Model/Search/TableMapper.php index 712afeeb2959f..ca7298e1beaac 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/TableMapper.php +++ b/app/code/Magento/CatalogSearch/Model/Search/TableMapper.php @@ -35,18 +35,13 @@ class TableMapper */ private $storeManager; - /** - * @var \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection - * @deprecated - */ - private $attributeCollection; - /** * @var EavConfig */ private $eavConfig; /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @param AppResource $resource * @param StoreManagerInterface $storeManager * @param CollectionFactory $attributeCollectionFactory @@ -60,7 +55,6 @@ public function __construct( ) { $this->resource = $resource; $this->storeManager = $storeManager; - $this->attributeCollection = $attributeCollectionFactory->create(); $this->eavConfig = $eavConfig !== null ? $eavConfig : ObjectManager::getInstance()->get(EavConfig::class); } @@ -116,7 +110,8 @@ public function getMappingAlias(FilterInterface $filter) * 'table_alias', * 'table', * 'join_condition', - * ['fields'] + * ['fields'], + * 'joinType' * ] * @param FilterInterface $filter * @return array From d21edaf91652e11d5fc89bd54fe5aafae154560f Mon Sep 17 00:00:00 2001 From: Illia Grybkov Date: Thu, 26 May 2016 10:28:09 +0300 Subject: [PATCH 0540/3232] MAGETWO-51447: CatalogSearch Fulltext Collection not allows to use filters with multiple values - Fix unit test --- .../Test/Unit/Model/Search/TableMapperTest.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php index bf4205a5dd07a..48270909629f9 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php @@ -119,7 +119,7 @@ function ($table) { ->method('getStore') ->willReturn($this->store); $this->attributeCollection = $this->getMockBuilder( - \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection::class + '\Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection' ) ->disableOriginalConstructor() ->getMock(); @@ -129,11 +129,8 @@ function ($table) { ->setMethods(['create']) ->disableOriginalConstructor() ->getMock(); - $attributeCollectionFactory->expects($this->once()) - ->method('create') - ->willReturn($this->attributeCollection); - $this->attributeCollection->expects($this->never()) - ->method('getItemByColumnValue'); + $attributeCollectionFactory->expects($this->never()) + ->method('create'); $this->eavConfig = $this->getMockBuilder(\Magento\Eav\Model\Config::class) ->setMethods(['getAttribute']) ->disableOriginalConstructor() From 909ebdaea79e7426187fb64f358a1e9816a19e14 Mon Sep 17 00:00:00 2001 From: Illia Grybkov Date: Tue, 6 Sep 2016 09:06:39 +0300 Subject: [PATCH 0541/3232] MAGETWO-51447: CatalogSearch Fulltext Collection not allows to use filters with multiple values - Use ::class notation instead of string literal --- .../CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php index 48270909629f9..dd9a556146ab3 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/TableMapperTest.php @@ -119,7 +119,7 @@ function ($table) { ->method('getStore') ->willReturn($this->store); $this->attributeCollection = $this->getMockBuilder( - '\Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection' + \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection::class ) ->disableOriginalConstructor() ->getMock(); From c2a4d8354fd48773b73e2f2cc32a7a5e8c60ff63 Mon Sep 17 00:00:00 2001 From: Illia Grybkov Date: Tue, 6 Sep 2016 10:02:22 +0300 Subject: [PATCH 0542/3232] MAGETWO-51447: CatalogSearch Fulltext Collection not allows to use filters with multiple values - Remove outdated workaround for MySQL 5.7 --- lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php index 064271f189ba4..0db1e3ff76333 100644 --- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php +++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Mapper.php @@ -158,7 +158,6 @@ public function buildQuery(RequestInterface $request) private function createAroundSelect(Select $select, ScoreBuilder $scoreBuilder) { $parentSelect = $this->getConnection()->select(); - $select->limit(10000000000); // MySQL 5.7 workaround $parentSelect->from( ['main_select' => $select], [ From 1cf1f8ad82bdc70d44fb573aec346a67cecec85f Mon Sep 17 00:00:00 2001 From: Maksim_Stsepantsevic Date: Tue, 6 Sep 2016 11:41:22 +0300 Subject: [PATCH 0543/3232] MAGETWO-57990: Implement Active Payments API - Fix unit tests - Fix doc blocks --- .../Unit/Gateway/Http/Client/SoapTest.php | 1 + .../Test/Unit/Model/MethodListTest.php | 59 ++++++++---- .../Paypal/Test/Unit/Helper/DataTest.php | 94 +++++++++++++------ .../Vault/Model/Ui/TokensConfigProvider.php | 2 +- .../Vault/Model/Ui/VaultConfigProvider.php | 2 +- .../Model/Ui/TokensConfigProviderTest.php | 63 ++++++++----- .../Unit/Model/Ui/VaultConfigProviderTest.php | 50 +++++++--- 7 files changed, 190 insertions(+), 81 deletions(-) diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Http/Client/SoapTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Http/Client/SoapTest.php index b8e1b0dcdf973..2a3ae9c306373 100644 --- a/app/code/Magento/Payment/Test/Unit/Gateway/Http/Client/SoapTest.php +++ b/app/code/Magento/Payment/Test/Unit/Gateway/Http/Client/SoapTest.php @@ -48,6 +48,7 @@ protected function setUp() \Magento\Payment\Gateway\Http\ConverterInterface::class )->getMockForAbstractClass(); $this->client = $this->getMockBuilder(\SoapClient::class) + ->setMethods(['__setSoapHeaders', '__soapCall', '__getLastRequest']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Payment/Test/Unit/Model/MethodListTest.php b/app/code/Magento/Payment/Test/Unit/Model/MethodListTest.php index 915ccddc05c89..872782407c129 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/MethodListTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/MethodListTest.php @@ -24,9 +24,14 @@ class MethodListTest extends \PHPUnit_Framework_TestCase protected $objectManager; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Payment\Api\PaymentMethodListInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $paymentMethodList; + + /** + * @var \Magento\Payment\Model\Method\InstanceFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $paymentHelperMock; + private $paymentMethodInstanceFactory; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -36,17 +41,35 @@ class MethodListTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->paymentHelperMock = $this->getMock(\Magento\Payment\Helper\Data::class, [], [], '', false); - $this->specificationFactoryMock = $this->getMock( + + $this->paymentMethodList = $this->getMockBuilder(\Magento\Payment\Api\PaymentMethodListInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->paymentMethodInstanceFactory = $this->getMockBuilder( + \Magento\Payment\Model\Method\InstanceFactory::class + )->disableOriginalConstructor()->getMock(); + + $this->specificationFactoryMock = $this->getMock( \Magento\Payment\Model\Checks\SpecificationFactory::class, [], [], '', false ); - $this->methodList = $this->objectManager->getObject( + $this->methodList = $this->objectManager->getObject( \Magento\Payment\Model\MethodList::class, [ - 'paymentHelper' => $this->paymentHelperMock, 'specificationFactory' => $this->specificationFactoryMock ] ); + + $this->objectManager->setBackwardCompatibleProperty( + $this->methodList, + 'paymentMethodList', + $this->paymentMethodList + ); + $this->objectManager->setBackwardCompatibleProperty( + $this->methodList, + 'paymentMethodInstanceFactory', + $this->paymentMethodInstanceFactory + ); } public function testGetAvailableMethods() @@ -58,12 +81,15 @@ public function testGetAvailableMethods() ->method('getPayment') ->will($this->returnValue($this->getMock(\Magento\Quote\Model\Quote\Payment::class, [], [], '', false))); - $methodMock = $this->getMock(\Magento\Payment\Model\Method\AbstractMethod::class, [], [], '', false); + $methodInstanceMock = $this->getMock(\Magento\Payment\Model\Method\AbstractMethod::class, [], [], '', false); + $methodInstanceMock->expects($this->once()) + ->method('isAvailable') + ->willReturn(true); $compositeMock = $this->getMock(\Magento\Payment\Model\Checks\Composite::class, [], [], '', false); $compositeMock->expects($this->atLeastOnce()) ->method('isApplicable') - ->with($methodMock, $quoteMock) + ->with($methodInstanceMock, $quoteMock) ->will($this->returnValue(true)); $this->specificationFactoryMock->expects($this->atLeastOnce()) @@ -76,18 +102,19 @@ public function testGetAvailableMethods() ]) ->will($this->returnValue($compositeMock)); - $storeMethods = [$methodMock]; - - $this->paymentHelperMock->expects($this->once()) - ->method('getStoreMethods') - ->with($storeId, $quoteMock) - ->will($this->returnValue($storeMethods)); + $methodMock = $this->getMockForAbstractClass(\Magento\Payment\Api\Data\PaymentMethodInterface::class); + $this->paymentMethodList->expects($this->once()) + ->method('getActiveList') + ->willReturn([$methodMock]); + $this->paymentMethodInstanceFactory->expects($this->once()) + ->method('create') + ->willReturn($methodInstanceMock); - $methodMock->expects($this->atLeastOnce()) + $methodInstanceMock->expects($this->atLeastOnce()) ->method('setInfoInstance') ->with($this->getMock(\Magento\Quote\Model\Quote\Payment::class, [], [], '', false)) ->will($this->returnSelf()); - $this->assertEquals([$methodMock], $this->methodList->getAvailableMethods($quoteMock)); + $this->assertEquals([$methodInstanceMock], $this->methodList->getAvailableMethods($quoteMock)); } } diff --git a/app/code/Magento/Paypal/Test/Unit/Helper/DataTest.php b/app/code/Magento/Paypal/Test/Unit/Helper/DataTest.php index fa0620a36a681..239c5d6cda746 100644 --- a/app/code/Magento/Paypal/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Helper/DataTest.php @@ -8,9 +8,14 @@ class DataTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Payment\Api\PaymentMethodListInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_paymentDataMock; + private $paymentMethodList; + + /** + * @var \Magento\Payment\Model\Method\InstanceFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $paymentMethodInstanceFactory; /** * @var \Magento\Paypal\Model\Config | \PHPUnit_Framework_MockObject_MockObject @@ -24,11 +29,13 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_paymentDataMock = $this->getMockBuilder( - \Magento\Payment\Helper\Data::class - )->disableOriginalConstructor()->setMethods( - ['getStoreMethods', 'getPaymentMethods'] - )->getMock(); + $this->paymentMethodList = $this->getMockBuilder(\Magento\Payment\Api\PaymentMethodListInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->paymentMethodInstanceFactory = $this->getMockBuilder( + \Magento\Payment\Model\Method\InstanceFactory::class + )->disableOriginalConstructor()->getMock(); $this->configMock = $this->getMock( \Magento\Paypal\Model\Config::class, @@ -48,32 +55,41 @@ protected function setUp() $this->_helper = $objectManager->getObject( \Magento\Paypal\Helper\Data::class, [ - 'paymentData' => $this->_paymentDataMock, 'methodCodes' => ['expressCheckout' => 'paypal_express', 'hostedPro' => 'hosted_pro'], 'configFactory' => $configMockFactory ] ); + + $objectManager->setBackwardCompatibleProperty( + $this->_helper, + 'paymentMethodList', + $this->paymentMethodList + ); + $objectManager->setBackwardCompatibleProperty( + $this->_helper, + 'paymentMethodInstanceFactory', + $this->paymentMethodInstanceFactory + ); } /** * @dataProvider getBillingAgreementMethodsDataProvider * @param $store * @param $quote - * @param $paymentMethods + * @param $paymentMethodsMap * @param $expectedResult */ - public function testGetBillingAgreementMethods($store, $quote, $paymentMethods, $expectedResult) + public function testGetBillingAgreementMethods($store, $quote, $paymentMethodsMap, $expectedResult) { - $this->_paymentDataMock->expects( - $this->any() - )->method( - 'getStoreMethods' - )->with( - $store, - $quote - )->will( - $this->returnValue($paymentMethods) - ); + $this->paymentMethodList->expects(static::once()) + ->method('getActiveList') + ->with($store) + ->willReturn(array_column($paymentMethodsMap, 0)); + + $this->paymentMethodInstanceFactory->expects(static::any()) + ->method('create') + ->willReturnMap($paymentMethodsMap); + $this->assertEquals($expectedResult, $this->_helper->getBillingAgreementMethods($store, $quote)); } @@ -84,16 +100,40 @@ public function getBillingAgreementMethodsDataProvider() { $quoteMock = $this->getMockBuilder( \Magento\Quote\Model\Quote::class - )->disableOriginalConstructor()->setMethods( - null - ); - $methodInterfaceMock = $this->getMockBuilder( - \Magento\Paypal\Model\Billing\Agreement\MethodInterface::class + )->disableOriginalConstructor()->getMock(); + + $methodMock = $this->getMockBuilder( + \Magento\Payment\Api\Data\PaymentMethodInterface::class )->getMock(); + $agreementMethodInstanceMock = $this->getMockBuilder( + \Magento\Paypal\Model\Method\Agreement::class + )->disableOriginalConstructor()->getMock(); + $agreementMethodInstanceMock->expects($this->any()) + ->method('isAvailable') + ->willReturn(true); + + $methodInstanceMock = $this->getMockBuilder( + \Magento\Payment\Model\Method\Cc::class + )->disableOriginalConstructor()->getMock(); + return [ - ['1', $quoteMock, [$methodInterfaceMock], [$methodInterfaceMock]], - ['1', $quoteMock, [new \StdClass()], []] + [ + '1', + $quoteMock, + [ + [$methodMock, $agreementMethodInstanceMock] + ], + [$agreementMethodInstanceMock] + ], + [ + '1', + $quoteMock, + [ + [$methodMock, $methodInstanceMock] + ], + [] + ] ]; } diff --git a/app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php b/app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php index 35f7229f54ea6..6a86ed694642c 100644 --- a/app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php +++ b/app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php @@ -141,7 +141,7 @@ private function getComponentProvider($vaultProviderCode) /** * Get list of active Vault payment methods. * - * @return \Magento\Payment\Model\MethodInterface[] + * @return VaultPaymentInterface[] */ private function getVaultPaymentMethodList() { diff --git a/app/code/Magento/Vault/Model/Ui/VaultConfigProvider.php b/app/code/Magento/Vault/Model/Ui/VaultConfigProvider.php index d11cf3867097f..9cd7b97562df9 100644 --- a/app/code/Magento/Vault/Model/Ui/VaultConfigProvider.php +++ b/app/code/Magento/Vault/Model/Ui/VaultConfigProvider.php @@ -80,7 +80,7 @@ public function getConfig() /** * Get list of active Vault payment methods. * - * @return \Magento\Payment\Model\MethodInterface[] + * @return VaultPaymentInterface[] */ private function getVaultPaymentMethodList() { diff --git a/app/code/Magento/Vault/Test/Unit/Model/Ui/TokensConfigProviderTest.php b/app/code/Magento/Vault/Test/Unit/Model/Ui/TokensConfigProviderTest.php index e64fff27ff14c..3e4b8b145af67 100644 --- a/app/code/Magento/Vault/Test/Unit/Model/Ui/TokensConfigProviderTest.php +++ b/app/code/Magento/Vault/Test/Unit/Model/Ui/TokensConfigProviderTest.php @@ -7,7 +7,6 @@ use Magento\Customer\Model\Session; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Payment\Helper\Data; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\Vault\Api\Data\PaymentTokenInterface; @@ -33,10 +32,25 @@ class TokensConfigProviderTest extends \PHPUnit_Framework_TestCase private $storeManager; /** - * @var VaultPaymentInterface|MockObject + * @var \Magento\Payment\Api\PaymentMethodListInterface|MockObject + */ + private $paymentMethodList; + + /** + * @var \Magento\Payment\Model\Method\InstanceFactory|MockObject + */ + private $paymentMethodInstanceFactory; + + /** + * @var \Magento\Payment\Api\Data\PaymentMethodInterface|MockObject */ private $vaultPayment; + /** + * @var VaultPaymentInterface|MockObject + */ + private $vaultPaymentInstance; + /** * @var StoreInterface|MockObject */ @@ -47,11 +61,6 @@ class TokensConfigProviderTest extends \PHPUnit_Framework_TestCase */ private $customerTokenManagement; - /** - * @var Data|MockObject - */ - private $paymentDataHelper; - /** * @var ObjectManager */ @@ -59,13 +68,18 @@ class TokensConfigProviderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->vaultPayment = $this->getMock(VaultPaymentInterface::class); + $this->paymentMethodList = $this->getMockBuilder(\Magento\Payment\Api\PaymentMethodListInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->paymentMethodInstanceFactory = $this->getMockBuilder( + \Magento\Payment\Model\Method\InstanceFactory::class + )->disableOriginalConstructor()->getMock(); + + $this->vaultPayment = $this->getMockForAbstractClass(\Magento\Payment\Api\Data\PaymentMethodInterface::class); + $this->vaultPaymentInstance = $this->getMockForAbstractClass(VaultPaymentInterface::class); $this->storeManager = $this->getMock(StoreManagerInterface::class); $this->store = $this->getMock(StoreInterface::class); - $this->paymentDataHelper = $this->getMockBuilder(Data::class) - ->disableOriginalConstructor() - ->setMethods(['getStoreMethods']) - ->getMock(); $this->objectManager = new ObjectManager($this); $this->customerTokenManagement = $this->getMockBuilder(CustomerTokenManagement::class) @@ -99,17 +113,17 @@ public function testGetConfig() $this->store->expects(static::once()) ->method('getId') ->willReturn($storeId); - - $this->paymentDataHelper->expects(static::once()) - ->method('getStoreMethods') + + $this->paymentMethodList->expects(static::once()) + ->method('getActiveList') ->with($storeId) ->willReturn([$this->vaultPayment]); + + $this->paymentMethodInstanceFactory->expects($this->once()) + ->method('create') + ->willReturn($this->vaultPaymentInstance); - $this->vaultPayment->expects(static::once()) - ->method('isActive') - ->with($storeId) - ->willReturn(true); - $this->vaultPayment->expects(static::once()) + $this->vaultPaymentInstance->expects(static::once()) ->method('getProviderCode') ->willReturn($vaultProviderCode); @@ -142,8 +156,13 @@ public function testGetConfig() $this->objectManager->setBackwardCompatibleProperty( $configProvider, - 'paymentDataHelper', - $this->paymentDataHelper + 'paymentMethodList', + $this->paymentMethodList + ); + $this->objectManager->setBackwardCompatibleProperty( + $configProvider, + 'paymentMethodInstanceFactory', + $this->paymentMethodInstanceFactory ); static::assertEquals($expectedConfig, $configProvider->getConfig()); diff --git a/app/code/Magento/Vault/Test/Unit/Model/Ui/VaultConfigProviderTest.php b/app/code/Magento/Vault/Test/Unit/Model/Ui/VaultConfigProviderTest.php index 7d0d8339ab2b1..d00531637b86d 100644 --- a/app/code/Magento/Vault/Test/Unit/Model/Ui/VaultConfigProviderTest.php +++ b/app/code/Magento/Vault/Test/Unit/Model/Ui/VaultConfigProviderTest.php @@ -7,7 +7,6 @@ use Magento\Customer\Model\Session; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Payment\Helper\Data; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\Vault\Model\Ui\VaultConfigProvider; @@ -21,15 +20,25 @@ class VaultConfigProviderTest extends \PHPUnit_Framework_TestCase { /** - * @var Data|MockObject + * @var \Magento\Payment\Api\PaymentMethodListInterface|MockObject */ - private $paymentDataHelper; + private $paymentMethodList; /** - * @var VaultPaymentInterface|MockObject + * @var \Magento\Payment\Model\Method\InstanceFactory|MockObject + */ + private $paymentMethodInstanceFactory; + + /** + * @var \Magento\Payment\Api\Data\PaymentMethodInterface|MockObject */ private $vaultPayment; + /** + * @var VaultPaymentInterface|MockObject + */ + private $vaultPaymentInstance; + /** * @var Session|MockObject */ @@ -52,12 +61,16 @@ class VaultConfigProviderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->paymentDataHelper = $this->getMockBuilder(Data::class) + $this->paymentMethodList = $this->getMockBuilder(\Magento\Payment\Api\PaymentMethodListInterface::class) ->disableOriginalConstructor() - ->setMethods(['getStoreMethods']) - ->getMock(); + ->getMockForAbstractClass(); - $this->vaultPayment = $this->getMockForAbstractClass(VaultPaymentInterface::class); + $this->paymentMethodInstanceFactory = $this->getMockBuilder( + \Magento\Payment\Model\Method\InstanceFactory::class + )->disableOriginalConstructor()->getMock(); + + $this->vaultPayment = $this->getMockForAbstractClass(\Magento\Payment\Api\Data\PaymentMethodInterface::class); + $this->vaultPaymentInstance = $this->getMockForAbstractClass(VaultPaymentInterface::class); $this->storeManager = $this->getMockForAbstractClass(StoreManagerInterface::class); $this->store = $this->getMockForAbstractClass(StoreInterface::class); $this->session = $this->getMockBuilder(Session::class) @@ -68,8 +81,13 @@ protected function setUp() $this->vaultConfigProvider = new VaultConfigProvider($this->storeManager, $this->session); $objectManager->setBackwardCompatibleProperty( $this->vaultConfigProvider, - 'paymentDataHelper', - $this->paymentDataHelper + 'paymentMethodList', + $this->paymentMethodList + ); + $objectManager->setBackwardCompatibleProperty( + $this->vaultConfigProvider, + 'paymentMethodInstanceFactory', + $this->paymentMethodInstanceFactory ); } @@ -101,15 +119,19 @@ public function testGetConfig($customerId, $vaultEnabled) ->method('getId') ->willReturn($storeId); - $this->paymentDataHelper->expects(static::once()) - ->method('getStoreMethods') + $this->paymentMethodList->expects(static::once()) + ->method('getActiveList') ->with($storeId) ->willReturn([$this->vaultPayment]); - $this->vaultPayment->expects(static::once()) + $this->paymentMethodInstanceFactory->expects($this->once()) + ->method('create') + ->willReturn($this->vaultPaymentInstance); + + $this->vaultPaymentInstance->expects(static::once()) ->method('getCode') ->willReturn($vaultPaymentCode); - $this->vaultPayment->expects($customerId !== null ? static::once() : static::never()) + $this->vaultPaymentInstance->expects($customerId !== null ? static::once() : static::never()) ->method('isActive') ->with($storeId) ->willReturn($vaultEnabled); From 0b05d4da623807689ff9e08bfd7a0a22f7a7582b Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Tue, 6 Sep 2016 01:45:08 -0700 Subject: [PATCH 0544/3232] MAGETWO-56341: Maximum error count when importing because issue URL key for specified store already exists --- .../Model/Import/Product.php | 39 ++++++++++++++++++- .../Model/Import/ProductTest.php | 3 +- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 21c12bf0a8b1a..4b52230f688bb 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1317,7 +1317,7 @@ public function saveProductEntity(array $entityRowsIn, array $entityRowsUp) $select = $this->_connection->select()->from( $entityTable, - $this->getNewSkuFieldsForSelect() + array_merge($this->getNewSkuFieldsForSelect(), $this->getOldSkuFieldsForSelect()) )->where( 'sku IN (?)', array_keys($entityRowsIn) @@ -1330,10 +1330,44 @@ public function saveProductEntity(array $entityRowsIn, array $entityRowsUp) $this->skuProcessor->setNewSkuData($sku, $key, $value); } } + + $this->_oldSku = $this->prepareUpdatedOldSkus($newProducts); } + return $this; } + /** + * Return additional data, needed to select. + * @return array + */ + private function getOldSkuFieldsForSelect() + { + return ['type_id', 'attribute_set_id', 'sku']; + } + + /** + * @param array $newProducts + * @return array + */ + private function prepareUpdatedOldSkus(array $newProducts) + { + $oldSkus = []; + foreach ($newProducts as $info) { + $typeId = $info['type_id']; + $sku = $info['sku']; + $oldSkus[$sku] = [ + 'type_id' => $typeId, + 'attr_set_id' => $info['attribute_set_id'], + 'entity_id' => $info['entity_id'], + 'supported_type' => isset($this->_productTypeModels[$typeId]), + $this->getProductEntityLinkField() => $info[$this->getProductEntityLinkField()], + ]; + } + + return array_replace($this->_oldSku, $oldSkus); + } + /** * Get new SKU fields for select * @@ -1718,6 +1752,7 @@ protected function _saveProducts() ['adapter' => $this, 'bunch' => $bunch] ); } + return $this; } @@ -2452,6 +2487,7 @@ protected function _saveValidatedBunches() { $source = $this->_getSource(); $source->rewind(); + while ($source->valid()) { try { $rowData = $source->current(); @@ -2465,6 +2501,7 @@ protected function _saveValidatedBunches() $rowData = $this->_customFieldsMapping($rowData); $this->validateRow($rowData, $source->key()); + $source->next(); } $this->checkUrlKeyDuplicates(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index a1762a065ba88..cf416154450c7 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -557,7 +557,7 @@ protected function getOptionValues(\Magento\Catalog\Model\Product\Option $option /** * @magentoDataIsolation enabled * @magentoDataFixture mediaImportImageFixture - * + * @magentoAppIsolation enabled * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function testSaveMediaImage() @@ -732,6 +732,7 @@ public function testInvalidSkuLink() /** * @magentoDataFixture Magento/Catalog/_files/products_with_multiselect_attribute.php * @magentoAppIsolation enabled + * @magentoDbIsolation enabled */ public function testValidateInvalidMultiselectValues() { From 3a5c5c2616e250a3d123ed83ad0fca781f2876f3 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 6 Sep 2016 12:05:06 +0300 Subject: [PATCH 0545/3232] MAGETWO-57820: [GITHUB] php bin/magento i18n:pack creates unwanted dir #6260 --- .../Pack/Writer/File/AbstractFileTest.php | 203 ++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 setup/src/Magento/Setup/Test/Unit/Module/I18n/Pack/Writer/File/AbstractFileTest.php diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Pack/Writer/File/AbstractFileTest.php b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Pack/Writer/File/AbstractFileTest.php new file mode 100644 index 0000000000000..10ce56838b361 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Pack/Writer/File/AbstractFileTest.php @@ -0,0 +1,203 @@ +contextMock = $this->getMock(Context::class, [], [], '', false, false); + $this->localeMock = $this->getMock(Locale::class, [], [], '', false, false); + $this->dictionaryMock = $this->getMock(Dictionary::class, [], [], '', false, false); + $this->phraseMock = $this->getMock(Phrase::class, [], [], '', false, false); + + $constructorArguments = $objectManagerHelper->getConstructArguments( + AbstractFile::class, + ['context' => $this->contextMock] + ); + $this->object = $this->getMockBuilder(AbstractFile::class) + ->setMethods(['_createDirectoryIfNotExist', '_writeFile']) + ->setConstructorArgs($constructorArguments) + ->getMockForAbstractClass(); + } + + /** + * @param string $contextType + * @param array $contextValue + * @dataProvider writeDictionaryWithRuntimeExceptionDataProvider + * @expectedException \RuntimeException + * @return void + */ + public function testWriteDictionaryWithRuntimeException($contextType, $contextValue) + { + $this->configureGeneralPhrasesMock($contextType, $contextValue); + + $this->object->expects($this->never()) + ->method('_createDirectoryIfNotExist'); + $this->object->expects($this->never()) + ->method('_writeFile'); + + $this->object->writeDictionary($this->dictionaryMock, $this->localeMock); + } + + /** + * @return array + */ + public function writeDictionaryWithRuntimeExceptionDataProvider() + { + return [ + ['', []], + ['module', []], + ['', ['Magento_Module']] + ]; + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Some error. Row #1. + * @return void + */ + public function testWriteDictionaryWithInvalidArgumentException() + { + $contextType = 'module'; + $contextValue = 'Magento_Module'; + + $this->configureGeneralPhrasesMock($contextType, [$contextValue]); + + $this->object->expects($this->never()) + ->method('_createDirectoryIfNotExist'); + $this->object->expects($this->never()) + ->method('_writeFile'); + + $this->contextMock->expects($this->once()) + ->method('buildPathToLocaleDirectoryByContext') + ->with($contextType, $contextValue) + ->willThrowException(new \InvalidArgumentException('Some error.')); + + $this->object->writeDictionary($this->dictionaryMock, $this->localeMock); + } + + /** + * @return void + */ + public function testWriteDictionaryWithUnregisteredComponentException() + { + $contextType = 'module'; + $contextValue = 'Magento_Module'; + + $this->configureGeneralPhrasesMock($contextType, [$contextValue]); + + $this->object->expects($this->never()) + ->method('_createDirectoryIfNotExist'); + $this->object->expects($this->never()) + ->method('_writeFile'); + + $this->contextMock->expects($this->once()) + ->method('buildPathToLocaleDirectoryByContext') + ->with($contextType, $contextValue) + ->willThrowException(new UnregisteredComponentException); + + $this->object->writeDictionary($this->dictionaryMock, $this->localeMock); + } + + /** + * @return void + */ + public function testWriteDictionary() + { + $contextType = 'module'; + $contextValue = 'Magento_Module'; + $path = '/some/path/'; + $phrase = 'Phrase'; + $locale = 'en_EN'; + $fileExtension = 'csv'; + $file = $path . $locale . '.' . $fileExtension; + + $this->configureGeneralPhrasesMock($contextType, [$contextValue]); + + $this->phraseMock->expects($this->once()) + ->method('getPhrase') + ->willReturn($phrase); + $this->localeMock->expects($this->once()) + ->method('__toString') + ->willReturn($locale); + + $this->object->expects($this->once()) + ->method('_getFileExtension') + ->willReturn($fileExtension); + $this->object->expects($this->once()) + ->method('_createDirectoryIfNotExist') + ->with(dirname($file)); + $this->object->expects($this->once()) + ->method('_writeFile') + ->with($file, [$phrase => $this->phraseMock]); + + $this->contextMock->expects($this->once()) + ->method('buildPathToLocaleDirectoryByContext') + ->with($contextType, $contextValue) + ->willReturn($path); + + $this->object->writeDictionary($this->dictionaryMock, $this->localeMock); + } + + /** + * @param string $contextType + * @param array $contextValue + * @return void + */ + protected function configureGeneralPhrasesMock($contextType, $contextValue) + { + $this->phraseMock->expects($this->any()) + ->method('getContextType') + ->willReturn($contextType); + $this->phraseMock->expects($this->any()) + ->method('getContextValue') + ->willReturn($contextValue); + + $this->dictionaryMock->expects($this->once()) + ->method('getPhrases') + ->willReturn([$this->phraseMock]); + } +} From 21c8a66997d73783bb4f6c1ed227c873578ec1d6 Mon Sep 17 00:00:00 2001 From: Maksym Iakusha Date: Mon, 22 Aug 2016 14:13:34 +0300 Subject: [PATCH 0546/3232] MAGETWO-55847: [GitHub] When tier price qty above 1000 adds a thousand separator in the Admin Panel #5745 --- .../Product/Form/Modifier/General.php | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index 7b54a508b8168..ce5ac077c529e 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -82,7 +82,7 @@ protected function customizeWeightFormat(array $data) $data = $this->arrayManager->replace( $path, $data, - $this->formatNumber($this->arrayManager->get($path, $data)) + $this->formatWeight($this->arrayManager->get($path, $data)) ); } @@ -105,7 +105,7 @@ protected function customizeAdvancedPriceFormat(array $data) $value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE] = $this->formatPrice($value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE]); $value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY] = - $this->formatNumber((int)$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY]); + (int)$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY]; } } @@ -378,23 +378,6 @@ private function getLocaleCurrency() return $this->localeCurrency; } - /** - * The getter function to get the store manager for real application code - * - * @return \Magento\Store\Model\StoreManagerInterface - * - * @deprecated - */ - private function getStoreManager() - { - if ($this->storeManager === null) { - $this->storeManager = - \Magento\Framework\App\ObjectManager::getInstance()->get(StoreManagerInterface::class); - } - return $this->storeManager; - } - - /** * Format price according to the locale of the currency * @@ -407,7 +390,7 @@ protected function formatPrice($value) return null; } - $store = $this->getStoreManager()->getStore(); + $store = $this->locator->getStore(); $currency = $this->getLocaleCurrency()->getCurrency($store->getBaseCurrencyCode()); $value = $currency->toCurrency($value, ['display' => \Magento\Framework\Currency::NO_SYMBOL]); @@ -428,7 +411,7 @@ protected function formatNumber($value) $value = (float)$value; $precision = strlen(substr(strrchr($value, "."), 1)); - $store = $this->getStoreManager()->getStore(); + $store = $this->locator->getStore(); $currency = $this->getLocaleCurrency()->getCurrency($store->getBaseCurrencyCode()); $value = $currency->toCurrency($value, ['display' => \Magento\Framework\Currency::NO_SYMBOL, 'precision' => $precision]); From 310808f4cba92da528f646acf85be576934b1eed Mon Sep 17 00:00:00 2001 From: Maksym Iakusha Date: Mon, 22 Aug 2016 14:20:22 +0300 Subject: [PATCH 0547/3232] MAGETWO-55847: [GitHub] When tier price qty above 1000 adds a thousand separator in the Admin Panel #5745 --- .../Ui/DataProvider/Product/Form/Modifier/General.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index ce5ac077c529e..ea0c6275875e0 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -9,7 +9,6 @@ use Magento\Catalog\Model\Locator\LocatorInterface; use Magento\Ui\Component\Form; use Magento\Framework\Stdlib\ArrayManager; -use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\Locale\CurrencyInterface; /** @@ -26,11 +25,6 @@ class General extends AbstractModifier * @var ArrayManager */ protected $arrayManager; - - /** - * @var StoreManagerInterface - */ - private $storeManager; /** * @var CurrencyInterface From 9d33182bbab1f70e304611575082fe241643a4d8 Mon Sep 17 00:00:00 2001 From: Maksym Iakusha Date: Mon, 22 Aug 2016 15:41:07 +0300 Subject: [PATCH 0548/3232] MAGETWO-55847: [GitHub] When tier price qty above 1000 adds a thousand separator in the Admin Panel #5745 --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/General.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index ea0c6275875e0..ab22e4aeb3dca 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -13,6 +13,8 @@ /** * Data provider for main panel of product page + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class General extends AbstractModifier { From 807667e61717cce32d3ec95014e55053247870c1 Mon Sep 17 00:00:00 2001 From: Maksym Aposov Date: Wed, 31 Aug 2016 19:40:30 +0300 Subject: [PATCH 0549/3232] MAGETWO-57175: Cannot delete product image --- .../Model/Product/Gallery/ReadHandler.php | 2 +- .../Model/Product/Gallery/ReadHandlerTest.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ReadHandler.php b/app/code/Magento/Catalog/Model/Product/Gallery/ReadHandler.php index 8a3109f3507a0..28ecfff39c94f 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/ReadHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ReadHandler.php @@ -78,7 +78,7 @@ public function addMediaDataToProduct(Product $product, array $mediaEntries) foreach ($mediaEntries as $mediaEntry) { $mediaEntry = $this->substituteNullsWithDefaultValues($mediaEntry); - $value['images'][] = $mediaEntry; + $value['images'][$mediaEntry['value_id']] = $mediaEntry; } $product->setData($attrCode, $value); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php index 8a14d1e6a858c..5c9a2f1e896b7 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php @@ -61,11 +61,18 @@ public function testExecute() $this->assertArrayHasKey('media_gallery', $data); $this->assertArrayHasKey('images', $data['media_gallery']); - $image = array_shift($data['media_gallery']['images']); - $this->assertEquals( - 'Image Alt Text', - $image['label'] - ); + $this->assertCount(1, $data['media_gallery']['images']); + foreach ($data['media_gallery']['images'] as $valueId => $imageData) { + $this->assertEquals( + 'Image Alt Text', + $imageData['label'] + ); + $this->assertEquals( + $imageData['value_id'], + $valueId, + "Required by Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml" + ); + } } } From fcb612d580e529f69b93cb8e5c637e36170b1c68 Mon Sep 17 00:00:00 2001 From: Maksym Aposov Date: Thu, 1 Sep 2016 15:35:34 +0300 Subject: [PATCH 0550/3232] MAGETWO-57175: Cannot delete product image --- .../Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php index 5c9a2f1e896b7..541256864c44e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php @@ -70,8 +70,7 @@ public function testExecute() ); $this->assertEquals( $imageData['value_id'], - $valueId, - "Required by Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml" + $valueId ); } } From fade3181d52f4e40069b528acdf63f2bf2f8f52e Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Tue, 6 Sep 2016 12:19:51 +0300 Subject: [PATCH 0551/3232] MAGETWO-57774: Update Creditmemo/InvoiceValidator --- .../Invoice/Validation/CanRefundTest.php | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Validation/CanRefundTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Validation/CanRefundTest.php index 0a91d91ce2a4e..773f3b75c91f5 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Validation/CanRefundTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Validation/CanRefundTest.php @@ -5,6 +5,8 @@ */ namespace Magento\Sales\Test\Unit\Model\Order\Invoice\Validation; +use Magento\Sales\Api\Data\OrderInterface; + /** * Class CanRefundTest */ @@ -15,6 +17,21 @@ class CanRefundTest extends \PHPUnit_Framework_TestCase */ private $invoiceMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $orderPaymentRepositoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $orderRepositoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $paymentMock; + /** * @var \Magento\Sales\Model\Order\Invoice\Validation\CanRefund */ @@ -25,7 +42,21 @@ protected function setUp() $this->invoiceMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Invoice::class) ->disableOriginalConstructor() ->getMock(); - $this->validator = new \Magento\Sales\Model\Order\Invoice\Validation\CanRefund(); + $this->orderPaymentRepositoryMock = $this->getMockBuilder( + \Magento\Sales\Api\OrderPaymentRepositoryInterface::class + ) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->orderRepositoryMock = $this->getMockBuilder(\Magento\Sales\Api\OrderRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->paymentMock = $this->getMockBuilder(\Magento\Payment\Model\InfoInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->validator = new \Magento\Sales\Model\Order\Invoice\Validation\CanRefund( + $this->orderPaymentRepositoryMock, + $this->orderRepositoryMock + ); } public function testValidateWrongInvoiceState() @@ -68,6 +99,24 @@ public function testValidate() $this->invoiceMock->expects($this->once()) ->method('getState') ->willReturn(\Magento\Sales\Model\Order\Invoice::STATE_PAID); + $orderMock = $this->getMockBuilder(OrderInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->orderRepositoryMock->expects($this->once()) + ->method('get') + ->willReturn($orderMock); + $orderMock->expects($this->once()) + ->method('getPayment') + ->willReturn($this->paymentMock); + $methodInstanceMock = $this->getMockBuilder(\Magento\Payment\Model\MethodInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->paymentMock->expects($this->once()) + ->method('getMethodInstance') + ->willReturn($methodInstanceMock); + $methodInstanceMock->expects($this->atLeastOnce()) + ->method('canRefund') + ->willReturn(true); $this->invoiceMock->expects($this->once()) ->method('getBaseGrandTotal') ->willReturn(1); From 34f3520531e0663264fb1fb6d5bbfd8082556489 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Tue, 6 Sep 2016 12:21:35 +0300 Subject: [PATCH 0552/3232] MAGETWO-56534: CLONE - Price in cart does not update correctly when price is changed in admin. --- .../Quote/Model/Product/Plugin/UpdateQuoteItems.php | 9 ++++----- .../Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php | 7 ++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php b/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php index c3fff34420573..c6062e351db06 100644 --- a/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php +++ b/app/code/Magento/Quote/Model/Product/Plugin/UpdateQuoteItems.php @@ -23,17 +23,16 @@ public function __construct( /** * @param \Magento\Catalog\Model\ResourceModel\Product $subject - * @param \Closure $proceed + * @param \Magento\Catalog\Model\ResourceModel\Product $result * @param \Magento\Framework\Model\AbstractModel $product - * @return mixed + * @return \Magento\Catalog\Model\ResourceModel\Product * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function aroundSave( + public function afterSave( \Magento\Catalog\Model\ResourceModel\Product $subject, - \Closure $proceed, + \Magento\Catalog\Model\ResourceModel\Product $result, \Magento\Framework\Model\AbstractModel $product ) { - $result = $proceed($product); $originalPrice = $product->getOrigData('price'); if (!empty($originalPrice) && ($originalPrice != $product->getPrice())) { $this->resource->markQuotesRecollect($product->getId()); diff --git a/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php b/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php index 41a14b0f78fcc..5301566981614 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Product/Plugin/UpdateQuoteItemsTest.php @@ -31,22 +31,19 @@ protected function setUp() * @param int $newPrice * @param bool $callMethod */ - public function testAroundUpdate($originalPrice, $newPrice, $callMethod) + public function testAfterUpdate($originalPrice, $newPrice, $callMethod) { $productResourceMock = $this->getMock(\Magento\Catalog\Model\ResourceModel\Product::class, [], [], '', false); $productMock = $this->getMockBuilder(\Magento\Framework\Model\AbstractModel::class) ->disableOriginalConstructor() ->setMethods(['getOrigData', 'getPrice', 'getId']) ->getMockForAbstractClass(); - $closure = function () use ($productResourceMock) { - return $productResourceMock; - }; $productId = 1; $productMock->expects($this->any())->method('getOrigData')->with('price')->willReturn($originalPrice); $productMock->expects($this->any())->method('getPrice')->willReturn($newPrice); $productMock->expects($this->any())->method('getId')->willReturn($productId); $this->quoteResource->expects($this->$callMethod())->method('markQuotesRecollect')->with($productId); - $result = $this->model->aroundSave($productResourceMock, $closure, $productMock); + $result = $this->model->afterSave($productResourceMock, $productResourceMock, $productMock); $this->assertEquals($result, $productResourceMock); } From 9389dad358a53c22c53c9fe6ca9d1e882c19b299 Mon Sep 17 00:00:00 2001 From: Yurii Hryhoriev Date: Tue, 6 Sep 2016 12:29:31 +0300 Subject: [PATCH 0553/3232] MAGETWO-56054: [GitHub] Admin >New order: 'Recently Viewed Products' has 0 price value #5810 - statics fix --- .../view/adminhtml/templates/order/create/sidebar/items.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b04c374209e33..59bb31a94fa0c 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 @@ -66,7 +66,7 @@ canDisplayPrice()): ?> -
    + canRemoveItems()): ?> From d48f1e221afddb026234bc1cf26af53a2e62167b Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Tue, 6 Sep 2016 02:58:53 -0700 Subject: [PATCH 0554/3232] MAGETWO-56341: Maximum error count when importing because issue URL key for specified store already exists --- .../Magento/CatalogImportExport/Model/Import/Product.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 4b52230f688bb..77ce0dc40edcf 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1331,7 +1331,7 @@ public function saveProductEntity(array $entityRowsIn, array $entityRowsUp) } } - $this->_oldSku = $this->prepareUpdatedOldSkus($newProducts); + $this->updateOldSku($newProducts); } return $this; @@ -1347,10 +1347,11 @@ private function getOldSkuFieldsForSelect() } /** + * Adds newly created products to _oldSku * @param array $newProducts - * @return array + * @return void */ - private function prepareUpdatedOldSkus(array $newProducts) + private function updateOldSku(array $newProducts) { $oldSkus = []; foreach ($newProducts as $info) { @@ -1365,7 +1366,7 @@ private function prepareUpdatedOldSkus(array $newProducts) ]; } - return array_replace($this->_oldSku, $oldSkus); + $this->_oldSku = array_replace($this->_oldSku, $oldSkus); } /** From 091925690886dba4301afe66cce0d774aece0026 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Tue, 6 Sep 2016 03:14:13 -0700 Subject: [PATCH 0555/3232] MAGETWO-56341: Maximum error count when importing because issue URL key for specified store already exists --- app/code/Magento/CatalogImportExport/Model/Import/Product.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 77ce0dc40edcf..75ec58ff90876 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1343,7 +1343,7 @@ public function saveProductEntity(array $entityRowsIn, array $entityRowsUp) */ private function getOldSkuFieldsForSelect() { - return ['type_id', 'attribute_set_id', 'sku']; + return ['type_id', 'attribute_set_id']; } /** @@ -1360,7 +1360,7 @@ private function updateOldSku(array $newProducts) $oldSkus[$sku] = [ 'type_id' => $typeId, 'attr_set_id' => $info['attribute_set_id'], - 'entity_id' => $info['entity_id'], + $this->getProductIdentifierField() => $info[$this->getProductIdentifierField()], 'supported_type' => isset($this->_productTypeModels[$typeId]), $this->getProductEntityLinkField() => $info[$this->getProductEntityLinkField()], ]; From 687342a60f35e99d675f9d4cb5d1ec7c3f301b6d Mon Sep 17 00:00:00 2001 From: Maksim_Stsepantsevic Date: Tue, 6 Sep 2016 14:10:49 +0300 Subject: [PATCH 0556/3232] MAGETWO-57990: Implement Active Payments API - Fix sort order --- app/code/Magento/Payment/Model/PaymentMethodList.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Payment/Model/PaymentMethodList.php b/app/code/Magento/Payment/Model/PaymentMethodList.php index eb2b6140c1d16..5968d201ca686 100644 --- a/app/code/Magento/Payment/Model/PaymentMethodList.php +++ b/app/code/Magento/Payment/Model/PaymentMethodList.php @@ -54,8 +54,8 @@ function ($code) { @uasort( $methodsInstances, - function (MethodInterface $a, MethodInterface $b) { - return (int)$a->getConfigData('sort_order') - (int)$b->getConfigData('sort_order'); + function (MethodInterface $a, MethodInterface $b) use ($storeId) { + return (int)$a->getConfigData('sort_order', $storeId) - (int)$b->getConfigData('sort_order', $storeId); } ); From a4c72610951b5acc21fd294948a022d91ffb74a8 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Tue, 6 Sep 2016 05:12:36 -0700 Subject: [PATCH 0557/3232] MAGETWO-56341: Maximum error count when importing because issue URL key for specified store already exists --- .../Model/Import/ProductTest.php | 61 +++++++++++++++++++ ...products_to_import_with_multiple_store.csv | 6 ++ 2 files changed, 67 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_import_with_multiple_store.csv diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index cf416154450c7..416ae8ecafcf6 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -14,6 +14,7 @@ */ namespace Magento\CatalogImportExport\Model\Import; +use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Category; use Magento\Framework\App\Bootstrap; @@ -38,6 +39,8 @@ class ProductTest extends \Magento\TestFramework\Indexer\TestCase */ protected $_uploader; + protected $importExport; + /** * @var \Magento\CatalogImportExport\Model\Import\UploaderFactory */ @@ -1269,4 +1272,62 @@ public function testProductWithUseConfigSettings() $this->assertEquals($manageStockUseConfig, $stockItem->getUseConfigManageStock()); } } + + /** + * @magentoDataFixture Magento/Store/_files/website.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ + public function testProductWithMultipleStoresInDifferentBunches() + { + $products = [ + 'simple1', + 'simple2', + 'simple3' + ]; + + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $importExportData = $this->getMockBuilder(\Magento\ImportExport\Helper\Data::class) + ->disableOriginalConstructor() + ->getMock(); + $importExportData->expects($this->atLeastOnce()) + ->method('getBunchSize') + ->willReturn(1); + $this->_model = $objectManager->create( + \Magento\CatalogImportExport\Model\Import\Product::class, + ['importExportData' => $importExportData] + ); + + $filesystem = $objectManager->create(\Magento\Framework\Filesystem::class); + $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); + $source = $this->objectManager->create( + \Magento\ImportExport\Model\Import\Source\Csv::class, + [ + 'file' => __DIR__ . '/_files/products_to_import_with_multiple_store.csv', + 'directory' => $directory + ] + ); + $errors = $this->_model->setParameters( + ['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, 'entity' => 'catalog_product'] + )->setSource( + $source + )->validateData(); + + $this->assertTrue($errors->getErrorsCount() == 0); + + $this->_model->importData(); + $productCollection = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Product\Collection::class); + $this->assertCount(3, $productCollection->getItems()); + $actualProductSkus = array_map( + function(ProductInterface $item) { + return $item->getSku(); + }, + $productCollection->getItems() + ); + $this->assertEquals( + $products, + array_values($actualProductSkus) + ); + } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_import_with_multiple_store.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_import_with_multiple_store.csv new file mode 100644 index 0000000000000..a4ad5adb7b0f4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_import_with_multiple_store.csv @@ -0,0 +1,6 @@ +sku,product_type,store_view_code,name,price,attribute_set_code,categories +simple1,simple,fixturestore,"simple 1",25,Default,"Default Category/Category 1" +simple1,simple,,"simple 1",25,Default,"Default Category/Category 1" +simple2,simple,fixturestore,"simple 2",34,Default,"Default Category/Category 1" +simple2,simple,,"simple 2",34,Default,"Default Category/Category 1" +simple3,simple,,"simple 3",58,Default,"Default Category/Category 1" From 7796729a9cd6b37ac191dcfee129c4b671bdca2b Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Tue, 6 Sep 2016 05:32:40 -0700 Subject: [PATCH 0558/3232] MAGETWO-56341: Maximum error count when importing because issue URL key for specified store already exists --- .../CatalogImportExport/Model/Import/ProductTest.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 416ae8ecafcf6..db5511bf9d8ff 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -39,8 +39,6 @@ class ProductTest extends \Magento\TestFramework\Indexer\TestCase */ protected $_uploader; - protected $importExport; - /** * @var \Magento\CatalogImportExport\Model\Import\UploaderFactory */ @@ -1287,19 +1285,18 @@ public function testProductWithMultipleStoresInDifferentBunches() 'simple3' ]; - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $importExportData = $this->getMockBuilder(\Magento\ImportExport\Helper\Data::class) ->disableOriginalConstructor() ->getMock(); $importExportData->expects($this->atLeastOnce()) ->method('getBunchSize') ->willReturn(1); - $this->_model = $objectManager->create( + $this->_model = $this->objectManager->create( \Magento\CatalogImportExport\Model\Import\Product::class, ['importExportData' => $importExportData] ); - $filesystem = $objectManager->create(\Magento\Framework\Filesystem::class); + $filesystem = $this->objectManager->create(\Magento\Framework\Filesystem::class); $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); $source = $this->objectManager->create( \Magento\ImportExport\Model\Import\Source\Csv::class, @@ -1317,7 +1314,8 @@ public function testProductWithMultipleStoresInDifferentBunches() $this->assertTrue($errors->getErrorsCount() == 0); $this->_model->importData(); - $productCollection = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Product\Collection::class); + $productCollection = $this->objectManager + ->create(\Magento\Catalog\Model\ResourceModel\Product\Collection::class); $this->assertCount(3, $productCollection->getItems()); $actualProductSkus = array_map( function(ProductInterface $item) { From c5a612a92288eb23d6f6140602b0492e5047779b Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Tue, 6 Sep 2016 16:24:04 +0300 Subject: [PATCH 0559/3232] MAGETWO-56814: Unable to print Invoices and Credit memo from Sales>Orders --- .../Order/PdfDocumentsMassAction.php | 52 ++++++++ .../Adminhtml/Order/Pdfcreditmemos.php | 2 +- .../Adminhtml/Order/Pdfinvoices.php | 4 +- .../Adminhtml/PdfDocumentsMassActionTest.php | 114 ++++++++++++++++++ 4 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/Sales/Controller/Adminhtml/Order/PdfDocumentsMassAction.php create mode 100644 app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/PdfDocumentsMassActionTest.php diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/PdfDocumentsMassAction.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/PdfDocumentsMassAction.php new file mode 100644 index 0000000000000..5396a1d69bc5b --- /dev/null +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/PdfDocumentsMassAction.php @@ -0,0 +1,52 @@ +filter->getCollection($this->getOrderCollection()->create()); + return $this->massAction($collection); + } catch (\Exception $e) { + $this->messageManager->addError($e->getMessage()); + /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ + $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); + return $resultRedirect->setPath($this->redirectUrl); + } + } + + /** + * Get Order Collection Factory + * + * @return \Magento\Sales\Model\ResourceModel\Order\CollectionFactory + * @deprecated + */ + private function getOrderCollection() + { + if ($this->orderCollectionFactory === null) { + $this->orderCollectionFactory = \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Sales\Model\ResourceModel\Order\CollectionFactory::class + ); + } + return $this->orderCollectionFactory; + } +} diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfcreditmemos.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfcreditmemos.php index 119333e85f325..9b2e62ed96ea9 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfcreditmemos.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfcreditmemos.php @@ -21,7 +21,7 @@ * Class Pdfcreditmemos * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Pdfcreditmemos extends \Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction +class Pdfcreditmemos extends \Magento\Sales\Controller\Adminhtml\Order\PdfDocumentsMassAction { /** * @var FileFactory diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfinvoices.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfinvoices.php index 8085f8fa406db..4eb93fb332f9e 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfinvoices.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfinvoices.php @@ -20,7 +20,7 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Pdfinvoices extends \Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction +class Pdfinvoices extends \Magento\Sales\Controller\Adminhtml\Order\PdfDocumentsMassAction { /** * @var FileFactory @@ -79,7 +79,7 @@ protected function massAction(AbstractCollection $collection) return $this->resultRedirectFactory->create()->setPath($this->getComponentRefererUrl()); } return $this->fileFactory->create( - sprintf('packingslip%s.pdf', $this->dateTime->date('Y-m-d_H-i-s')), + sprintf('invoice%s.pdf', $this->dateTime->date('Y-m-d_H-i-s')), $this->pdfInvoice->getPdf($invoicesCollection->getItems())->render(), DirectoryList::VAR_DIR, 'application/pdf' diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/PdfDocumentsMassActionTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/PdfDocumentsMassActionTest.php new file mode 100644 index 0000000000000..e93c22fb837f0 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/PdfDocumentsMassActionTest.php @@ -0,0 +1,114 @@ +messageManager = $this->getMock( + \Magento\Framework\Message\Manager::class, + ['addSuccess', 'addError'], + [], + '', + false + ); + + $this->orderCollectionMock = $this->getMock( + \Magento\Sales\Model\ResourceModel\Order\Collection::class, + [], + [], + '', + false + ); + $this->filterMock = $this->getMock(\Magento\Ui\Component\MassAction\Filter::class, [], [], '', false); + + $this->orderCollectionFactoryMock = $this->getMock( + \Magento\Sales\Model\ResourceModel\Order\CollectionFactory::class, + ['create'], + [], + '', + false + ); + + $this->orderCollectionFactoryMock + ->expects($this->once()) + ->method('create') + ->willReturn($this->orderCollectionMock); + $this->resultRedirect = $this->getMock(\Magento\Backend\Model\View\Result\Redirect::class, [], [], '', false); + $resultRedirectFactory = $this->getMock( + \Magento\Framework\Controller\ResultFactory::class, + [], + [], + '', + false + ); + $resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirect); + $this->controller = $objectManagerHelper->getObject( + \Magento\Sales\Controller\Adminhtml\Order\Pdfinvoices::class, + [ + 'filter' => $this->filterMock, + 'resultFactory' => $resultRedirectFactory, + 'messageManager' => $this->messageManager + ] + ); + $objectManagerHelper + ->setBackwardCompatibleProperty( + $this->controller, + 'orderCollectionFactory', + $this->orderCollectionFactoryMock + ); + } + + public function testExecute() + { + $exception = new \Exception(); + $this->filterMock + ->expects($this->once()) + ->method('getCollection') + ->with($this->orderCollectionMock) + ->willThrowException($exception); + $this->messageManager->expects($this->once())->method('addError'); + + $this->resultRedirect->expects($this->once())->method('setPath')->willReturnSelf(); + $this->controller->execute($exception); + } +} From 817212010b52a8889e2e8395c547f2f4dc613dcf Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Tue, 6 Sep 2016 17:08:22 +0300 Subject: [PATCH 0560/3232] MAGETWO-57776: Introduce new service refundInvoice --- app/code/Magento/Sales/Model/RefundInvoice.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/RefundInvoice.php b/app/code/Magento/Sales/Model/RefundInvoice.php index 1f01c80e991db..80c445faa3f35 100644 --- a/app/code/Magento/Sales/Model/RefundInvoice.php +++ b/app/code/Magento/Sales/Model/RefundInvoice.php @@ -94,7 +94,21 @@ class RefundInvoice implements RefundInvoiceInterface private $logger; /** - * @inheritDoc + * RefundInvoice constructor. + * + * @param ResourceConnection $resourceConnection + * @param OrderStateResolverInterface $orderStateResolver + * @param OrderRepositoryInterface $orderRepository + * @param InvoiceRepositoryInterface $invoiceRepository + * @param OrderValidatorInterface $orderValidator + * @param InvoiceValidatorInterface $invoiceValidator + * @param CreditmemoValidatorInterface $creditmemoValidator + * @param CreditmemoRepositoryInterface $creditmemoRepository + * @param PaymentAdapterInterface $paymentAdapter + * @param CreditmemoDocumentFactory $creditmemoDocumentFactory + * @param NotifierInterface $notifier + * @param Config $config + * @param LoggerInterface $logger */ public function __construct( ResourceConnection $resourceConnection, From 07bfa36a6d0aa1ace97ff2428ed3ae137ad3c09a Mon Sep 17 00:00:00 2001 From: Anton Kaplya Date: Tue, 6 Sep 2016 17:22:42 +0300 Subject: [PATCH 0561/3232] MAGETWO-57760: Implement creditmemoDocumentFactory --- .../Model/Order/CreditmemoDocumentFactory.php | 18 +- .../Magento/Sales/Model/RefundInvoice.php | 1 - .../Order/CreditmemoDocumentFactoryTest.php | 263 ++++++++++++++++++ 3 files changed, 275 insertions(+), 7 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php diff --git a/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php b/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php index 67ec822651bcb..efd7d6ddf2f75 100644 --- a/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php +++ b/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php @@ -11,10 +11,10 @@ use Magento\Sales\Api\Data\CreditmemoInterface; use Magento\Sales\Api\Data\CreditmemoItemCreationInterface; use Magento\Sales\Api\Data\CreditmemoCommentCreationInterface; -use Magento\Sales\Api\Data\CreditmemoCommentInterface; use Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory; use Magento\Framework\EntityManager\HydratorPool; use Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface; +use Magento\Sales\Api\OrderRepositoryInterface; /** * Class CreditmemoDocumentFactory @@ -37,21 +37,29 @@ class CreditmemoDocumentFactory */ private $hydratorPool; + /** + * @var OrderRepositoryInterface + */ + private $orderRepository; + /** * CreditmemoDocumentFactory constructor. * * @param CreditmemoFactory $creditmemoFactory * @param CreditmemoCommentInterfaceFactory $commentFactory * @param HydratorPool $hydratorPool + * @param OrderRepositoryInterface $orderRepository */ public function __construct( CreditmemoFactory $creditmemoFactory, CreditmemoCommentInterfaceFactory $commentFactory, - HydratorPool $hydratorPool + HydratorPool $hydratorPool, + OrderRepositoryInterface $orderRepository ) { $this->creditmemoFactory = $creditmemoFactory; $this->commentFactory = $commentFactory; $this->hydratorPool = $hydratorPool; + $this->orderRepository = $orderRepository; } /** @@ -89,8 +97,6 @@ private function attachComment(CreditmemoInterface $creditmemo, CreditmemoCommen $commentData = $this->hydratorPool->getHydrator(CreditmemoCommentCreationInterface::class) ->extract($comment); $comment = $this->commentFactory->create(['data' => $commentData]); -// $comment = $this->hydratorPool->getHydrator(CreditmemoCommentInterface::class) -// ->hydrate($comment, $commentData); $comment->setParentId($creditmemo->getEntityId()) ->setStoreId($creditmemo->getStoreId()) ->setCreditmemo($creditmemo) @@ -135,14 +141,14 @@ public function createFromOrder( */ public function createFromInvoice( InvoiceInterface $invoice, - OrderInterface $order, array $items = [], CreditmemoCommentCreationInterface $comment = null, $appendComment = false, CreditmemoCreationArgumentsInterface $arguments = null ) { $data = $this->getCreditmemoCreationData($items, $arguments); - $invoice->setOrder($order); + /** @var $invoice \Magento\Sales\Model\Order\Invoice */ + $invoice->setOrder($this->orderRepository->get($invoice->getOrderId())); $creditmemo = $this->creditmemoFactory->createByInvoice($invoice, $data); if ($comment) { $creditmemo = $this->attachComment($creditmemo, $comment, $appendComment); diff --git a/app/code/Magento/Sales/Model/RefundInvoice.php b/app/code/Magento/Sales/Model/RefundInvoice.php index 80c445faa3f35..9b14963692338 100644 --- a/app/code/Magento/Sales/Model/RefundInvoice.php +++ b/app/code/Magento/Sales/Model/RefundInvoice.php @@ -157,7 +157,6 @@ public function execute( $order = $this->orderRepository->get($invoice->getOrderId()); $creditmemo = $this->creditmemoDocumentFactory->createFromInvoice( $invoice, - $order, $items, $comment, ($appendComment && $notify), diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php new file mode 100644 index 0000000000000..4f1204ec90c78 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php @@ -0,0 +1,263 @@ +objectManager = new ObjectManager($this); + $this->creditmemoFactoryMock = $this->getMockBuilder(CreditmemoFactory::class) + ->disableOriginalConstructor() + ->getMock(); + $this->commentFactoryMock = + $this->getMockBuilder('Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory') + ->setMethods(['create']) + ->getMock(); + $this->hydratorPoolMock = $this->getMockBuilder(HydratorPool::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderRepositoryMock = $this->getMockBuilder(OrderRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderMock = $this->getMockBuilder(Order::class) + ->disableOriginalConstructor() + ->getMock(); + $this->invoiceMock = $this->getMockBuilder(Invoice::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoItemCreationMock = $this->getMockBuilder(CreditmemoItemCreationInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoMock = $this->getMockBuilder(CreditmemoInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->hydratorMock = $this->getMockBuilder(HydratorInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->commentCreationArgumentsMock = $this->getMockBuilder(CreditmemoCreationArgumentsInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->commentCreationMock = $this->getMockBuilder(CreditmemoCommentCreationInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->creditmemoMock->expects($this->once()) + ->method('getEntityId') + ->willReturn(11); + + $this->commentMock = $this->getMockBuilder(CreditmemoCommentInterface::class) + ->disableOriginalConstructor() + ->setMethods(array_merge( + get_class_methods(CreditmemoCommentInterface::class), + ['setStoreId', 'setCreditmemo']) + ) + ->getMock(); + $this->factory = $this->objectManager->getObject( + CreditmemoDocumentFactory::class, + [ + 'creditmemoFactory' => $this->creditmemoFactoryMock, + 'commentFactory' => $this->commentFactoryMock, + 'hydratorPool' => $this->hydratorPoolMock, + 'orderRepository' => $this->orderRepositoryMock + ] + ); + } + + private function commonFactoryFlow() + { + $this->creditmemoItemCreationMock->expects($this->once()) + ->method('getOrderItemId') + ->willReturn(7); + $this->creditmemoItemCreationMock->expects($this->once()) + ->method('getQty') + ->willReturn(3); + $this->hydratorPoolMock->expects($this->exactly(2)) + ->method('getHydrator') + ->willReturnMap( + [ + [CreditmemoCreationArgumentsInterface::class, $this->hydratorMock], + [CreditmemoCommentCreationInterface::class, $this->hydratorMock], + ] + ); + $this->hydratorMock->expects($this->exactly(2)) + ->method('extract') + ->willReturnMap([ + [$this->commentCreationArgumentsMock, ['shipping_amount' => '20.00']], + [$this->commentCreationMock, ['comment' => 'text']] + ]); + $this->commentFactoryMock->expects($this->once()) + ->method('create') + ->with( + [ + 'data' => [ + 'comment' => 'text' + ] + ] + ) + ->willReturn($this->commentMock); + $this->creditmemoMock->expects($this->once()) + ->method('getEntityId') + ->willReturn(11); + $this->creditmemoMock->expects($this->once()) + ->method('getStoreId') + ->willReturn(1); + $this->commentMock->expects($this->once()) + ->method('setParentId') + ->with(11) + ->willReturnSelf(); + $this->commentMock->expects($this->once()) + ->method('setStoreId') + ->with(1) + ->willReturnSelf(); + $this->commentMock->expects($this->once()) + ->method('setIsCustomerNotified') + ->with(true) + ->willReturnSelf(); + $this->commentMock->expects($this->once()) + ->method('setCreditmemo') + ->with($this->creditmemoMock) + ->willReturnSelf(); + } + + public function testCreateFromOrder() + { + $this->commonFactoryFlow(); + $this->creditmemoFactoryMock->expects($this->once()) + ->method('createByOrder') + ->with( + $this->orderMock, + [ + 'shipping_amount' => '20.00', + 'qtys' => [7 => 3] + ] + ) + ->willReturn($this->creditmemoMock); + $this->factory->createFromOrder( + $this->orderMock, + [$this->creditmemoItemCreationMock], + $this->commentCreationMock, + true, + $this->commentCreationArgumentsMock + ); + } + + public function testCreateFromInvoice() + { + $this->commonFactoryFlow(); + $this->creditmemoFactoryMock->expects($this->once()) + ->method('createByInvoice') + ->with( + $this->invoiceMock, + [ + 'shipping_amount' => '20.00', + 'qtys' => [7 => 3] + ] + ) + ->willReturn($this->creditmemoMock); + $this->orderRepositoryMock->expects($this->once()) + ->method('get') + ->willReturn($this->orderMock); + $this->invoiceMock->expects($this->once()) + ->method('setOrder') + ->with($this->orderMock) + ->willReturnSelf(); + $this->factory->createFromInvoice( + $this->invoiceMock, + [$this->creditmemoItemCreationMock], + $this->commentCreationMock, + true, + $this->commentCreationArgumentsMock + ); + } +} From 50dcb103a2d787c0d8b0be4073a988c1e7b0cf7d Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Tue, 6 Sep 2016 17:25:07 +0300 Subject: [PATCH 0562/3232] MAGETWO-57760: Implement creditmemoDocumentFactory --- app/code/Magento/Sales/Model/RefundInvoice.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/Model/RefundInvoice.php b/app/code/Magento/Sales/Model/RefundInvoice.php index 80c445faa3f35..7d2dad90569d3 100644 --- a/app/code/Magento/Sales/Model/RefundInvoice.php +++ b/app/code/Magento/Sales/Model/RefundInvoice.php @@ -10,7 +10,7 @@ use Magento\Sales\Api\InvoiceRepositoryInterface; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Api\RefundInvoiceInterface; -use Magento\Sales\Model\Order\Config; +use Magento\Sales\Model\Order\Config as OrderConfig; use Magento\Sales\Model\Order\Creditmemo\CreditmemoValidatorInterface; use Magento\Sales\Model\Order\Creditmemo\NotifierInterface; use Magento\Sales\Model\Order\Creditmemo\Validation\QuantityValidator; @@ -84,7 +84,7 @@ class RefundInvoice implements RefundInvoiceInterface private $notifier; /** - * @var Config + * @var OrderConfig */ private $config; @@ -107,7 +107,7 @@ class RefundInvoice implements RefundInvoiceInterface * @param PaymentAdapterInterface $paymentAdapter * @param CreditmemoDocumentFactory $creditmemoDocumentFactory * @param NotifierInterface $notifier - * @param Config $config + * @param OrderConfig $config * @param LoggerInterface $logger */ public function __construct( @@ -122,7 +122,7 @@ public function __construct( PaymentAdapterInterface $paymentAdapter, CreditmemoDocumentFactory $creditmemoDocumentFactory, NotifierInterface $notifier, - Config $config, + OrderConfig $config, LoggerInterface $logger ) { $this->resourceConnection = $resourceConnection; From ac84ed58dd230abdfaf0306af150b0161d43aa31 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Tue, 6 Sep 2016 17:26:21 +0300 Subject: [PATCH 0563/3232] MAGETWO-57760: Implement creditmemoDocumentFactory --- app/code/Magento/Sales/Model/RefundOrder.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/Model/RefundOrder.php b/app/code/Magento/Sales/Model/RefundOrder.php index b638cdcb5727f..e9c6cbd377354 100644 --- a/app/code/Magento/Sales/Model/RefundOrder.php +++ b/app/code/Magento/Sales/Model/RefundOrder.php @@ -9,7 +9,7 @@ use Magento\Sales\Api\CreditmemoRepositoryInterface; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Api\RefundOrderInterface; -use Magento\Sales\Model\Order\Config; +use Magento\Sales\Model\Order\Config as OrderConfig; use Magento\Sales\Model\Order\Creditmemo\CreditmemoValidatorInterface; use Magento\Sales\Model\Order\Creditmemo\NotifierInterface; use Magento\Sales\Model\Order\Creditmemo\Validation\QuantityValidator; @@ -72,7 +72,7 @@ class RefundOrder implements RefundOrderInterface private $notifier; /** - * @var Config + * @var OrderConfig */ private $config; @@ -82,7 +82,18 @@ class RefundOrder implements RefundOrderInterface private $logger; /** - * @inheritDoc + * RefundOrder constructor. + * @param ResourceConnection $resourceConnection + * @param OrderStateResolverInterface $orderStateResolver + * @param OrderRepositoryInterface $orderRepository + * @param OrderValidatorInterface $orderValidator + * @param CreditmemoValidatorInterface $creditmemoValidator + * @param CreditmemoRepositoryInterface $creditmemoRepository + * @param PaymentAdapterInterface $paymentAdapter + * @param CreditmemoDocumentFactory $creditmemoDocumentFactory + * @param NotifierInterface $notifier + * @param OrderConfig $config + * @param LoggerInterface $logger */ public function __construct( ResourceConnection $resourceConnection, @@ -94,7 +105,7 @@ public function __construct( PaymentAdapterInterface $paymentAdapter, CreditmemoDocumentFactory $creditmemoDocumentFactory, NotifierInterface $notifier, - Config $config, + OrderConfig $config, LoggerInterface $logger ) { $this->resourceConnection = $resourceConnection; From 509d5fa501375e038e8866057d277412cde0cee9 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Tue, 6 Sep 2016 17:45:30 +0300 Subject: [PATCH 0564/3232] MAGETWO-55393: [Github #5636] Many storeviews break the page --- .../catalog/product/attribute/labels.phtml | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml index dd90b3b57de7c..4a3219efbb946 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml @@ -17,25 +17,27 @@
    -
    escapeHtml(__('IP Address')) ?>escapeHtml(__('Time of session start')) ?>
    getFormattedIp() ?>formatDateTime($item->getCreatedAt()) ?>escapeHtml($item->getFormattedIp()) ?>escapeHtml($block->formatDateTime($item->getCreatedAt())) ?>
    convertPrice($_item->getPrice()) ?>getItemPrice($_item) ?> getItemPrice($_item) ?>getItemPrice($_item) ?>
    - - - getStores() as $_store): ?> - - - - - - - getLabelValues() ?> - getStores() as $_store): ?> - - - - -
    getName() ?>
    - getReadOnly()):?> disabled="disabled"/> -
    +
    + + + + getStores() as $_store): ?> + + + + + + + getLabelValues() ?> + getStores() as $_store): ?> + + + + +
    getName() ?>
    + getReadOnly()):?> disabled="disabled"/> +
    +
    From 2d636959f1f5c2362106a9c6aa68900cc44de54d Mon Sep 17 00:00:00 2001 From: Maksim_Stsepantsevic Date: Tue, 6 Sep 2016 18:11:52 +0300 Subject: [PATCH 0565/3232] MAGETWO-57990: Implement Active Payments API - Unit test for PaymentMethodList API --- .../Test/Unit/Model/PaymentMethodListTest.php | 215 ++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 app/code/Magento/Payment/Test/Unit/Model/PaymentMethodListTest.php diff --git a/app/code/Magento/Payment/Test/Unit/Model/PaymentMethodListTest.php b/app/code/Magento/Payment/Test/Unit/Model/PaymentMethodListTest.php new file mode 100644 index 0000000000000..c41e5ac2a1aac --- /dev/null +++ b/app/code/Magento/Payment/Test/Unit/Model/PaymentMethodListTest.php @@ -0,0 +1,215 @@ +methodFactoryMock = $this->getMockBuilder(\Magento\Payment\Api\Data\PaymentMethodInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $this->helperMock = $this->getMockBuilder(\Magento\Payment\Helper\Data::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->paymentMethodList = $this->objectManagerHelper->getObject( + \Magento\Payment\Model\PaymentMethodList::class, + [ + 'methodFactory' => $this->methodFactoryMock, + 'helper' => $this->helperMock + ] + ); + } + + /** + * Setup getList method. + * + * @param array $paymentMethodConfig + * @param array $methodInstancesMap + * @return void + */ + private function setUpGetList($paymentMethodConfig, $methodInstancesMap) + { + $this->helperMock->expects($this->once()) + ->method('getPaymentMethods') + ->willReturn($paymentMethodConfig); + $this->helperMock->expects($this->any()) + ->method('getMethodInstance') + ->willReturnMap($methodInstancesMap); + + $this->methodFactoryMock->expects($this->any()) + ->method('create') + ->willReturnCallback(function ($data) { + $paymentMethod = $this->getMockBuilder(\Magento\Payment\Api\Data\PaymentMethodInterface::class) + ->getMockForAbstractClass(); + $paymentMethod->expects($this->any()) + ->method('getCode') + ->willReturn($data['code']); + $paymentMethod->expects($this->any()) + ->method('getIsActive') + ->willReturn($data['isActive']); + + return $paymentMethod; + }); + } + + /** + * Test getList. + * + * @param int $storeId + * @param array $paymentMethodConfig + * @param array $methodInstancesMap + * @param array $expected + * @return void + * + * @dataProvider getListDataProvider + */ + public function testGetList($storeId, $paymentMethodConfig, $methodInstancesMap, $expected) + { + $this->setUpGetList($paymentMethodConfig, $methodInstancesMap); + + $codes = array_map( + function ($method) { + return $method->getCode(); + }, + $this->paymentMethodList->getList($storeId) + ); + + $this->assertEquals($expected, $codes); + } + + /** + * Data provider for getList. + * + * @return array + */ + public function getListDataProvider() + { + return [ + [ + 1, + ['method_code_1' => [], 'method_code_2' => []], + [ + ['method_code_1', $this->mockPaymentMethodInstance(1, 10, 'method_code_1', 'title', true)], + ['method_code_2', $this->mockPaymentMethodInstance(1, 5, 'method_code_2', 'title', true)] + ], + ['method_code_2', 'method_code_1'] + ] + ]; + } + + /** + * Test getActiveList. + * + * @param int $storeId + * @param array $paymentMethodConfig + * @param array $methodInstancesMap + * @param array $expected + * @return void + * + * @dataProvider getActiveListDataProvider + */ + public function testGetActiveList($storeId, $paymentMethodConfig, $methodInstancesMap, $expected) + { + $this->setUpGetList($paymentMethodConfig, $methodInstancesMap); + + $codes = array_map( + function ($method) { + return $method->getCode(); + }, + $this->paymentMethodList->getActiveList($storeId) + ); + + $this->assertEquals($expected, $codes); + } + + /** + * Data provider for getActiveList. + * + * @return array + */ + public function getActiveListDataProvider() + { + return [ + [ + 1, + ['method_code_1' => [], 'method_code_2' => []], + [ + ['method_code_1', $this->mockPaymentMethodInstance(1, 10, 'method_code_1', 'title', false)], + ['method_code_2', $this->mockPaymentMethodInstance(1, 5, 'method_code_2', 'title', true)] + ], + ['method_code_2'] + ] + ]; + } + + /** + * Mock payment method instance. + * + * @param int $storeId + * @param int $sortOrder + * @param string $code + * @param string $title + * @param bool $isActive + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function mockPaymentMethodInstance($storeId, $sortOrder, $code, $title, $isActive) + { + $paymentMethodInstance = $this->getMockBuilder(\Magento\Payment\Model\Method\AbstractMethod::class) + ->setMethods(['getCode', 'getTitle', 'isActive', 'getConfigData']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $paymentMethodInstance->expects($this->any()) + ->method('getConfigData') + ->willReturnMap([ + ['sort_order', $storeId, $sortOrder] + ]); + $paymentMethodInstance->expects($this->any()) + ->method('getCode') + ->willReturn($code); + $paymentMethodInstance->expects($this->any()) + ->method('getTitle') + ->willReturn($title); + $paymentMethodInstance->expects($this->any()) + ->method('isActive') + ->willReturn($isActive); + + return $paymentMethodInstance; + } +} From 02a6c3757a298c8e699847a4ded93df8cf834048 Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Tue, 6 Sep 2016 18:28:02 +0300 Subject: [PATCH 0566/3232] =?UTF-8?q?MAGETWO-57923:=20=E2=80=9CNo=20Paymen?= =?UTF-8?q?t=20method=20available=E2=80=9D=20when=20customer=20tries=20to?= =?UTF-8?q?=20ship=20his=20items=20to=20billing=20restricted=20country?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Used setBillingAddress action instead setShippingInformation - Fixed condition for Vault comparision callback - Fixed namespaces --- app/code/Magento/Braintree/Helper/Country.php | 17 ++++++------ .../frontend/web/js/view/billing-address.js | 27 +++++++------------ .../frontend/web/js/view/payment/vault.js | 4 +-- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/Braintree/Helper/Country.php b/app/code/Magento/Braintree/Helper/Country.php index 3067c95d5e373..e8660b8523b30 100644 --- a/app/code/Magento/Braintree/Helper/Country.php +++ b/app/code/Magento/Braintree/Helper/Country.php @@ -5,18 +5,21 @@ */ namespace Magento\Braintree\Helper; +use Magento\Directory\Model\ResourceModel\Country\CollectionFactory; +use Magento\Braintree\Model\Adminhtml\System\Config\Country as CountryConfig; + /** * Class Country */ class Country { /** - * @var \Magento\Directory\Model\ResourceModel\Country\CollectionFactory + * @var CollectionFactory */ private $collectionFactory; /** - * @var \Magento\Braintree\Model\Adminhtml\System\Config\Country + * @var CountryConfig */ private $countryConfig; @@ -26,13 +29,11 @@ class Country private $countries; /** - * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $factory - * @param \Magento\Braintree\Model\Adminhtml\System\Config\Country $countryConfig + * @param CollectionFactory $factory + * @param CountryConfig $countryConfig */ - public function __construct( - \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $factory, - \Magento\Braintree\Model\Adminhtml\System\Config\Country $countryConfig - ) { + public function __construct(CollectionFactory $factory, CountryConfig $countryConfig) + { $this->collectionFactory = $factory; $this->countryConfig = $countryConfig; } diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index 17dbf158d50be..517231cf888f2 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -7,6 +7,7 @@ define( [ 'ko', + 'underscore', 'Magento_Ui/js/form/form', 'Magento_Customer/js/model/customer', 'Magento_Customer/js/model/address-list', @@ -17,12 +18,12 @@ define( 'Magento_Checkout/js/model/checkout-data-resolver', 'Magento_Customer/js/customer-data', 'Magento_Checkout/js/action/set-billing-address', - 'Magento_Checkout/js/action/set-shipping-information', 'Magento_Ui/js/model/messageList', 'mage/translate' ], function ( ko, + _, Component, customer, addressList, @@ -33,7 +34,6 @@ define( checkoutDataResolver, customerData, setBillingAddressAction, - setShippingInformationAction, globalMessageList, $t ) { @@ -149,11 +149,6 @@ define( if (this.selectedAddress() && this.selectedAddress() != newAddressOption) { selectBillingAddress(this.selectedAddress()); checkoutData.setSelectedBillingAddress(this.selectedAddress().getKey()); - - if (window.checkoutConfig.reloadOnBillingAddress) { - setBillingAddressAction(globalMessageList); - } - this.updateAddresses(); } else { this.source.set('params.invalid', false); this.source.trigger(this.dataScopePrefix + '.data.validate'); @@ -176,13 +171,9 @@ define( selectBillingAddress(newBillingAddress); checkoutData.setSelectedBillingAddress(newBillingAddress.getKey()); checkoutData.setNewCustomerBillingAddress(addressData); - - if (window.checkoutConfig.reloadOnBillingAddress) { - setBillingAddressAction(globalMessageList); - } - this.updateAddresses(); } } + this.updateAddresses(); }, /** @@ -239,18 +230,20 @@ define( * Trigger action to update shipping and billing addresses */ updateAddresses: function () { - if (!window.checkoutConfig.displayBillingOnPaymentMethod) { - setShippingInformationAction(); + if (window.checkoutConfig.reloadOnBillingAddress || + !window.checkoutConfig.displayBillingOnPaymentMethod + ) { + setBillingAddressAction(globalMessageList); } }, /** * Get code - * @param {Object} $parent + * @param {Object} parent * @returns {String} */ - getCode: function ($parent) { - return $parent.getCode === 'function' ? $parent.getCode() : 'shared'; + getCode: function (parent) { + return _.isFunction(parent.getCode) ? parent.getCode() : 'shared'; } }); } diff --git a/app/code/Magento/Vault/view/frontend/web/js/view/payment/vault.js b/app/code/Magento/Vault/view/frontend/web/js/view/payment/vault.js index c4e6c12834b09..05d56e305f23e 100644 --- a/app/code/Magento/Vault/view/frontend/web/js/view/payment/vault.js +++ b/app/code/Magento/Vault/view/frontend/web/js/view/payment/vault.js @@ -31,8 +31,8 @@ define( * @return {Boolean} */ typeComparatorCallback: function (typeA, typeB) { - // vaults items have the same name as vault payment without index - return typeA.substring(0, typeA.length - 2) === typeB; + // vault token items have the same name as vault payment without index + return typeA.substring(0, typeA.lastIndexOf('_')) === typeB; } } ); From 83eac3e5ce8306ec79e290d7225b9c8671c29a8f Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Tue, 6 Sep 2016 18:51:47 +0300 Subject: [PATCH 0567/3232] MAGETWO-52660: Improve performance of static assets deployment - MAGETWO-57913: Mysql connections is lost if forked process --- .../Deploy/Model/Deploy/DeployInterface.php | 6 - .../Deploy/Model/Deploy/LocaleDeploy.php | 13 +- .../Deploy/Model/Deploy/LocaleQuickDeploy.php | 12 +- .../Magento/Deploy/Model/DeployManager.php | 17 ++- .../Deploy/Model/DeployStrategyFactory.php | 21 +--- .../Deploy/Model/DeployStrategyProvider.php | 28 ++--- .../Process/ResourceConnectionProvider.php | 21 ---- .../Deploy/Model/ProcessQueueManager.php | 14 +-- .../Unit/Model/Deploy/LocaleDeployTest.php | 115 ++++++++++++------ .../Model/Deploy/LocaleQuickDeployTest.php | 39 +++--- .../Test/Unit/Model/DeployManagerTest.php | 14 ++- .../Unit/Model/DeployStrategyFactoryTest.php | 38 ++---- .../Unit/Model/ProcessQueueManagerTest.php | 12 +- 13 files changed, 163 insertions(+), 187 deletions(-) delete mode 100644 app/code/Magento/Deploy/Model/Process/ResourceConnectionProvider.php diff --git a/app/code/Magento/Deploy/Model/Deploy/DeployInterface.php b/app/code/Magento/Deploy/Model/Deploy/DeployInterface.php index 26896b88e0384..806cca60eddbf 100644 --- a/app/code/Magento/Deploy/Model/Deploy/DeployInterface.php +++ b/app/code/Magento/Deploy/Model/Deploy/DeployInterface.php @@ -15,10 +15,4 @@ interface DeployInterface * @return int */ public function deploy($area, $themePath, $locale); - - /** - * @param array $options - * @return void - */ - public function setOptions(array $options); } diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php index 9d70364de3191..f2ca6d8e477c5 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php @@ -152,6 +152,7 @@ class LocaleDeploy implements DeployInterface * @param \Magento\Framework\View\DesignInterfaceFactory $designFactory * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param array $alternativeSources + * @param array $options * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -169,7 +170,8 @@ public function __construct( Files $filesUtil, \Magento\Framework\View\DesignInterfaceFactory $designFactory, \Magento\Framework\Locale\ResolverInterface $localeResolver, - array $alternativeSources + array $alternativeSources, + $options = [] ) { $this->output = $output; $this->assetRepo = $assetRepo; @@ -191,6 +193,7 @@ function (AlternativeSourceInterface $alternativeSource) { ); $this->designFactory = $designFactory; $this->localeResolver = $localeResolver; + $this->options = $options; } /** @@ -247,14 +250,6 @@ public function deploy($area, $themePath, $locale) return $this->errorCount ? Cli::RETURN_FAILURE : Cli::RETURN_SUCCESS; } - /** - * {@inheritdoc} - */ - public function setOptions(array $options) - { - $this->options = $options; - } - /** * @param string $area * @param string $themePath diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php index 7fee087c5617a..2e2279e242721 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleQuickDeploy.php @@ -41,11 +41,13 @@ class LocaleQuickDeploy implements DeployInterface /** * @param Filesystem $filesystem * @param OutputInterface $output + * @param array $options */ - public function __construct(\Magento\Framework\Filesystem $filesystem, OutputInterface $output) + public function __construct(\Magento\Framework\Filesystem $filesystem, OutputInterface $output, $options = []) { $this->filesystem = $filesystem; $this->output = $output; + $this->options = $options; } /** @@ -110,14 +112,6 @@ public function deploy($area, $themePath, $locale) return Cli::RETURN_SUCCESS; } - /** - * {@inheritdoc} - */ - public function setOptions(array $options) - { - $this->options = $options; - } - /** * @param string $path * @return void diff --git a/app/code/Magento/Deploy/Model/DeployManager.php b/app/code/Magento/Deploy/Model/DeployManager.php index e06ba66a4c50c..7257ded0f7793 100644 --- a/app/code/Magento/Deploy/Model/DeployManager.php +++ b/app/code/Magento/Deploy/Model/DeployManager.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; use Magento\Deploy\Model\Deploy\TemplateMinifier; +use \Magento\Framework\App\State; class DeployManager { @@ -58,12 +59,18 @@ class DeployManager */ private $idDryRun; + /** + * @var State + */ + private $state; + /** * @param OutputInterface $output * @param StorageInterface $versionStorage * @param DeployStrategyProviderFactory $deployStrategyProviderFactory * @param ProcessQueueManager $processQueueManager * @param TemplateMinifier $templateMinifier + * @param State $state * @param array $options */ public function __construct( @@ -72,6 +79,7 @@ public function __construct( DeployStrategyProviderFactory $deployStrategyProviderFactory, ProcessQueueManager $processQueueManager, TemplateMinifier $templateMinifier, + State $state, array $options ) { $this->output = $output; @@ -80,6 +88,7 @@ public function __construct( $this->deployStrategyProviderFactory = $deployStrategyProviderFactory; $this->processQueueManager = $processQueueManager; $this->templateMinifier = $templateMinifier; + $this->state = $state; } /** @@ -119,7 +128,11 @@ public function deploy() $locales = array_keys($package); list($area, $themePath) = current($package); foreach ($strategyProvider->getDeployStrategies($area, $themePath, $locales) as $locale => $strategy) { - $result |= $strategy->deploy($area, $themePath, $locale); + $result |= $this->state->emulateAreaCode( + $area, + [$strategy, 'deploy'], + [$area, $themePath, $locale] + ); } } } @@ -157,7 +170,7 @@ private function runInParallel(DeployStrategyProvider $strategyProvider) $dependentStrategy = []; foreach ($strategyProvider->getDeployStrategies($area, $themePath, $locales) as $locale => $strategy) { $deploymentFunc = function () use ($area, $themePath, $locale, $strategy) { - return $strategy->deploy($area, $themePath, $locale); + return $this->state->emulateAreaCode($area, [$strategy, 'deploy'], [$area, $themePath, $locale]); }; if (null === $baseStrategy) { $baseStrategy = $deploymentFunc; diff --git a/app/code/Magento/Deploy/Model/DeployStrategyFactory.php b/app/code/Magento/Deploy/Model/DeployStrategyFactory.php index 17e4f538d3253..6cfb60dfd8712 100644 --- a/app/code/Magento/Deploy/Model/DeployStrategyFactory.php +++ b/app/code/Magento/Deploy/Model/DeployStrategyFactory.php @@ -7,8 +7,7 @@ namespace Magento\Deploy\Model; use Magento\Deploy\Model\Deploy\DeployInterface; -use Magento\Framework\App\ObjectManagerFactory; -use Magento\Framework\App\State; +use Magento\Framework\ObjectManagerInterface; class DeployStrategyFactory { @@ -23,25 +22,19 @@ class DeployStrategyFactory const DEPLOY_STRATEGY_QUICK = 'quick'; /** - * @var ObjectManagerFactory + * @param ObjectManagerInterface $objectManager */ - private $objectManagerFactory; - - /** - * @param ObjectManagerFactory $objectManagerFactory - */ - public function __construct(ObjectManagerFactory $objectManagerFactory) + public function __construct(ObjectManagerInterface $objectManager) { - $this->objectManagerFactory = $objectManagerFactory; + $this->objectManager = $objectManager; } /** - * @param string $areaCode * @param string $type * @param array $arguments * @return DeployInterface */ - public function create($areaCode, $type, array $arguments = []) + public function create($type, array $arguments = []) { $strategyMap = [ self::DEPLOY_STRATEGY_STANDARD => Deploy\LocaleDeploy::class, @@ -51,9 +44,7 @@ public function create($areaCode, $type, array $arguments = []) if (!isset($strategyMap[$type])) { throw new \InvalidArgumentException('Wrong deploy strategy type: ' . $type); } - $objectManager = $this->objectManagerFactory->create([State::PARAM_MODE => State::MODE_PRODUCTION]); - $objectManager->get(State::class)->setAreaCode($areaCode); - return $objectManager->create($strategyMap[$type], $arguments); + return $this->objectManager->create($strategyMap[$type], $arguments); } } diff --git a/app/code/Magento/Deploy/Model/DeployStrategyProvider.php b/app/code/Magento/Deploy/Model/DeployStrategyProvider.php index c575b626bb41c..22b489acb1132 100644 --- a/app/code/Magento/Deploy/Model/DeployStrategyProvider.php +++ b/app/code/Magento/Deploy/Model/DeployStrategyProvider.php @@ -15,11 +15,6 @@ class DeployStrategyProvider { - /** - * @var DeployInterface[] - */ - private $deployStrategies; - /** * @var RulePool */ @@ -86,7 +81,7 @@ public function getDeployStrategies($area, $themePath, array $locales) { if (count($locales) == 1) { $locale = current($locales); - return [$locale => $this->getDeployStrategy($area, DeployStrategyFactory::DEPLOY_STRATEGY_STANDARD)]; + return [$locale => $this->getDeployStrategy(DeployStrategyFactory::DEPLOY_STRATEGY_STANDARD)]; } $baseLocale = null; @@ -114,7 +109,7 @@ public function getDeployStrategies($area, $themePath, array $locales) ); return array_map(function ($strategyType) use ($area, $baseLocale) { - return $this->getDeployStrategy($area, $strategyType, $baseLocale); + return $this->getDeployStrategy($strategyType, $baseLocale); }, $deployStrategies); } @@ -178,29 +173,20 @@ private function getFallbackRule() } /** - * @param string $area * @param string $type * @param null|string $baseLocale * @return DeployInterface */ - private function getDeployStrategy($area, $type, $baseLocale = null) + private function getDeployStrategy($type, $baseLocale = null) { - $key = $area . '-' . $type; - if (!isset($this->deployStrategies[$key])) { - $this->deployStrategies[$key] = $this->deployStrategyFactory->create( - $area, - $type, - ['output' => $this->output] - ); - } - - $deployStrategy = $this->deployStrategies[$key]; $options = $this->options; if ($baseLocale) { $options[DeployManager::DEPLOY_BASE_LOCALE] = $baseLocale; } - $deployStrategy->setOptions($options); - return $deployStrategy; + return $this->deployStrategyFactory->create( + $type, + ['output' => $this->output, 'options' => $options] + ); } } diff --git a/app/code/Magento/Deploy/Model/Process/ResourceConnectionProvider.php b/app/code/Magento/Deploy/Model/Process/ResourceConnectionProvider.php deleted file mode 100644 index 921d3134075ae..0000000000000 --- a/app/code/Magento/Deploy/Model/Process/ResourceConnectionProvider.php +++ /dev/null @@ -1,21 +0,0 @@ -get(ResourceConnection::class); - } -} diff --git a/app/code/Magento/Deploy/Model/ProcessQueueManager.php b/app/code/Magento/Deploy/Model/ProcessQueueManager.php index 029ca5ace26dc..ab0690fa1d43b 100644 --- a/app/code/Magento/Deploy/Model/ProcessQueueManager.php +++ b/app/code/Magento/Deploy/Model/ProcessQueueManager.php @@ -6,7 +6,7 @@ namespace Magento\Deploy\Model; -use Magento\Deploy\Model\Process\ResourceConnectionProvider; +use Magento\Framework\App\ResourceConnection; class ProcessQueueManager { @@ -31,18 +31,18 @@ class ProcessQueueManager private $processManager; /** - * @var ResourceConnectionProvider + * @var ResourceConnection */ - private $resourceConnectionProvider; + private $resourceConnection; /** * @param ProcessManager $processManager - * @param ResourceConnectionProvider $resourceConnectionProvider + * @param ResourceConnection $resourceConnection */ - public function __construct(ProcessManager $processManager, ResourceConnectionProvider $resourceConnectionProvider) + public function __construct(ProcessManager $processManager, ResourceConnection $resourceConnection) { $this->processManager = $processManager; - $this->resourceConnectionProvider = $resourceConnectionProvider; + $this->resourceConnection = $resourceConnection; } /** @@ -98,7 +98,7 @@ public function process() } usleep(5000); } - $this->resourceConnectionProvider->get()->closeConnection(); + $this->resourceConnection->closeConnection(); return $returnStatus; } diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleDeployTest.php index c6f2b973c9afb..757da133ddbc3 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleDeployTest.php @@ -5,28 +5,32 @@ */ namespace Magento\Deploy\Test\Unit\Model\Deploy; +use Magento\Framework\App\Utility\Files; +use Magento\Framework\App\View\Asset\Publisher; +use Magento\Framework\Translate\Js\Config; +use Magento\Framework\View\Asset\Minification; +use Magento\Framework\View\Asset\Repository; +use Magento\Framework\View\Asset\RepositoryFactory; +use Psr\Log\LoggerInterface; +use Symfony\Component\Console\Output\OutputInterface; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class LocaleDeployTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Deploy\Model\Deploy\LocaleDeploy - */ - private $model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Translate\Js\Config + * @var \PHPUnit_Framework_MockObject_MockObject|Config */ private $jsTranslationMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\View\Asset\Minification + * @var \PHPUnit_Framework_MockObject_MockObject|Minification */ private $minificationMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\View\Asset\RepositoryFactory + * @var \PHPUnit_Framework_MockObject_MockObject|RepositoryFactory */ private $assetRepoFactoryMock; @@ -46,7 +50,7 @@ class LocaleDeployTest extends \PHPUnit_Framework_TestCase private $bundleManagerMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Utility\Files + * @var \PHPUnit_Framework_MockObject_MockObject|Files */ private $filesUtilMock; @@ -60,17 +64,42 @@ class LocaleDeployTest extends \PHPUnit_Framework_TestCase */ private $localeResolverMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|OutputInterface + */ + private $outputMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + */ + private $loggerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $assetRepoMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $assetPublisherMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $themeProviderMock; + protected function setUp() { - $outputMock = $this->getMock(\Symfony\Component\Console\Output\OutputInterface::class, [], [], '', false); - $loggerMock = $this->getMock(\Psr\Log\LoggerInterface::class, [], [], '', false); - $this->filesUtilMock = $this->getMock(\Magento\Framework\App\Utility\Files::class, [], [], '', false); - $assetRepoMock = $this->getMock(\Magento\Framework\View\Asset\Repository::class, [], [], '', false); - $this->minificationMock = $this->getMock(\Magento\Framework\View\Asset\Minification::class, [], [], '', false); - $this->jsTranslationMock = $this->getMock(\Magento\Framework\Translate\Js\Config::class, [], [], '', false); - $assetPublisherMock = $this->getMock(\Magento\Framework\App\View\Asset\Publisher::class, [], [], '', false); + $this->outputMock = $this->getMock(OutputInterface::class, [], [], '', false); + $this->loggerMock = $this->getMock(LoggerInterface::class, [], [], '', false); + $this->filesUtilMock = $this->getMock(Files::class, [], [], '', false); + $this->assetRepoMock = $this->getMock(Repository::class, [], [], '', false); + $this->minificationMock = $this->getMock(Minification::class, [], [], '', false); + $this->jsTranslationMock = $this->getMock(Config::class, [], [], '', false); + $this->assetPublisherMock = $this->getMock(Publisher::class, [], [], '', false); $this->assetRepoFactoryMock = $this->getMock( - \Magento\Framework\View\Asset\RepositoryFactory::class, + RepositoryFactory::class, ['create'], [], '', @@ -97,7 +126,7 @@ protected function setUp() '', false ); - $themeProviderMock = $this->getMock( + $this->themeProviderMock = $this->getMock( \Magento\Framework\View\Design\Theme\ThemeProviderInterface::class, [], [], @@ -118,24 +147,6 @@ protected function setUp() '', false ); - - $this->model = new \Magento\Deploy\Model\Deploy\LocaleDeploy( - $outputMock, - $this->jsTranslationMock, - $this->minificationMock, - $assetRepoMock, - $this->assetRepoFactoryMock, - $this->fileManagerFactoryMock, - $this->configFactoryMock, - $assetPublisherMock, - $this->bundleManagerMock, - $themeProviderMock, - $loggerMock, - $this->filesUtilMock, - $this->designFactoryMock, - $this->localeResolverMock, - [] - ); } public function testDeploy() @@ -145,11 +156,11 @@ public function testDeploy() $locale = 'en_US'; $designMock = $this->getMock(\Magento\Framework\View\DesignInterface::class, [], [], '', false); - $assetRepoMock = $this->getMock(\Magento\Framework\View\Asset\Repository::class, [], [], '', false); + $assetRepoMock = $this->getMock(Repository::class, [], [], '', false); $requireJsConfigMock = $this->getMock(\Magento\Framework\RequireJs\Config::class, [], [], '', false); $fileManagerMock = $this->getMock(\Magento\RequireJs\Model\FileManager::class, [], [], '', false); - $this->model->setOptions([\Magento\Deploy\Console\Command\DeployStaticOptionsInterface::NO_JAVASCRIPT => 0]); + $model = $this->getModel([\Magento\Deploy\Console\Command\DeployStaticOptionsInterface::NO_JAVASCRIPT => 0]); $this->localeResolverMock->expects($this->once())->method('setLocale')->with($locale); $this->designFactoryMock->expects($this->once())->method('create')->willReturn($designMock); @@ -171,7 +182,33 @@ public function testDeploy() $this->assertEquals( \Magento\Framework\Console\Cli::RETURN_SUCCESS, - $this->model->deploy($area, $themePath, $locale) + $model->deploy($area, $themePath, $locale) + ); + } + + /** + * @param array $options + * @return \Magento\Deploy\Model\Deploy\LocaleDeploy + */ + private function getModel($options = []) + { + return new \Magento\Deploy\Model\Deploy\LocaleDeploy( + $this->outputMock, + $this->jsTranslationMock, + $this->minificationMock, + $this->assetRepoMock, + $this->assetRepoFactoryMock, + $this->fileManagerFactoryMock, + $this->configFactoryMock, + $this->assetPublisherMock, + $this->bundleManagerMock, + $this->themeProviderMock, + $this->loggerMock, + $this->filesUtilMock, + $this->designFactoryMock, + $this->localeResolverMock, + [], + $options ); } } diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php index eb51b9bf0b8fe..e1eb4b5b81147 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleQuickDeployTest.php @@ -20,11 +20,6 @@ class LocaleQuickDeployTest extends \PHPUnit_Framework_TestCase */ private $outputMock; - /** - * @var LocaleQuickDeploy - */ - private $unit; - /** * @var WriteInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -39,14 +34,6 @@ protected function setUp() $this->staticDirectoryMock = $this->getMockBuilder(WriteInterface::class) ->setMethods(['createSymlink', 'getAbsolutePath', 'getRelativePath', 'copyFile', 'readRecursively']) ->getMockForAbstractClass(); - - $this->unit = (new ObjectManager($this))->getObject( - LocaleQuickDeploy::class, - [ - 'output' => $this->outputMock, - 'staticDirectory' => $this->staticDirectoryMock - ] - ); } /** @@ -55,7 +42,7 @@ protected function setUp() */ public function testDeployWithoutBaseLocale() { - $this->unit->deploy('adminhtml', 'Magento/backend', 'en_US'); + $this->getModel()->deploy('adminhtml', 'Magento/backend', 'en_US'); } public function testDeployWithSymlinkStrategy() @@ -72,11 +59,11 @@ public function testDeployWithSymlinkStrategy() ['_requirejs/adminhtml/Magento/backend/en_US', '_requirejs/adminhtml/Magento/backend/uk_UA'] ); - $this->unit->setOptions([ + $model =$this->getModel([ DeployManager::DEPLOY_BASE_LOCALE => $baseLocal, Options::SYMLINK_LOCALE => 1, ]); - $this->unit->deploy($area, $themePath, $locale); + $model->deploy($area, $themePath, $locale); } public function testDeployWithCopyStrategy() @@ -102,10 +89,26 @@ public function testDeployWithCopyStrategy() [$baseLocal . 'file2', $locale . 'file2', null] ); - $this->unit->setOptions([ + $model =$this->getModel([ DeployManager::DEPLOY_BASE_LOCALE => $baseLocal, Options::SYMLINK_LOCALE => 0, ]); - $this->unit->deploy($area, $themePath, $locale); + $model->deploy($area, $themePath, $locale); + } + + /** + * @param array $options + * @return LocaleQuickDeploy + */ + private function getModel($options = []) + { + return (new ObjectManager($this))->getObject( + LocaleQuickDeploy::class, + [ + 'output' => $this->outputMock, + 'staticDirectory' => $this->staticDirectoryMock, + 'options' => $options + ] + ); } } diff --git a/app/code/Magento/Deploy/Test/Unit/Model/DeployManagerTest.php b/app/code/Magento/Deploy/Test/Unit/Model/DeployManagerTest.php index e6a04bd12913e..83b2c0776b935 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/DeployManagerTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/DeployManagerTest.php @@ -37,6 +37,11 @@ class DeployManagerTest extends \PHPUnit_Framework_TestCase */ private $processQueueManager; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\State + */ + private $stateMock; + protected function setUp() { $this->deployStrategyProviderFactoryMock = $this->getMock( @@ -67,6 +72,9 @@ protected function setUp() '', false ); + $this->stateMock = $this->getMockBuilder(\Magento\Framework\App\State::class) + ->disableOriginalConstructor() + ->getMock(); $this->outputMock = $this->getMock(\Symfony\Component\Console\Output\OutputInterface::class, [], [], '', false); } @@ -129,8 +137,9 @@ public function testDeploy() ['output' => $this->outputMock, 'options' => $options] )->willReturn($strategyProviderMock); $strategyProviderMock->expects($this->once())->method('getDeployStrategies')->with($area, $themePath, [$locale]) - ->willReturn([$deployStrategyMock]); - $deployStrategyMock->expects($this->once())->method('deploy') + ->willReturn([$locale => $deployStrategyMock]); + $this->stateMock->expects(self::once())->method('emulateAreaCode') + ->with($area, [$deployStrategyMock, 'deploy'], [$area, $themePath, $locale]) ->willReturn(\Magento\Framework\Console\Cli::RETURN_SUCCESS); $version = (new \DateTime())->getTimestamp(); @@ -152,6 +161,7 @@ private function getModel(array $options) $this->deployStrategyProviderFactoryMock, $this->processQueueManager, $this->minifierTemplateMock, + $this->stateMock, $options ); } diff --git a/app/code/Magento/Deploy/Test/Unit/Model/DeployStrategyFactoryTest.php b/app/code/Magento/Deploy/Test/Unit/Model/DeployStrategyFactoryTest.php index 525d6a3d20534..9b89411fc089c 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/DeployStrategyFactoryTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/DeployStrategyFactoryTest.php @@ -7,16 +7,15 @@ use Magento\Deploy\Model\Deploy\LocaleDeploy; use Magento\Deploy\Model\DeployStrategyFactory; -use Magento\Framework\App\ObjectManagerFactory; -use Magento\Framework\App\State; +use Magento\Framework\ObjectManagerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class DeployStrategyFactoryTest extends \PHPUnit_Framework_TestCase { /** - * @var ObjectManagerFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ - private $objectManagerFactoryMock; + private $objectManagerMock; /** * @var DeployStrategyFactory @@ -25,18 +24,12 @@ class DeployStrategyFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->objectManagerFactoryMock = $this->getMock( - ObjectManagerFactory::class, - [], - [], - '', - false - ); + $this->objectManagerMock = $this->getMock(ObjectManagerInterface::class); $this->unit = (new ObjectManager($this))->getObject( DeployStrategyFactory::class, [ - 'objectManagerFactory' => $this->objectManagerFactoryMock, + 'objectManager' => $this->objectManagerMock, ] ); } @@ -47,29 +40,14 @@ protected function setUp() */ public function testCreateWithWrongStrategyType() { - $this->unit->create('adminhtml', 'wrong-type'); + $this->unit->create('wrong-type'); } public function testCreate() { - $areaCode = 'adminhtml'; - - $objectManagerMock = $this->getMockBuilder(\Magento\Framework\App\ObjectManager::class) - ->disableOriginalConstructor() - ->getMock(); - $stateMock = $this->getMockBuilder(State::class) - ->disableOriginalConstructor() - ->getMock(); - $stateMock->expects(self::once())->method('setAreaCode')->with($areaCode)->willReturnSelf(); - - $this->objectManagerFactoryMock->expects(self::once())->method('create') - ->with([State::PARAM_MODE => State::MODE_PRODUCTION]) - ->willReturn($objectManagerMock); - - $objectManagerMock->expects(self::once())->method('get')->willReturn($stateMock); - $objectManagerMock->expects(self::once())->method('create') + $this->objectManagerMock->expects(self::once())->method('create') ->with(LocaleDeploy::class, ['arg1' => 1]); - $this->unit->create($areaCode, DeployStrategyFactory::DEPLOY_STRATEGY_STANDARD, ['arg1' => 1]); + $this->unit->create(DeployStrategyFactory::DEPLOY_STRATEGY_STANDARD, ['arg1' => 1]); } } diff --git a/app/code/Magento/Deploy/Test/Unit/Model/ProcessQueueManagerTest.php b/app/code/Magento/Deploy/Test/Unit/Model/ProcessQueueManagerTest.php index cf84b2beb6cfb..60c23ec740425 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/ProcessQueueManagerTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/ProcessQueueManagerTest.php @@ -5,7 +5,6 @@ */ namespace Magento\Deploy\Test\Unit\Model; -use Magento\Deploy\Model\Process\ResourceConnectionProvider; use Magento\Deploy\Model\ProcessManager; use Magento\Framework\App\ResourceConnection; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -25,17 +24,17 @@ class ProcessQueueManagerTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResourceConnection */ - private $resourceConnectionProviderMock; + private $resourceConnectionMock; protected function setUp() { $this->processManagerMock = $this->getMock(ProcessManager::class, [], [], '', false); - $this->resourceConnectionProviderMock = $this->getMock(ResourceConnectionProvider::class, [], [], '', false); + $this->resourceConnectionMock = $this->getMock(ResourceConnection::class, [], [], '', false); $this->model = (new ObjectManager($this))->getObject( \Magento\Deploy\Model\ProcessQueueManager::class, [ 'processManager' => $this->processManagerMock, - 'resourceConnectionProvider' => $this->resourceConnectionProviderMock, + 'resourceConnection' => $this->resourceConnectionMock, ] ); } @@ -62,10 +61,7 @@ public function testProcess() $processMock->expects($this->once())->method('getStatus')->willReturn(0); $this->processManagerMock->expects($this->once())->method('delete')->with($processMock); - $resourceConnectionMock = $this->getMock(ResourceConnection::class, [], [], '', false); - $resourceConnectionMock->expects(self::once())->method('closeConnection'); - $this->resourceConnectionProviderMock->expects($this->once())->method('get') - ->willReturn($resourceConnectionMock); + $this->resourceConnectionMock->expects(self::once())->method('closeConnection'); $this->assertEquals(0, $this->model->process()); } From 9de26061096fd0ab9467e068278c7b234809b80c Mon Sep 17 00:00:00 2001 From: Sergey Semenov Date: Tue, 6 Sep 2016 18:54:44 +0300 Subject: [PATCH 0568/3232] MAGETWO-56077: [GitHub] Unable to add more than 1 product to a cart from Wishlist #5282 --- app/code/Magento/Wishlist/Helper/Data.php | 8 ++++- .../Wishlist/Test/Unit/Helper/DataTest.php | 32 +++++++++++++++++-- .../Wishlist/view/frontend/web/wishlist.js | 22 +++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index d64d1a185f0a2..292f66a71baa0 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -446,7 +446,13 @@ public function getSharedAddAllToCartUrl() */ protected function _getCartUrlParameters($item) { - return ['item' => is_string($item) ? $item : $item->getWishlistItemId()]; + $params = [ + 'item' => is_string($item) ? $item : $item->getWishlistItemId(), + ]; + if (is_object($item)) { + $params['qty'] = $item->getQty(); + } + return $params; } /** diff --git a/app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php b/app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php index 46054445620ac..ec6e959a3d4ca 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php @@ -124,6 +124,7 @@ protected function setUp() ->setMethods([ 'getProduct', 'getWishlistItemId', + 'getQty', ]) ->getMock(); @@ -217,6 +218,7 @@ public function testGetAddToCartParams() $url = 'result url'; $storeId = 1; $wishlistItemId = 1; + $wishlistItemQty = 1; $this->wishlistItem->expects($this->once()) ->method('getProduct') @@ -224,6 +226,9 @@ public function testGetAddToCartParams() $this->wishlistItem->expects($this->once()) ->method('getWishlistItemId') ->willReturn($wishlistItemId); + $this->wishlistItem->expects($this->once()) + ->method('getQty') + ->willReturn($wishlistItemQty); $this->product->expects($this->once()) ->method('isVisibleInSiteVisibility') @@ -243,9 +248,13 @@ public function testGetAddToCartParams() ->with('wishlist/index/cart') ->willReturn($url); + $expected = [ + 'item' => $wishlistItemId, + 'qty' => $wishlistItemQty, + ]; $this->postDataHelper->expects($this->once()) ->method('getPostData') - ->with($url, ['item' => $wishlistItemId]) + ->with($url, $expected) ->willReturn($url); $this->assertEquals($url, $this->model->getAddToCartParams($this->wishlistItem)); @@ -256,6 +265,7 @@ public function testGetAddToCartParamsWithReferer() $url = 'result url'; $storeId = 1; $wishlistItemId = 1; + $wishlistItemQty = 1; $referer = 'referer'; $refererEncoded = 'referer_encoded'; @@ -265,6 +275,9 @@ public function testGetAddToCartParamsWithReferer() $this->wishlistItem->expects($this->once()) ->method('getWishlistItemId') ->willReturn($wishlistItemId); + $this->wishlistItem->expects($this->once()) + ->method('getQty') + ->willReturn($wishlistItemQty); $this->product->expects($this->once()) ->method('isVisibleInSiteVisibility') @@ -288,9 +301,14 @@ public function testGetAddToCartParamsWithReferer() ->with('wishlist/index/cart') ->willReturn($url); + $expected = [ + 'item' => $wishlistItemId, + ActionInterface::PARAM_NAME_URL_ENCODED => $refererEncoded, + 'qty' => $wishlistItemQty, + ]; $this->postDataHelper->expects($this->once()) ->method('getPostData') - ->with($url, ['item' => $wishlistItemId, ActionInterface::PARAM_NAME_URL_ENCODED => $refererEncoded]) + ->with($url, $expected) ->willReturn($url); $this->assertEquals($url, $this->model->getAddToCartParams($this->wishlistItem, true)); @@ -363,6 +381,7 @@ public function testGetSharedAddToCartUrl() $url = 'result url'; $storeId = 1; $wishlistItemId = 1; + $wishlistItemQty = 1; $this->wishlistItem->expects($this->once()) ->method('getProduct') @@ -370,6 +389,9 @@ public function testGetSharedAddToCartUrl() $this->wishlistItem->expects($this->once()) ->method('getWishlistItemId') ->willReturn($wishlistItemId); + $this->wishlistItem->expects($this->once()) + ->method('getQty') + ->willReturn($wishlistItemQty); $this->product->expects($this->once()) ->method('isVisibleInSiteVisibility') @@ -383,9 +405,13 @@ public function testGetSharedAddToCartUrl() ->with('wishlist/shared/cart') ->willReturn($url); + $exptected = [ + 'item' => $wishlistItemId, + 'qty' => $wishlistItemQty, + ]; $this->postDataHelper->expects($this->once()) ->method('getPostData') - ->with($url, ['item' => $wishlistItemId]) + ->with($url, $exptected) ->willReturn($url); $this->assertEquals($url, $this->model->getSharedAddToCartUrl($this->wishlistItem)); diff --git a/app/code/Magento/Wishlist/view/frontend/web/wishlist.js b/app/code/Magento/Wishlist/view/frontend/web/wishlist.js index a4fdc178c704f..0d6e510e5f5e9 100644 --- a/app/code/Magento/Wishlist/view/frontend/web/wishlist.js +++ b/app/code/Magento/Wishlist/view/frontend/web/wishlist.js @@ -47,6 +47,7 @@ define([ event.preventDefault(); $.mage.dataPost().postData($(event.currentTarget).data('post-remove')); }, this)) + .on('click', this.options.addToCartSelector, $.proxy(this._beforeAddToCart, this)) .on('click', this.options.addAllToCartSelector, $.proxy(this._addAllWItemsToCart, this)) .on('focusin focusout', this.options.commentInputType, $.proxy(this._focusComment, this)); } @@ -59,6 +60,27 @@ define([ }); }, + /** + * Process data before add to cart + * + * - update item's qty value. + * + * @param {Event} event + * @private + */ + _beforeAddToCart: function(event) { + var elem = $(event.currentTarget), + itemId = elem.data(this.options.dataAttribute), + qtyName = $.validator.format(this.options.nameFormat, itemId), + qtyValue = elem.parents().find('[name="' + qtyName + '"]').val(), + params = elem.data('post'); + + if (params) { + params.data = $.extend({}, params.data, {'qty': qtyValue}); + elem.data('post', params); + } + }, + /** * Add wish list items to cart. * @private From 834f8735f67d67a7e05d8fabe3dd430b5a82306b Mon Sep 17 00:00:00 2001 From: Sergey Semenov Date: Tue, 6 Sep 2016 19:02:52 +0300 Subject: [PATCH 0569/3232] MAGETWO-56077: [GitHub] Unable to add more than 1 product to a cart from Wishlist #5282 --- app/code/Magento/Wishlist/Helper/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 292f66a71baa0..736786e6e30b3 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -449,7 +449,7 @@ protected function _getCartUrlParameters($item) $params = [ 'item' => is_string($item) ? $item : $item->getWishlistItemId(), ]; - if (is_object($item)) { + if ($item instanceof \Magento\Wishlist\Model\Item) { $params['qty'] = $item->getQty(); } return $params; From 05235d6bc127c228685cb88fd7353bb7e71beaa2 Mon Sep 17 00:00:00 2001 From: Oleksandr Radchenko Date: Tue, 6 Sep 2016 19:03:38 +0300 Subject: [PATCH 0570/3232] MAGETWO-54680: Fixed Unit tests --- app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php b/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php index 843a0b0ea8d65..85a4a51384dab 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php @@ -248,7 +248,6 @@ public function testOrderCreditmemo($invoiceId, $items, $notify, $appendComment) ->method('createFromInvoice') ->with( $this->invoiceMock, - $this->orderMock, $items, $this->creditmemoCommentCreationMock, ($appendComment && $notify), @@ -358,7 +357,6 @@ public function testDocumentValidationException() ->method('createFromInvoice') ->with( $this->invoiceMock, - $this->orderMock, $items, $this->creditmemoCommentCreationMock, ($appendComment && $notify), @@ -417,7 +415,6 @@ public function testCouldNotCreditmemoException() ->method('createFromInvoice') ->with( $this->invoiceMock, - $this->orderMock, $items, $this->creditmemoCommentCreationMock, ($appendComment && $notify), From 19f4597fb9b1a92a0123c33c4e09c37aeeb6d8a7 Mon Sep 17 00:00:00 2001 From: Dmytro Voskoboinikov Date: Tue, 6 Sep 2016 19:04:57 +0300 Subject: [PATCH 0571/3232] MAGETWO-54680: Order status change after Creditmemo creation through API --- .../Sales/Model/Order/Creditmemo/Sender/EmailSender.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php index 8e777aa52f8c6..49392d1bdd978 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php @@ -41,11 +41,6 @@ class EmailSender extends Sender implements SenderInterface */ private $globalConfig; - /** - * @var Renderer - */ - protected $addressRenderer; - /** * Application Event Dispatcher * @@ -79,7 +74,6 @@ public function __construct( $this->paymentHelper = $paymentHelper; $this->creditmemoResource = $creditmemoResource; $this->globalConfig = $globalConfig; - $this->addressRenderer = $addressRenderer; $this->eventManager = $eventManager; } From 75f34a2c3a82f910ec04bc32f35c0bb6c1b6ed4c Mon Sep 17 00:00:00 2001 From: Dmytro Voskoboinikov Date: Tue, 6 Sep 2016 19:32:42 +0300 Subject: [PATCH 0572/3232] MAGETWO-54680: Order status change after Creditmemo creation through API --- .../Sales/Model/Order/CreditmemoDocumentFactory.php | 9 +++++---- app/code/Magento/Sales/Model/RefundInvoice.php | 2 +- app/code/Magento/Sales/Model/RefundOrder.php | 2 +- .../Creditmemo/Validation/QuantityValidatorTest.php | 3 ++- .../Unit/Model/Order/CreditmemoDocumentFactoryTest.php | 9 +++++---- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php b/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php index efd7d6ddf2f75..822e658204151 100644 --- a/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php +++ b/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php @@ -3,7 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Sales\Model\Order; use Magento\Sales\Api\Data\OrderInterface; @@ -21,7 +20,6 @@ */ class CreditmemoDocumentFactory { - /** * @var \Magento\Sales\Model\Order\CreditmemoFactory */ @@ -92,8 +90,11 @@ private function getCreditmemoCreationData( * @param bool $appendComment * @return CreditmemoInterface */ - private function attachComment(CreditmemoInterface $creditmemo, CreditmemoCommentCreationInterface $comment, $appendComment = false) - { + private function attachComment( + CreditmemoInterface $creditmemo, + CreditmemoCommentCreationInterface $comment, + $appendComment = false + ) { $commentData = $this->hydratorPool->getHydrator(CreditmemoCommentCreationInterface::class) ->extract($comment); $comment = $this->commentFactory->create(['data' => $commentData]); diff --git a/app/code/Magento/Sales/Model/RefundInvoice.php b/app/code/Magento/Sales/Model/RefundInvoice.php index 15fc2ae10217e..99957dcb1ff9a 100644 --- a/app/code/Magento/Sales/Model/RefundInvoice.php +++ b/app/code/Magento/Sales/Model/RefundInvoice.php @@ -188,7 +188,7 @@ public function execute( ); if (!empty($validationMessages )) { throw new \Magento\Sales\Exception\DocumentValidationException( - __("Creditmemo Document Validation Error(s):\n" . implode("\n", $validationMessages )) + __("Creditmemo Document Validation Error(s):\n" . implode("\n", $validationMessages)) ); } $connection->beginTransaction(); diff --git a/app/code/Magento/Sales/Model/RefundOrder.php b/app/code/Magento/Sales/Model/RefundOrder.php index e9c6cbd377354..b882cfadeae58 100644 --- a/app/code/Magento/Sales/Model/RefundOrder.php +++ b/app/code/Magento/Sales/Model/RefundOrder.php @@ -157,7 +157,7 @@ public function execute( $validationMessages = array_merge($orderValidationResult, $creditmemoValidationResult); if (!empty($validationMessages )) { throw new \Magento\Sales\Exception\DocumentValidationException( - __("Creditmemo Document Validation Error(s):\n" . implode("\n", $validationMessages )) + __("Creditmemo Document Validation Error(s):\n" . implode("\n", $validationMessages)) ); } $connection->beginTransaction(); diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Validation/QuantityValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Validation/QuantityValidatorTest.php index 07d22c50be291..5c3fa75c97af1 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Validation/QuantityValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Validation/QuantityValidatorTest.php @@ -21,6 +21,7 @@ class QuantityValidatorTest extends \PHPUnit_Framework_TestCase * @var OrderRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject */ private $orderRepositoryMock; + /** * @var InvoiceRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -158,7 +159,7 @@ public function testValidateWithWrongItemId() * @param array $expected * @dataProvider dataProviderForValidateQty */ - public function testValidate($orderId, $orderItemId, $qtyToRequest, $qtyToRefund, $sku, $total, array $expected) + public function testValidate($orderId, $orderItemId, $qtyToRequest, $qtyToRefund, $sku, $total, array $expected) { $creditmemoMock = $this->getMockBuilder(CreditmemoInterface::class) ->disableOriginalConstructor() diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php index 4f1204ec90c78..44dc7204492bb 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php @@ -3,7 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Sales\Test\Unit\Model\Order; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -138,9 +137,11 @@ public function setUp() $this->commentMock = $this->getMockBuilder(CreditmemoCommentInterface::class) ->disableOriginalConstructor() - ->setMethods(array_merge( - get_class_methods(CreditmemoCommentInterface::class), - ['setStoreId', 'setCreditmemo']) + ->setMethods( + array_merge( + get_class_methods(CreditmemoCommentInterface::class), + ['setStoreId', 'setCreditmemo'] + ) ) ->getMock(); $this->factory = $this->objectManager->getObject( From 4bb62f8dc0e09697f95dd1206254983f5c436edb Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Mon, 1 Aug 2016 17:32:56 -0500 Subject: [PATCH 0573/3232] MAGETWO-55066: Reviewed and updated variations and constraints. (cherry picked from commit ed2db92) --- .../Test/TestCase/CreateWidgetEntityTest.php | 1 + .../Test/TestCase/CreateWidgetEntityTest.xml | 6 ++ .../Test/TestCase/DeleteWidgetEntityTest.php | 1 + .../Test/TestCase/DeleteWidgetEntityTest.xml | 1 + .../Widget/Test/TestCase/NavigateMenuTest.xml | 1 + .../tests/app/Magento/Widget/Test/etc/di.xml | 64 +++++++++++++++++++ 6 files changed, 74 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php index edd021713f892..6358ac8821f26 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php @@ -26,6 +26,7 @@ class CreateWidgetEntityTest extends AbstractCreateWidgetEntityTest /* tags */ const MVP = 'yes'; const TEST_TYPE = 'extended_acceptance_test'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml index 42d81d2f16c81..0363600f86c93 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml @@ -8,6 +8,7 @@ + severity:S1 CMS Static Block Magento Luma Title_%isolation% @@ -19,6 +20,7 @@ + severity:S1 test_type:extended_acceptance_test CMS Page Link Magento Luma @@ -31,6 +33,7 @@ + severity:S1 Recently Viewed Products Magento Luma Title_%isolation% @@ -42,6 +45,7 @@ + severity:S1 Recently Compared Products Magento Luma Title_%isolation% @@ -53,6 +57,7 @@ + severity:S1 Catalog Category Link Magento Luma Title_%isolation% @@ -64,6 +69,7 @@ + severity:S1 test_type:extended_acceptance_test Catalog Product Link Magento Luma diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.php index ba89d591e3640..f80389d64acff 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.php @@ -29,6 +29,7 @@ class DeleteWidgetEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.xml index fc63d3f5c2660..c30eda8810f22 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/DeleteWidgetEntityTest.xml @@ -8,6 +8,7 @@ + severity:S1 default diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml index 99c383d8748ee..02201d6fb4a3b 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml @@ -8,6 +8,7 @@ + severity:S2 Content > Widgets Widgets diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml new file mode 100644 index 0000000000000..eb3c2031c995a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml @@ -0,0 +1,64 @@ + + + + + + S2 + + + + + S1 + + + + + S1 + + + + + S2 + + + + + S1 + + + + + S1 + + + + + S1 + + + + + S1 + + + + + S1 + + + + + S1 + + + + + S1 + + + From f3d48ba71016f3c6d7d38c972486bd2c20e1c6a7 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Tue, 6 Sep 2016 11:54:10 -0500 Subject: [PATCH 0574/3232] MAGETWO-55066: Reviewed and updated variations and constraints. (cherry picked from commit 85a0dde) --- .../TestCase/CreateCmsBlockEntityTest.php | 1 + .../TestCase/CreateCmsBlockEntityTest.xml | 3 +- .../Test/TestCase/CreateCmsPageEntityTest.php | 1 + .../Test/TestCase/CreateCmsPageEntityTest.xml | 10 ++-- .../CreateCmsPageRewriteEntityTest.php | 1 + .../CreateCmsPageRewriteEntityTest.xml | 4 ++ .../CreateCustomUrlRewriteEntityTest.xml | 4 +- .../TestCase/DeleteCmsBlockEntityTest.php | 1 + .../TestCase/DeleteCmsBlockEntityTest.xml | 1 + .../Test/TestCase/DeleteCmsPageEntityTest.php | 1 + .../Test/TestCase/DeleteCmsPageEntityTest.xml | 1 + .../DeleteCmsPageUrlRewriteEntityTest.php | 1 + .../DeleteCmsPageUrlRewriteEntityTest.xml | 5 +- .../Cms/Test/TestCase/GridFilteringTest.xml | 2 + .../Test/TestCase/GridFullTextSearchTest.xml | 2 + .../Cms/Test/TestCase/GridSortingTest.xml | 2 + .../Cms/Test/TestCase/NavigateMenuTest.xml | 2 + .../TestCase/UpdateCmsBlockEntityTest.php | 1 + .../TestCase/UpdateCmsBlockEntityTest.xml | 3 +- .../Test/TestCase/UpdateCmsPageEntityTest.php | 1 + .../Test/TestCase/UpdateCmsPageEntityTest.xml | 4 +- .../UpdateCmsPageRewriteEntityTest.php | 1 + .../UpdateCmsPageRewriteEntityTest.xml | 3 ++ .../Test/TestCase/CreateSitemapEntityTest.php | 1 + .../Test/TestCase/CreateSitemapEntityTest.xml | 3 ++ .../Test/TestCase/DeleteSitemapEntityTest.php | 1 + .../Test/TestCase/DeleteSitemapEntityTest.xml | 1 + .../Test/TestCase/NavigateMenuTest.xml | 1 + .../tests/app/Magento/Sitemap/Test/etc/di.xml | 54 +++++++++++++++++++ .../Test/TestCase/CreateWidgetEntityTest.xml | 8 ++- .../tests/app/Magento/Widget/Test/etc/di.xml | 5 ++ 31 files changed, 112 insertions(+), 17 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/di.xml diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php index 7e3c3f0ebb3c9..79da8791af2be 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php @@ -27,6 +27,7 @@ class CreateCmsBlockEntityTest extends AbstractCmsBlockEntityTest /* tags */ const MVP = 'yes'; const TEST_TYPE = 'extended_acceptance_test'; + const SEVERITY = 'S1'; /* end tags */ /** 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 a2bbdb817961d..7a07dc4ad7c68 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,6 +8,7 @@ + severity:S1 test_type:extended_acceptance_test block_%isolation% identifier_%isolation% @@ -19,13 +20,13 @@ + severity:S2 block_%isolation% identifier_%isolation% default No description_%isolation% - 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 f5035a2eaf76d..250c55ff00d44 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,6 +29,7 @@ class CreateCmsPageEntityTest extends Injectable /* tags */ const MVP = 'yes'; const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml index 60b440fc0868b..7990b64f97df8 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml @@ -8,18 +8,20 @@ + severity:S1 + test_type:acceptance_test, test_type:extended_acceptance_test cmsPage Yes NewCmsPage%isolation% identifier-%isolation% All Store Views cms_page_text_content%isolation% - test_type:acceptance_test, test_type:extended_acceptance_test + severity:S1 cmsPage Yes NewCmsPage%isolation% @@ -30,6 +32,7 @@ + severity:S1 cmsPage Yes NewCmsPage%isolation% @@ -39,11 +42,10 @@ default General Contact Name - - + severity:S3 cmsPage NewCmsPage%isolation% identifier-%isolation% @@ -51,8 +53,6 @@ No cms_page_text_content%isolation% - - diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php index 296525540073f..42796d8fbb726 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php @@ -33,6 +33,7 @@ class CreateCmsPageRewriteEntityTest extends Injectable /* tags */ const MVP = 'yes'; const TEST_TYPE = 'extended_acceptance_test'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml index 19b5053fc4097..a00bea4a3126d 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml @@ -8,6 +8,7 @@ + severity:S1 test_type:extended_acceptance_test For CMS page cms/page/view/page_id/%cmsPage::default% @@ -19,6 +20,7 @@ + severity:S1 For CMS page cms/page/view/page_id/%cmsPage::default% request_path%isolation%.html @@ -29,6 +31,7 @@ + severity:S1 For CMS page cms/page/view/page_id/%cmsPage::default% request_path%isolation%.htm @@ -39,6 +42,7 @@ + severity:S1 For CMS page cms/page/view/page_id/%cmsPage::default% request_path%isolation%.aspx diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCustomUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCustomUrlRewriteEntityTest.xml index 9f14cefa8147d..90f40a55e8f64 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCustomUrlRewriteEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCustomUrlRewriteEntityTest.xml @@ -8,6 +8,7 @@ + severity:S1 Custom Main Website/Main Website Store/Default Store View cms/page/view/page_id/%cmsPage::default% @@ -15,10 +16,10 @@ No test description_full path - + severity:S1 Custom Main Website/Main Website Store/Default Store View cms/page/view/page_id/%cmsPage::default% @@ -26,7 +27,6 @@ Temporary (302) test description_full path - diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php index ad2ae5689c985..62c703960e727 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php @@ -31,6 +31,7 @@ class DeleteCmsBlockEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* 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 d9c52aba53d52..fc043effe5a77 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,6 +8,7 @@ + severity:S1 diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php index 25225917014fc..d893bdbe2d13e 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php @@ -29,6 +29,7 @@ class DeleteCmsPageEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml index 5c476928ca6ee..2a85425890e8e 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml @@ -8,6 +8,7 @@ + severity:S1 default diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php index 68d0ae541253d..a07303875a54b 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php @@ -30,6 +30,7 @@ class DeleteCmsPageUrlRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S2'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml index a065c37513ac5..77e54edfb85f9 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml @@ -8,21 +8,22 @@ + severity:S2 cms_default_no_redirect + severity:S2 cms_default_permanent_redirect - + severity:S2 cms_default_temporary_redirect - diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFilteringTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFilteringTest.xml index af26b1f11f177..715190039162b 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFilteringTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFilteringTest.xml @@ -8,6 +8,7 @@ + severity:S2 Verify cms page grid filtering 2 cmsPage @@ -28,6 +29,7 @@ + severity:S2 Verify cms block grid filtering 2 cmsBlock diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFullTextSearchTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFullTextSearchTest.xml index 21a0dd32a56b2..893cfc2f0dacc 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFullTextSearchTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridFullTextSearchTest.xml @@ -8,6 +8,7 @@ + severity:S2 Verify cms page grid full text search 2 cmsPage @@ -19,6 +20,7 @@ + severity:S2 Verify cms blocks grid full text search 2 cmsBlock diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridSortingTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridSortingTest.xml index 595277423b39c..d6467a53e1565 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridSortingTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/GridSortingTest.xml @@ -8,6 +8,7 @@ + severity:S2 Verify cms page grid sorting ID @@ -18,6 +19,7 @@ + severity:S2 Verify cms blocks grid sorting - diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml index 38c9e8cf8f21d..127c85f840102 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml @@ -8,11 +8,13 @@ + severity:S2 Content > Pages Pages + severity:S2 Content > Blocks Blocks diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php index 8fa92fba59f8e..6272eff0cf699 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php @@ -27,6 +27,7 @@ class UpdateCmsBlockEntityTest extends AbstractCmsBlockEntityTest { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** 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 652166b0fe00d..a2cd59dd89db8 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,6 +8,7 @@ + severity:S1 block_updated_%isolation% identifier_updated_%isolation% all_store_views @@ -18,13 +19,13 @@ + severity:S3 block_updated_%isolation% identifier_updated_%isolation% default No description_updated_%isolation% - 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 b16f4384f27d5..a9a98e8dd21c0 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 @@ -31,6 +31,7 @@ class UpdateCmsPageEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml index a24fe83e503ce..75f8cf63f645e 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml @@ -8,19 +8,21 @@ + severity:S3 CmsPageEdited%isolation% No cms_page_text_content_after_edit - + severity:S1 CmsPageEdited%isolation% cms_page_url_edited_%isolation% Content Heading TextEdited cms_page_text_content_after_edit + diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php index 43fd7e69ac359..bfa992dd81c8d 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php @@ -35,6 +35,7 @@ class UpdateCmsPageRewriteEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S2'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml index e8a1a637f7ef9..40664ee7c1313 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml @@ -8,6 +8,7 @@ + severity:S2 cms_default_no_redirect Main Website/Main Website Store/%default% request_path%isolation% @@ -17,6 +18,7 @@ + severity:S2 cms_default_temporary_redirect Main Website/Main Website Store/Default Store View request_path%isolation%.html @@ -26,6 +28,7 @@ + severity:S2 cms_default_permanent_redirect Main Website/Main Website Store/Default Store View request_path%isolation%.htm diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.php index f820e92f9a526..1329fab583d88 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.php @@ -30,6 +30,7 @@ class CreateSitemapEntityTest extends Injectable /* tags */ const MVP = 'yes'; const TEST_TYPE = 'extended_acceptance_test'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.xml index 36a9708cd3da5..b9d589db0ac8f 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.xml @@ -8,6 +8,7 @@ + severity:S1 test_type:extended_acceptance_test sitemap.xml / @@ -15,11 +16,13 @@ + severity:S3 %isolation% / + severity:S3 sitemap.xml /%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php index e8f24bfccc056..5ea826345da84 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.php @@ -31,6 +31,7 @@ class DeleteSitemapEntityTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S2'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.xml index 432f7a9026670..b0c30897fc7e8 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/DeleteSitemapEntityTest.xml @@ -8,6 +8,7 @@ + severity:S2 default diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml index cc5de2a32735d..67d70772a0c18 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml @@ -8,6 +8,7 @@ + severity:S2 Marketing > Site Map Site Map diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/di.xml new file mode 100644 index 0000000000000..546ef7f8d4ee3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/etc/di.xml @@ -0,0 +1,54 @@ + + + + + + S2 + + + + + S3 + + + + + S3 + + + + + S2 + + + + + S3 + + + + + S1 + + + + + S1 + + + + + S1 + + + + + S1 + + + diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml index 0363600f86c93..520d1ce2d3db3 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml @@ -16,7 +16,6 @@ on_category cmsStaticBlock - @@ -41,7 +40,6 @@ for_viewed_products recentlyViewedProducts - @@ -53,7 +51,6 @@ for_compared_products recentlyComparedProducts - @@ -65,7 +62,6 @@ for_category_link catalogCategoryLink - @@ -78,11 +74,11 @@ on_product_link catalogProductLink - + severity:S2 Disabled CMS Static Block Magento Luma @@ -97,6 +93,7 @@ + severity:S3 Invalidated Catalog Category Link Magento Luma @@ -111,6 +108,7 @@ + severity:S1 Catalog New Products List Magento Luma Title_%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml index eb3c2031c995a..122a9659cf2b6 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml @@ -16,6 +16,11 @@ S1 + + + S1 + + S1 From 205d73737d421d3a458a5672064db60032b1fa5e Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Tue, 6 Sep 2016 15:53:16 -0500 Subject: [PATCH 0575/3232] MAGETWO-55412: Reviewed and updated variations and constraints. --- .../Test/TestCase/CreateCurrencyRateTest.php | 1 + .../Test/TestCase/CreateCurrencyRateTest.xml | 1 + .../app/Magento/Directory/Test/etc/di.xml | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/Directory/Test/etc/di.xml diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php index 4d397bde28bf6..bc40a2ab98f6d 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php @@ -31,6 +31,7 @@ class CreateCurrencyRateTest extends Injectable { /* tags */ const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml index e3eb961bcfe9d..1e87903d068e1 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml @@ -8,6 +8,7 @@ + severity:S1 test_type:acceptance_test, test_type:extended_acceptance_test USD EUR diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Directory/Test/etc/di.xml new file mode 100644 index 0000000000000..d85076bd922cd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/etc/di.xml @@ -0,0 +1,19 @@ + + + + + + S1 + + + + + S1 + + + From dfa7d6d25c7016d22e85265cc225bc5774968b5e Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko Date: Wed, 7 Sep 2016 10:22:07 +0300 Subject: [PATCH 0576/3232] MAGETWO-57855: Outdated PayPal URL --- app/code/Magento/Paypal/Model/Config.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Paypal/Model/Config.php b/app/code/Magento/Paypal/Model/Config.php index e02615d24ad3d..0af8b18355ec3 100644 --- a/app/code/Magento/Paypal/Model/Config.php +++ b/app/code/Magento/Paypal/Model/Config.php @@ -866,7 +866,9 @@ public function isOrderReviewStepDisabled() */ public function getExpressCheckoutStartUrl($token) { - return $this->getPaypalUrl(['cmd' => '_express-checkout', 'token' => $token]); + return sprintf('https://www.%spaypal.com/checkoutnow/2%s', + $this->getValue('sandboxFlag') ? 'sandbox.' : '', + '?token=' . urlencode($token)); } /** From 43a38127b4b789c771b013d2613c99b3620df3c3 Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Wed, 7 Sep 2016 10:30:13 +0300 Subject: [PATCH 0577/3232] MAGETWO-57569: [Backport] Functional upgrade test fail 2.1.x --> 2.2.x - 2.2 - Restore testsuite rule upgrade.xml --- .../Mtf/TestSuite/InjectableTests/upgrade.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/upgrade.xml diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/upgrade.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/upgrade.xml new file mode 100644 index 0000000000000..71f50859db921 --- /dev/null +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/upgrade.xml @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file From 3e070060cfe99fea8d824aff65fad7d59d33a2a7 Mon Sep 17 00:00:00 2001 From: Illia Grybkov Date: Wed, 7 Sep 2016 10:39:19 +0300 Subject: [PATCH 0578/3232] MAGETWO-55847: [GitHub] When tier price qty above 1000 adds a thousand separator in the Admin Panel #5745 - Remove suppress --- .../Ui/DataProvider/Product/Form/Modifier/General.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index ab22e4aeb3dca..0fbba264f7e93 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -9,12 +9,9 @@ use Magento\Catalog\Model\Locator\LocatorInterface; use Magento\Ui\Component\Form; use Magento\Framework\Stdlib\ArrayManager; -use Magento\Framework\Locale\CurrencyInterface; /** * Data provider for main panel of product page - * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class General extends AbstractModifier { @@ -29,7 +26,7 @@ class General extends AbstractModifier protected $arrayManager; /** - * @var CurrencyInterface + * @var \Magento\Framework\Locale\CurrencyInterface */ private $localeCurrency; @@ -369,7 +366,8 @@ protected function customizeNameListeners(array $meta) private function getLocaleCurrency() { if ($this->localeCurrency === null) { - $this->localeCurrency = \Magento\Framework\App\ObjectManager::getInstance()->get(CurrencyInterface::class); + $this->localeCurrency = \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Locale\CurrencyInterface::class); } return $this->localeCurrency; } From 9a19cb9f4daf4663c49e6f16bcdd1df90acc90b6 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Wed, 7 Sep 2016 11:07:12 +0300 Subject: [PATCH 0579/3232] MAGETWO-54680: Order status change after Creditmemo creation through API --- app/code/Magento/Sales/Model/RefundOrder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/RefundOrder.php b/app/code/Magento/Sales/Model/RefundOrder.php index b882cfadeae58..68099d67e7e0b 100644 --- a/app/code/Magento/Sales/Model/RefundOrder.php +++ b/app/code/Magento/Sales/Model/RefundOrder.php @@ -155,7 +155,7 @@ public function execute( ] ); $validationMessages = array_merge($orderValidationResult, $creditmemoValidationResult); - if (!empty($validationMessages )) { + if (!empty($validationMessages)) { throw new \Magento\Sales\Exception\DocumentValidationException( __("Creditmemo Document Validation Error(s):\n" . implode("\n", $validationMessages)) ); From d8cdfd8ecf20d26b7737910c000920a5b4f911bf Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Wed, 7 Sep 2016 11:17:16 +0300 Subject: [PATCH 0580/3232] MAGETWO-54680: Order status change after Creditmemo creation through API. Service coupling --- app/code/Magento/Sales/Model/RefundInvoice.php | 1 + app/code/Magento/Sales/Model/RefundOrder.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/code/Magento/Sales/Model/RefundInvoice.php b/app/code/Magento/Sales/Model/RefundInvoice.php index 99957dcb1ff9a..966da34f818c7 100644 --- a/app/code/Magento/Sales/Model/RefundInvoice.php +++ b/app/code/Magento/Sales/Model/RefundInvoice.php @@ -25,6 +25,7 @@ /** * Class RefundInvoice + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class RefundInvoice implements RefundInvoiceInterface { diff --git a/app/code/Magento/Sales/Model/RefundOrder.php b/app/code/Magento/Sales/Model/RefundOrder.php index 68099d67e7e0b..84745f938a17a 100644 --- a/app/code/Magento/Sales/Model/RefundOrder.php +++ b/app/code/Magento/Sales/Model/RefundOrder.php @@ -23,6 +23,7 @@ /** * Class RefundOrder + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class RefundOrder implements RefundOrderInterface { From febd2bd92e16f178c03f9988a91f98d57b43abbd Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Wed, 7 Sep 2016 11:25:48 +0300 Subject: [PATCH 0581/3232] MAGETWO-55380: Information hint block for Zip/Postal Code should NOT block request for available shipping solution --- .../view/frontend/web/js/model/shipping-rates-validator.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js b/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js index e002823fef17e..55678fc701d5b 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js @@ -127,9 +127,8 @@ define( element.on('value', function () { clearTimeout(self.validateAddressTimeout); self.validateAddressTimeout = setTimeout(function () { - if (self.postcodeValidation()) { - self.validateFields(); - } + self.postcodeValidation(); + self.validateFields(); }, delay); }); observedElements.push(element); From d1106101fd35865ae7465ca8d3faa5f2c847c8b1 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Wed, 7 Sep 2016 11:37:07 +0300 Subject: [PATCH 0582/3232] MAGETWO-52660: Improve performance of static assets deployment - MAGETWO-57913: Mysql connections is lost if forked process --- .../Magento/Framework/View/Asset/LockerProcess.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Asset/LockerProcess.php b/lib/internal/Magento/Framework/View/Asset/LockerProcess.php index 660cf0418669e..e8938211fecbf 100644 --- a/lib/internal/Magento/Framework/View/Asset/LockerProcess.php +++ b/lib/internal/Magento/Framework/View/Asset/LockerProcess.php @@ -59,7 +59,6 @@ public function __construct(Filesystem $filesystem) /** * @inheritdoc - * @throws FileSystemException */ public function lockProcess($lockName) { @@ -94,14 +93,18 @@ public function unlockProcess() * Check whether generation process has already locked * * @return bool - * @throws FileSystemException */ private function isProcessLocked() { if ($this->tmpDirectory->isExist($this->lockFilePath)) { - $lockTime = (int) $this->tmpDirectory->readFile($this->lockFilePath); - if ((time() - $lockTime) >= self::MAX_LOCK_TIME) { - $this->tmpDirectory->delete($this->lockFilePath); + try { + $lockTime = (int)$this->tmpDirectory->readFile($this->lockFilePath); + if ((time() - $lockTime) >= self::MAX_LOCK_TIME) { + $this->tmpDirectory->delete($this->lockFilePath); + + return false; + } + } catch (FileSystemException $e) { return false; } From be2fd37a4b0f8db40f64b3e3d9fa6a8996b80a0b Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Wed, 7 Sep 2016 11:39:10 +0300 Subject: [PATCH 0583/3232] MAGETWO-57569: [Backport] Functional upgrade test fail 2.1.x --> 2.2.x - 2.2 - Restore testsuite rule upgrade.xml --- .../testsuites/Magento/Mtf/TestSuite/InjectableTests/setup.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/setup.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/setup.xml index 6a5c6e5d904dd..e1f1395bc132c 100644 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/setup.xml +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/setup.xml @@ -11,5 +11,8 @@ + + + From 1c4893a5a643317ca867498767394cd7440c9694 Mon Sep 17 00:00:00 2001 From: Dmytro Voskoboinikov Date: Wed, 7 Sep 2016 11:41:18 +0300 Subject: [PATCH 0584/3232] MAGETWO-54680: Order status change after Creditmemo creation through API --- .../Order/Creditmemo/Sender/EmailSender.php | 80 +++++++++---------- 1 file changed, 38 insertions(+), 42 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php index 49392d1bdd978..76210505fd467 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php @@ -5,18 +5,7 @@ */ namespace Magento\Sales\Model\Order\Creditmemo\Sender; -use Magento\Payment\Helper\Data as PaymentHelper; -use Magento\Sales\Api\Data\CreditmemoCommentCreationInterface; -use Magento\Sales\Api\Data\CreditmemoInterface; -use Magento\Sales\Api\Data\OrderInterface; -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\Sender; -use Magento\Sales\Model\ResourceModel\Order\Creditmemo as CreditmemoResource; -use Magento\Sales\Model\Order\Address\Renderer; -use Magento\Framework\Event\ManagerInterface; use Magento\Sales\Model\Order\Creditmemo\SenderInterface; /** @@ -25,52 +14,55 @@ class EmailSender extends Sender implements SenderInterface { /** - * @var PaymentHelper + * @var \Magento\Payment\Helper\Data */ private $paymentHelper; /** - * @var CreditmemoResource + * @var \Magento\Sales\Model\ResourceModel\Order\Creditmemo */ private $creditmemoResource; /** - * Global configuration storage. - * * @var \Magento\Framework\App\Config\ScopeConfigInterface */ private $globalConfig; /** - * Application Event Dispatcher - * - * @var ManagerInterface + * @var \Magento\Framework\Event\ManagerInterface */ private $eventManager; /** - * @param Template $templateContainer - * @param CreditmemoIdentity $identityContainer - * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Magento\Sales\Model\Order\Email\Container\Template $templateContainer + * @param \Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity $identityContainer + * @param \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory * @param \Psr\Log\LoggerInterface $logger - * @param PaymentHelper $paymentHelper - * @param CreditmemoResource $creditmemoResource + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer + * @param \Magento\Payment\Helper\Data $paymentHelper + * @param \Magento\Sales\Model\ResourceModel\Order\Creditmemo $creditmemoResource * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig - * @param Renderer $addressRenderer - * @param ManagerInterface $eventManager + * @param \Magento\Framework\Event\ManagerInterface $eventManager */ public function __construct( - Template $templateContainer, - CreditmemoIdentity $identityContainer, + \Magento\Sales\Model\Order\Email\Container\Template $templateContainer, + \Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity $identityContainer, \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, \Psr\Log\LoggerInterface $logger, - Renderer $addressRenderer, - PaymentHelper $paymentHelper, - CreditmemoResource $creditmemoResource, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, + \Magento\Payment\Helper\Data $paymentHelper, + \Magento\Sales\Model\ResourceModel\Order\Creditmemo $creditmemoResource, \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig, - ManagerInterface $eventManager + \Magento\Framework\Event\ManagerInterface $eventManager ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger, $addressRenderer); + parent::__construct( + $templateContainer, + $identityContainer, + $senderBuilderFactory, + $logger, + $addressRenderer + ); + $this->paymentHelper = $paymentHelper; $this->creditmemoResource = $creditmemoResource; $this->globalConfig = $globalConfig; @@ -88,22 +80,22 @@ public function __construct( * Otherwise, email will be sent later during running of * corresponding cron job. * - * @param OrderInterface $order - * @param CreditmemoInterface $creditmemo - * @param CreditmemoCommentCreationInterface $comment + * @param \Magento\Sales\Api\Data\OrderInterface $order + * @param \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo + * @param \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface|null $comment * @param bool $forceSyncMode + * * @return bool */ public function send( - OrderInterface $order, - CreditmemoInterface $creditmemo, - CreditmemoCommentCreationInterface $comment = null, + \Magento\Sales\Api\Data\OrderInterface $order, + \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo, + \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment = null, $forceSyncMode = false ) { $creditmemo->setSendEmail(true); if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { - $transport = [ 'order' => $order, 'creditmemo' => $creditmemo, @@ -124,11 +116,14 @@ public function send( if ($this->checkAndSend($order)) { $creditmemo->setEmailSent(true); + $this->creditmemoResource->saveAttribute($creditmemo, ['send_email', 'email_sent']); + return true; } } else { $creditmemo->setEmailSent(null); + $this->creditmemoResource->saveAttribute($creditmemo, 'email_sent'); } @@ -138,12 +133,13 @@ public function send( } /** - * Return payment info block as html + * Returns payment info block as HTML. + * + * @param \Magento\Sales\Api\Data\OrderInterface $order * - * @param Order $order * @return string */ - private function getPaymentHtml(Order $order) + private function getPaymentHtml(\Magento\Sales\Api\Data\OrderInterface $order) { return $this->paymentHelper->getInfoBlockHtml( $order->getPayment(), From 1418846daf13e05aeec5732e0fb1cccd1a7b5365 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Wed, 7 Sep 2016 11:47:22 +0300 Subject: [PATCH 0585/3232] MAGETWO-54680: Order status change after Creditmemo creation through API. Service coupling --- .../Model/Order/CreditmemoDocumentFactory.php | 90 +++++++++---------- 1 file changed, 41 insertions(+), 49 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php b/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php index 822e658204151..469b226053cdd 100644 --- a/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php +++ b/app/code/Magento/Sales/Model/Order/CreditmemoDocumentFactory.php @@ -5,16 +5,6 @@ */ namespace Magento\Sales\Model\Order; -use Magento\Sales\Api\Data\OrderInterface; -use Magento\Sales\Api\Data\InvoiceInterface; -use Magento\Sales\Api\Data\CreditmemoInterface; -use Magento\Sales\Api\Data\CreditmemoItemCreationInterface; -use Magento\Sales\Api\Data\CreditmemoCommentCreationInterface; -use Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory; -use Magento\Framework\EntityManager\HydratorPool; -use Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface; -use Magento\Sales\Api\OrderRepositoryInterface; - /** * Class CreditmemoDocumentFactory */ @@ -26,33 +16,33 @@ class CreditmemoDocumentFactory private $creditmemoFactory; /** - * @var CreditmemoCommentInterfaceFactory + * @var \Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory */ private $commentFactory; /** - * @var HydratorPool + * @var \Magento\Framework\EntityManager\HydratorPool */ private $hydratorPool; /** - * @var OrderRepositoryInterface + * @var \Magento\Sales\Api\OrderRepositoryInterface */ private $orderRepository; /** * CreditmemoDocumentFactory constructor. * - * @param CreditmemoFactory $creditmemoFactory - * @param CreditmemoCommentInterfaceFactory $commentFactory - * @param HydratorPool $hydratorPool - * @param OrderRepositoryInterface $orderRepository + * @param \Magento\Sales\Model\Order\CreditmemoFactory $creditmemoFactory + * @param \Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory $commentFactory + * @param \Magento\Framework\EntityManager\HydratorPool $hydratorPool + * @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository */ public function __construct( - CreditmemoFactory $creditmemoFactory, - CreditmemoCommentInterfaceFactory $commentFactory, - HydratorPool $hydratorPool, - OrderRepositoryInterface $orderRepository + \Magento\Sales\Model\Order\CreditmemoFactory $creditmemoFactory, + \Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory $commentFactory, + \Magento\Framework\EntityManager\HydratorPool $hydratorPool, + \Magento\Sales\Api\OrderRepositoryInterface $orderRepository ) { $this->creditmemoFactory = $creditmemoFactory; $this->commentFactory = $commentFactory; @@ -63,20 +53,22 @@ public function __construct( /** * Get array with original data for new Creditmemo document * - * @param CreditmemoItemCreationInterface[] $items - * @param CreditmemoCreationArgumentsInterface|null $arguments + * @param \Magento\Sales\Api\Data\CreditmemoItemCreationInterface[] $items + * @param \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface|null $arguments * @return array */ private function getCreditmemoCreationData( array $items = [], - CreditmemoCreationArgumentsInterface $arguments = null + \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface $arguments = null ) { $data = ['qtys' => []]; foreach ($items as $item) { $data['qtys'][$item->getOrderItemId()] = $item->getQty(); } if ($arguments) { - $hydrator = $this->hydratorPool->getHydrator(CreditmemoCreationArgumentsInterface::class); + $hydrator = $this->hydratorPool->getHydrator( + \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface::class + ); $data = array_merge($hydrator->extract($arguments), $data); } return $data; @@ -85,18 +77,19 @@ private function getCreditmemoCreationData( /** * Attach comment to the Creditmemo document. * - * @param CreditmemoInterface $creditmemo - * @param CreditmemoCommentCreationInterface $comment + * @param \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo + * @param \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment * @param bool $appendComment - * @return CreditmemoInterface + * @return \Magento\Sales\Api\Data\CreditmemoInterface */ private function attachComment( - CreditmemoInterface $creditmemo, - CreditmemoCommentCreationInterface $comment, + \Magento\Sales\Api\Data\CreditmemoInterface $creditmemo, + \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment, $appendComment = false ) { - $commentData = $this->hydratorPool->getHydrator(CreditmemoCommentCreationInterface::class) - ->extract($comment); + $commentData = $this->hydratorPool->getHydrator( + \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface::class + )->extract($comment); $comment = $this->commentFactory->create(['data' => $commentData]); $comment->setParentId($creditmemo->getEntityId()) ->setStoreId($creditmemo->getStoreId()) @@ -109,19 +102,19 @@ private function attachComment( /** * Create new Creditmemo - * @param OrderInterface $order - * @param CreditmemoItemCreationInterface[] $items - * @param CreditmemoCommentCreationInterface|null $comment + * @param \Magento\Sales\Api\Data\OrderInterface $order + * @param \Magento\Sales\Api\Data\CreditmemoItemCreationInterface[] $items + * @param \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface|null $comment * @param bool|null $appendComment - * @param CreditmemoCreationArgumentsInterface|null $arguments - * @return CreditmemoInterface + * @param \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface|null $arguments + * @return \Magento\Sales\Api\Data\CreditmemoInterface */ public function createFromOrder( - OrderInterface $order, + \Magento\Sales\Api\Data\OrderInterface $order, array $items = [], - CreditmemoCommentCreationInterface $comment = null, + \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment = null, $appendComment = false, - CreditmemoCreationArgumentsInterface $arguments = null + \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface $arguments = null ) { $data = $this->getCreditmemoCreationData($items, $arguments); $creditmemo = $this->creditmemoFactory->createByOrder($order, $data); @@ -132,20 +125,19 @@ public function createFromOrder( } /** - * @param InvoiceInterface $invoice - * @param OrderInterface $order - * @param CreditmemoItemCreationInterface[] $items - * @param CreditmemoCommentCreationInterface|null $comment + * @param \Magento\Sales\Api\Data\InvoiceInterface $invoice + * @param \Magento\Sales\Api\Data\CreditmemoItemCreationInterface[] $items + * @param \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface|null $comment * @param bool|null $appendComment - * @param CreditmemoCreationArgumentsInterface|null $arguments - * @return CreditmemoInterface + * @param \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface|null $arguments + * @return \Magento\Sales\Api\Data\CreditmemoInterface */ public function createFromInvoice( - InvoiceInterface $invoice, + \Magento\Sales\Api\Data\InvoiceInterface $invoice, array $items = [], - CreditmemoCommentCreationInterface $comment = null, + \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment = null, $appendComment = false, - CreditmemoCreationArgumentsInterface $arguments = null + \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface $arguments = null ) { $data = $this->getCreditmemoCreationData($items, $arguments); /** @var $invoice \Magento\Sales\Model\Order\Invoice */ From 756b45ccea69961b48dd52c7399c3b85a579f9c1 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Wed, 7 Sep 2016 11:50:27 +0300 Subject: [PATCH 0586/3232] MAGETWO-54680: Order status change after Creditmemo creation through API. Service coupling --- .../Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php | 1 + app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php | 1 + app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php | 1 + 3 files changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php index 44dc7204492bb..521167f10aebd 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoDocumentFactoryTest.php @@ -21,6 +21,7 @@ /** * Class CreditmemoDocumentFactoryTest + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class CreditmemoDocumentFactoryTest extends \PHPUnit_Framework_TestCase { diff --git a/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php b/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php index 85a4a51384dab..03610171ed4bd 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php @@ -29,6 +29,7 @@ /** * Class RefundInvoiceTest + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class RefundInvoiceTest extends \PHPUnit_Framework_TestCase { diff --git a/app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php b/app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php index baa8b0a1f58cd..358cf224a738f 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php @@ -26,6 +26,7 @@ /** * Class RefundOrderTest + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class RefundOrderTest extends \PHPUnit_Framework_TestCase { From 2de1222eef6ea5468d44768e7fceb8af03a81840 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Wed, 7 Sep 2016 12:02:27 +0300 Subject: [PATCH 0587/3232] MAGETWO-54680: Order status change after Creditmemo creation through API. L3 --- app/code/Magento/Sales/Model/RefundInvoice.php | 1 + app/code/Magento/Sales/Model/RefundOrder.php | 1 + .../Sales/Test/Unit/Model/RefundInvoiceTest.php | 11 +---------- .../Magento/Sales/Test/Unit/Model/RefundOrderTest.php | 1 + 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Sales/Model/RefundInvoice.php b/app/code/Magento/Sales/Model/RefundInvoice.php index 966da34f818c7..18837315ef83a 100644 --- a/app/code/Magento/Sales/Model/RefundInvoice.php +++ b/app/code/Magento/Sales/Model/RefundInvoice.php @@ -110,6 +110,7 @@ class RefundInvoice implements RefundInvoiceInterface * @param NotifierInterface $notifier * @param OrderConfig $config * @param LoggerInterface $logger + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( ResourceConnection $resourceConnection, diff --git a/app/code/Magento/Sales/Model/RefundOrder.php b/app/code/Magento/Sales/Model/RefundOrder.php index 84745f938a17a..70fc7be4310e6 100644 --- a/app/code/Magento/Sales/Model/RefundOrder.php +++ b/app/code/Magento/Sales/Model/RefundOrder.php @@ -95,6 +95,7 @@ class RefundOrder implements RefundOrderInterface * @param NotifierInterface $notifier * @param OrderConfig $config * @param LoggerInterface $logger + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( ResourceConnection $resourceConnection, diff --git a/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php b/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php index 03610171ed4bd..9a0a9e4f8c688 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php @@ -30,6 +30,7 @@ /** * Class RefundInvoiceTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) */ class RefundInvoiceTest extends \PHPUnit_Framework_TestCase { @@ -267,36 +268,29 @@ public function testOrderCreditmemo($invoiceId, $items, $notify, $appendComment) ->method('validate') ->with($this->invoiceMock) ->willReturn([]); - $this->paymentAdapterMock->expects($this->once()) ->method('refund') ->with($this->creditmemoMock, $this->orderMock) ->willReturn($this->orderMock); - $this->orderStateResolverMock->expects($this->once()) ->method('getStateForOrder') ->with($this->orderMock, []) ->willReturn(Order::STATE_CLOSED); - $this->orderMock->expects($this->once()) ->method('setState') ->with(Order::STATE_CLOSED) ->willReturnSelf(); - $this->orderMock->expects($this->once()) ->method('getState') ->willReturn(Order::STATE_CLOSED); - $this->configMock->expects($this->once()) ->method('getStateDefaultStatus') ->with(Order::STATE_CLOSED) ->willReturn('Closed'); - $this->orderMock->expects($this->once()) ->method('setStatus') ->with('Closed') ->willReturnSelf(); - $this->creditmemoMock->expects($this->once()) ->method('setState') ->with(\Magento\Sales\Model\Order\Creditmemo::STATE_REFUNDED) @@ -306,18 +300,15 @@ public function testOrderCreditmemo($invoiceId, $items, $notify, $appendComment) ->method('save') ->with($this->creditmemoMock) ->willReturn($this->creditmemoMock); - $this->orderRepositoryMock->expects($this->once()) ->method('save') ->with($this->orderMock) ->willReturn($this->orderMock); - if ($notify) { $this->notifierMock->expects($this->once()) ->method('notify') ->with($this->orderMock, $this->creditmemoMock, $this->creditmemoCommentCreationMock); } - $this->creditmemoMock->expects($this->once()) ->method('getEntityId') ->willReturn(2); diff --git a/app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php b/app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php index 358cf224a738f..a50dc31d80a84 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php @@ -27,6 +27,7 @@ /** * Class RefundOrderTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) */ class RefundOrderTest extends \PHPUnit_Framework_TestCase { From cd5bb2dece341552e0ee41b358d4baedcc9e37f6 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Wed, 7 Sep 2016 12:12:19 +0300 Subject: [PATCH 0588/3232] MAGETWO-57820: [GITHUB] php bin/magento i18n:pack creates unwanted dir #6260 --- .../src/Magento/Setup/Module/I18n/Context.php | 9 ++---- .../I18n/Pack/Writer/File/AbstractFile.php | 6 ++-- .../I18n/UnregisteredComponentException.php | 13 --------- .../Test/Unit/Module/I18n/ContextTest.php | 29 +++++++++---------- .../Pack/Writer/File/AbstractFileTest.php | 5 ++-- 5 files changed, 21 insertions(+), 41 deletions(-) delete mode 100644 setup/src/Magento/Setup/Module/I18n/UnregisteredComponentException.php diff --git a/setup/src/Magento/Setup/Module/I18n/Context.php b/setup/src/Magento/Setup/Module/I18n/Context.php index 0dbdbb0248607..a2137e3d9bd00 100644 --- a/setup/src/Magento/Setup/Module/I18n/Context.php +++ b/setup/src/Magento/Setup/Module/I18n/Context.php @@ -93,9 +93,8 @@ private function getComponentName($componentType, $path) * * @param string $type * @param array $value - * @return string + * @return string|null * @throws \InvalidArgumentException - * @throws UnregisteredComponentException */ public function buildPathToLocaleDirectoryByContext($type, $value) { @@ -113,10 +112,6 @@ public function buildPathToLocaleDirectoryByContext($type, $value) throw new \InvalidArgumentException(sprintf('Invalid context given: "%s".', $type)); } - if (null === $path) { - throw new UnregisteredComponentException(); - } - - return $path . '/' . self::LOCALE_DIRECTORY . '/'; + return (null === $path) ? null : $path . '/' . self::LOCALE_DIRECTORY . '/'; } } diff --git a/setup/src/Magento/Setup/Module/I18n/Pack/Writer/File/AbstractFile.php b/setup/src/Magento/Setup/Module/I18n/Pack/Writer/File/AbstractFile.php index 817e783999a33..2495a9209e235 100644 --- a/setup/src/Magento/Setup/Module/I18n/Pack/Writer/File/AbstractFile.php +++ b/setup/src/Magento/Setup/Module/I18n/Pack/Writer/File/AbstractFile.php @@ -10,7 +10,6 @@ use Magento\Setup\Module\I18n\Factory; use Magento\Setup\Module\I18n\Locale; use Magento\Setup\Module\I18n\Pack\WriterInterface; -use Magento\Setup\Module\I18n\UnregisteredComponentException; /** * Abstract pack writer @@ -121,9 +120,12 @@ protected function _buildPackFilesData(Dictionary $dictionary) $path = $this->_context->buildPathToLocaleDirectoryByContext($phrase->getContextType(), $context); } catch (\InvalidArgumentException $e) { throw new \InvalidArgumentException($e->getMessage() . ' Row #' . ($key + 1) . '.'); - } catch (UnregisteredComponentException $e) { + } + + if (null === $path) { continue; } + $filename = $path . $this->_locale . '.' . $this->_getFileExtension(); $files[$filename][$phrase->getPhrase()] = $phrase; } diff --git a/setup/src/Magento/Setup/Module/I18n/UnregisteredComponentException.php b/setup/src/Magento/Setup/Module/I18n/UnregisteredComponentException.php deleted file mode 100644 index ff47e683476e1..0000000000000 --- a/setup/src/Magento/Setup/Module/I18n/UnregisteredComponentException.php +++ /dev/null @@ -1,13 +0,0 @@ -context = new Context($this->componentRegistrar); $this->context->buildPathToLocaleDirectoryByContext('invalid_type', 'Magento_Module'); } - - /** - * @expectedException \Magento\Setup\Module\I18n\UnregisteredComponentException - */ - public function testBuildPathToLocaleDirectoryByContextWithUnregisteredComponent() - { - $moduleName = 'Magento_Module'; - $this->componentRegistrar->expects($this->once()) - ->method('getPath') - ->with(ComponentRegistrar::MODULE, $moduleName) - ->willReturn(null); - $this->context = new Context($this->componentRegistrar); - $this->context->buildPathToLocaleDirectoryByContext(ComponentRegistrar::MODULE, $moduleName); - } } diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Pack/Writer/File/AbstractFileTest.php b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Pack/Writer/File/AbstractFileTest.php index 10ce56838b361..bc52fe38321da 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Pack/Writer/File/AbstractFileTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Pack/Writer/File/AbstractFileTest.php @@ -10,7 +10,6 @@ use Magento\Setup\Module\I18n\Dictionary; use Magento\Setup\Module\I18n\Dictionary\Phrase; use Magento\Setup\Module\I18n\Pack\Writer\File\AbstractFile; -use Magento\Setup\Module\I18n\UnregisteredComponentException; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; class AbstractFileTest extends \PHPUnit_Framework_TestCase @@ -122,7 +121,7 @@ public function testWriteDictionaryWithInvalidArgumentException() /** * @return void */ - public function testWriteDictionaryWithUnregisteredComponentException() + public function testWriteDictionaryWherePathIsNull() { $contextType = 'module'; $contextValue = 'Magento_Module'; @@ -137,7 +136,7 @@ public function testWriteDictionaryWithUnregisteredComponentException() $this->contextMock->expects($this->once()) ->method('buildPathToLocaleDirectoryByContext') ->with($contextType, $contextValue) - ->willThrowException(new UnregisteredComponentException); + ->willReturn(null); $this->object->writeDictionary($this->dictionaryMock, $this->localeMock); } From a67d3eaf8ad30cc07c5fd7cc3c97f43ccfb39bb5 Mon Sep 17 00:00:00 2001 From: vnayda Date: Wed, 7 Sep 2016 13:13:53 +0300 Subject: [PATCH 0589/3232] MAGETWO-55341: Request to ESI doesn't return any data --- app/code/Magento/Ui/view/base/layout/default.xml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Ui/view/base/layout/default.xml b/app/code/Magento/Ui/view/base/layout/default.xml index 7f2efbd855872..dc60120c34645 100644 --- a/app/code/Magento/Ui/view/base/layout/default.xml +++ b/app/code/Magento/Ui/view/base/layout/default.xml @@ -5,10 +5,8 @@ * See COPYING.txt for license details. */ --> - - - - - - - + + + + + From 99bb170a805f3e9d0ab5c9b9bb801f739ac161c1 Mon Sep 17 00:00:00 2001 From: vnayda Date: Wed, 7 Sep 2016 16:48:56 +0300 Subject: [PATCH 0590/3232] MAGETWO-55341: Request to ESI doesn't return any data --- app/code/Magento/Ui/view/base/layout/default.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/layout/default.xml b/app/code/Magento/Ui/view/base/layout/default.xml index dc60120c34645..64d5f1483a2f3 100644 --- a/app/code/Magento/Ui/view/base/layout/default.xml +++ b/app/code/Magento/Ui/view/base/layout/default.xml @@ -5,8 +5,10 @@ * See COPYING.txt for license details. */ --> - - - - - + + + + + + + From eae5c4574cd357d3c3eaf79b38649a91302c5500 Mon Sep 17 00:00:00 2001 From: "Karpenko, Oleksandr" Date: Wed, 7 Sep 2016 17:15:27 +0300 Subject: [PATCH 0591/3232] MAGETWO-56915: Versioning of static files (CSS, JS, Fonts, Images, etc.) doesn't enabled by default - for mainline --- app/code/Magento/Deploy/Model/Deployer.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Deploy/Model/Deployer.php b/app/code/Magento/Deploy/Model/Deployer.php index bef65532fd423..3d041a39b6ffb 100644 --- a/app/code/Magento/Deploy/Model/Deployer.php +++ b/app/code/Magento/Deploy/Model/Deployer.php @@ -215,6 +215,9 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $d $libFiles = $this->filesUtil->getStaticLibraryFiles(); $appFiles = $this->filesUtil->getStaticPreProcessingFiles(); + $version = (new \DateTime())->getTimestamp(); + $this->versionStorage->save($version); + foreach ($deployableAreaThemeMap as $area => $themes) { $this->emulateApplicationArea($area); foreach ($locales as $locale) { @@ -319,11 +322,7 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $d $this->output->writeln("\nSuccessful: {$this->count} files modified\n---\n"); } - $version = (new \DateTime())->getTimestamp(); $this->output->writeln("New version of deployed files: {$version}"); - if (!$this->getOption(Options::DRY_RUN)) { - $this->versionStorage->save($version); - } if ($this->errorCount > 0) { // we must have an exit code higher than zero to indicate something was wrong From 42856508fbb5c5f390542bc2df8b20a2f3fbd843 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Wed, 7 Sep 2016 17:57:43 +0300 Subject: [PATCH 0592/3232] MAGETWO-58081: [GitHub] Magento2 SSL Installation httpss:// #6262 --- setup/pub/magento/setup/web-configuration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/pub/magento/setup/web-configuration.js b/setup/pub/magento/setup/web-configuration.js index 164ce5ba63c41..03a0fc7845dda 100644 --- a/setup/pub/magento/setup/web-configuration.js +++ b/setup/pub/magento/setup/web-configuration.js @@ -68,12 +68,12 @@ angular.module('web-configuration', ['ngStorage']) $scope.$watch('config.address.base_url', function() { if (angular.equals($scope.config.https.text, '') || angular.isUndefined($scope.config.https.text)) { - $scope.config.https.text = $scope.config.address.base_url.replace('http', 'https'); + $scope.config.https.text = $scope.config.address.base_url.replace('http://', 'https://'); } }); $scope.populateHttps = function() { - $scope.config.https.text = $scope.config.address.base_url.replace('http', 'https'); + $scope.config.https.text = $scope.config.address.base_url.replace('http://', 'https://'); }; $scope.showEncryptKey = function() { From 102874d806578ac02793ecc56e023209da8c368c Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Wed, 7 Sep 2016 18:16:21 +0300 Subject: [PATCH 0593/3232] MAGETWO-57569: [Backport] Functional upgrade test fail 2.1.x --> 2.2.x - 2.2 - Fix success message --- setup/pub/magento/setup/updater-success.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setup/pub/magento/setup/updater-success.js b/setup/pub/magento/setup/updater-success.js index d2e98394251c8..36e58958ed691 100644 --- a/setup/pub/magento/setup/updater-success.js +++ b/setup/pub/magento/setup/updater-success.js @@ -8,8 +8,16 @@ angular.module('updater-success', ['ngStorage']) .controller('updaterSuccessController', ['$scope', '$state', '$localStorage', '$window', 'navigationService', function ($scope, $state, $localStorage, $window, navigationService) { if ($localStorage.successPageAction) { $scope.successPageAction = $localStorage.successPageAction; - $scope.successPageActionMessage = $scope.successPageAction + - ($scope.endsWith($scope.successPageAction, 'e') ? 'd' : 'ed'); + switch (true) { + case $scope.endsWith($scope.successPageAction, 'd'): + $scope.successPageActionMessage = $scope.successPageAction; + break; + case $scope.endsWith($scope.successPageAction, 'e'): + $scope.successPageActionMessage = $scope.successPageAction + 'd'; + break; + default: + $scope.successPageActionMessage = $scope.successPageAction + 'ed'; + } } if ($localStorage.packages) { $scope.packages = $localStorage.packages; From f8cf1544e7fb547f5039bd21b1398928792e21d1 Mon Sep 17 00:00:00 2001 From: Roman Liukshyn Date: Wed, 7 Sep 2016 18:41:28 +0300 Subject: [PATCH 0594/3232] MAGETWO-57893: Orders processed via Paypal PAyflow Pro not receiving shipping/tax charges --- app/code/Magento/Paypal/Model/Payflow/Transparent.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Paypal/Model/Payflow/Transparent.php b/app/code/Magento/Paypal/Model/Payflow/Transparent.php index f0383dffc9b24..5f3597665f6f9 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Transparent.php +++ b/app/code/Magento/Paypal/Model/Payflow/Transparent.php @@ -166,6 +166,8 @@ public function authorize(InfoInterface $payment, $amount) $request->setData('trxtype', self::TRXTYPE_AUTH_ONLY); $request->setData('origid', $token); $request->setData('amt', $this->formatPrice($amount)); + $request->setData('taxamt', $this->formatPrice($order->getBaseTaxAmount())); + $request->setData('freightamt', $this->formatPrice($order->getBaseShippingAmount())); $response = $this->postRequest($request, $this->getConfig()); $this->processErrors($response); From f13d577d00e466299a62067709de964b5a6b65be Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Wed, 7 Sep 2016 18:42:22 +0300 Subject: [PATCH 0595/3232] MAGETWO-57569: [Backport] Functional upgrade test fail 2.1.x --> 2.2.x - 2.2 - Fix success message --- .../app/Magento/Setup/Test/Constraint/AssertSuccessMessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Setup/Test/Constraint/AssertSuccessMessage.php b/dev/tests/functional/tests/app/Magento/Setup/Test/Constraint/AssertSuccessMessage.php index 7f7d17f60679c..dcfb2922d5c78 100644 --- a/dev/tests/functional/tests/app/Magento/Setup/Test/Constraint/AssertSuccessMessage.php +++ b/dev/tests/functional/tests/app/Magento/Setup/Test/Constraint/AssertSuccessMessage.php @@ -23,7 +23,7 @@ class AssertSuccessMessage extends AbstractConstraint */ public function processAssert(SetupWizard $setupWizard, $package) { - $message = "You upgraded:"; + $message = "You upgraded"; \PHPUnit_Framework_Assert::assertContains( $message, $setupWizard->getSuccessMessage()->getUpdaterStatus(), From ad400b0576c086861b499f03dba7aec9d9e16ee3 Mon Sep 17 00:00:00 2001 From: "Karpenko, Oleksandr" Date: Wed, 7 Sep 2016 19:14:12 +0300 Subject: [PATCH 0596/3232] MAGETWO-56915: Versioning of static files (CSS, JS, Fonts, Images, etc.) doesn't enabled by default - for mainline --- app/code/Magento/Deploy/Model/Deployer.php | 56 ++++++++++++---------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/app/code/Magento/Deploy/Model/Deployer.php b/app/code/Magento/Deploy/Model/Deployer.php index 3d041a39b6ffb..85268f12c2ade 100644 --- a/app/code/Magento/Deploy/Model/Deployer.php +++ b/app/code/Magento/Deploy/Model/Deployer.php @@ -216,7 +216,9 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $d $appFiles = $this->filesUtil->getStaticPreProcessingFiles(); $version = (new \DateTime())->getTimestamp(); - $this->versionStorage->save($version); + if (!$this->getOption(Options::DRY_RUN)) { + $this->versionStorage->save($version); + } foreach ($deployableAreaThemeMap as $area => $themes) { $this->emulateApplicationArea($area); @@ -228,31 +230,33 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $d $this->count = 0; $this->errorCount = 0; - /** @var \Magento\Theme\Model\View\Design $design */ - $design = $this->objectManager->create(\Magento\Theme\Model\View\Design::class); - $design->setDesignTheme($themePath, $area); - - $assetRepo = $this->objectManager->create( - \Magento\Framework\View\Asset\Repository::class, - [ - 'design' => $design, - ] - ); - /** @var \Magento\RequireJs\Model\FileManager $fileManager */ - $fileManager = $this->objectManager->create( - \Magento\RequireJs\Model\FileManager::class, - [ - 'config' => $this->objectManager->create( - \Magento\Framework\RequireJs\Config::class, - [ - 'assetRepo' => $assetRepo, - 'design' => $design, - ] - ), - 'assetRepo' => $assetRepo, - ] - ); - $fileManager->createRequireJsConfigAsset(); + if (!$this->getOption(Options::DRY_RUN)) { + /** @var \Magento\Theme\Model\View\Design $design */ + $design = $this->objectManager->create(\Magento\Theme\Model\View\Design::class); + $design->setDesignTheme($themePath, $area); + + $assetRepo = $this->objectManager->create( + \Magento\Framework\View\Asset\Repository::class, + [ + 'design' => $design, + ] + ); + /** @var \Magento\RequireJs\Model\FileManager $fileManager */ + $fileManager = $this->objectManager->create( + \Magento\RequireJs\Model\FileManager::class, + [ + 'config' => $this->objectManager->create( + \Magento\Framework\RequireJs\Config::class, + [ + 'assetRepo' => $assetRepo, + 'design' => $design, + ] + ), + 'assetRepo' => $assetRepo, + ] + ); + $fileManager->createRequireJsConfigAsset(); + } foreach ($appFiles as $info) { list($fileArea, $fileTheme, , $module, $filePath, $fullPath) = $info; From 976dbc76e110c7aa47178e5bcddf6320bac4ef43 Mon Sep 17 00:00:00 2001 From: Arpita Barua Date: Wed, 7 Sep 2016 14:22:18 -0500 Subject: [PATCH 0597/3232] MAGETWO-55287: Missing product name in bundle product error message - Added changes for this bug --- .../Model/Quote/Item/QuantityValidator.php | 85 ++-- .../QuantityValidator/Initializer/Option.php | 1 + .../Initializer/OptionTest.php | 1 + .../Initializer/QuantityValidatorTest.php | 454 ++++++++++++++++++ .../Quote/Item/QuantityValidatorTest.php | 156 ++++++ 5 files changed, 659 insertions(+), 38 deletions(-) create mode 100644 app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogInventory/Quote/Item/QuantityValidatorTest.php diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php index 0f28d9f26c3e9..6aa90b889bbf5 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php @@ -10,6 +10,9 @@ use Magento\CatalogInventory\Api\StockRegistryInterface; use Magento\CatalogInventory\Api\StockStateInterface; +/** + * Class QuantityValidator + */ class QuantityValidator { /** @@ -23,20 +26,21 @@ class QuantityValidator protected $stockItemInitializer; /** - * @var StockRegistryInterface + * @var \Magento\CatalogInventory\Api\StockRegistryInterface */ protected $stockRegistry; /** - * @var StockStateInterface + * @var \Magento\CatalogInventory\Api\StockStateInterface */ protected $stockState; /** * @param QuantityValidator\Initializer\Option $optionInitializer * @param QuantityValidator\Initializer\StockItem $stockItemInitializer - * @param StockRegistryInterface $stockRegistry - * @param StockStateInterface $stockState + * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry + * @param \Magento\CatalogInventory\Api\StockStateInterface $stockState + * @return void */ public function __construct( QuantityValidator\Initializer\Option $optionInitializer, @@ -50,6 +54,30 @@ public function __construct( $this->stockState = $stockState; } + /** + * Add error information to Quote Item + * + * @param \Magento\Framework\DataObject $result + * @param \Magento\Quote\Model\Quote\Item $quoteItem + * @param bool $removeError + * @return void + */ + private function addErrorInfoToQuote($result, $quoteItem) + { + $quoteItem->addErrorInfo( + 'cataloginventory', + \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + $result->getMessage() + ); + + $quoteItem->getQuote()->addErrorInfo( + $result->getQuoteMessageIndex(), + 'cataloginventory', + \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + $result->getQuoteMessage() + ); + } + /** * Check product inventory data when quote item quantity declaring * @@ -81,7 +109,6 @@ public function validate(\Magento\Framework\Event\Observer $observer) $quoteItem->getProduct()->getId(), $quoteItem->getProduct()->getStore()->getWebsiteId() ); - /* @var $stockItem \Magento\CatalogInventory\Api\Data\StockItemInterface */ if (!$stockItem instanceof \Magento\CatalogInventory\Api\Data\StockItemInterface) { throw new \Magento\Framework\Exception\LocalizedException(__('The stock item for Product is not valid.')); } @@ -152,48 +179,30 @@ public function validate(\Magento\Framework\Event\Observer $observer) ); } } + // variable to keep track if we have previously encountered an error in one of the options + $removeError = true; foreach ($options as $option) { $result = $this->optionInitializer->initialize($option, $quoteItem, $qty); if ($result->getHasError()) { $option->setHasError(true); - - $quoteItem->addErrorInfo( - 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, - $result->getMessage() - ); - - $quoteItem->getQuote()->addErrorInfo( - $result->getQuoteMessageIndex(), - 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, - $result->getQuoteMessage() - ); - } else { - // Delete error from item and its quote, if it was set due to qty lack - $this->_removeErrorsFromQuoteAndItem($quoteItem, \Magento\CatalogInventory\Helper\Data::ERROR_QTY); + //Setting this to false, so no error statuses are cleared + $removeError = false; + $this->addErrorInfoToQuote($result, $quoteItem, $removeError); } } - } else { - $result = $this->stockItemInitializer->initialize($stockItem, $quoteItem, $qty); - if ($result->getHasError()) { - $quoteItem->addErrorInfo( - 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, - $result->getMessage() - ); - - $quoteItem->getQuote()->addErrorInfo( - $result->getQuoteMessageIndex(), - 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, - $result->getQuoteMessage() - ); - } else { - // Delete error from item and its quote, if it was set due to qty lack + if ($removeError) { $this->_removeErrorsFromQuoteAndItem($quoteItem, \Magento\CatalogInventory\Helper\Data::ERROR_QTY); } + } else { + if ($quoteItem->getParentItem() === null) { + $result = $this->stockItemInitializer->initialize($stockItem, $quoteItem, $qty); + if ($result->getHasError()) { + $this->addErrorInfoToQuote($result, $quoteItem); + } else { + $this->_removeErrorsFromQuoteAndItem($quoteItem, \Magento\CatalogInventory\Helper\Data::ERROR_QTY); + } + } } } diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php index 41dbebda5cdf0..ef69379f25f41 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php @@ -101,6 +101,7 @@ public function initialize( ); $stockItem = $this->getStockItem($option, $quoteItem); + $stockItem->setProductName($option->getProduct()->getName()); $result = $this->stockState->checkQuoteItemQty( $option->getProduct()->getId(), $optionQty, diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php index b91f8a1fdb09d..a55540c5c4b21 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php @@ -106,6 +106,7 @@ protected function setUp() '__wakeup', 'unsIsChildItem', 'getItemId', + 'setProductName' ]; $this->stockItemMock = $this->getMock( diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php new file mode 100644 index 0000000000000..c11db1341a78f --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php @@ -0,0 +1,454 @@ +stockRegistryMock = $this->getMockBuilder(\Magento\CatalogInventory\Model\StockRegistry::class) + ->disableOriginalConstructor() + ->setMethods(['getStockItem']) + ->getMock(); + $this->optionInitializer = $this->getMockBuilder( + \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option::class + ) + ->disableOriginalConstructor() + ->getMock(); + $this->stockItemInitializer = $this->getMockBuilder( + \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\StockItem::class + ) + ->disableOriginalConstructor() + ->getMock(); + $this->stockState = $this->getMockBuilder(\Magento\CatalogInventory\Model\StockState::class) + ->disableOriginalConstructor() + ->setMethods(['checkQtyIncrements', 'getHasError', 'getQuoteMessageIndex', 'getQuoteMessage']) + ->getMock(); + $this->quantityValidator = $objectManagerHelper->getObject( + \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator::class, + [ + 'optionInitializer' => $this->optionInitializer, + 'stockItemInitializer' => $this->stockItemInitializer, + 'stockRegistry' => $this->stockRegistryMock, + 'stockState' => $this->stockState + ], + '', + false + ); + $this->observerMock = $this->getMockBuilder(\Magento\Framework\Event\Observer::class) + ->disableOriginalConstructor() + ->setMethods(['getEvent']) + ->getMock(); + $this->eventMock = $this->getMockBuilder(\Magento\Framework\Event::class) + ->disableOriginalConstructor() + ->setMethods(['getItem']) + ->getMock(); + $this->quoteMock = $this->getMockBuilder(\Magento\Quote\Model\Quote::class) + ->disableOriginalConstructor() + ->setMethods(['getIsSuperMode', 'addErrorInfo', 'getQuote', 'getItemsCollection']) + ->getMock(); + $this->storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) + ->disableOriginalConstructor() + ->setMethods(['getWebsiteId']) + ->getMock(); + $this->quoteItemMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item::class) + ->disableOriginalConstructor() + ->setMethods( + ['getProductId', 'getQuote', 'getQty', 'getProduct', 'getParentItem', + 'addErrorInfo', 'setData', 'getQtyOptions'] + ) + ->getMock(); + $this->parentItemMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item::class) + ->disableOriginalConstructor() + ->setMethods(['getProduct', 'getId', 'getStore']) + ->getMock(); + $this->productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) + ->disableOriginalConstructor() + ->setMethods(['getId', 'getStore', 'getTypeInstance']) + ->getMock(); + $this->stockItemMock = $this->getMockBuilder(\Magento\CatalogInventory\Model\Stock\Item::class) + ->disableOriginalConstructor() + ->setMethods(['getIsInStock']) + ->getMock(); + $this->parentStockItemMock = $this->getMockBuilder(\Magento\CatalogInventory\Model\Stock\Item::class) + ->disableOriginalConstructor() + ->setMethods(['getIsInStock']) + ->getMock(); + $this->typeInstanceMock = $this->getMockBuilder(\Magento\CatalogInventory\Model\Stock\Item::class) + ->disableOriginalConstructor() + ->setMethods(['prepareQuoteItemQty']) + ->getMock(); + $this->resultMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) + ->disableOriginalConstructor() + ->setMethods(['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError']) + ->getMock(); + } + + /** + * This tests the scenario when item is not in stock + * + * @return void + */ + public function testValidateOutOfStock() + { + $this->createInitialStub(0); + $this->stockRegistryMock->expects($this->at(0)) + ->method('getStockItem') + ->willReturn($this->stockItemMock); + $this->stockItemMock->expects($this->once()) + ->method('getIsInStock') + ->willReturn(false); + $this->quoteItemMock->expects($this->once()) + ->method('addErrorInfo') + ->with( + 'cataloginventory', + \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + __('This product is out of stock.') + ); + $this->quoteMock->expects($this->once()) + ->method('addErrorInfo') + ->with( + 'stock', + 'cataloginventory', + \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + __('Some of the products are out of stock.') + ); + $this->quantityValidator->validate($this->observerMock); + } + + /** + * This tests the scenario when item is in stock but parent is not in stock + * + * @return void + */ + public function testValidateInStock() + { + $this->createInitialStub(1); + $this->stockRegistryMock->expects($this->at(0)) + ->method('getStockItem') + ->willReturn($this->stockItemMock); + $this->stockRegistryMock->expects($this->at(1)) + ->method('getStockItem') + ->willReturn($this->parentStockItemMock); + $this->parentStockItemMock->expects($this->once()) + ->method('getIsInStock') + ->willReturn(false); + $this->quoteItemMock->expects($this->any()) + ->method('getParentItem') + ->willReturn($this->parentItemMock); + $this->stockItemMock->expects($this->once()) + ->method('getIsInStock') + ->willReturn(true); + $this->stockRegistryMock->expects($this->at(0)) + ->method('getStockItem') + ->willReturn($this->stockItemMock); + $this->quoteItemMock->expects($this->once()) + ->method('addErrorInfo') + ->with( + 'cataloginventory', + \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + __('This product is out of stock.') + ); + $this->quoteMock->expects($this->once()) + ->method('addErrorInfo') + ->with( + 'stock', + 'cataloginventory', + \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + __('Some of the products are out of stock.') + ); + $this->quantityValidator->validate($this->observerMock); + } + + /** + * This tests the scenario when item is in stock and has options + * + * @return void + */ + public function testValidateWithOptions() + { + $optionMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item\Option::class) + ->disableOriginalConstructor() + ->setMethods(['setHasError']) + ->getMock(); + $this->stockRegistryMock->expects($this->at(0)) + ->method('getStockItem') + ->willReturn($this->stockItemMock); + $options = [$optionMock]; + $this->createInitialStub(1); + $this->setUpStubForQuantity(1, true); + $this->setUpStubForRemoveError(); + $this->parentStockItemMock->expects($this->any()) + ->method('getIsInStock') + ->willReturn(true); + $this->stockItemMock->expects($this->once()) + ->method('getIsInStock') + ->willReturn(true); + $this->quoteItemMock->expects($this->any()) + ->method('getQtyOptions') + ->willReturn($options); + $this->optionInitializer->expects($this->any()) + ->method('initialize') + ->willReturn($this->resultMock); + $optionMock->expects($this->never()) + ->method('setHasError'); + $this->quantityValidator->validate($this->observerMock); + } + + /** + * This tests the scenario with options but has errors + * + * @return void + */ + public function testValidateWithOptionsAndError(){ + $optionMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item\Option::class) + ->disableOriginalConstructor() + ->setMethods(['setHasError']) + ->getMock(); + $this->stockRegistryMock->expects($this->at(0)) + ->method('getStockItem') + ->willReturn($this->stockItemMock); + $options = [$optionMock]; + $this->createInitialStub(1); + $this->setUpStubForQuantity(1, true); + $this->setUpStubForRemoveError(); + $this->parentStockItemMock->expects($this->any()) + ->method('getIsInStock') + ->willReturn(true); + $this->stockItemMock->expects($this->once()) + ->method('getIsInStock') + ->willReturn(true); + $this->quoteItemMock->expects($this->any()) + ->method('getQtyOptions') + ->willReturn($options); + $this->optionInitializer->expects($this->any()) + ->method('initialize') + ->willReturn($this->resultMock); + $optionMock->expects($this->never()) + ->method('setHasError'); + $this->quantityValidator->validate($this->observerMock); + } + + /** + * This tests the scenario when all the items are both parent and item are in stock and any errors are cleared + * + * @return void + */ + public function testRemoveError() + { + $this->createInitialStub(1); + $this->setUpStubForRemoveError(); + $this->quoteItemMock->expects($this->any()) + ->method('getQtyOptions') + ->willReturn(null); + $this->stockRegistryMock->expects($this->at(0)) + ->method('getStockItem') + ->willReturn($this->stockItemMock); + $this->quoteItemMock->expects($this->any()) + ->method('getParentItem') + ->willReturn($this->parentItemMock); + $this->stockItemMock->expects($this->once()) + ->method('getIsInStock') + ->willReturn(true); + $this->quoteItemMock->expects($this->never()) + ->method('addErrorInfo'); + $this->quoteMock->expects($this->never()) + ->method('addErrorInfo'); + $this->quantityValidator->validate($this->observerMock); + } + + /** + * This test the scenario when stock Item is not of correct type and throws appropriate exception + * + * @throws \Magento\Framework\Exception\LocalizedException + * @return void + */ + public function testException() + { + $this->createInitialStub(1); + $this->stockRegistryMock->expects($this->at(0)) + ->method('getStockItem') + ->willReturn(null); + $this->setExpectedException(\Magento\Framework\Exception\LocalizedException::class); + $this->quantityValidator->validate($this->observerMock); + } + + private function setUpStubForQuantity($qty, $hasError) + { + $this->productMock->expects($this->any()) + ->method('getTypeInstance') + ->willReturn($this->typeInstanceMock); + $this->typeInstanceMock->expects($this->any()) + ->method('prepareQuoteItemQty') + ->willReturn($qty); + $this->quoteItemMock->expects($this->any()) + ->method('setData'); + $this->productMock->expects($this->any()) + ->method('getId') + ->willReturn(1); + $this->stockState->expects($this->any()) + ->method('checkQtyIncrements') + ->willReturn($this->resultMock); + $this->resultMock->expects($this->any()) + ->method('getHasError') + ->willReturn($hasError); + $this->resultMock->expects($this->any()) + ->method('getMessage') + ->willReturn(''); + $this->resultMock->expects($this->any()) + ->method('getQuoteMessage') + ->willReturn(''); + $this->resultMock->expects($this->any()) + ->method('getQuoteMessageIndex') + ->willReturn(''); + } + + private function createInitialStub($qty) + { + $this->storeMock->expects($this->any()) + ->method('getWebsiteId') + ->willReturn(1); + $this->quoteMock->expects($this->any()) + ->method('getIsSuperMode') + ->willReturn(0); + $this->productMock->expects($this->any()) + ->method('getId') + ->willReturn(1); + $this->productMock->expects($this->any()) + ->method('getStore') + ->willReturn($this->storeMock); + $this->quoteItemMock->expects($this->any()) + ->method('getProductId') + ->willReturn(1); + $this->quoteItemMock->expects($this->any()) + ->method('getQuote') + ->willReturn($this->quoteMock); + $this->quoteItemMock->expects($this->once()) + ->method('getQty') + ->willReturn($qty); + $this->quoteItemMock->expects($this->any()) + ->method('getProduct') + ->willReturn($this->productMock); + $this->eventMock->expects($this->any()) + ->method('getItem') + ->willReturn($this->quoteItemMock); + $this->observerMock->expects($this->any()) + ->method('getEvent') + ->willReturn($this->eventMock); + $this->parentItemMock->expects($this->any()) + ->method('getProduct') + ->willReturn($this->productMock); + $this->parentStockItemMock->expects($this->any()) + ->method('getIsInStock') + ->willReturn(false); + $this->storeMock->expects($this->any()) + ->method('getWebsiteId') + ->willReturn(1); + $this->quoteItemMock->expects($this->any()) + ->method('getQuote') + ->willReturn($this->quoteMock); + $this->quoteMock->expects($this->any()) + ->method('getQuote') + ->willReturn($this->quoteMock); + $this->quoteItemMock->expects($this->any()) + ->method('addErrorInfo'); + $this->quoteMock->expects($this->any()) + ->method('addErrorInfo'); + $this->setUpStubForQuantity(0, false); + $this->stockItemInitializer->expects($this->any()) + ->method('initialize') + ->willReturn($this->resultMock); + } + + private function setUpStubForRemoveError(){ + $quoteItems = [$this->quoteItemMock]; + $this->quoteItemMock->expects($this->any()) + ->method('getHasError') + ->willReturn(false); + $this->quoteMock->expects($this->any()) + ->method('getItemsCollection') + ->willReturn($quoteItems); + $this->quoteMock->expects($this->any()) + ->method('getHasError') + ->willReturn(false); + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Quote/Item/QuantityValidatorTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Quote/Item/QuantityValidatorTest.php new file mode 100644 index 0000000000000..b2716333dd621 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Quote/Item/QuantityValidatorTest.php @@ -0,0 +1,156 @@ +objectManager = Bootstrap::getObjectManager(); + $this->observerMock = $this->getMockBuilder(\Magento\Framework\Event\Observer::class) + ->disableOriginalConstructor() + ->setMethods(['getEvent']) + ->getMock(); + $this->optionInitializer = $this->getMockBuilder( + \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option::class + ) + ->disableOriginalConstructor() + ->getMock(); + $this->stockState = $this->getMockBuilder(\Magento\CatalogInventory\Model\StockState::class) + ->disableOriginalConstructor() + ->setMethods(['checkQtyIncrements', 'getHasError', 'getQuoteMessageIndex', 'getQuoteMessage']) + ->getMock(); + $this->quantityValidator = $this->objectManager->create( + \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator::class, + [ + 'optionInitializer' => $this->optionInitializer, + 'stockState' => $this->stockState + ] + ); + $this->observer = $this->objectManager->create( + \Magento\CatalogInventory\Observer\QuantityValidatorObserver::class, + [ + 'quantityValidator' => $this->quantityValidator + ] + ); + $this->eventMock = $this->getMockBuilder(\Magento\Framework\Event::class) + ->disableOriginalConstructor() + ->setMethods(['getItem']) + ->getMock(); + } + + /** + * @magentoDataFixture Magento/Checkout/_files/quote_with_bundle_product.php + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ + public function testQuoteWithOptions() + { + /** @var $session \Magento\Checkout\Model\Session */ + $session = $this->objectManager->create(\Magento\Checkout\Model\Session::class); + + /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ + $productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + /** @var $product \Magento\Catalog\Model\Product */ + $product = $productRepository->get('bundle-product'); + $resultMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) + ->disableOriginalConstructor() + ->setMethods(['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError']) + ->getMock(); + $this->stockState->expects($this->any())->method('checkQtyIncrements')->willReturn($resultMock); + /* @var $quoteItem \Magento\Quote\Model\Quote\Item */ + $quoteItem = $this->_getQuoteItemIdByProductId($session->getQuote(), $product->getId()); + $this->observerMock->expects($this->once())->method('getEvent')->willReturn($this->eventMock); + $this->optionInitializer->expects($this->any())->method('initialize')->willReturn($resultMock); + $this->eventMock->expects($this->once())->method('getItem')->willReturn($quoteItem); + $this->observer->execute($this->observerMock); + $this->assertCount(0, $quoteItem->getErrorInfos(), 'Errors present in QuoteItem when expected 0 errors'); + } + + /** + * @magentoDataFixture Magento/Checkout/_files/quote_with_bundle_product.php + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ + public function testQuoteWithOptionsWithErrors() + { + /** @var $session \Magento\Checkout\Model\Session */ + $session = $this->objectManager->create(\Magento\Checkout\Model\Session::class); + /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ + $productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + /** @var $product \Magento\Catalog\Model\Product */ + $product = $productRepository->get('bundle-product'); + /* @var $quoteItem \Magento\Quote\Model\Quote\Item */ + $quoteItem = $this->_getQuoteItemIdByProductId($session->getQuote(), $product->getId()); + $resultMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) + ->disableOriginalConstructor() + ->setMethods(['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError']) + ->getMock(); + $this->observerMock->expects($this->once())->method('getEvent')->willReturn($this->eventMock); + $this->eventMock->expects($this->once())->method('getItem')->willReturn($quoteItem); + $this->stockState->expects($this->any())->method('checkQtyIncrements')->willReturn($resultMock); + $this->optionInitializer->expects($this->any())->method('initialize')->willReturn($resultMock); + $resultMock->expects($this->any())->method('getHasError')->willReturn(true); + $this->observer->execute($this->observerMock); + $this->assertCount(2, $quoteItem->getErrorInfos(), 'Expected 2 errors in QuoteItem'); + } + + /** + * Gets \Magento\Quote\Model\Quote\Item from \Magento\Quote\Model\Quote by product id + * + * @param \Magento\Quote\Model\Quote $quote + * @param $productId + * @return \Magento\Quote\Model\Quote\Item + */ + private function _getQuoteItemIdByProductId($quote, $productId) + { + /** @var $quoteItems \Magento\Quote\Model\Quote\Item[] */ + $quoteItems = $quote->getAllItems(); + foreach ($quoteItems as $quoteItem) { + if ($productId == $quoteItem->getProductId()) { + return $quoteItem; + } + } + $this->fail('Test failed since no quoteItem found by productId '.$productId); + } +} \ No newline at end of file From 11e0fa7f09be3178f5ebce84c0ca4021ed447943 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Wed, 7 Sep 2016 15:23:14 -0500 Subject: [PATCH 0598/3232] MAGETWO-52837: Magento commands should return nonzero if failure. - Added return codes to CE and EE commands. --- .../Catalog/Console/Command/ProductAttributesCleanUp.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php b/app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php index d1b938296f9bd..0be23e6b2983f 100644 --- a/app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php +++ b/app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php @@ -101,11 +101,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln(""); $output->writeln("Unused product attributes successfully cleaned up:"); $output->writeln(" " . implode("\n ", $attributeTables) . ""); + return \Magento\Framework\Console\Cli::RETURN_SUCCESS; } catch (\Exception $exception) { $this->attributeResource->rollBack(); $output->writeln(""); $output->writeln("{$exception->getMessage()}"); + // we must have an exit code higher than zero to indicate something was wrong + return \Magento\Framework\Console\Cli::RETURN_FAILURE; } } From 65e833444ede7cb2f52a547423f7d591a5e8b6aa Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Thu, 8 Sep 2016 10:06:55 +0300 Subject: [PATCH 0599/3232] MAGETWO-58081: [GitHub] Magento2 SSL Installation httpss:// #6262 --- setup/view/magento/setup/web-configuration.phtml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/setup/view/magento/setup/web-configuration.phtml b/setup/view/magento/setup/web-configuration.phtml index d2097f78527b5..35aa19484ed53 100644 --- a/setup/view/magento/setup/web-configuration.phtml +++ b/setup/view/magento/setup/web-configuration.phtml @@ -68,13 +68,17 @@ $hints = [ ng-init="config.address.auto_base_url = 'autoBaseUrl ?>'; fillBaseURL();" ng-blur="addSlash()" ng-change="populateHttps()" + ng-pattern="/^(https?:\/\/).*$/" tooltip-placement="right" tooltip-html-unsafe="" tooltip-trigger="focus" tooltip-append-to-body="true" >
    - + Please enter a valid base URL path. (ex: http://www.example.com/)
    @@ -189,10 +193,16 @@ $hints = [ ng-class="{'invalid': webconfig.https.$invalid && webconfig.submitted}" ng-if="config.https.front || config.https.admin" ng-focus="" + ng-pattern="/^(https?:\/\/).*$/" required >
    - Please enter a valid HTTPS base URL path. (ex: https://www.example.com/) + + Please enter a valid HTTPS base URL path. (ex: https://www.example.com/) +
    From 012f5c041739fb50c1f3fb2566e1b0176889b143 Mon Sep 17 00:00:00 2001 From: "Karpenko, Oleksandr" Date: Thu, 8 Sep 2016 11:30:44 +0300 Subject: [PATCH 0600/3232] MAGETWO-56915: Versioning of static files (CSS, JS, Fonts, Images, etc.) doesn't enabled by default - for mainline --- app/code/Magento/Deploy/Model/Deployer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Deploy/Model/Deployer.php b/app/code/Magento/Deploy/Model/Deployer.php index 85268f12c2ade..b925d39d4e09a 100644 --- a/app/code/Magento/Deploy/Model/Deployer.php +++ b/app/code/Magento/Deploy/Model/Deployer.php @@ -302,7 +302,7 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales, array $d $dictionaryFileName = $this->jsTranslationConfig->getDictionaryFileName(); $this->deployFile($dictionaryFileName, $area, $themePath, $locale, null); } - if ($this->getMinification()->isEnabled('js')) { + if ($this->getMinification()->isEnabled('js') && !$this->getOption(Options::DRY_RUN)) { $fileManager->createMinResolverAsset(); } } From 5450526d2662d5044368cf29066476355a16d951 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Thu, 8 Sep 2016 11:54:24 +0300 Subject: [PATCH 0601/3232] MAGETWO-57992: Reloading page on checkout causes shipping method to go "undefined" - for mainline --- .../view/frontend/web/js/model/checkout-data-resolver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/checkout-data-resolver.js b/app/code/Magento/Checkout/view/frontend/web/js/model/checkout-data-resolver.js index edbca0a510b19..0fd1a4967f836 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/model/checkout-data-resolver.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/checkout-data-resolver.js @@ -165,7 +165,7 @@ define( } if (!availableRate && window.checkoutConfig.selectedShippingMethod) { - availableRate = true; + availableRate = window.checkoutConfig.selectedShippingMethod; selectShippingMethodAction(window.checkoutConfig.selectedShippingMethod); } From 024737e65254cc65f579b04afd47957b5025f6de Mon Sep 17 00:00:00 2001 From: Maksym Iakusha Date: Tue, 6 Sep 2016 12:32:40 +0300 Subject: [PATCH 0602/3232] MAGETWO-56150: Order comments history shows time of comment twice --- .../Adminhtml/Order/View/Tab/History.php | 2 +- .../Adminhtml/Order/View/Tab/HistoryTest.php | 40 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) 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 8a6674aa154b0..e496283d89a3c 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 @@ -161,7 +161,7 @@ public function getItemCreatedAt(array $item, $dateType = 'date', $format = \Int ? $item['created_at'] : new \DateTime($item['created_at']); if ('date' === $dateType) { - return $this->_localeDate->formatDateTime($date, $format, $format); + return $this->_localeDate->formatDate($date, $format); } return $this->_localeDate->formatDateTime($date, \IntlDateFormatter::NONE, $format); } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php index 6445fd36dd146..d1bdfa80c4ea7 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php @@ -30,6 +30,17 @@ class HistoryTest extends \PHPUnit_Framework_TestCase */ protected $coreRegistryMock; + /** + * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $localeDateMock; + + /** + * @var \Magento\Backend\Block\Template\Context|\PHPUnit_Framework_MockObject_MockObject + */ + protected $contextMock; + + protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -37,11 +48,25 @@ protected function setUp() $this->coreRegistryMock = $this->getMock(\Magento\Framework\Registry::class, [], [], '', false); $this->adminHelperMock = $this->getMock(\Magento\Sales\Helper\Admin::class, [], [], '', false); + $this->contextMock = $this->getMockBuilder(\Magento\Backend\Block\Template\Context::class) + ->disableOriginalConstructor() + ->setMethods(['getLocaleDate']) + ->getMock(); + + $this->localeDateMock = $this->getMockBuilder(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class) + ->getMock(); + + $this->contextMock->expects($this->any())->method('getLocaleDate')->will( + $this->returnValue($this->localeDateMock) + ); + $this->commentsHistory = $this->objectManager->getObject( \Magento\Sales\Block\Adminhtml\Order\View\Tab\History::class, [ 'adminHelper' => $this->adminHelperMock, - 'registry' => $this->coreRegistryMock + 'registry' => $this->coreRegistryMock, + 'context' => $this->contextMock, + 'localeDate' => $this->localeDateMock ] ); } @@ -63,4 +88,17 @@ public function testGetItemCommentIsNotSet() $this->adminHelperMock->expects($this->never())->method('escapeHtmlWithLinks'); $this->assertEquals('', $this->commentsHistory->getItemComment($item)); } + + public function testGetItemCreatedAt() + { + $date = new \DateTime; + $item = ['created_at' => $date ]; + + $this->localeDateMock->expects($this->once()) + ->method('formatDate') + ->with($date, \IntlDateFormatter::MEDIUM) + ->willReturn('date'); + + $this->assertEquals('date', $this->commentsHistory->getItemCreatedAt($item)); + } } From 5175e2dae7ac8036d462a6698482ea78c135ac49 Mon Sep 17 00:00:00 2001 From: Maksym Iakusha Date: Wed, 7 Sep 2016 10:18:05 +0300 Subject: [PATCH 0603/3232] MAGETWO-56150: Order comments history shows time of comment twice --- .../Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php index d1bdfa80c4ea7..b60a4a39469c2 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php @@ -40,7 +40,6 @@ class HistoryTest extends \PHPUnit_Framework_TestCase */ protected $contextMock; - protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); From 404b8b99d077a944e469013262ea59c83477097d Mon Sep 17 00:00:00 2001 From: Maksym Aposov Date: Thu, 8 Sep 2016 12:06:23 +0300 Subject: [PATCH 0604/3232] MAGETWO-56150: Order comments history shows time of comment twice --- .../Adminhtml/Order/View/Tab/History.php | 7 ++--- .../Adminhtml/Order/View/Tab/HistoryTest.php | 28 +++++++++++++++++-- 2 files changed, 27 insertions(+), 8 deletions(-) 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 e496283d89a3c..a68c543acf731 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 @@ -157,13 +157,10 @@ public function getItemCreatedAt(array $item, $dateType = 'date', $format = \Int if (!isset($item['created_at'])) { return ''; } - $date = $item['created_at'] instanceof \DateTimeInterface - ? $item['created_at'] - : new \DateTime($item['created_at']); if ('date' === $dateType) { - return $this->_localeDate->formatDate($date, $format); + return $this->formatDate($item['created_at'], $format); } - return $this->_localeDate->formatDateTime($date, \IntlDateFormatter::NONE, $format); + return $this->formatTime($item['created_at'], $format); } /** diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php index b60a4a39469c2..0edeac7170929 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/HistoryTest.php @@ -88,16 +88,38 @@ public function testGetItemCommentIsNotSet() $this->assertEquals('', $this->commentsHistory->getItemComment($item)); } - public function testGetItemCreatedAt() + public function testGetItemCreatedAtDate() { $date = new \DateTime; $item = ['created_at' => $date ]; $this->localeDateMock->expects($this->once()) - ->method('formatDate') - ->with($date, \IntlDateFormatter::MEDIUM) + ->method('formatDateTime') + ->with($date, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE) ->willReturn('date'); $this->assertEquals('date', $this->commentsHistory->getItemCreatedAt($item)); } + + public function testGetItemCreatedAtTime() + { + $date = new \DateTime; + $item = ['created_at' => $date ]; + + $this->localeDateMock->expects($this->once()) + ->method('formatDateTime') + ->with($date, \IntlDateFormatter::NONE, \IntlDateFormatter::MEDIUM) + ->willReturn('time'); + + $this->assertEquals('time', $this->commentsHistory->getItemCreatedAt($item, 'time')); + } + + public function testGetItemCreatedAtEmpty() + { + $item = ['title' => "Test" ]; + + $this->localeDateMock->expects($this->never())->method('formatDateTime'); + $this->assertEquals('', $this->commentsHistory->getItemCreatedAt($item)); + $this->assertEquals('', $this->commentsHistory->getItemCreatedAt($item, 'time')); + } } From 6bb07aacfefdf6a8d178fd6ef2e81c0c3085eeaa Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Thu, 8 Sep 2016 12:36:03 +0300 Subject: [PATCH 0605/3232] =?UTF-8?q?MAGETWO-57923:=20=E2=80=9CNo=20Paymen?= =?UTF-8?q?t=20method=20available=E2=80=9D=20when=20customer=20tries=20to?= =?UTF-8?q?=20ship=20his=20items=20to=20billing=20restricted=20country?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed conditional for virtual quote --- .../web/js/action/set-billing-address.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js index 31d52e5dd1d76..36518a4d615e1 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js @@ -10,7 +10,6 @@ define( 'mage/storage', 'Magento_Checkout/js/model/error-processor', 'Magento_Customer/js/model/customer', - 'Magento_Checkout/js/action/get-totals', 'Magento_Checkout/js/model/full-screen-loader', 'Magento_Checkout/js/action/get-payment-information' ], @@ -20,7 +19,6 @@ define( storage, errorProcessor, customer, - getTotalsAction, fullScreenLoader, getPaymentInformationAction ) { @@ -55,18 +53,12 @@ define( serviceUrl, JSON.stringify(payload) ).done( function () { - var deferred = null; + var deferred = $.Deferred(); - if (!quote.isVirtual()) { - getTotalsAction([]); + getPaymentInformationAction(deferred); + $.when(deferred).done(function () { fullScreenLoader.stopLoader(); - } else { - deferred = $.Deferred(); - getPaymentInformationAction(deferred); - $.when(deferred).done(function () { - fullScreenLoader.stopLoader(); - }); - } + }); } ).fail( function (response) { From 9a8956492ebb966851cb6e532f71b3c558bfa987 Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Thu, 8 Sep 2016 13:27:58 +0300 Subject: [PATCH 0606/3232] MAGETWO-57569: [Backport] Functional upgrade test fail 2.1.x --> 2.2.x - 2.2 - Add showing unstable versions during system upgrade test --- .../Setup/Test/Block/SelectVersion.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/Setup/Test/Block/SelectVersion.php b/dev/tests/functional/tests/app/Magento/Setup/Test/Block/SelectVersion.php index 0ce9dd2867a13..437203e072e96 100644 --- a/dev/tests/functional/tests/app/Magento/Setup/Test/Block/SelectVersion.php +++ b/dev/tests/functional/tests/app/Magento/Setup/Test/Block/SelectVersion.php @@ -30,6 +30,13 @@ class SelectVersion extends Form */ protected $firstField = '#selectVersion'; + /** + * Show all versions checkbox + * + * @var string + */ + private $showAllVersions = '#showUnstable'; + /** * Click on 'Next' button. * @@ -50,9 +57,24 @@ public function clickNext() public function fill(FixtureInterface $fixture, SimpleElement $element = null) { $this->waitForElementVisible($this->firstField); + $this->chooseShowAllVersions(); + return parent::fill($fixture, $element); } + /** + * Show all versions include unstable + * + * @return void + */ + private function chooseShowAllVersions() + { + $element = $this->_rootElement->find($this->showAllVersions, Locator::SELECTOR_CSS); + if ($element->isVisible()) { + $element->click(); + } + } + /** * Choose 'yes' for upgrade option called 'Other components' * From 82e64c55458d38371a9cb6871bcc6eb2559f123c Mon Sep 17 00:00:00 2001 From: Rodion Savchuk Date: Thu, 8 Sep 2016 15:01:32 +0300 Subject: [PATCH 0607/3232] MTA-3519: Update Products Using Mass Action change Stock Availability --- .../Edit/Action/Tab/AdvancedInventory.php | 24 ------- .../Product/Edit/Action/Tab/Attributes.php | 2 +- .../Product/Edit/Action/UpdateAttribute.php | 72 ------------------- .../Edit/Action/UpdateAttributeForm.php | 69 ++++++++++++++++++ ...eAttribute.xml => UpdateAttributeForm.xml} | 4 +- .../Test/Block/Adminhtml/Product/Grid.php | 8 +-- .../AssertMassProductUpdateSuccessMessage.php | 2 +- .../Test/Constraint/AssertProductsInStock.php | 2 +- .../CatalogProductActionAttributeEdit.xml | 2 +- .../Product/MassProductUpdateTest.php | 23 ++++-- .../Product/MassProductUpdateTest.xml | 2 - .../Test/Block/Adminhtml/Product/Grid.php | 4 +- 12 files changed, 98 insertions(+), 116 deletions(-) delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Tab/AdvancedInventory.php delete mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.php rename dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/{UpdateAttribute.xml => UpdateAttributeForm.xml} (87%) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Tab/AdvancedInventory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Tab/AdvancedInventory.php deleted file mode 100644 index b43923841625b..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/Tab/AdvancedInventory.php +++ /dev/null @@ -1,24 +0,0 @@ -_rootElement->find($this->advancedInventoryTab)->isVisible()) { - $this->_rootElement->find($this->advancedInventoryTab)->click(); - } - - return parent::fillTabs($fields, $element); - } - - /** - * Fill form with containers. - * - * @param FixtureInterface $product - * @param array $checkbox [optional] - * @return $this - */ - public function fillForm(FixtureInterface $product, $checkbox = null) - { - $fields = $product->getData(); - foreach ($checkbox as $key => $value) { - $fields[$key] = $value; - } - $fields = array_reverse($fields); - $this->unassignedFields = $fields; - $this->fillMissedFields(); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.php new file mode 100644 index 0000000000000..7827d731913a6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.php @@ -0,0 +1,69 @@ + [ + 'price' => 'toggle_price' + ], + 'advanced_inventory' => [ + 'stock_data' => 'stock_data_checkbox' + ] + ]; + + /** + * Advanced Inventory Tab selector. + * + * @var string + */ + protected $advancedInventoryTab = '#attributes_update_tabs_inventory'; + + /** + * Create data array for filling containers. + * + * Returns data in format + * [[abstract_container_name => [field_name => [attribute_name => attribute_value, ..], ..], ..] + * where container name should be set to 'null' if a field is not present on the form. + * + * @param InjectableFixture $fixture + * @return array + */ + protected function getFixtureFieldsByContainers(InjectableFixture $fixture) + { + $dataByContainer = []; + $data = $fixture->getData(); + + foreach ($this->containers as $key => $container) { + foreach ($container['fields'] as $fieldKey => $field) { + if (isset($data[$fieldKey])) { + $dataByContainer[$key][$fieldKey]['value'] = $data[$fieldKey]; + if (isset($this->checkboxMapping[$key][$fieldKey])) { + $dataByContainer[$key][$this->checkboxMapping[$key][$fieldKey]]['value'] = 'Yes'; + } + } + } + if (isset($dataByContainer[$key])) { + $dataByContainer[$key] = array_reverse($dataByContainer[$key]); + } + } + + return $dataByContainer; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.xml similarity index 87% rename from dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.xml rename to dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.xml index ce33473cadb29..06eb0626d723d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttribute.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.xml @@ -24,11 +24,11 @@ #attributes_update_tabs_inventory - [id=inventory_stock_availability_checkbox] + #inventory_stock_availability_checkbox checkbox - [id=inventory_stock_availability] + #inventory_stock_availability select diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php index 3925877bdb530..32ce108f76956 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Grid.php @@ -78,7 +78,7 @@ class Grid extends DataGrid */ public function updateAttributes(array $items = []) { - $productsSku = []; + $products = []; /** @var FixtureInterface $product */ foreach ($items as $product) { $dataConfig = $product->getDataConfig(); @@ -87,12 +87,12 @@ public function updateAttributes(array $items = []) $renderArguments = [ 'product' => $product, ]; - $productsSku = $this->callRender($typeId, 'updateAttributes', $renderArguments); + $products = $this->callRender($typeId, 'prepareData', $renderArguments); } else { - $productsSku[] = ["sku" => $product->getSku()]; + $products[] = ["sku" => $product->getSku()]; } } - $this->massaction($productsSku, 'Update attributes'); + $this->massaction($products, 'Update attributes'); } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php index 6d1b90e84ea51..fc5e7a2d475dc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php @@ -23,7 +23,7 @@ class AssertMassProductUpdateSuccessMessage extends AbstractConstraint * Assert that after mass update successful message appears. * * @param CatalogProductIndex $productGrid - * @param $productsCount + * @param string $productsCount * @return void */ public function processAssert(CatalogProductIndex $productGrid, $productsCount) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductsInStock.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductsInStock.php index 73ff98c582e7d..f485076d5c018 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductsInStock.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductsInStock.php @@ -42,6 +42,6 @@ public function processAssert( */ public function toString() { - return 'In stock control is visible.'; + return 'In stock control is visible for each product.'; } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductActionAttributeEdit.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductActionAttributeEdit.xml index 1910f34e6fbcd..1ff06177a5a20 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductActionAttributeEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductActionAttributeEdit.xml @@ -7,7 +7,7 @@ --> - + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php index 38fa9e0143b92..0aeb1ab4f620e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php @@ -98,14 +98,12 @@ public function __inject( * @param CatalogProductSimple $product * @param string $configData * @param array $initialProducts - * @param string $checkbox * @return array */ public function test( CatalogProductSimple $product, $configData, - array $initialProducts, - $checkbox + array $initialProducts ) { $this->configData = $configData; @@ -123,9 +121,22 @@ public function test( // Steps $this->productGrid->open(); $this->productGrid->getProductGrid()->updateAttributes($products); - $this->attributeMassActionPage->getAttributesBlockForm()->fillForm($product, $checkbox); + $this->attributeMassActionPage->getAttributesBlockForm()->fill($product); $this->attributeMassActionPage->getFormPageActions()->save(); + $updatedProducts = $this->prepareUpdatedProducts($products, $product); + + return ['products' => $updatedProducts]; + } + /** + * Prepare updated products. + * + * @param array $products + * @param CatalogProductSimple $product + * @return array + */ + private function prepareUpdatedProducts(array $products, CatalogProductSimple $product) + { $productsReturn = []; /** @var FixtureInterface $item */ foreach ($products as $item) { @@ -134,8 +145,8 @@ public function test( ['data' => array_merge($item->getData(), $product->getData())] ); } - - return ['products' => $productsReturn]; + + return $productsReturn; } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml index 3f61b38add2d8..a6a29cd397eeb 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml @@ -12,7 +12,6 @@ catalogProductSimple::simple_10_dollar catalogProductSimple::simple_10_dollar 2 - Yes 1.99 @@ -22,7 +21,6 @@ configurableProduct::out_of_stock catalogProductSimple::out_of_stock 3 - Yes In Stock diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php index 5d64683aa677b..5dcf34bdba58e 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php @@ -15,12 +15,12 @@ class Grid extends DataGrid { /** - * Update attributes for product. + * Prepare data. * * @param ConfigurableProduct $product * @return array */ - public function updateAttributes($product) + public function prepareData($product) { $configurableAttributesData = $product->getConfigurableAttributesData(); $productItems[] = ['sku' => $product->getSku()]; From e29ea9c9ba8d968d8dd2e60fb2543f388dabcf85 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Thu, 8 Sep 2016 15:54:11 +0300 Subject: [PATCH 0608/3232] MAGETWO-57842: [FT] Wrong selector for Allow Gift Options for items in Shopping Cart in CheckoutWithGiftMessagesTest --- .../Magento/GiftMessage/Test/Block/Cart/Item/GiftOptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Block/Cart/Item/GiftOptions.php b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Block/Cart/Item/GiftOptions.php index 0320b3e9a60a8..0d008ef79e092 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Block/Cart/Item/GiftOptions.php +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Block/Cart/Item/GiftOptions.php @@ -33,7 +33,7 @@ class GiftOptions extends Form * * @var string */ - protected $allowGiftOptions = '//a[contains(@class,"action-gift")][ancestor::tbody[contains(.,"%s")]]'; + protected $allowGiftOptions = '//*[contains(@class,"action-gift")][ancestor::tbody[contains(.,"%s")]]'; /** * Selector for apply Gift Message button on order From 1dc9cbbad8c70ac38d7a2d8411c288676a335e47 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Thu, 8 Sep 2016 15:55:00 +0300 Subject: [PATCH 0609/3232] MAGETWO-55120: [GitHub] No category id on the category page --- .../Magento/Catalog/Controller/Adminhtml/Category/Edit.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php index b2722ec019785..847499901ccdb 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php @@ -99,9 +99,10 @@ public function execute() return $this->ajaxRequestResponse($category, $resultPage); } + $resultPageTitle = $categoryId ? $category->getName() . ' (ID: ' . $categoryId . ')' : __('Categories'); $resultPage->setActiveMenu('Magento_Catalog::catalog_categories'); $resultPage->getConfig()->getTitle()->prepend(__('Categories')); - $resultPage->getConfig()->getTitle()->prepend($categoryId ? $category->getName() : __('Categories')); + $resultPage->getConfig()->getTitle()->prepend($resultPageTitle); $resultPage->addBreadcrumb(__('Manage Catalog Categories'), __('Manage Categories')); $block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js'); From e9ca714cf37109ab752d43daf6a3d52534dce958 Mon Sep 17 00:00:00 2001 From: Rodion Savchuk Date: Thu, 8 Sep 2016 16:27:17 +0300 Subject: [PATCH 0610/3232] MTA-3519: Update Products Using Mass Action change Stock Availability --- .../Adminhtml/Product/Edit/Action/UpdateAttributeForm.php | 7 ------- .../Constraint/AssertMassProductUpdateSuccessMessage.php | 2 +- .../Test/TestCase/Product/MassProductUpdateTest.xml | 6 +++--- .../Test/Block/Adminhtml/Product/Grid.php | 3 +-- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.php index 7827d731913a6..f3faefffc588e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Action/UpdateAttributeForm.php @@ -28,13 +28,6 @@ class UpdateAttributeForm extends FormTabs ] ]; - /** - * Advanced Inventory Tab selector. - * - * @var string - */ - protected $advancedInventoryTab = '#attributes_update_tabs_inventory'; - /** * Create data array for filling containers. * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php index fc5e7a2d475dc..10bd793211c7a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertMassProductUpdateSuccessMessage.php @@ -23,7 +23,7 @@ class AssertMassProductUpdateSuccessMessage extends AbstractConstraint * Assert that after mass update successful message appears. * * @param CatalogProductIndex $productGrid - * @param string $productsCount + * @param integer $productsCount * @return void */ public function processAssert(CatalogProductIndex $productGrid, $productsCount) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml index a6a29cd397eeb..329d3309f953f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.xml @@ -11,16 +11,16 @@ product_flat catalogProductSimple::simple_10_dollar catalogProductSimple::simple_10_dollar - 2 + 2 1.99 - + product_flat configurableProduct::out_of_stock catalogProductSimple::out_of_stock - 3 + 3 In Stock diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php index 5dcf34bdba58e..e6fa3271ea6cd 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Grid.php @@ -6,13 +6,12 @@ namespace Magento\ConfigurableProduct\Test\Block\Adminhtml\Product; -use Magento\Ui\Test\Block\Adminhtml\DataGrid; use Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct; /** * Backend catalog product grid. */ -class Grid extends DataGrid +class Grid extends \Magento\Catalog\Test\Block\Adminhtml\Product\Grid { /** * Prepare data. From a37caa71243bb759340e9ecebe20a2c9c44dbbc5 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Thu, 8 Sep 2016 17:03:21 +0300 Subject: [PATCH 0611/3232] MAGETWO-54680: Order status change after Creditmemo creation through API. Validation fix for creationitems --- .../Validation/CreationQuantityValidator.php | 85 +++++++++++++++++++ .../Creditmemo/ItemCreationValidator.php | 40 +++++++++ .../ItemCreationValidatorInterface.php | 23 +++++ .../Validation/QuantityValidator.php | 2 +- .../Magento/Sales/Model/RefundInvoice.php | 36 ++++++-- app/code/Magento/Sales/Model/RefundOrder.php | 23 ++++- app/code/Magento/Sales/Model/Validator.php | 12 ++- app/code/Magento/Sales/etc/di.xml | 1 + 8 files changed, 210 insertions(+), 12 deletions(-) create mode 100644 app/code/Magento/Sales/Model/Order/Creditmemo/Item/Validation/CreationQuantityValidator.php create mode 100644 app/code/Magento/Sales/Model/Order/Creditmemo/ItemCreationValidator.php create mode 100644 app/code/Magento/Sales/Model/Order/Creditmemo/ItemCreationValidatorInterface.php diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item/Validation/CreationQuantityValidator.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item/Validation/CreationQuantityValidator.php new file mode 100644 index 0000000000000..cd1f108d7ee65 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item/Validation/CreationQuantityValidator.php @@ -0,0 +1,85 @@ +orderItemRepository = $orderItemRepository; + $this->context = $context; + } + + /** + * @inheritdoc + */ + public function validate($entity) + { + try { + $orderItem = $this->orderItemRepository->get($entity->getOrderItemId()); + if (!$this->isItemPartOfContextOrder($orderItem)) { + return [__('The creditmemo contains product item that is not part of the original order.')]; + } + } catch (NoSuchEntityException $e) { + return [__('The creditmemo contains product item that is not part of the original order.')]; + } + + if ($orderItem->getParentItemId() !== null) { + return [__('The creditmemo contains incorrect product items.')]; + } + + if (!$this->isQtyAvailable($orderItem, $entity->getQty())) { + return [__('The quantity to refund must not be greater than the unrefunded quantity')]; + } + + return []; + } + + /** + * @param Item $orderItem + * @param int $qty + * @return bool + */ + private function isQtyAvailable(Item $orderItem, $qty) + { + return $qty <= $orderItem->getQtyToRefund() || $orderItem->isDummy(); + } + + /** + * @param OrderItemInterface $orderItem + * @return bool + */ + private function isItemPartOfContextOrder(OrderItemInterface $orderItem) + { + return $this->context instanceof OrderInterface && $this->context->getEntityId() === $orderItem->getOrderId(); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/ItemCreationValidator.php b/app/code/Magento/Sales/Model/Order/Creditmemo/ItemCreationValidator.php new file mode 100644 index 0000000000000..f1b8e6d9cab9b --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/ItemCreationValidator.php @@ -0,0 +1,40 @@ +validator = $validator; + } + + /** + * @inheritdoc + */ + public function validate( + CreditmemoItemCreationInterface $entity, + array $validators, + OrderInterface $context = null + ) { + return $this->validator->validate($entity, $validators, $context); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/ItemCreationValidatorInterface.php b/app/code/Magento/Sales/Model/Order/Creditmemo/ItemCreationValidatorInterface.php new file mode 100644 index 0000000000000..9f8bb84ccd16a --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/ItemCreationValidatorInterface.php @@ -0,0 +1,23 @@ +getOrderId() === null) { - return [__('Order Id is required for shipment document')]; + return [__('Order Id is required for creditmemo document')]; } $messages = []; diff --git a/app/code/Magento/Sales/Model/RefundInvoice.php b/app/code/Magento/Sales/Model/RefundInvoice.php index 18837315ef83a..832ef2bd514d3 100644 --- a/app/code/Magento/Sales/Model/RefundInvoice.php +++ b/app/code/Magento/Sales/Model/RefundInvoice.php @@ -12,7 +12,9 @@ use Magento\Sales\Api\RefundInvoiceInterface; use Magento\Sales\Model\Order\Config as OrderConfig; use Magento\Sales\Model\Order\Creditmemo\CreditmemoValidatorInterface; +use Magento\Sales\Model\Order\Creditmemo\ItemCreationValidatorInterface; use Magento\Sales\Model\Order\Creditmemo\NotifierInterface; +use Magento\Sales\Model\Order\Creditmemo\Item\Validation\CreationQuantityValidator; use Magento\Sales\Model\Order\Creditmemo\Validation\QuantityValidator; use Magento\Sales\Model\Order\Creditmemo\Validation\TotalsValidator; use Magento\Sales\Model\Order\CreditmemoDocumentFactory; @@ -64,6 +66,11 @@ class RefundInvoice implements RefundInvoiceInterface */ private $creditmemoValidator; + /** + * @var ItemCreationValidatorInterface + */ + private $itemCreationValidator; + /** * @var CreditmemoRepositoryInterface */ @@ -104,12 +111,13 @@ class RefundInvoice implements RefundInvoiceInterface * @param OrderValidatorInterface $orderValidator * @param InvoiceValidatorInterface $invoiceValidator * @param CreditmemoValidatorInterface $creditmemoValidator - * @param CreditmemoRepositoryInterface $creditmemoRepository - * @param PaymentAdapterInterface $paymentAdapter - * @param CreditmemoDocumentFactory $creditmemoDocumentFactory - * @param NotifierInterface $notifier - * @param OrderConfig $config - * @param LoggerInterface $logger + * @param Order\Creditmemo\ItemCreationValidatorInterface $itemCreationValidator + * @internal param CreditmemoRepositoryInterface $creditmemoRepository + * @internal param PaymentAdapterInterface $paymentAdapter + * @internal param CreditmemoDocumentFactory $creditmemoDocumentFactory + * @internal param NotifierInterface $notifier + * @internal param OrderConfig $config + * @internal param LoggerInterface $logger * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -120,6 +128,7 @@ public function __construct( OrderValidatorInterface $orderValidator, InvoiceValidatorInterface $invoiceValidator, CreditmemoValidatorInterface $creditmemoValidator, + ItemCreationValidatorInterface $itemCreationValidator, CreditmemoRepositoryInterface $creditmemoRepository, PaymentAdapterInterface $paymentAdapter, CreditmemoDocumentFactory $creditmemoDocumentFactory, @@ -133,6 +142,7 @@ public function __construct( $this->invoiceRepository = $invoiceRepository; $this->orderValidator = $orderValidator; $this->creditmemoValidator = $creditmemoValidator; + $this->itemCreationValidator = $itemCreationValidator; $this->creditmemoRepository = $creditmemoRepository; $this->paymentAdapter = $paymentAdapter; $this->creditmemoDocumentFactory = $creditmemoDocumentFactory; @@ -183,10 +193,22 @@ public function execute( TotalsValidator::class ] ); + $itemsValidation = []; + foreach ($items as $item) { + $itemsValidation = array_merge( + $itemsValidation, + $this->itemCreationValidator->validate( + $item, + [CreationQuantityValidator::class], + $order + ) + ); + } $validationMessages = array_merge( $orderValidationResult, $invoiceValidationResult, - $creditmemoValidationResult + $creditmemoValidationResult, + $itemsValidation ); if (!empty($validationMessages )) { throw new \Magento\Sales\Exception\DocumentValidationException( diff --git a/app/code/Magento/Sales/Model/RefundOrder.php b/app/code/Magento/Sales/Model/RefundOrder.php index 70fc7be4310e6..65d81df0d1de9 100644 --- a/app/code/Magento/Sales/Model/RefundOrder.php +++ b/app/code/Magento/Sales/Model/RefundOrder.php @@ -11,7 +11,9 @@ use Magento\Sales\Api\RefundOrderInterface; use Magento\Sales\Model\Order\Config as OrderConfig; use Magento\Sales\Model\Order\Creditmemo\CreditmemoValidatorInterface; +use Magento\Sales\Model\Order\Creditmemo\ItemCreationValidatorInterface; use Magento\Sales\Model\Order\Creditmemo\NotifierInterface; +use Magento\Sales\Model\Order\Creditmemo\Item\Validation\CreationQuantityValidator; use Magento\Sales\Model\Order\Creditmemo\Validation\QuantityValidator; use Magento\Sales\Model\Order\Creditmemo\Validation\TotalsValidator; use Magento\Sales\Model\Order\CreditmemoDocumentFactory; @@ -52,6 +54,11 @@ class RefundOrder implements RefundOrderInterface */ private $creditmemoValidator; + /** + * @var Order\Creditmemo\ItemCreationValidatorInterface + */ + private $itemCreationValidator; + /** * @var CreditmemoRepositoryInterface */ @@ -89,6 +96,7 @@ class RefundOrder implements RefundOrderInterface * @param OrderRepositoryInterface $orderRepository * @param OrderValidatorInterface $orderValidator * @param CreditmemoValidatorInterface $creditmemoValidator + * @param ItemCreationValidatorInterface $itemCreationValidator * @param CreditmemoRepositoryInterface $creditmemoRepository * @param PaymentAdapterInterface $paymentAdapter * @param CreditmemoDocumentFactory $creditmemoDocumentFactory @@ -103,6 +111,7 @@ public function __construct( OrderRepositoryInterface $orderRepository, OrderValidatorInterface $orderValidator, CreditmemoValidatorInterface $creditmemoValidator, + ItemCreationValidatorInterface $itemCreationValidator, CreditmemoRepositoryInterface $creditmemoRepository, PaymentAdapterInterface $paymentAdapter, CreditmemoDocumentFactory $creditmemoDocumentFactory, @@ -115,6 +124,7 @@ public function __construct( $this->orderRepository = $orderRepository; $this->orderValidator = $orderValidator; $this->creditmemoValidator = $creditmemoValidator; + $this->itemCreationValidator = $itemCreationValidator; $this->creditmemoRepository = $creditmemoRepository; $this->paymentAdapter = $paymentAdapter; $this->creditmemoDocumentFactory = $creditmemoDocumentFactory; @@ -156,7 +166,18 @@ public function execute( TotalsValidator::class ] ); - $validationMessages = array_merge($orderValidationResult, $creditmemoValidationResult); + $itemsValidation = []; + foreach ($items as $item) { + $itemsValidation = array_merge( + $itemsValidation, + $this->itemCreationValidator->validate( + $item, + [CreationQuantityValidator::class], + $order + ) + ); + } + $validationMessages = array_merge($orderValidationResult, $creditmemoValidationResult, $itemsValidation); if (!empty($validationMessages)) { throw new \Magento\Sales\Exception\DocumentValidationException( __("Creditmemo Document Validation Error(s):\n" . implode("\n", $validationMessages)) diff --git a/app/code/Magento/Sales/Model/Validator.php b/app/code/Magento/Sales/Model/Validator.php index b8d57ded29702..10aa0735b952e 100644 --- a/app/code/Magento/Sales/Model/Validator.php +++ b/app/code/Magento/Sales/Model/Validator.php @@ -33,14 +33,20 @@ public function __construct(ObjectManagerInterface $objectManager) /** * @param object $entity * @param ValidatorInterface[] $validators - * @return string[] + * @param object|null $context + * @return \string[] * @throws ConfigurationMismatchException */ - public function validate($entity, array $validators) + public function validate($entity, array $validators, $context = null) { $messages = []; + $validatorArguments = []; + if ($context !== null) { + $validatorArguments['context'] = $context; + } + foreach ($validators as $validatorName) { - $validator = $this->objectManager->get($validatorName); + $validator = $this->objectManager->create($validatorName, $validatorArguments); if (!$validator instanceof ValidatorInterface) { throw new ConfigurationMismatchException( __( diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 06ebc387417eb..03437a8e98013 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -104,6 +104,7 @@ + From 19e49d1d8283b14c06e4c0f080fdfb3cd0804426 Mon Sep 17 00:00:00 2001 From: Rodion Savchuk Date: Thu, 8 Sep 2016 17:04:01 +0300 Subject: [PATCH 0612/3232] MTA-3519: Update Products Using Mass Action change Stock Availability --- .../Test/TestCase/Product/MassProductUpdateTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php index 0aeb1ab4f620e..e59e31916204f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/MassProductUpdateTest.php @@ -100,11 +100,8 @@ public function __inject( * @param array $initialProducts * @return array */ - public function test( - CatalogProductSimple $product, - $configData, - array $initialProducts - ) { + public function test(CatalogProductSimple $product, $configData, array $initialProducts) + { $this->configData = $configData; // Preconditions From e144dc337311865c4f7dcd676ec00cfd165f4d3d Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Thu, 8 Sep 2016 09:51:42 -0500 Subject: [PATCH 0613/3232] MAGETWO-55412: Reviewed and updated variations and constraints. --- .../Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml index 1e87903d068e1..dd42950c18a78 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml @@ -8,8 +8,7 @@ - severity:S1 - test_type:acceptance_test, test_type:extended_acceptance_test + test_type:acceptance_test, test_type:extended_acceptance_test, severity:S1 USD EUR 0.8 From 9d356e766eafe07a473d3ad30dea145dbe8699b4 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Thu, 8 Sep 2016 17:57:36 +0300 Subject: [PATCH 0614/3232] MAGETWO-54680: Order status change after Creditmemo creation through API. Validation fix for creationitems, remove redundant check --- .../Creditmemo/Item/Validation/CreationQuantityValidator.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item/Validation/CreationQuantityValidator.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item/Validation/CreationQuantityValidator.php index cd1f108d7ee65..5a9704866953c 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Item/Validation/CreationQuantityValidator.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item/Validation/CreationQuantityValidator.php @@ -53,10 +53,6 @@ public function validate($entity) return [__('The creditmemo contains product item that is not part of the original order.')]; } - if ($orderItem->getParentItemId() !== null) { - return [__('The creditmemo contains incorrect product items.')]; - } - if (!$this->isQtyAvailable($orderItem, $entity->getQty())) { return [__('The quantity to refund must not be greater than the unrefunded quantity')]; } From b1738778c3dc908b676cde09a8042e3e7b3d3d1d Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Thu, 8 Sep 2016 18:07:03 +0300 Subject: [PATCH 0615/3232] MAGETWO-50412: [GITHUB] Issues with adding groups on attribute set creation page --- .../catalog/product/attribute/set/main.phtml | 91 ++++++++++++------- .../templates/modal/modal-prompt-content.html | 20 ++++ .../Ui/view/base/web/js/modal/modal.js | 2 + .../Ui/view/base/web/js/modal/prompt.js | 88 +++++++++++------- .../templates/modal/modal-prompt-content.html | 20 ++++ .../css/source/components/_modals_extend.less | 2 +- 6 files changed, 158 insertions(+), 65 deletions(-) create mode 100644 app/code/Magento/Ui/view/adminhtml/web/templates/modal/modal-prompt-content.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/modal/modal-prompt-content.html diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml index 4379fa062a121..9d833cb388333 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml @@ -53,9 +53,10 @@ "jquery", "Magento_Ui/js/modal/prompt", "Magento_Ui/js/modal/alert", + "Magento_Ui/js/modal/confirm", "extjs/ext-tree-checkbox", "prototype" - ], function(jQuery, prompt, alert){ + ], function(jQuery, prompt, alert, confirm){ //getIsReadOnly() ? 'false' : 'true'); ?>; @@ -208,6 +209,8 @@ }, submit : function() { + var i, child, newNode; + if( TreePanels.root.firstChild == TreePanels.root.lastChild ) { return; } @@ -220,23 +223,40 @@ } if( editSet.currentNode && editSet.currentNode.attributes.cls == 'folder' ) { - TreePanels.root.removeChild(editSet.currentNode); - for( i in editSet.currentNode.childNodes ) { - if( editSet.currentNode.childNodes[i].id ) { - child = editSet.currentNode.childNodes[i]; - newNode = new Ext.tree.TreeNode(child.attributes); - - if( child.attributes.is_user_defined == 1 ) { - TreePanels.root2.appendChild(newNode); + confirm({ + title: "", + content: 'escapeJs(__('Are you sure you want to delete this group?')) ?>', + actions: { + confirm: function () { + TreePanels.root.removeChild(editSet.currentNode); + + for( i in editSet.currentNode.childNodes ) { + if( editSet.currentNode.childNodes[i].id ) { + child = editSet.currentNode.childNodes[i]; + newNode = new Ext.tree.TreeNode(child.attributes); + + if( child.attributes.is_user_defined == 1 ) { + TreePanels.root2.appendChild(newNode); + } + } + } + + editSet.req.removeGroups[editSet.currentNode.id] = editSet.currentNode.id; + editSet.currentNode = false; } } - } - editSet.req.removeGroups[editSet.currentNode.id] = editSet.currentNode.id; - editSet.currentNode = false; + }); } }, SystemNodesExists : function(currentNode) { + if (!currentNode) { + alert({ + content: 'escapeJs(__('Please select a node.')) ?>' + }); + return; + } + for (i in currentNode.childNodes) { if (currentNode.childNodes[i].id) { child = editSet.currentNode.childNodes[i]; @@ -253,31 +273,40 @@ addGroup : function() { prompt({ + title: "", content: "", value: "", + validation: true, + validationRules: ['required-entry'], + attributesForm: { + novalidate: 'novalidate', + action: '' + }, + attributesField: { + name: 'name', + 'data-validate': '{required:true}', + maxlength: '255' + }, actions: { confirm: function (group_name) { group_name = group_name.strip(); - if( group_name == '' ) { - self.addGroup(); - } else if( group_name != false && group_name != null && group_name != '' ) { - if (!editSet.validateGroupName(group_name, 0)) { - return; - } - - var newNode = new Ext.tree.TreeNode({ - text : group_name.escapeHTML(), - cls : 'folder', - allowDrop : true, - allowDrag : true - }); - TreePanels.root.appendChild(newNode); - newNode.addListener('beforemove', editSet.groupBeforeMove); - newNode.addListener('beforeinsert', editSet.groupBeforeInsert); - newNode.addListener('beforeappend', editSet.groupBeforeInsert); - newNode.addListener('click', editSet.register); + if (!editSet.validateGroupName(group_name, 0)) { + return; } + + var newNode = new Ext.tree.TreeNode({ + text : group_name.escapeHTML(), + cls : 'folder', + allowDrop : true, + allowDrag : true + }); + + TreePanels.root.appendChild(newNode); + newNode.addListener('beforemove', editSet.groupBeforeMove); + newNode.addListener('beforeinsert', editSet.groupBeforeInsert); + newNode.addListener('beforeappend', editSet.groupBeforeInsert); + newNode.addListener('click', editSet.register); } } }); @@ -302,7 +331,7 @@ } for (var i=0; i < TreePanels.root.childNodes.length; i++) { if (TreePanels.root.childNodes[i].text.toLowerCase() == name.toLowerCase() && TreePanels.root.childNodes[i].id != exceptNodeId) { - errorText = ''; + errorText = ''; alert({ content: errorText.replace("/name/",name) }); diff --git a/app/code/Magento/Ui/view/adminhtml/web/templates/modal/modal-prompt-content.html b/app/code/Magento/Ui/view/adminhtml/web/templates/modal/modal-prompt-content.html new file mode 100644 index 0000000000000..c08f3f69fc4f5 --- /dev/null +++ b/app/code/Magento/Ui/view/adminhtml/web/templates/modal/modal-prompt-content.html @@ -0,0 +1,20 @@ + +> +
    +
    + <% if(data.label){ %> + + <% } %> +
    + /> +
    +
    +
    + diff --git a/app/code/Magento/Ui/view/base/web/js/modal/modal.js b/app/code/Magento/Ui/view/base/web/js/modal/modal.js index 759ea3be5e624..ab9dc49751774 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/modal.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/modal.js @@ -42,6 +42,7 @@ define([ */ $.widget('mage.modal', { options: { + id: null, type: 'popup', title: '', subTitle: '', @@ -121,6 +122,7 @@ define([ 'closeModal' ); + this.options.id = this.uuid; this.options.transitionEvent = transitionEvent; this._createWrapper(); this._renderModal(); diff --git a/app/code/Magento/Ui/view/base/web/js/modal/prompt.js b/app/code/Magento/Ui/view/base/web/js/modal/prompt.js index 17e78c0ea311b..c2ab3142baf69 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/prompt.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/prompt.js @@ -6,19 +6,24 @@ define([ 'jquery', 'underscore', + 'mage/template', + 'text!ui/template/modal/modal-prompt-content.html', 'jquery/ui', 'Magento_Ui/js/modal/modal', 'mage/translate' -], function ($, _) { +], function ($, _, template, promptContentTmpl) { 'use strict'; $.widget('mage.prompt', $.mage.modal, { options: { modalClass: 'prompt', - promptField: '[data-role="promptField"]', + promptContentTmpl: promptContentTmpl, + promptField: '[data-role="prompt-field"]', attributesForm: {}, attributesField: {}, value: '', + validation: false, + validationRules: [], actions: { /** @@ -64,61 +69,73 @@ define([ */ _create: function () { this.options.focus = this.options.promptField; + this.options.validation = this.options.validation && this.options.validationRules.length; this._super(); - this.modal.find(this.options.modalContent).append(this.getFieldTemplate()); + this.modal.find(this.options.modalContent).append(this.getFormTemplate()); this.modal.find(this.options.modalCloseBtn).off().on('click', _.bind(this.closeModal, this, false)); + + if (this.options.validation) { + this.setValidationClasses(); + } + this.openModal(); }, /** - * Field template getter. + * Form template getter. * - * @returns {Object} Field template + * @returns {Object} Form template. */ - getFieldTemplate: function () { - var input = '', - form = '
    ', - wrapper = '
    ', - $wrapper = $(wrapper), - $form = $(form), - $input = $(input), + getFormTemplate: function () { + var formTemplate, + formAttr = '', + inputAttr = '', attributeName; - for (attributeName in this.options.attributesField) { - if (this.options.attributesField.hasOwnProperty(attributeName)) { - $input.attr(attributeName, this.options.attributesField[attributeName]); + for (attributeName in this.options.attributesForm) { + if (this.options.attributesForm.hasOwnProperty(attributeName)) { + formAttr = formAttr + ' ' + attributeName + '="' + + this.options.attributesForm[attributeName] + '"'; } } - for (attributeName in this.options.attributesForm) { - if (this.options.attributesForm.hasOwnProperty(attributeName)) { - $form.attr(attributeName, this.options.attributesForm[attributeName]); + for (attributeName in this.options.attributesField) { + if (this.options.attributesField.hasOwnProperty(attributeName)) { + inputAttr = inputAttr + ' ' + attributeName + '="' + + this.options.attributesField[attributeName] + '"'; } } - $form.append($input); + formTemplate = $(template(this.options.promptContentTmpl, { + data: this.options, + formAttr: formAttr, + inputAttr: inputAttr + })); - return $wrapper.append($form); + return formTemplate; }, /** - * Compile template and append to wrapper. + * Remove widget */ - _renderModal: function () { - this._super(); - - if (this.options.label) { - this.element.append(this.options.label); - } + _remove: function () { + this.modal.remove(); + }, - this.element.wrap(''); + /** + * Validate prompt field + */ + validate: function () { + return $.validator.validateSingleElement(this.options.promptField); }, /** - * Remove widget + * Add validation classes to prompt field */ - _remove: function () { - this.modal.remove(); + setValidationClasses: function () { + this.modal.find(this.options.promptField).attr('class', $.proxy(function (i, val) { + return val + ' ' + this.options.validationRules.join(' '); + }, this)); }, /** @@ -136,11 +153,16 @@ define([ var value; if (result) { + if (this.options.validation && !this.validate()) { + return; + } + value = this.modal.find(this.options.promptField).val(); - this.options.actions.confirm(value); + this.options.actions.confirm.call(this, value); } else { this.options.actions.cancel.call(this, result); } + this.options.actions.always(); this.element.bind('promptclosed', _.bind(this._remove, this)); @@ -149,6 +171,6 @@ define([ }); return function (config) { - return $('
    ').html(config.content).prompt(config); + return $('
    ').html(config.content).prompt(config); }; }); diff --git a/app/code/Magento/Ui/view/base/web/templates/modal/modal-prompt-content.html b/app/code/Magento/Ui/view/base/web/templates/modal/modal-prompt-content.html new file mode 100644 index 0000000000000..0a6788a1eb569 --- /dev/null +++ b/app/code/Magento/Ui/view/base/web/templates/modal/modal-prompt-content.html @@ -0,0 +1,20 @@ + +> +
    +
    + <% if(data.label){ %> + + <% } %> +
    + /> +
    +
    +
    + diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_modals_extend.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_modals_extend.less index 7e88ff91b857c..b6524e2d49bf5 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/components/_modals_extend.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_modals_extend.less @@ -69,7 +69,7 @@ .modal-popup { &.prompt { .prompt-message { - padding: @modal-prompt-message__padding 0; + padding-bottom: @modal-prompt-message__padding; input { width: 100%; From e3cf96130548c2836ed51511437de74cc98efbff Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Thu, 8 Sep 2016 10:09:37 -0500 Subject: [PATCH 0616/3232] MAGETWO-55066: Reviewed and updated variations and constraints. --- .../Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml | 3 +-- .../Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml | 3 +-- .../Sitemap/Test/TestCase/CreateSitemapEntityTest.xml | 3 +-- .../Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml | 6 ++---- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml index 7990b64f97df8..67b4421182848 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml @@ -8,8 +8,7 @@ - severity:S1 - test_type:acceptance_test, test_type:extended_acceptance_test + test_type:acceptance_test, test_type:extended_acceptance_test, severity:S1 cmsPage Yes NewCmsPage%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml index a00bea4a3126d..3f413f78331d2 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml @@ -8,8 +8,7 @@ - severity:S1 - test_type:extended_acceptance_test + test_type:extended_acceptance_test, severity:S1 For CMS page cms/page/view/page_id/%cmsPage::default% request_path%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.xml index b9d589db0ac8f..cd948084a3bef 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/CreateSitemapEntityTest.xml @@ -8,8 +8,7 @@ - severity:S1 - test_type:extended_acceptance_test + test_type:extended_acceptance_test, severity:S1 sitemap.xml / diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml index 520d1ce2d3db3..f533e115253ed 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml @@ -19,8 +19,7 @@ - severity:S1 - test_type:extended_acceptance_test + test_type:extended_acceptance_test, severity:S1 CMS Page Link Magento Luma Title_%isolation% @@ -65,8 +64,7 @@ - severity:S1 - test_type:extended_acceptance_test + test_type:extended_acceptance_test, severity:S1 Catalog Product Link Magento Luma Title_%isolation% From e3989d290d47a4640b18e065a7a60d0ce81efeac Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Thu, 8 Sep 2016 10:18:24 -0500 Subject: [PATCH 0617/3232] MAGETWO-55066: Reviewed and updated variations and constraints. --- .../app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 7a07dc4ad7c68..51c0853a24dbc 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,8 +8,7 @@ - severity:S1 - test_type:extended_acceptance_test + test_type:extended_acceptance_test, severity:S1 block_%isolation% identifier_%isolation% All Store Views From d5ba3f3aac28dc4bfd19c72179e75ff36ccd75b8 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Thu, 8 Sep 2016 18:54:57 +0300 Subject: [PATCH 0618/3232] MAGETWO-54680: Order status change after Creditmemo creation through API. Fix Doc comment --- app/code/Magento/Sales/Model/RefundInvoice.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Sales/Model/RefundInvoice.php b/app/code/Magento/Sales/Model/RefundInvoice.php index 832ef2bd514d3..37bf915aa505c 100644 --- a/app/code/Magento/Sales/Model/RefundInvoice.php +++ b/app/code/Magento/Sales/Model/RefundInvoice.php @@ -112,12 +112,12 @@ class RefundInvoice implements RefundInvoiceInterface * @param InvoiceValidatorInterface $invoiceValidator * @param CreditmemoValidatorInterface $creditmemoValidator * @param Order\Creditmemo\ItemCreationValidatorInterface $itemCreationValidator - * @internal param CreditmemoRepositoryInterface $creditmemoRepository - * @internal param PaymentAdapterInterface $paymentAdapter - * @internal param CreditmemoDocumentFactory $creditmemoDocumentFactory - * @internal param NotifierInterface $notifier - * @internal param OrderConfig $config - * @internal param LoggerInterface $logger + * @param CreditmemoRepositoryInterface $creditmemoRepository + * @param PaymentAdapterInterface $paymentAdapter + * @param CreditmemoDocumentFactory $creditmemoDocumentFactory + * @param NotifierInterface $notifier + * @param OrderConfig $config + * @param LoggerInterface $logger * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( From 2bd184527d46c2d3ec07a34332797c1a0d7e92d3 Mon Sep 17 00:00:00 2001 From: Arpita Barua Date: Thu, 8 Sep 2016 10:56:02 -0500 Subject: [PATCH 0619/3232] MAGETWO-55287: Missing product name in bundle product error message - Removing fully qualified namespace from the code. Importing the fully qualified namespace instead in the beginning of the file. --- .../Model/Quote/Item/QuantityValidator.php | 45 ++--- .../Initializer/QuantityValidatorTest.php | 154 +++++++++--------- .../Quote/Item/QuantityValidatorTest.php | 61 +++---- 3 files changed, 125 insertions(+), 135 deletions(-) rename dev/tests/integration/testsuite/Magento/CatalogInventory/{ => Model}/Quote/Item/QuantityValidatorTest.php (69%) diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php index 6aa90b889bbf5..ca18b7ec9049f 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php @@ -9,7 +9,12 @@ use Magento\CatalogInventory\Api\StockRegistryInterface; use Magento\CatalogInventory\Api\StockStateInterface; - +use Magento\Framework\Exception\LocalizedException; +use Magento\CatalogInventory\Api\Data\StockItemInterface; +use Magento\CatalogInventory\Helper\Data; +use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option; +use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\StockItem; +use Magento\Framework\Event\Observer; /** * Class QuantityValidator */ @@ -36,15 +41,15 @@ class QuantityValidator protected $stockState; /** - * @param QuantityValidator\Initializer\Option $optionInitializer - * @param QuantityValidator\Initializer\StockItem $stockItemInitializer - * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry - * @param \Magento\CatalogInventory\Api\StockStateInterface $stockState + * @param Option $optionInitializer + * @param StockItem $stockItemInitializer + * @param StockRegistryInterface $stockRegistry + * @param StockStateInterface $stockState * @return void */ public function __construct( - QuantityValidator\Initializer\Option $optionInitializer, - QuantityValidator\Initializer\StockItem $stockItemInitializer, + Option $optionInitializer, + StockItem $stockItemInitializer, StockRegistryInterface $stockRegistry, StockStateInterface $stockState ) { @@ -66,14 +71,14 @@ private function addErrorInfoToQuote($result, $quoteItem) { $quoteItem->addErrorInfo( 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + Data::ERROR_QTY, $result->getMessage() ); $quoteItem->getQuote()->addErrorInfo( $result->getQuoteMessageIndex(), 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + Data::ERROR_QTY, $result->getQuoteMessage() ); } @@ -89,7 +94,7 @@ private function addErrorInfoToQuote($result, $quoteItem) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function validate(\Magento\Framework\Event\Observer $observer) + public function validate(Observer $observer) { /* @var $quoteItem \Magento\Quote\Model\Quote\Item */ $quoteItem = $observer->getEvent()->getItem(); @@ -109,8 +114,8 @@ public function validate(\Magento\Framework\Event\Observer $observer) $quoteItem->getProduct()->getId(), $quoteItem->getProduct()->getStore()->getWebsiteId() ); - if (!$stockItem instanceof \Magento\CatalogInventory\Api\Data\StockItemInterface) { - throw new \Magento\Framework\Exception\LocalizedException(__('The stock item for Product is not valid.')); + if (!$stockItem instanceof StockItemInterface) { + throw new LocalizedException(__('The stock item for Product is not valid.')); } $parentStockItem = false; @@ -130,19 +135,19 @@ public function validate(\Magento\Framework\Event\Observer $observer) if (!$stockItem->getIsInStock() || $parentStockItem && !$parentStockItem->getIsInStock()) { $quoteItem->addErrorInfo( 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + Data::ERROR_QTY, __('This product is out of stock.') ); $quoteItem->getQuote()->addErrorInfo( 'stock', 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + Data::ERROR_QTY, __('Some of the products are out of stock.') ); return; } else { // Delete error from item and its quote, if it was set due to item out of stock - $this->_removeErrorsFromQuoteAndItem($quoteItem, \Magento\CatalogInventory\Helper\Data::ERROR_QTY); + $this->_removeErrorsFromQuoteAndItem($quoteItem, Data::ERROR_QTY); } } @@ -161,21 +166,21 @@ public function validate(\Magento\Framework\Event\Observer $observer) if ($result->getHasError()) { $quoteItem->addErrorInfo( 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY_INCREMENTS, + Data::ERROR_QTY_INCREMENTS, $result->getMessage() ); $quoteItem->getQuote()->addErrorInfo( $result->getQuoteMessageIndex(), 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY_INCREMENTS, + Data::ERROR_QTY_INCREMENTS, $result->getQuoteMessage() ); } else { // Delete error from item and its quote, if it was set due to qty problems $this->_removeErrorsFromQuoteAndItem( $quoteItem, - \Magento\CatalogInventory\Helper\Data::ERROR_QTY_INCREMENTS + Data::ERROR_QTY_INCREMENTS ); } } @@ -192,7 +197,7 @@ public function validate(\Magento\Framework\Event\Observer $observer) } } if ($removeError) { - $this->_removeErrorsFromQuoteAndItem($quoteItem, \Magento\CatalogInventory\Helper\Data::ERROR_QTY); + $this->_removeErrorsFromQuoteAndItem($quoteItem, Data::ERROR_QTY); } } else { if ($quoteItem->getParentItem() === null) { @@ -200,7 +205,7 @@ public function validate(\Magento\Framework\Event\Observer $observer) if ($result->getHasError()) { $this->addErrorInfoToQuote($result, $quoteItem); } else { - $this->_removeErrorsFromQuoteAndItem($quoteItem, \Magento\CatalogInventory\Helper\Data::ERROR_QTY); + $this->_removeErrorsFromQuoteAndItem($quoteItem, Data::ERROR_QTY); } } } diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php index c11db1341a78f..38abeec16972a 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php @@ -6,6 +6,25 @@ namespace Magento\CatalogInventory\Test\Unit\Model\Quote\Item\QuantityValidator\Initializer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\CatalogInventory\Model\StockRegistry; +use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option; +use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\StockItem; +use Magento\CatalogInventory\Model\StockState; +use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator; +use Magento\Framework\Event\Observer; +use Magento\Quote\Model\Quote; +use Magento\Store\Model\Store; +use Magento\Quote\Model\Quote\Item; +use Magento\Catalog\Model\Product; +use Magento\CatalogInventory\Model\Stock\Item as StockMock; +use Magento\Bundle\Model\Product\Type; +use Magento\Framework\DataObject; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Event; +use Magento\CatalogInventory\Helper\Data; +use Magento\Quote\Model\Quote\Item\Option as OptionItem; + /** * Class QuantityValidatorTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -13,7 +32,7 @@ class QuantityValidatorTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator */ private $quantityValidator; @@ -82,85 +101,56 @@ class QuantityValidatorTest extends \PHPUnit_Framework_TestCase */ private $resultMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $stockState; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $stockItemInitializer; + + protected function setUp() { - $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->stockRegistryMock = $this->getMockBuilder(\Magento\CatalogInventory\Model\StockRegistry::class) - ->disableOriginalConstructor() - ->setMethods(['getStockItem']) - ->getMock(); - $this->optionInitializer = $this->getMockBuilder( - \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option::class - ) - ->disableOriginalConstructor() - ->getMock(); - $this->stockItemInitializer = $this->getMockBuilder( - \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\StockItem::class - ) - ->disableOriginalConstructor() - ->getMock(); - $this->stockState = $this->getMockBuilder(\Magento\CatalogInventory\Model\StockState::class) - ->disableOriginalConstructor() - ->setMethods(['checkQtyIncrements', 'getHasError', 'getQuoteMessageIndex', 'getQuoteMessage']) - ->getMock(); - $this->quantityValidator = $objectManagerHelper->getObject( - \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator::class, + $objectManagerHelper = new ObjectManager($this); + $this->stockRegistryMock = $this->getMock(StockRegistry::class, ['getStockItem'], [], '', false); + $this->optionInitializer = $this->getMock(Option::class, [], [], '', false); + $this->stockItemInitializer = $this->getMock(StockItem::class, [], [], '', false); + $this->stockState = $this->getMock(StockState::class, [], [], '', false); + $this->quantityValidator = $objectManagerHelper->getObject(QuantityValidator::class, [ 'optionInitializer' => $this->optionInitializer, 'stockItemInitializer' => $this->stockItemInitializer, 'stockRegistry' => $this->stockRegistryMock, 'stockState' => $this->stockState - ], - '', - false + ] + ); + $this->observerMock = $this->getMock(Observer::class, [], [], '', false); + $this->eventMock = $this->getMock(Event::class, ['getItem'], [], '', false); + $this->quoteMock = $this->getMock(Quote::class, [], [], '', false); + $this->storeMock = $this->getMock(Store::class, [], [], '', false); + $this->quoteItemMock = $this->getMock( + Item::class, + ['getProductId', 'getQuote', 'getQty', 'getProduct', 'getParentItem', + 'addErrorInfo', 'setData', 'getQtyOptions'], + [], '', false + ); + $this->parentItemMock = $this->getMock( + Item::class, + ['getProduct', 'getId', 'getStore'], + [], '', false + ); + $this->productMock = $this->getMock(Product::class, [], [], '', false); + $this->stockItemMock = $this->getMock(StockMock::class, [], [], '', false); + $this->parentStockItemMock = $this->getMock(StockMock::class, [], [], '', false); + $this->typeInstanceMock = $this->getMock(Type::class, [], [], '', false); + $this->resultMock = $this->getMock( + DataObject::class, + ['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError'], + [], '', false ); - $this->observerMock = $this->getMockBuilder(\Magento\Framework\Event\Observer::class) - ->disableOriginalConstructor() - ->setMethods(['getEvent']) - ->getMock(); - $this->eventMock = $this->getMockBuilder(\Magento\Framework\Event::class) - ->disableOriginalConstructor() - ->setMethods(['getItem']) - ->getMock(); - $this->quoteMock = $this->getMockBuilder(\Magento\Quote\Model\Quote::class) - ->disableOriginalConstructor() - ->setMethods(['getIsSuperMode', 'addErrorInfo', 'getQuote', 'getItemsCollection']) - ->getMock(); - $this->storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) - ->disableOriginalConstructor() - ->setMethods(['getWebsiteId']) - ->getMock(); - $this->quoteItemMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item::class) - ->disableOriginalConstructor() - ->setMethods( - ['getProductId', 'getQuote', 'getQty', 'getProduct', 'getParentItem', - 'addErrorInfo', 'setData', 'getQtyOptions'] - ) - ->getMock(); - $this->parentItemMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item::class) - ->disableOriginalConstructor() - ->setMethods(['getProduct', 'getId', 'getStore']) - ->getMock(); - $this->productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) - ->disableOriginalConstructor() - ->setMethods(['getId', 'getStore', 'getTypeInstance']) - ->getMock(); - $this->stockItemMock = $this->getMockBuilder(\Magento\CatalogInventory\Model\Stock\Item::class) - ->disableOriginalConstructor() - ->setMethods(['getIsInStock']) - ->getMock(); - $this->parentStockItemMock = $this->getMockBuilder(\Magento\CatalogInventory\Model\Stock\Item::class) - ->disableOriginalConstructor() - ->setMethods(['getIsInStock']) - ->getMock(); - $this->typeInstanceMock = $this->getMockBuilder(\Magento\CatalogInventory\Model\Stock\Item::class) - ->disableOriginalConstructor() - ->setMethods(['prepareQuoteItemQty']) - ->getMock(); - $this->resultMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) - ->disableOriginalConstructor() - ->setMethods(['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError']) - ->getMock(); } /** @@ -181,7 +171,7 @@ public function testValidateOutOfStock() ->method('addErrorInfo') ->with( 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + Data::ERROR_QTY, __('This product is out of stock.') ); $this->quoteMock->expects($this->once()) @@ -189,7 +179,7 @@ public function testValidateOutOfStock() ->with( 'stock', 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + Data::ERROR_QTY, __('Some of the products are out of stock.') ); $this->quantityValidator->validate($this->observerMock); @@ -225,7 +215,7 @@ public function testValidateInStock() ->method('addErrorInfo') ->with( 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + Data::ERROR_QTY, __('This product is out of stock.') ); $this->quoteMock->expects($this->once()) @@ -233,7 +223,7 @@ public function testValidateInStock() ->with( 'stock', 'cataloginventory', - \Magento\CatalogInventory\Helper\Data::ERROR_QTY, + Data::ERROR_QTY, __('Some of the products are out of stock.') ); $this->quantityValidator->validate($this->observerMock); @@ -246,7 +236,7 @@ public function testValidateInStock() */ public function testValidateWithOptions() { - $optionMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item\Option::class) + $optionMock = $this->getMockBuilder(OptionItem::class) ->disableOriginalConstructor() ->setMethods(['setHasError']) ->getMock(); @@ -279,8 +269,9 @@ public function testValidateWithOptions() * * @return void */ - public function testValidateWithOptionsAndError(){ - $optionMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Item\Option::class) + public function testValidateWithOptionsAndError() + { + $optionMock = $this->getMockBuilder(OptionItem::class) ->disableOriginalConstructor() ->setMethods(['setHasError']) ->getMock(); @@ -348,7 +339,7 @@ public function testException() $this->stockRegistryMock->expects($this->at(0)) ->method('getStockItem') ->willReturn(null); - $this->setExpectedException(\Magento\Framework\Exception\LocalizedException::class); + $this->setExpectedException(LocalizedException::class); $this->quantityValidator->validate($this->observerMock); } @@ -439,7 +430,8 @@ private function createInitialStub($qty) ->willReturn($this->resultMock); } - private function setUpStubForRemoveError(){ + private function setUpStubForRemoveError() + { $quoteItems = [$this->quoteItemMock]; $this->quoteItemMock->expects($this->any()) ->method('getHasError') diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Quote/Item/QuantityValidatorTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php similarity index 69% rename from dev/tests/integration/testsuite/Magento/CatalogInventory/Quote/Item/QuantityValidatorTest.php rename to dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php index b2716333dd621..50646137505d8 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Quote/Item/QuantityValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php @@ -4,7 +4,17 @@ * See COPYING.txt for license details. */ namespace Magento\CatalogInventory\Model\Quote\Item; + use Magento\TestFramework\Helper\Bootstrap; +use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option; +use Magento\Framework\Event\Observer; +use Magento\CatalogInventory\Model\StockState; +use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator; +use Magento\CatalogInventory\Observer\QuantityValidatorObserver; +use Magento\Framework\Event; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\DataObject; +use Magento\Checkout\Model\Session; class QuantityValidatorTest extends \PHPUnit_Framework_TestCase { @@ -47,36 +57,21 @@ protected function setUp() { /** @var \Magento\Framework\ObjectManagerInterface objectManager */ $this->objectManager = Bootstrap::getObjectManager(); - $this->observerMock = $this->getMockBuilder(\Magento\Framework\Event\Observer::class) - ->disableOriginalConstructor() - ->setMethods(['getEvent']) - ->getMock(); - $this->optionInitializer = $this->getMockBuilder( - \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option::class - ) - ->disableOriginalConstructor() - ->getMock(); - $this->stockState = $this->getMockBuilder(\Magento\CatalogInventory\Model\StockState::class) - ->disableOriginalConstructor() - ->setMethods(['checkQtyIncrements', 'getHasError', 'getQuoteMessageIndex', 'getQuoteMessage']) - ->getMock(); - $this->quantityValidator = $this->objectManager->create( - \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator::class, + $this->observerMock = $this->getMock(Observer::class, [], [], '', false); + $this->optionInitializer = $this->getMock(Option::class, [], [], '', false); + $this->stockState = $this->getMock(StockState::class, [], [], '', false); + $this->quantityValidator = $this->objectManager->create(QuantityValidator::class, [ 'optionInitializer' => $this->optionInitializer, 'stockState' => $this->stockState ] ); - $this->observer = $this->objectManager->create( - \Magento\CatalogInventory\Observer\QuantityValidatorObserver::class, + $this->observer = $this->objectManager->create(QuantityValidatorObserver::class, [ 'quantityValidator' => $this->quantityValidator ] ); - $this->eventMock = $this->getMockBuilder(\Magento\Framework\Event::class) - ->disableOriginalConstructor() - ->setMethods(['getItem']) - ->getMock(); + $this->eventMock = $this->getMock(Event::class, ['getItem'], [], '', false); } /** @@ -87,16 +82,13 @@ protected function setUp() public function testQuoteWithOptions() { /** @var $session \Magento\Checkout\Model\Session */ - $session = $this->objectManager->create(\Magento\Checkout\Model\Session::class); + $session = $this->objectManager->create(Session::class); /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ - $productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + $productRepository = $this->objectManager->create(ProductRepositoryInterface::class); /** @var $product \Magento\Catalog\Model\Product */ $product = $productRepository->get('bundle-product'); - $resultMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) - ->disableOriginalConstructor() - ->setMethods(['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError']) - ->getMock(); + $resultMock = $this->getMock(DataObject::class, [], [], '', false); $this->stockState->expects($this->any())->method('checkQtyIncrements')->willReturn($resultMock); /* @var $quoteItem \Magento\Quote\Model\Quote\Item */ $quoteItem = $this->_getQuoteItemIdByProductId($session->getQuote(), $product->getId()); @@ -115,17 +107,18 @@ public function testQuoteWithOptions() public function testQuoteWithOptionsWithErrors() { /** @var $session \Magento\Checkout\Model\Session */ - $session = $this->objectManager->create(\Magento\Checkout\Model\Session::class); + $session = $this->objectManager->create(Session::class); /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ - $productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + $productRepository = $this->objectManager->create(ProductRepositoryInterface::class); /** @var $product \Magento\Catalog\Model\Product */ $product = $productRepository->get('bundle-product'); /* @var $quoteItem \Magento\Quote\Model\Quote\Item */ $quoteItem = $this->_getQuoteItemIdByProductId($session->getQuote(), $product->getId()); - $resultMock = $this->getMockBuilder(\Magento\Framework\DataObject::class) - ->disableOriginalConstructor() - ->setMethods(['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError']) - ->getMock(); + $resultMock = $this->getMock( + DataObject::class, + ['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError'], + [], '', false + ); $this->observerMock->expects($this->once())->method('getEvent')->willReturn($this->eventMock); $this->eventMock->expects($this->once())->method('getItem')->willReturn($quoteItem); $this->stockState->expects($this->any())->method('checkQtyIncrements')->willReturn($resultMock); @@ -153,4 +146,4 @@ private function _getQuoteItemIdByProductId($quote, $productId) } $this->fail('Test failed since no quoteItem found by productId '.$productId); } -} \ No newline at end of file +} From 476b927255ef90700698b030e32fd4d7c190c5b2 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Thu, 8 Sep 2016 10:59:25 -0500 Subject: [PATCH 0620/3232] MAGETWO-55417: Reviewed and updated variations and constraints. --- ...dminUserWhenCreatingNewIntegrationTest.php | 1 + ...dminUserWhenCreatingNewIntegrationTest.xml | 1 + .../LockAdminUserWhenCreatingNewRoleTest.php | 1 + .../LockAdminUserWhenCreatingNewRoleTest.xml | 1 + .../TestCase/LockCustomerOnEditPageTest.php | 1 + .../TestCase/LockCustomerOnEditPageTest.xml | 1 + .../TestCase/LockCustomerOnLoginPageTest.php | 1 + .../TestCase/LockCustomerOnLoginPageTest.xml | 1 + .../NewCustomerPasswordComplexityTest.php | 1 + .../NewCustomerPasswordComplexityTest.xml | 2 + .../ResetCustomerPasswordFailedTest.php | 1 + .../ResetCustomerPasswordFailedTest.xml | 1 + .../TestCase/ResetUserPasswordFailedTest.php | 1 + .../TestCase/ResetUserPasswordFailedTest.xml | 1 + .../app/Magento/Security/Test/etc/di.xml | 39 +++++++++++++++++++ 15 files changed, 54 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/Security/Test/etc/di.xml diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php index cc75c27949c0e..b977a8f098f49 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php @@ -33,6 +33,7 @@ class LockAdminUserWhenCreatingNewIntegrationTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S2'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.xml index 87f109ac81bcf..aed87c9db7730 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.xml @@ -8,6 +8,7 @@ + severity:S2 user_lockout_failures custom_admin_with_default_role Integration%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php index 23a43100de854..7c76e4c4d43b8 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php @@ -33,6 +33,7 @@ class LockAdminUserWhenCreatingNewRoleTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S2'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.xml index 3b9b5fd6295ee..7e5c44696d832 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.xml @@ -8,6 +8,7 @@ + severity:S2 user_lockout_failures custom_admin_with_default_role AdminRole%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php index c5b910c124707..df1f872006561 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php @@ -35,6 +35,7 @@ class LockCustomerOnEditPageTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.xml index 3e53235c075a6..89435ba2fb7f8 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.xml @@ -8,6 +8,7 @@ + severity:S1 customer_max_login_failures_number default incorrect password diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.php index 1612f1dac24e4..795a8531512c6 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.php @@ -29,6 +29,7 @@ class LockCustomerOnLoginPageTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.xml index 21318c5f3f0d5..a5376d73685ba 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnLoginPageTest.xml @@ -8,6 +8,7 @@ + severity:S1 customer_max_login_failures_number default incorrect password diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.php index 8fdab9165db03..3c77248a0debc 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.php @@ -25,6 +25,7 @@ class NewCustomerPasswordComplexityTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml index 925b8145f59ad..579c7fcfc05cb 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml @@ -8,6 +8,7 @@ + severity:S1 john doe johndoe%isolation%@example.com @@ -17,6 +18,7 @@ + severity:S1 john doe johndoe%isolation%@example.com diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.php index d3b7a3ccb1304..71bd5e562c6dc 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.php @@ -27,6 +27,7 @@ class ResetCustomerPasswordFailedTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.xml index 88be6fae63d9b..92ce965b8bc4e 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetCustomerPasswordFailedTest.xml @@ -8,6 +8,7 @@ + severity:S1 customer_US 2 diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.php index 0bf600a7042f9..cc7683f251bef 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.php @@ -27,6 +27,7 @@ class ResetUserPasswordFailedTest extends Injectable { /* tags */ const MVP = 'yes'; + const SEVERITY = 'S1'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.xml b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.xml index 3301cd8624a7c..644f494844a5b 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.xml +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/ResetUserPasswordFailedTest.xml @@ -8,6 +8,7 @@ + severity:S1 custom_admin_with_default_role 2 diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Security/Test/etc/di.xml new file mode 100644 index 0000000000000..7e29aefb0475d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Security/Test/etc/di.xml @@ -0,0 +1,39 @@ + + + + + + S1 + + + + + S1 + + + + + S1 + + + + + S1 + + + + + S2 + + + + + S1 + + + From c2b8fcc2cd118b7ae1c838eab5e2aea63277c7ff Mon Sep 17 00:00:00 2001 From: Arpita Barua Date: Thu, 8 Sep 2016 11:16:48 -0500 Subject: [PATCH 0621/3232] MAGETWO-55287: Missing product name in bundle product error message - Cleaning up Acceptance Tests --- .../Model/Quote/Item/QuantityValidator.php | 1 + .../Initializer/QuantityValidatorTest.php | 24 ++++++++++++------- .../Quote/Item/QuantityValidatorTest.php | 10 +++++--- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php index ca18b7ec9049f..5921a24122b6c 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php @@ -15,6 +15,7 @@ use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\Option; use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\Initializer\StockItem; use Magento\Framework\Event\Observer; + /** * Class QuantityValidator */ diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php index 38abeec16972a..1dedbbe69677c 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php @@ -111,7 +111,6 @@ class QuantityValidatorTest extends \PHPUnit_Framework_TestCase */ private $stockItemInitializer; - protected function setUp() { $objectManagerHelper = new ObjectManager($this); @@ -119,7 +118,8 @@ protected function setUp() $this->optionInitializer = $this->getMock(Option::class, [], [], '', false); $this->stockItemInitializer = $this->getMock(StockItem::class, [], [], '', false); $this->stockState = $this->getMock(StockState::class, [], [], '', false); - $this->quantityValidator = $objectManagerHelper->getObject(QuantityValidator::class, + $this->quantityValidator = $objectManagerHelper->getObject( + QuantityValidator::class, [ 'optionInitializer' => $this->optionInitializer, 'stockItemInitializer' => $this->stockItemInitializer, @@ -135,12 +135,16 @@ protected function setUp() Item::class, ['getProductId', 'getQuote', 'getQty', 'getProduct', 'getParentItem', 'addErrorInfo', 'setData', 'getQtyOptions'], - [], '', false + [], + '', + false ); $this->parentItemMock = $this->getMock( Item::class, ['getProduct', 'getId', 'getStore'], - [], '', false + [], + '', + false ); $this->productMock = $this->getMock(Product::class, [], [], '', false); $this->stockItemMock = $this->getMock(StockMock::class, [], [], '', false); @@ -149,7 +153,9 @@ protected function setUp() $this->resultMock = $this->getMock( DataObject::class, ['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError'], - [], '', false + [], + '', + false ); } @@ -171,7 +177,7 @@ public function testValidateOutOfStock() ->method('addErrorInfo') ->with( 'cataloginventory', - Data::ERROR_QTY, + Data::ERROR_QTY, __('This product is out of stock.') ); $this->quoteMock->expects($this->once()) @@ -179,7 +185,7 @@ public function testValidateOutOfStock() ->with( 'stock', 'cataloginventory', - Data::ERROR_QTY, + Data::ERROR_QTY, __('Some of the products are out of stock.') ); $this->quantityValidator->validate($this->observerMock); @@ -215,7 +221,7 @@ public function testValidateInStock() ->method('addErrorInfo') ->with( 'cataloginventory', - Data::ERROR_QTY, + Data::ERROR_QTY, __('This product is out of stock.') ); $this->quoteMock->expects($this->once()) @@ -223,7 +229,7 @@ public function testValidateInStock() ->with( 'stock', 'cataloginventory', - Data::ERROR_QTY, + Data::ERROR_QTY, __('Some of the products are out of stock.') ); $this->quantityValidator->validate($this->observerMock); diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php index 50646137505d8..12f6391d303ad 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php @@ -60,13 +60,15 @@ protected function setUp() $this->observerMock = $this->getMock(Observer::class, [], [], '', false); $this->optionInitializer = $this->getMock(Option::class, [], [], '', false); $this->stockState = $this->getMock(StockState::class, [], [], '', false); - $this->quantityValidator = $this->objectManager->create(QuantityValidator::class, + $this->quantityValidator = $this->objectManager->create( + QuantityValidator::class, [ 'optionInitializer' => $this->optionInitializer, 'stockState' => $this->stockState ] ); - $this->observer = $this->objectManager->create(QuantityValidatorObserver::class, + $this->observer = $this->objectManager->create( + QuantityValidatorObserver::class, [ 'quantityValidator' => $this->quantityValidator ] @@ -117,7 +119,9 @@ public function testQuoteWithOptionsWithErrors() $resultMock = $this->getMock( DataObject::class, ['checkQtyIncrements', 'getMessage', 'getQuoteMessage', 'getHasError'], - [], '', false + [], + '', + false ); $this->observerMock->expects($this->once())->method('getEvent')->willReturn($this->eventMock); $this->eventMock->expects($this->once())->method('getItem')->willReturn($quoteItem); From cb6587c3d70d19c5377ae920a7500e9abcf78687 Mon Sep 17 00:00:00 2001 From: Arpita Barua Date: Thu, 8 Sep 2016 12:11:59 -0500 Subject: [PATCH 0622/3232] MAGETWO-55287: Missing product name in bundle product error message - Cleaning up Acceptance Tests --- .../Initializer/QuantityValidatorTest.php | 1 + .../Model/Quote/Item/QuantityValidatorTest.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php index 1dedbbe69677c..7fd886f381538 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php @@ -28,6 +28,7 @@ /** * Class QuantityValidatorTest * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) */ class QuantityValidatorTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php index 12f6391d303ad..4da19b6c103bf 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php @@ -16,10 +16,16 @@ use Magento\Framework\DataObject; use Magento\Checkout\Model\Session; + +/** + * Class QuantityValidatorTest + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class QuantityValidatorTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\CatalogInventory\Model\Quote\Item\QuantityValidator + * @var QuantityValidator */ private $quantityValidator; From b88c323f39f66209c300d9f987d671254fa364a7 Mon Sep 17 00:00:00 2001 From: Arpita Barua Date: Thu, 8 Sep 2016 12:19:40 -0500 Subject: [PATCH 0623/3232] MAGETWO-55287: Missing product name in bundle product error message - Cleaning up Acceptance Tests --- .../CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php index 4da19b6c103bf..12cbbb36e3de8 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidatorTest.php @@ -16,7 +16,6 @@ use Magento\Framework\DataObject; use Magento\Checkout\Model\Session; - /** * Class QuantityValidatorTest * From c4a37c95631d82ba18efc9f85dbe9e6126bed5df Mon Sep 17 00:00:00 2001 From: Alex Bomko Date: Thu, 8 Sep 2016 20:34:43 +0300 Subject: [PATCH 0624/3232] MAGETWO-52446: Currency switcher is not working for home page widgets --- .../Block/Product/ProductsList.php | 24 +++++++++++++++++-- .../Unit/Block/Product/ProductsListTest.php | 10 ++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index a547fb862acac..0f665984b0e04 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -4,12 +4,11 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\CatalogWidget\Block\Product; use Magento\Framework\DataObject\IdentityInterface; use Magento\Widget\Block\BlockInterface; +use Magento\Framework\Pricing\PriceCurrencyInterface; /** * Catalog Products List widget block @@ -81,6 +80,11 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem */ protected $conditionsHelper; + /** + * @var PriceCurrencyInterface + */ + private $priceCurrency; + /** * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory @@ -144,6 +148,7 @@ public function getCacheKeyInfo() return [ 'CATALOG_PRODUCTS_LIST_WIDGET', + $this->getPriceCurrency()->getCurrencySymbol(), $this->_storeManager->getStore()->getId(), $this->_design->getDesignTheme()->getId(), $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP), @@ -351,4 +356,19 @@ public function getTitle() { return $this->getData('title'); } + + /** + * @return PriceCurrencyInterface + * + * @deprecated + */ + private function getPriceCurrency() + { + if ($this->priceCurrency === null) { + $this->priceCurrency = \Magento\Framework\App\ObjectManager::getInstance() + ->get(PriceCurrencyInterface::class); + } + return $this->priceCurrency; + + } } diff --git a/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php b/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php index fd4ae990a754d..c2410cea1d9bf 100644 --- a/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php +++ b/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php @@ -10,6 +10,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Catalog\Model\Product\Visibility; +use Magento\Framework\Pricing\PriceCurrencyInterface; /** * Class ProductsListTest @@ -72,6 +73,11 @@ class ProductsListTest extends \PHPUnit_Framework_TestCase */ protected $layout; + /** + * @var PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $priceCurrency; + protected function setUp() { $this->collectionFactory = @@ -105,11 +111,13 @@ protected function setUp() ); $this->request = $arguments['context']->getRequest(); $this->layout = $arguments['context']->getLayout(); + $this->priceCurrency = $this->getMock(PriceCurrencyInterface::class); $this->productsList = $objectManagerHelper->getObject( \Magento\CatalogWidget\Block\Product\ProductsList::class, $arguments ); + $objectManagerHelper->setBackwardCompatibleProperty($this->productsList, 'priceCurrency', $this->priceCurrency); } public function testGetCacheKeyInfo() @@ -130,9 +138,11 @@ public function testGetCacheKeyInfo() $this->request->expects($this->once())->method('getParam')->with('page_number')->willReturn(1); $this->request->expects($this->once())->method('getParams')->willReturn('request_params'); + $this->priceCurrency->expects($this->once())->method('getCurrencySymbol')->willReturn('$'); $cacheKey = [ 'CATALOG_PRODUCTS_LIST_WIDGET', + '$', 1, 'blank', 'context_group', From 0a3cd4600e20800321c6e2bdd9c33c0dd6aa2f72 Mon Sep 17 00:00:00 2001 From: pdanzinger Date: Thu, 8 Sep 2016 22:54:56 +0200 Subject: [PATCH 0625/3232] Remove obsolete comment in catalog_category_view.xml In catalog_category_view.xml there is an XML comment that tells developers they can change the pager increments using methods like "addPagerLimit". These settings can be found in the backend now and the method "addPagerLimit" is only to be found in a list of deprecated methods I think it is safe to assume this comment doesn't serve a purpose anymore. --- .../frontend/layout/catalog_category_view.xml | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view.xml index 4c8ae8eaae952..298cdcc29e953 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view.xml @@ -28,53 +28,6 @@ - - product_list_toolbar From c3ed73da517929ce2e5f0eac76269ba31a9ea849 Mon Sep 17 00:00:00 2001 From: aakimov Date: Wed, 7 Sep 2016 17:08:38 +0300 Subject: [PATCH 0626/3232] MAGETWO-58067: [GitHub] Data Loss for Country Multiselect in Backend on Website Level --- .../system/shipping/applicable_country.phtml | 7 +++-- .../Form/Field/Select/Allowspecific.php | 30 ++++++++++++++++--- .../Form/Field/Select/AllowspecificTest.php | 6 ++-- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/shipping/applicable_country.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/shipping/applicable_country.phtml index 6d003c6cb6810..7729b96f5ac36 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/shipping/applicable_country.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/shipping/applicable_country.phtml @@ -61,11 +61,14 @@ CountryModel.prototype = { if (applyCountryElement && applyCountryElement.id) { var specifCountryElement = $(applyCountryElement.id.replace(/sallowspecific/, 'specificcountry')); var showMethodElement = $(applyCountryElement.id.replace(/sallowspecific/, 'showmethod')); + // 'Use Default' checkbox of the related county list UI element + var useDefaultElement = document.getElementById(specifCountryElement.id + '_inherit'); + //var specifErrMsgElement = $(applyCountryElement.id.replace(/sallowspecific/, 'specificerrmsg')); if (specifCountryElement) { if (applyCountryElement.value == 1) { - //if specific country element selected - specifCountryElement.enable(); + // enable related country select only if its 'Use Default' checkbox is absent or is unchecked + specifCountryElement.disabled = (useDefaultElement) ? useDefaultElement.checked : false; if (showMethodElement) { this.showElement(showMethodElement.up(1)); } diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field/Select/Allowspecific.php b/app/code/Magento/Config/Block/System/Config/Form/Field/Select/Allowspecific.php index 6eb813e83967e..9dd8d78ac17d6 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field/Select/Allowspecific.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field/Select/Allowspecific.php @@ -22,10 +22,32 @@ class Allowspecific extends \Magento\Framework\Data\Form\Element\Select */ public function getAfterElementHtml() { - $javaScript = "\n "; - return $javaScript . parent::getAfterElementHtml(); + $elementId = $this->getHtmlId(); + $countryListId = $this->_getSpecificCountryElementId(); + $useDefaultElementId = $countryListId . '_inherit'; + + $elementJavaScript = << +// + +HTML; + + return $elementJavaScript . parent::getAfterElementHtml(); } /** diff --git a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/Select/AllowspecificTest.php b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/Select/AllowspecificTest.php index 295da57969374..3a0f751c8b216 100644 --- a/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/Select/AllowspecificTest.php +++ b/app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/Select/AllowspecificTest.php @@ -37,14 +37,14 @@ protected function setUp() public function testGetAfterElementHtml() { $this->_formMock->expects( - $this->exactly(2) + $this->once() )->method( 'getHtmlIdPrefix' )->will( $this->returnValue('test_prefix_') ); $this->_formMock->expects( - $this->exactly(2) + $this->once() )->method( 'getHtmlIdSuffix' )->will( @@ -57,7 +57,7 @@ public function testGetAfterElementHtml() $actual = $this->_object->getAfterElementHtml(); - $this->assertStringEndsWith($afterHtmlCode, $actual); + $this->assertStringEndsWith('' . $afterHtmlCode, $actual); $this->assertStringStartsWith(' +
    + Snippet: + + + + + + + + + + + + + + + + + + + + + + + + + +
    DirectiveHowSourceRendered
    ng-bind-htmlAutomatically uses $sanitize
    <div ng-bind-html="snippet">
    </div>
    ng-bind-htmlBypass $sanitize by explicitly trusting the dangerous value +
    <div ng-bind-html="deliberatelyTrustDangerousSnippet()">
    +     </div>
    +
    ng-bindAutomatically escapes
    <div ng-bind="snippet">
    </div>
    +
    + + + it('should sanitize the html snippet by default', function() { + expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()). + toBe('

    an html\nclick here\nsnippet

    '); + }); + it('should inline raw snippet if bound to a trusted value', function() { + expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()). + toBe("

    an html\n" + + "click here\n" + + "snippet

    "); + }); + it('should escape snippet without any filter', function() { + expect(element(by.css('#bind-default div')).getInnerHtml()). + toBe("<p style=\"color:blue\">an html\n" + + "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + + "snippet</p>"); + }); + it('should update', function() { + element(by.model('snippet')).clear(); + element(by.model('snippet')).sendKeys('new text'); + expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()). + toBe('new text'); + expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe( + 'new text'); + expect(element(by.css('#bind-default div')).getInnerHtml()).toBe( + "new <b onclick=\"alert(1)\">text</b>"); + }); +
    + + */ + function $SanitizeProvider() { + this.$get = ['$$sanitizeUri', function($$sanitizeUri) { + return function(html) { + var buf = []; + htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) { + return !/^unsafe/.test($$sanitizeUri(uri, isImage)); + })); + return buf.join(''); + }; + }]; + } + + function sanitizeText(chars) { + var buf = []; + var writer = htmlSanitizeWriter(buf, angular.noop); + writer.chars(chars); + return buf.join(''); + } + + +// Regular Expressions for parsing tags and attributes + var START_TAG_REGEXP = + /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, + END_TAG_REGEXP = /^<\s*\/\s*([\w:-]+)[^>]*>/, + ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, + BEGIN_TAG_REGEXP = /^/g, + DOCTYPE_REGEXP = /]*?)>/i, + CDATA_REGEXP = //g, + // Match everything outside of normal chars and " (quote character) + NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; + + +// Good source of info about elements and attributes +// http://dev.w3.org/html5/spec/Overview.html#semantics +// http://simon.html5.org/html-elements + +// Safe Void Elements - HTML5 +// http://dev.w3.org/html5/spec/Overview.html#void-elements + var voidElements = makeMap("area,br,col,hr,img,wbr"); + +// Elements that you can, intentionally, leave open (and which close themselves) +// http://dev.w3.org/html5/spec/Overview.html#optional-tags + var optionalEndTagBlockElements = makeMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"), + optionalEndTagInlineElements = makeMap("rp,rt"), + optionalEndTagElements = angular.extend({}, + optionalEndTagInlineElements, + optionalEndTagBlockElements); + +// Safe Block Elements - HTML5 + var blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap("address,article," + + "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," + + "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")); + +// Inline Elements - HTML5 + var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap("a,abbr,acronym,b," + + "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," + + "samp,small,span,strike,strong,sub,sup,time,tt,u,var")); + + +// Special Elements (can contain anything) + var specialElements = makeMap("script,style"); + + var validElements = angular.extend({}, + voidElements, + blockElements, + inlineElements, + optionalEndTagElements); + +//Attributes that have href and hence need to be sanitized + var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap"); + var validAttrs = angular.extend({}, uriAttrs, makeMap( + 'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+ + 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+ + 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+ + 'scope,scrolling,shape,size,span,start,summary,target,title,type,'+ + 'valign,value,vspace,width')); + + function makeMap(str) { + var obj = {}, items = str.split(','), i; + for (i = 0; i < items.length; i++) obj[items[i]] = true; + return obj; + } + + + /** + * @example + * htmlParser(htmlString, { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * }); + * + * @param {string} html string + * @param {object} handler + */ + function htmlParser( html, handler ) { + var index, chars, match, stack = [], last = html; + stack.last = function() { return stack[ stack.length - 1 ]; }; + + while ( html ) { + chars = true; + + // Make sure we're not in a script or style element + if ( !stack.last() || !specialElements[ stack.last() ] ) { + + // Comment + if ( html.indexOf("", index) === index) { + if (handler.comment) handler.comment( html.substring( 4, index ) ); + html = html.substring( index + 3 ); + chars = false; + } + // DOCTYPE + } else if ( DOCTYPE_REGEXP.test(html) ) { + match = html.match( DOCTYPE_REGEXP ); + + if ( match ) { + html = html.replace( match[0] , ''); + chars = false; + } + // end tag + } else if ( BEGING_END_TAGE_REGEXP.test(html) ) { + match = html.match( END_TAG_REGEXP ); + + if ( match ) { + html = html.substring( match[0].length ); + match[0].replace( END_TAG_REGEXP, parseEndTag ); + chars = false; + } + + // start tag + } else if ( BEGIN_TAG_REGEXP.test(html) ) { + match = html.match( START_TAG_REGEXP ); + + if ( match ) { + html = html.substring( match[0].length ); + match[0].replace( START_TAG_REGEXP, parseStartTag ); + chars = false; + } + } + + if ( chars ) { + index = html.indexOf("<"); + + var text = index < 0 ? html : html.substring( 0, index ); + html = index < 0 ? "" : html.substring( index ); + + if (handler.chars) handler.chars( decodeEntities(text) ); + } + + } else { + html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'), + function(all, text){ + text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1"); + + if (handler.chars) handler.chars( decodeEntities(text) ); + + return ""; + }); + + parseEndTag( "", stack.last() ); + } + + if ( html == last ) { + throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " + + "of html: {0}", html); + } + last = html; + } + + // Clean up any remaining tags + parseEndTag(); + + function parseStartTag( tag, tagName, rest, unary ) { + tagName = angular.lowercase(tagName); + if ( blockElements[ tagName ] ) { + while ( stack.last() && inlineElements[ stack.last() ] ) { + parseEndTag( "", stack.last() ); + } + } + + if ( optionalEndTagElements[ tagName ] && stack.last() == tagName ) { + parseEndTag( "", tagName ); + } + + unary = voidElements[ tagName ] || !!unary; + + if ( !unary ) + stack.push( tagName ); + + var attrs = {}; + + rest.replace(ATTR_REGEXP, + function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) { + var value = doubleQuotedValue + || singleQuotedValue + || unquotedValue + || ''; + + attrs[name] = decodeEntities(value); + }); + if (handler.start) handler.start( tagName, attrs, unary ); + } + + function parseEndTag( tag, tagName ) { + var pos = 0, i; + tagName = angular.lowercase(tagName); + if ( tagName ) + // Find the closest opened tag of the same type + for ( pos = stack.length - 1; pos >= 0; pos-- ) + if ( stack[ pos ] == tagName ) + break; + + if ( pos >= 0 ) { + // Close all the open elements, up the stack + for ( i = stack.length - 1; i >= pos; i-- ) + if (handler.end) handler.end( stack[ i ] ); + + // Remove the open elements from the stack + stack.length = pos; + } + } + } + + var hiddenPre=document.createElement("pre"); + var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/; + /** + * decodes all entities into regular string + * @param value + * @returns {string} A string with decoded entities. + */ + function decodeEntities(value) { + if (!value) { return ''; } + + // Note: IE8 does not preserve spaces at the start/end of innerHTML + // so we must capture them and reattach them afterward + var parts = spaceRe.exec(value); + var spaceBefore = parts[1]; + var spaceAfter = parts[3]; + var content = parts[2]; + if (content) { + hiddenPre.innerHTML=content.replace(//g, '>'); + } + + /** + * create an HTML/XML writer which writes to buffer + * @param {Array} buf use buf.jain('') to get out sanitized html string + * @returns {object} in the form of { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * } + */ + function htmlSanitizeWriter(buf, uriValidator){ + var ignore = false; + var out = angular.bind(buf, buf.push); + return { + start: function(tag, attrs, unary){ + tag = angular.lowercase(tag); + if (!ignore && specialElements[tag]) { + ignore = tag; + } + if (!ignore && validElements[tag] === true) { + out('<'); + out(tag); + angular.forEach(attrs, function(value, key){ + var lkey=angular.lowercase(key); + var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background'); + if (validAttrs[lkey] === true && + (uriAttrs[lkey] !== true || uriValidator(value, isImage))) { + out(' '); + out(key); + out('="'); + out(encodeEntities(value)); + out('"'); + } + }); + out(unary ? '/>' : '>'); + } + }, + end: function(tag){ + tag = angular.lowercase(tag); + if (!ignore && validElements[tag] === true) { + out(''); + } + if (tag == ignore) { + ignore = false; + } + }, + chars: function(chars){ + if (!ignore) { + out(encodeEntities(chars)); + } + } + }; + } + + +// define ngSanitize module and register $sanitize service + angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider); + + /* global sanitizeText: false */ + + /** + * @ngdoc filter + * @name linky + * @function + * + * @description + * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and + * plain email address links. + * + * Requires the {@link ngSanitize `ngSanitize`} module to be installed. + * + * @param {string} text Input text. + * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in. + * @returns {string} Html-linkified text. + * + * @usage + + * + * @example + + + +
    + Snippet: + + + + + + + + + + + + + + + + + + + + + +
    FilterSourceRendered
    linky filter +
    <div ng-bind-html="snippet | linky">
    </div>
    +
    +
    +
    linky target +
    <div ng-bind-html="snippetWithTarget | linky:'_blank'">
    </div>
    +
    +
    +
    no filter
    <div ng-bind="snippet">
    </div>
    + + + it('should linkify the snippet with urls', function() { + expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()). + toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' + + 'another@somewhere.org, and one more: ftp://127.0.0.1/.'); + expect(element.all(by.css('#linky-filter a')).count()).toEqual(4); + }); + it('should not linkify snippet without the linky filter', function() { + expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()). + toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' + + 'another@somewhere.org, and one more: ftp://127.0.0.1/.'); + expect(element.all(by.css('#escaped-html a')).count()).toEqual(0); + }); + it('should update', function() { + element(by.model('snippet')).clear(); + element(by.model('snippet')).sendKeys('new http://link.'); + expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()). + toBe('new http://link.'); + expect(element.all(by.css('#linky-filter a')).count()).toEqual(1); + expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()) + .toBe('new http://link.'); + }); + it('should work with the target property', function() { + expect(element(by.id('linky-target')). + element(by.binding("snippetWithTarget | linky:'_blank'")).getText()). + toBe('http://angularjs.org/'); + expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank'); + }); + + + */ + angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) { + var LINKY_URL_REGEXP = + /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/, + MAILTO_REGEXP = /^mailto:/; + + return function(text, target) { + if (!text) return text; + var match; + var raw = text; + var html = []; + var url; + var i; + while ((match = raw.match(LINKY_URL_REGEXP))) { + // We can not end in these as they are sometimes found at the end of the sentence + url = match[0]; + // if we did not match ftp/http/mailto then assume mailto + if (match[2] == match[3]) url = 'mailto:' + url; + i = match.index; + addText(raw.substr(0, i)); + addLink(url, match[0].replace(MAILTO_REGEXP, '')); + raw = raw.substring(i + match[0].length); + } + addText(raw); + return $sanitize(html.join('')); + + function addText(text) { + if (!text) { + return; + } + html.push(sanitizeText(text)); + } + + function addLink(url, text) { + html.push(''); + addText(text); + html.push(''); + } + }; + }]); + + +})(window, window.angular); \ No newline at end of file diff --git a/setup/pub/angular-sanitize/angular-sanitize.min.js b/setup/pub/angular-sanitize/angular-sanitize.min.js index 0eb2619c6ab40..4fc586065be2f 100644 --- a/setup/pub/angular-sanitize/angular-sanitize.min.js +++ b/setup/pub/angular-sanitize/angular-sanitize.min.js @@ -11,3 +11,4 @@ c(B(a))}}}var L=h.$$minErr("$sanitize"),A=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s u=h.extend({},q,k("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),x=k("script,style"),C=h.extend({},w,t,u,v),D=k("background,cite,href,longdesc,src,usemap"),O=h.extend({},D,k("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width")), n=document.createElement("pre"),M=/^(\s*)([\s\S]*?)(\s*)$/;h.module("ngSanitize",[]).provider("$sanitize",function(){this.$get=["$$sanitizeUri",function(a){return function(e){var d=[];F(e,s(d,function(c,b){return!/^unsafe/.test(a(c,b))}));return d.join("")}}]});h.module("ngSanitize").filter("linky",["$sanitize",function(a){var e=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,d=/^mailto:/;return function(c,b){function g(a){a&&m.push(E(a))}function f(a,c){m.push("');g(c);m.push("")}if(!c)return c;for(var l,k=c,m=[],n,p;l=k.match(e);)n=l[0],l[2]==l[3]&&(n="mailto:"+n),p=l.index,g(k.substr(0,p)),f(n,l[0].replace(d,"")),k=k.substring(p+l[0].length);g(k);return a(m.join(""))}}])})(window,window.angular); +//# sourceMappingURL=angular-sanitize.min.js.map \ No newline at end of file diff --git a/setup/pub/angular-sanitize/angular-sanitize.min.js.map b/setup/pub/angular-sanitize/angular-sanitize.min.js.map new file mode 100644 index 0000000000000..0c993a6ed2afb --- /dev/null +++ b/setup/pub/angular-sanitize/angular-sanitize.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-sanitize.min.js", +"lineCount":13, +"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAiJtCC,QAASA,EAAY,CAACC,CAAD,CAAQ,CAC3B,IAAIC,EAAM,EACGC,EAAAC,CAAmBF,CAAnBE,CAAwBN,CAAAO,KAAxBD,CACbH,MAAA,CAAaA,CAAb,CACA,OAAOC,EAAAI,KAAA,CAAS,EAAT,CAJoB,CAmE7BC,QAASA,EAAO,CAACC,CAAD,CAAM,CAAA,IAChBC,EAAM,EAAIC,EAAAA,CAAQF,CAAAG,MAAA,CAAU,GAAV,CAAtB,KAAsCC,CACtC,KAAKA,CAAL,CAAS,CAAT,CAAYA,CAAZ,CAAgBF,CAAAG,OAAhB,CAA8BD,CAAA,EAA9B,CAAmCH,CAAA,CAAIC,CAAA,CAAME,CAAN,CAAJ,CAAA,CAAgB,CAAA,CACnD,OAAOH,EAHa,CAmBtBK,QAASA,EAAU,CAAEC,CAAF,CAAQC,CAAR,CAAkB,CAiFnCC,QAASA,EAAa,CAAEC,CAAF,CAAOC,CAAP,CAAgBC,CAAhB,CAAsBC,CAAtB,CAA8B,CAClDF,CAAA,CAAUrB,CAAAwB,UAAA,CAAkBH,CAAlB,CACV,IAAKI,CAAA,CAAeJ,CAAf,CAAL,CACE,IAAA,CAAQK,CAAAC,KAAA,EAAR,EAAwBC,CAAA,CAAgBF,CAAAC,KAAA,EAAhB,CAAxB,CAAA,CACEE,CAAA,CAAa,EAAb,CAAiBH,CAAAC,KAAA,EAAjB,CAICG,EAAA,CAAwBT,CAAxB,CAAL,EAA0CK,CAAAC,KAAA,EAA1C,EAA0DN,CAA1D,EACEQ,CAAA,CAAa,EAAb,CAAiBR,CAAjB,CAKF,EAFAE,CAEA,CAFQQ,CAAA,CAAcV,CAAd,CAER,EAFmC,CAAC,CAACE,CAErC,GACEG,CAAAM,KAAA,CAAYX,CAAZ,CAEF,KAAIY,EAAQ,EAEZX,EAAAY,QAAA,CAAaC,CAAb,CACE,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAcC,CAAd,CAAiCC,CAAjC,CAAoDC,CAApD,CAAmE,CAMzEP,CAAA,CAAMI,CAAN,CAAA,CAAcI,CAAA,CALFH,CAKE,EAJTC,CAIS,EAHTC,CAGS,EAFT,EAES,CAN2D,CAD7E,CASItB,EAAAwB,MAAJ,EAAmBxB,CAAAwB,MAAA,CAAerB,CAAf,CAAwBY,CAAxB,CAA+BV,CAA/B,CA5B+B,CA+BpDM,QAASA,EAAW,CAAET,CAAF,CAAOC,CAAP,CAAiB,CAAA,IAC/BsB,EAAM,CADyB,CACtB7B,CAEb,IADAO,CACA,CADUrB,CAAAwB,UAAA,CAAkBH,CAAlB,CACV,CAEE,IAAMsB,CAAN,CAAYjB,CAAAX,OAAZ,CAA2B,CAA3B,CAAqC,CAArC,EAA8B4B,CAA9B,EACOjB,CAAA,CAAOiB,CAAP,CADP,EACuBtB,CADvB,CAAwCsB,CAAA,EAAxC;AAIF,GAAY,CAAZ,EAAKA,CAAL,CAAgB,CAEd,IAAM7B,CAAN,CAAUY,CAAAX,OAAV,CAAyB,CAAzB,CAA4BD,CAA5B,EAAiC6B,CAAjC,CAAsC7B,CAAA,EAAtC,CACMI,CAAA0B,IAAJ,EAAiB1B,CAAA0B,IAAA,CAAalB,CAAA,CAAOZ,CAAP,CAAb,CAGnBY,EAAAX,OAAA,CAAe4B,CAND,CATmB,CAhHF,IAC/BE,CAD+B,CACxB1C,CADwB,CACVuB,EAAQ,EADE,CACEC,EAAOV,CAG5C,KAFAS,CAAAC,KAEA,CAFamB,QAAQ,EAAG,CAAE,MAAOpB,EAAA,CAAOA,CAAAX,OAAP,CAAsB,CAAtB,CAAT,CAExB,CAAQE,CAAR,CAAA,CAAe,CACbd,CAAA,CAAQ,CAAA,CAGR,IAAMuB,CAAAC,KAAA,EAAN,EAAuBoB,CAAA,CAAiBrB,CAAAC,KAAA,EAAjB,CAAvB,CAmDEV,CASA,CATOA,CAAAiB,QAAA,CAAiBc,MAAJ,CAAW,kBAAX,CAAgCtB,CAAAC,KAAA,EAAhC,CAA+C,QAA/C,CAAyD,GAAzD,CAAb,CACL,QAAQ,CAACsB,CAAD,CAAMC,CAAN,CAAW,CACjBA,CAAA,CAAOA,CAAAhB,QAAA,CAAaiB,CAAb,CAA6B,IAA7B,CAAAjB,QAAA,CAA2CkB,CAA3C,CAAyD,IAAzD,CAEHlC,EAAAf,MAAJ,EAAmBe,CAAAf,MAAA,CAAesC,CAAA,CAAeS,CAAf,CAAf,CAEnB,OAAO,EALU,CADd,CASP,CAAArB,CAAA,CAAa,EAAb,CAAiBH,CAAAC,KAAA,EAAjB,CA5DF,KAAyD,CAGvD,GAA8B,CAA9B,GAAKV,CAAAoC,QAAA,CAAa,SAAb,CAAL,CAEER,CAEA,CAFQ5B,CAAAoC,QAAA,CAAa,IAAb,CAAmB,CAAnB,CAER,CAAc,CAAd,EAAKR,CAAL,EAAmB5B,CAAAqC,YAAA,CAAiB,QAAjB,CAAwBT,CAAxB,CAAnB,GAAsDA,CAAtD,GACM3B,CAAAqC,QAEJ,EAFqBrC,CAAAqC,QAAA,CAAiBtC,CAAAuC,UAAA,CAAgB,CAAhB,CAAmBX,CAAnB,CAAjB,CAErB,CADA5B,CACA,CADOA,CAAAuC,UAAA,CAAgBX,CAAhB,CAAwB,CAAxB,CACP,CAAA1C,CAAA,CAAQ,CAAA,CAHV,CAJF,KAUO,IAAKsD,CAAAC,KAAA,CAAoBzC,CAApB,CAAL,CAGL,IAFAmB,CAEA,CAFQnB,CAAAmB,MAAA,CAAYqB,CAAZ,CAER,CACExC,CACA;AADOA,CAAAiB,QAAA,CAAcE,CAAA,CAAM,CAAN,CAAd,CAAyB,EAAzB,CACP,CAAAjC,CAAA,CAAQ,CAAA,CAFV,CAHK,IAQA,IAAKwD,CAAAD,KAAA,CAA4BzC,CAA5B,CAAL,CAGL,IAFAmB,CAEA,CAFQnB,CAAAmB,MAAA,CAAYwB,CAAZ,CAER,CACE3C,CAEA,CAFOA,CAAAuC,UAAA,CAAgBpB,CAAA,CAAM,CAAN,CAAArB,OAAhB,CAEP,CADAqB,CAAA,CAAM,CAAN,CAAAF,QAAA,CAAkB0B,CAAlB,CAAkC/B,CAAlC,CACA,CAAA1B,CAAA,CAAQ,CAAA,CAHV,CAHK,IAUK0D,EAAAH,KAAA,CAAsBzC,CAAtB,CAAL,GACLmB,CADK,CACGnB,CAAAmB,MAAA,CAAY0B,CAAZ,CADH,IAIH7C,CAEA,CAFOA,CAAAuC,UAAA,CAAgBpB,CAAA,CAAM,CAAN,CAAArB,OAAhB,CAEP,CADAqB,CAAA,CAAM,CAAN,CAAAF,QAAA,CAAkB4B,CAAlB,CAAoC3C,CAApC,CACA,CAAAhB,CAAA,CAAQ,CAAA,CANL,CAUFA,EAAL,GACE0C,CAKA,CALQ5B,CAAAoC,QAAA,CAAa,GAAb,CAKR,CAHIH,CAGJ,CAHmB,CAAR,CAAAL,CAAA,CAAY5B,CAAZ,CAAmBA,CAAAuC,UAAA,CAAgB,CAAhB,CAAmBX,CAAnB,CAG9B,CAFA5B,CAEA,CAFe,CAAR,CAAA4B,CAAA,CAAY,EAAZ,CAAiB5B,CAAAuC,UAAA,CAAgBX,CAAhB,CAExB,CAAI3B,CAAAf,MAAJ,EAAmBe,CAAAf,MAAA,CAAesC,CAAA,CAAeS,CAAf,CAAf,CANrB,CAzCuD,CA+DzD,GAAKjC,CAAL,EAAaU,CAAb,CACE,KAAMoC,EAAA,CAAgB,UAAhB,CAC4C9C,CAD5C,CAAN,CAGFU,CAAA,CAAOV,CAvEM,CA2EfY,CAAA,EA/EmC,CA2IrCY,QAASA,EAAc,CAACuB,CAAD,CAAQ,CAC7B,GAAI,CAACA,CAAL,CAAc,MAAO,EAIrB,KAAIC,EAAQC,CAAAC,KAAA,CAAaH,CAAb,CACRI,EAAAA,CAAcH,CAAA,CAAM,CAAN,CAClB,KAAII,EAAaJ,CAAA,CAAM,CAAN,CAEjB,IADIK,CACJ,CADcL,CAAA,CAAM,CAAN,CACd,CACEM,CAAAC,UAKA,CALoBF,CAAApC,QAAA,CAAgB,IAAhB,CAAqB,MAArB,CAKpB,CAAAoC,CAAA,CAAU,aAAA,EAAiBC,EAAjB,CACRA,CAAAE,YADQ,CACgBF,CAAAG,UAE5B,OAAON,EAAP,CAAqBE,CAArB,CAA+BD,CAlBF,CA4B/BM,QAASA,EAAc,CAACX,CAAD,CAAQ,CAC7B,MAAOA,EAAA9B,QAAA,CACG,IADH;AACS,OADT,CAAAA,QAAA,CAEG0C,CAFH,CAE4B,QAAQ,CAACZ,CAAD,CAAO,CAC9C,MAAO,IAAP,CAAcA,CAAAa,WAAA,CAAiB,CAAjB,CAAd,CAAoC,GADU,CAF3C,CAAA3C,QAAA,CAKG,IALH,CAKS,MALT,CAAAA,QAAA,CAMG,IANH,CAMS,MANT,CADsB,CAoB/B7B,QAASA,EAAkB,CAACD,CAAD,CAAM0E,CAAN,CAAmB,CAC5C,IAAIC,EAAS,CAAA,CAAb,CACIC,EAAMhF,CAAAiF,KAAA,CAAa7E,CAAb,CAAkBA,CAAA4B,KAAlB,CACV,OAAO,OACEU,QAAQ,CAACtB,CAAD,CAAMa,CAAN,CAAaV,CAAb,CAAmB,CAChCH,CAAA,CAAMpB,CAAAwB,UAAA,CAAkBJ,CAAlB,CACD2D,EAAAA,CAAL,EAAehC,CAAA,CAAgB3B,CAAhB,CAAf,GACE2D,CADF,CACW3D,CADX,CAGK2D,EAAL,EAAsC,CAAA,CAAtC,GAAeG,CAAA,CAAc9D,CAAd,CAAf,GACE4D,CAAA,CAAI,GAAJ,CAcA,CAbAA,CAAA,CAAI5D,CAAJ,CAaA,CAZApB,CAAAmF,QAAA,CAAgBlD,CAAhB,CAAuB,QAAQ,CAAC+B,CAAD,CAAQoB,CAAR,CAAY,CACzC,IAAIC,EAAKrF,CAAAwB,UAAA,CAAkB4D,CAAlB,CAAT,CACIE,EAAmB,KAAnBA,GAAWlE,CAAXkE,EAAqC,KAArCA,GAA4BD,CAA5BC,EAAyD,YAAzDA,GAAgDD,CAC3B,EAAA,CAAzB,GAAIE,CAAA,CAAWF,CAAX,CAAJ,EACsB,CAAA,CADtB,GACGG,CAAA,CAASH,CAAT,CADH,EAC8B,CAAAP,CAAA,CAAad,CAAb,CAAoBsB,CAApB,CAD9B,GAEEN,CAAA,CAAI,GAAJ,CAIA,CAHAA,CAAA,CAAII,CAAJ,CAGA,CAFAJ,CAAA,CAAI,IAAJ,CAEA,CADAA,CAAA,CAAIL,CAAA,CAAeX,CAAf,CAAJ,CACA,CAAAgB,CAAA,CAAI,GAAJ,CANF,CAHyC,CAA3C,CAYA,CAAAA,CAAA,CAAIzD,CAAA,CAAQ,IAAR,CAAe,GAAnB,CAfF,CALgC,CAD7B,KAwBAqB,QAAQ,CAACxB,CAAD,CAAK,CACdA,CAAA,CAAMpB,CAAAwB,UAAA,CAAkBJ,CAAlB,CACD2D,EAAL,EAAsC,CAAA,CAAtC,GAAeG,CAAA,CAAc9D,CAAd,CAAf,GACE4D,CAAA,CAAI,IAAJ,CAEA,CADAA,CAAA,CAAI5D,CAAJ,CACA,CAAA4D,CAAA,CAAI,GAAJ,CAHF,CAKI5D,EAAJ,EAAW2D,CAAX,GACEA,CADF,CACW,CAAA,CADX,CAPc,CAxBb,OAmCE5E,QAAQ,CAACA,CAAD,CAAO,CACb4E,CAAL;AACEC,CAAA,CAAIL,CAAA,CAAexE,CAAf,CAAJ,CAFgB,CAnCjB,CAHqC,CAha9C,IAAI4D,EAAkB/D,CAAAyF,SAAA,CAAiB,WAAjB,CAAtB,CAwJI3B,EACG,4FAzJP,CA0JEF,EAAiB,2BA1JnB,CA2JEzB,EAAc,yEA3JhB,CA4JE0B,EAAmB,IA5JrB,CA6JEF,EAAyB,SA7J3B,CA8JER,EAAiB,qBA9JnB,CA+JEM,EAAiB,qBA/JnB,CAgKEL,EAAe,yBAhKjB,CAkKEwB,EAA0B,gBAlK5B,CA2KI7C,EAAetB,CAAA,CAAQ,wBAAR,CAIfiF,EAAAA,CAA8BjF,CAAA,CAAQ,gDAAR,CAC9BkF,EAAAA,CAA+BlF,CAAA,CAAQ,OAAR,CADnC,KAEIqB,EAAyB9B,CAAA4F,OAAA,CAAe,EAAf,CACeD,CADf,CAEeD,CAFf,CAF7B,CAOIjE,EAAgBzB,CAAA4F,OAAA,CAAe,EAAf,CAAmBF,CAAnB,CAAgDjF,CAAA,CAAQ,4KAAR,CAAhD,CAPpB;AAYImB,EAAiB5B,CAAA4F,OAAA,CAAe,EAAf,CAAmBD,CAAnB,CAAiDlF,CAAA,CAAQ,2JAAR,CAAjD,CAZrB,CAkBIsC,EAAkBtC,CAAA,CAAQ,cAAR,CAlBtB,CAoBIyE,EAAgBlF,CAAA4F,OAAA,CAAe,EAAf,CACe7D,CADf,CAEeN,CAFf,CAGeG,CAHf,CAIeE,CAJf,CApBpB,CA2BI0D,EAAW/E,CAAA,CAAQ,0CAAR,CA3Bf,CA4BI8E,EAAavF,CAAA4F,OAAA,CAAe,EAAf,CAAmBJ,CAAnB,CAA6B/E,CAAA,CAC1C,ySAD0C,CAA7B,CA5BjB;AA0LI8D,EAAUsB,QAAAC,cAAA,CAAuB,KAAvB,CA1Ld,CA2LI5B,EAAU,wBAsGdlE,EAAA+F,OAAA,CAAe,YAAf,CAA6B,EAA7B,CAAAC,SAAA,CAA0C,WAA1C,CA7UAC,QAA0B,EAAG,CAC3B,IAAAC,KAAA,CAAY,CAAC,eAAD,CAAkB,QAAQ,CAACC,CAAD,CAAgB,CACpD,MAAO,SAAQ,CAAClF,CAAD,CAAO,CACpB,IAAIb,EAAM,EACVY,EAAA,CAAWC,CAAX,CAAiBZ,CAAA,CAAmBD,CAAnB,CAAwB,QAAQ,CAACgG,CAAD,CAAMd,CAAN,CAAe,CAC9D,MAAO,CAAC,SAAA5B,KAAA,CAAeyC,CAAA,CAAcC,CAAd,CAAmBd,CAAnB,CAAf,CADsD,CAA/C,CAAjB,CAGA,OAAOlF,EAAAI,KAAA,CAAS,EAAT,CALa,CAD8B,CAA1C,CADe,CA6U7B,CAuGAR,EAAA+F,OAAA,CAAe,YAAf,CAAAM,OAAA,CAAoC,OAApC,CAA6C,CAAC,WAAD,CAAc,QAAQ,CAACC,CAAD,CAAY,CAAA,IACzEC,EACE,mEAFuE,CAGzEC,EAAgB,UAEpB,OAAO,SAAQ,CAACtD,CAAD,CAAOuD,CAAP,CAAe,CAoB5BC,QAASA,EAAO,CAACxD,CAAD,CAAO,CAChBA,CAAL,EAGAjC,CAAAe,KAAA,CAAU9B,CAAA,CAAagD,CAAb,CAAV,CAJqB,CAOvByD,QAASA,EAAO,CAACC,CAAD,CAAM1D,CAAN,CAAY,CAC1BjC,CAAAe,KAAA,CAAU,KAAV,CACIhC,EAAA6G,UAAA,CAAkBJ,CAAlB,CAAJ;CACExF,CAAAe,KAAA,CAAU,UAAV,CAEA,CADAf,CAAAe,KAAA,CAAUyE,CAAV,CACA,CAAAxF,CAAAe,KAAA,CAAU,IAAV,CAHF,CAKAf,EAAAe,KAAA,CAAU,QAAV,CACAf,EAAAe,KAAA,CAAU4E,CAAV,CACA3F,EAAAe,KAAA,CAAU,IAAV,CACA0E,EAAA,CAAQxD,CAAR,CACAjC,EAAAe,KAAA,CAAU,MAAV,CAX0B,CA1B5B,GAAI,CAACkB,CAAL,CAAW,MAAOA,EAMlB,KALA,IAAId,CAAJ,CACI0E,EAAM5D,CADV,CAEIjC,EAAO,EAFX,CAGI2F,CAHJ,CAII9F,CACJ,CAAQsB,CAAR,CAAgB0E,CAAA1E,MAAA,CAAUmE,CAAV,CAAhB,CAAA,CAEEK,CAMA,CANMxE,CAAA,CAAM,CAAN,CAMN,CAJIA,CAAA,CAAM,CAAN,CAIJ,EAJgBA,CAAA,CAAM,CAAN,CAIhB,GAJ0BwE,CAI1B,CAJgC,SAIhC,CAJ4CA,CAI5C,EAHA9F,CAGA,CAHIsB,CAAAS,MAGJ,CAFA6D,CAAA,CAAQI,CAAAC,OAAA,CAAW,CAAX,CAAcjG,CAAd,CAAR,CAEA,CADA6F,CAAA,CAAQC,CAAR,CAAaxE,CAAA,CAAM,CAAN,CAAAF,QAAA,CAAiBsE,CAAjB,CAAgC,EAAhC,CAAb,CACA,CAAAM,CAAA,CAAMA,CAAAtD,UAAA,CAAc1C,CAAd,CAAkBsB,CAAA,CAAM,CAAN,CAAArB,OAAlB,CAER2F,EAAA,CAAQI,CAAR,CACA,OAAOR,EAAA,CAAUrF,CAAAT,KAAA,CAAU,EAAV,CAAV,CAlBqB,CAL+C,CAAlC,CAA7C,CAzjBsC,CAArC,CAAA,CA0mBET,MA1mBF,CA0mBUA,MAAAC,QA1mBV;", +"sources":["angular-sanitize.js"], +"names":["window","angular","undefined","sanitizeText","chars","buf","htmlSanitizeWriter","writer","noop","join","makeMap","str","obj","items","split","i","length","htmlParser","html","handler","parseStartTag","tag","tagName","rest","unary","lowercase","blockElements","stack","last","inlineElements","parseEndTag","optionalEndTagElements","voidElements","push","attrs","replace","ATTR_REGEXP","match","name","doubleQuotedValue","singleQuotedValue","unquotedValue","decodeEntities","start","pos","end","index","stack.last","specialElements","RegExp","all","text","COMMENT_REGEXP","CDATA_REGEXP","indexOf","lastIndexOf","comment","substring","DOCTYPE_REGEXP","test","BEGING_END_TAGE_REGEXP","END_TAG_REGEXP","BEGIN_TAG_REGEXP","START_TAG_REGEXP","$sanitizeMinErr","value","parts","spaceRe","exec","spaceBefore","spaceAfter","content","hiddenPre","innerHTML","textContent","innerText","encodeEntities","NON_ALPHANUMERIC_REGEXP","charCodeAt","uriValidator","ignore","out","bind","validElements","forEach","key","lkey","isImage","validAttrs","uriAttrs","$$minErr","optionalEndTagBlockElements","optionalEndTagInlineElements","extend","document","createElement","module","provider","$SanitizeProvider","$get","$$sanitizeUri","uri","filter","$sanitize","LINKY_URL_REGEXP","MAILTO_REGEXP","target","addText","addLink","url","isDefined","raw","substr"] +} \ No newline at end of file diff --git a/setup/pub/angular/angular.min.js b/setup/pub/angular/angular.min.js index 32f1b23d746fe..c7d2ea7388e33 100644 --- a/setup/pub/angular/angular.min.js +++ b/setup/pub/angular/angular.min.js @@ -209,3 +209,4 @@ c(k[2]?k[1]:m),y=c(k[7]),w=k[8]?c(k[8]):null,x=[[{element:f,label:""}]];D&&(a(D) c[v],w(e,d)==h){k=q(e,d);break}}else d[m]=c[h],n&&(d[n]=h),k=q(e,d);1@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}'); +//# sourceMappingURL=angular.min.js.map From 571047afabc6fbb2bd466e107fa25f56d4ea332f Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Fri, 16 Sep 2016 17:00:07 +0300 Subject: [PATCH 0772/3232] MAGETWO-58457: Can not install Magento 2.1.1 via GUI from composer project --- setup/pub/angular-clickout/angular-clickout.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/pub/angular-clickout/angular-clickout.min.js b/setup/pub/angular-clickout/angular-clickout.min.js index 87f0465fdecee..093193c46538a 100644 --- a/setup/pub/angular-clickout/angular-clickout.min.js +++ b/setup/pub/angular-clickout/angular-clickout.min.js @@ -1,3 +1,3 @@ /*! Angular clickout v1.0.2 | © 2014 Greg Bergé | License MIT */ !function(a,b,c){"use strict";b.module("clickOut",[]).directive("clickOut",["$window","$parse",function(a,c){return{restrict:"A",link:function(d,e,f){var g=c(f.clickOut);b.element(a).on("click",function(a){e[0].contains(a.target)||(g(d,{$event:a}),d.$apply())})}}}])}(window,window.angular); -//# sourceMappingURL=angular-clickouts.min.js.map \ No newline at end of file +//# sourceMappingURL=angular-clickout.min.js.map \ No newline at end of file From 1bd39c84c1300c98cabf79f9417bad20ba4caf97 Mon Sep 17 00:00:00 2001 From: Vitalii Korotun Date: Fri, 16 Sep 2016 17:04:32 +0300 Subject: [PATCH 0773/3232] MAGETWO-56552: [GITHUB PR#4733] Escape Js Quote for layout updates - fix Unit tests --- .../Test/Unit/Element/Html/SelectTest.php | 199 +++++++----------- 1 file changed, 76 insertions(+), 123 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/SelectTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/SelectTest.php index 96d4f9854a208..5e3bc19a25977 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/SelectTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/SelectTest.php @@ -29,12 +29,6 @@ protected function setUp() $this->escaper = $this->getMockBuilder(\Magento\Framework\Escaper::class) ->disableOriginalConstructor() ->getMock(); - $this->escaper->expects($this->any()) - ->method('escapeHtml') - ->will($this->returnArgument(0)); - $this->escaper->expects($this->any()) - ->method('escapeHtmlAttr') - ->will($this->returnArgument(0)); $context = $this->getMockBuilder(\Magento\Framework\View\Element\Context::class) ->disableOriginalConstructor() @@ -103,6 +97,13 @@ public function testGetSetTitle() public function testGetHtmlJs() { + $this->escaper->expects($this->any()) + ->method('escapeHtml') + ->will($this->returnArgument(0)); + $this->escaper->expects($this->any()) + ->method('escapeHtmlAttr') + ->will($this->returnArgument(0)); + $selectId = 'testId'; $selectClass = 'testClass'; $selectTitle = 'testTitle'; @@ -133,6 +134,13 @@ public function testGetHtmlJs() public function testGetHtml() { + $this->escaper->expects($this->any()) + ->method('escapeHtml') + ->will($this->returnArgument(0)); + $this->escaper->expects($this->any()) + ->method('escapeHtmlAttr') + ->will($this->returnArgument(0)); + $selectId = 'testId'; $selectClass = 'testClass'; $selectTitle = 'testTitle'; @@ -190,9 +198,16 @@ public function testGetHtmlEscapes() $this->getOptionsWithDoubleQuotes() ]; - foreach ($optionsSets as $optionsSet) { - $inOptions = $optionsSet['in']; + $expectedResult = ''; + foreach ($optionsSets as $inOptions) { $this->select->setId($inOptions['id']); $this->select->setClass($inOptions['class']); $this->select->setTitle($inOptions['title']); @@ -203,140 +218,78 @@ public function testGetHtmlEscapes() } $this->select->setValue($inOptions['values']); - $result = $this->prepareResult($optionsSet['out']); - - $this->assertEquals($result, $this->select->getHtml()); + $this->assertEquals($expectedResult, $this->select->getHtml()); // reset $this->select->setOptions([]); } } - private function prepareResult(array $optionSet) - { - $result = ''; - - return $result; - } - + /** + * @return array + */ private function getOptionsWithSingleQuotes() { return [ - 'in' => [ - 'id' => "test'Id", - 'class' => "test'Class", - 'title' => "test'Title", - 'name' => "test'Name", - 'options' => [ - 'regular' => [ - 'value' => 'testValue', - 'label' => "test'Label", - 'params' => ['paramKey' => "param'Value"] - ], - 'selected' => [ - 'value' => 'selectedValue', - 'label' => "selected'Label" - ], - 'optgroup' => [ - 'value' => [ - 'groupElementValue' => "GroupElement'Label", - 'selectedGroupElementValue' => "SelectedGroupElement'Label" - ], - 'label' => "group'Label" - ] + 'id' => "test'Id", + 'class' => "test'Class", + 'title' => "test'Title", + 'name' => "test'Name", + 'options' => [ + 'regular' => [ + 'value' => 'testValue', + 'label' => "test'Label", + 'params' => ['paramKey' => "param'Value"] ], - 'values' => ['selectedValue', 'selectedGroupElementValue'] - ], - 'out' => [ - 'id' => 'ESCAPED_ATTR', - 'class' => 'ESCAPED_ATTR', - 'title' => 'ESCAPED_ATTR', - 'name' => 'ESCAPED_ATTR', - 'options' => [ - 'regular' => [ - 'value' => 'testValue', - 'label' => 'ESCAPED', - 'params' => ['paramKey' => 'ESCAPED_ATTR'] - ], - 'selected' => [ - 'value' => 'selectedValue', - 'label' => 'ESCAPED' - ], - 'optgroup' => [ - 'value' => [ - 'groupElementValue' => 'ESCAPED', - 'selectedGroupElementValue' => 'ESCAPED' - ], - 'label' => 'ESCAPED_ATTR' - ] + 'selected' => [ + 'value' => 'selectedValue', + 'label' => "selected'Label", + 'params' => [] ], - 'values' => ['selectedValue', 'selectedGroupElementValue'] - ] + 'optgroup' => [ + 'value' => [ + 'groupElementValue' => "GroupElement'Label", + 'selectedGroupElementValue' => "SelectedGroupElement'Label" + ], + 'label' => "group'Label", + 'params' => [] + ] + ], + 'values' => ['selectedValue', 'selectedGroupElementValue'] ]; } + /** + * @return array + */ private function getOptionsWithDoubleQuotes() { return [ - 'in' => [ - 'id' => 'test"Id', - 'class' => 'test"Class', - 'title' => 'test"Title', - 'name' => 'test"Name', - 'options' => [ - 'regular' => [ - 'value' => 'testValue', - 'label' => 'test"Label', - 'params' => ['paramKey' => 'param"Value'] - ], - 'selected' => [ - 'value' => 'selectedValue', - 'label' => 'selected"Label' - ], - 'optgroup' => [ - 'value' => [ - 'groupElementValue' => 'GroupElement"Label', - 'selectedGroupElementValue' => 'SelectedGroupElement"Label' - ], - 'label' => 'group"Label' - ] + 'id' => 'test"Id', + 'class' => 'test"Class', + 'title' => 'test"Title', + 'name' => 'test"Name', + 'options' => [ + 'regular' => [ + 'value' => 'testValue', + 'label' => 'test"Label', + 'params' => ['paramKey' => 'param"Value'] ], - 'values' => ['selectedValue', 'selectedGroupElementValue'] - ], - 'out' => [ - 'id' => 'ESCAPED_ATTR', - 'class' => 'ESCAPED_ATTR', - 'title' => 'ESCAPED_ATTR', - 'name' => 'ESCAPED_ATTR', - 'options' => [ - 'regular' => [ - 'value' => 'testValue', - 'label' => 'ESCAPED', - 'params' => ['paramKey' => 'ESCAPED_ATTR'] - ], - 'selected' => [ - 'value' => 'selectedValue', - 'label' => 'ESCAPED' - ], - 'optgroup' => [ - 'value' => [ - 'groupElementValue' => 'ESCAPED', - 'selectedGroupElementValue' => 'ESCAPED' - ], - 'label' => 'ESCAPED_ATTR' - ] + 'selected' => [ + 'value' => 'selectedValue', + 'label' => 'selected"Label', + 'params' => [] ], - 'values' => ['selectedValue', 'selectedGroupElementValue'] - ] + 'optgroup' => [ + 'value' => [ + 'groupElementValue' => 'GroupElement"Label', + 'selectedGroupElementValue' => 'SelectedGroupElement"Label' + ], + 'label' => 'group"Label', + 'params' => [] + ] + ], + 'values' => ['selectedValue', 'selectedGroupElementValue'] ]; } } From f1baac032543a8defb9eec4c35d14a7619db0181 Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Fri, 16 Sep 2016 17:17:42 +0300 Subject: [PATCH 0774/3232] =?UTF-8?q?MAGETWO-57923:=20=E2=80=9CNo=20Paymen?= =?UTF-8?q?t=20method=20available=E2=80=9D=20when=20customer=20tries=20to?= =?UTF-8?q?=20ship=20his=20items=20to=20billing=20restricted=20country?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added billing address change action for useShippingAddress method --- .../Checkout/view/frontend/web/js/view/billing-address.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index 517231cf888f2..0c2e7fb01c701 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -128,9 +128,7 @@ define( if (this.isAddressSameAsShipping()) { selectBillingAddress(quote.shippingAddress()); - if (window.checkoutConfig.reloadOnBillingAddress) { - setBillingAddressAction(globalMessageList); - } + this.updateAddresses(); this.isAddressDetailsVisible(true); } else { lastSelectedBillingAddress = quote.billingAddress(); From 2554f1e8b79f41a7205ba9cc0fe013d2838888a4 Mon Sep 17 00:00:00 2001 From: Yurii Hryhoriev Date: Fri, 16 Sep 2016 17:26:24 +0300 Subject: [PATCH 0775/3232] MAGETWO-47698: [Github] Custom options not displayed correctly on a store view level #2908 #5885 - tests stabilization --- .../Model/Product/Type/Configurable/PriceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php index 053e33da09fe9..649224015a1cb 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php @@ -91,7 +91,7 @@ public function testGetFinalPriceWithCustomOption() [ [ 'id' => 1, - 'option_id' => 0, + 'option_id' => null, 'previous_group' => 'text', 'title' => 'Test Field', 'type' => 'field', From ba7488d5798a4b1dcdd0e2f4a0bb437c3303f7af Mon Sep 17 00:00:00 2001 From: Yurii Hryhoriev Date: Fri, 16 Sep 2016 18:09:43 +0300 Subject: [PATCH 0776/3232] MAGETWO-47698: [Github] Custom options not displayed correctly on a store view level #2908 #5885 - tests stabilization --- .../Model/Product/Type/Configurable/PriceTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php index 649224015a1cb..6322a60cef8a5 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php @@ -90,7 +90,6 @@ public function testGetFinalPriceWithCustomOption() $options = $this->prepareOptions( [ [ - 'id' => 1, 'option_id' => null, 'previous_group' => 'text', 'title' => 'Test Field', From 8b5f17dc64341db4f02949bf67112c3a3f112503 Mon Sep 17 00:00:00 2001 From: Vitalii Korotun Date: Fri, 16 Sep 2016 18:21:27 +0300 Subject: [PATCH 0777/3232] MAGETWO-56552: [GITHUB PR#4733] Escape Js Quote for layout updates - fix Unit tests --- .../Framework/View/Element/Html/Select.php | 16 ++++++++-------- .../View/Test/Unit/Element/Html/SelectTest.php | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Element/Html/Select.php b/lib/internal/Magento/Framework/View/Element/Html/Select.php index 5ca493032e05f..7e0c07ff75e45 100644 --- a/lib/internal/Magento/Framework/View/Element/Html/Select.php +++ b/lib/internal/Magento/Framework/View/Element/Html/Select.php @@ -134,13 +134,13 @@ protected function _toHtml() } $html = '' - . '' + $expectedResult = '
    '; $html .= ' '; $html .= ''; $expected .= ' '; $expected .= ''; diff --git a/app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php b/app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php index 788c7788cccd1..2c671914f264b 100644 --- a/app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php +++ b/app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php @@ -8,6 +8,15 @@ namespace Magento\Config\Test\Unit\Block\System\Config; +use Magento\Config\Model\Config\Reader\Source\Deployed\SettingChecker; +use Magento\Framework\App\DeploymentConfig; + +/** + * Test System config form block + * + * @package Magento\Config\Test\Unit\Block\System\Config + */ + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -178,6 +187,20 @@ protected function setUp() $this->_objectBuilder = $this->getMockBuilder(\Magento\Config\Block\System\Config\Form::class) ->setConstructorArgs($objectArguments) ->setMethods(['something']); + $deploymentConfigMock = $this->getMockBuilder(DeploymentConfig::class) + ->disableOriginalConstructor() + ->getMock(); + $deploymentConfigMock->expects($this->any()) + ->method('get') + ->willReturn([]); + + $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); + $objectManagerMock->expects($this->any()) + ->method('get') + ->willReturnMap([ + [DeploymentConfig::class, $deploymentConfigMock] + ]); + \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock); $this->object = $helper->getObject(\Magento\Config\Block\System\Config\Form::class, $data); $this->object->setData('scope_id', 1); } @@ -549,10 +572,12 @@ public function testInitFields( 'field_config' => 'fieldData', 'scope' => 'stores', 'scope_id' => 1, - 'scope_label' => '[GLOBAL]', + 'scope_label' => __('[GLOBAL]'), 'can_use_default_value' => false, 'can_use_website_value' => false, 'can_restore_to_default' => false, + 'disabled' => false, + 'is_disable_inheritance' => false ]; $formFieldMock->expects($this->once())->method('setRenderer')->with($fieldRendererMock); @@ -571,6 +596,18 @@ public function testInitFields( $fieldMock->expects($this->once())->method('populateInput'); + + $settingChecker = $this->getMockBuilder(SettingChecker::class) + ->disableOriginalConstructor() + ->getMock(); + $settingChecker->expects($this->once()) + ->method('isReadOnly') + ->willReturn(false); + $reflection = new \ReflectionClass(get_class($this->object)); + $reflectionProperty = $reflection->getProperty('settingChecker'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->object, $settingChecker); + $this->object->initFields($fieldsetMock, $groupMock, $sectionMock, $fieldPrefix, $labelPrefix); } diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/LoaderTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/LoaderTest.php index 6047aa4c06afb..69d4b01526a21 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/LoaderTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/LoaderTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Config\Test\Unit\Model\Config; +/** + * @package Magento\Config\Test\Unit\Model\Config + */ class LoaderTest extends \PHPUnit_Framework_TestCase { /** @@ -32,7 +35,6 @@ protected function setUp() false ); $this->_model = new \Magento\Config\Model\Config\Loader($this->_configValueFactory); - $this->_configCollection = $this->getMock( \Magento\Config\Model\ResourceModel\Config\Data\Collection::class, [], diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Reader/Source/Deployed/SettingCheckerTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Reader/Source/Deployed/SettingCheckerTest.php new file mode 100644 index 0000000000000..08315d0a64a05 --- /dev/null +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Reader/Source/Deployed/SettingCheckerTest.php @@ -0,0 +1,59 @@ +config = $this->getMockBuilder(DeploymentConfig::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->checker = new SettingChecker($this->config); + } + + public function testIsDefined() + { + $path = 'general/web/locale'; + $scope = 'website'; + $scopeCode = 'myWebsite'; + + $this->config->expects($this->once()) + ->method('get') + ->willReturn([ + $scope => [ + $scopeCode => [ + $path => 'value' + ], + ], + + ]); + + $this->assertTrue($this->checker->isReadOnly($path, $scope)); + } +} diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json index bdd1a9c14ae68..54f25860572d0 100644 --- a/app/code/Magento/Config/composer.json +++ b/app/code/Magento/Config/composer.json @@ -11,6 +11,9 @@ "magento/module-backend": "100.2.*", "magento/module-media-storage": "100.2.*" }, + "suggest": { + "magento/module-deploy": "100.2.*" + }, "type": "magento2-module", "version": "100.2.0-dev", "license": [ diff --git a/app/code/Magento/Config/etc/di.xml b/app/code/Magento/Config/etc/di.xml index 9a72ebcb16609..c2b3055da2c67 100644 --- a/app/code/Magento/Config/etc/di.xml +++ b/app/code/Magento/Config/etc/di.xml @@ -69,4 +69,96 @@ Magento\Config\Model\ResourceModel\Config\Data\Collection\Proxy + + + + Magento\Config\App\Config\Type\System + + + + + + systemConfigSourceAggregatedProxy + systemConfigPostProcessorCompositeProxy + Magento\Framework\App\Cache\Type\Config + + + + + modulesDataProvider + + + + + Magento\Framework\App\DeploymentConfig\Reader + Magento\Framework\Config\ConfigOptionsListConstants::KEY_MODULES + Magento\Framework\Config\File\ConfigFilePool::APP_CONFIG + + + + + systemConfigPostProcessorComposite + + + + + systemConfigSourceAggregated + + + + + + Magento\Store\Model\Config\Processor\Placeholder + + + + + + + + Magento\Config\App\Config\Source\ModularConfigSource + 10 + + + Magento\Config\App\Config\Source\RuntimeConfigSource + 100 + + + systemConfigInitialDataProvider + 1000 + + + + + + + Magento\Framework\App\DeploymentConfig\Reader + Magento\Config\App\Config\Type\System::CONFIG_TYPE + Magento\Framework\Config\File\ConfigFilePool::APP_CONFIG + + + + + + + systemConfigInitialDataProvider + 10 + + + Magento\Config\App\Config\Source\RuntimeConfigSource + 1000 + + + + + + + + + appDumpSystemSource + Magento\Config\App\Config\Type\System::CONFIG_TYPE + + + + diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurationsTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurationsTest.php index def49f42fa960..c027a90993b8d 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurationsTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurationsTest.php @@ -69,10 +69,14 @@ protected function setUp() ); } - public function testAfterInitialize() + /** + * Prepare configurable matrix + * + * @return array + */ + private function getConfigurableMatrix() { - $productMock = $this->getProductMock(); - $configurableMatrix = [ + return [ [ 'newProduct' => true, 'id' => 'product1' @@ -109,6 +113,12 @@ public function testAfterInitialize() 'weight' => '5.55', ], ]; + } + + public function testAfterInitialize() + { + $productMock = $this->getProductMock(); + $configurableMatrix = $this->getConfigurableMatrix(); $configurations = [ 'product2' => [ 'status' => 'simple2_status', diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php b/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php index e93978d968366..90c0f2c496605 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/Reader/DbTest.php @@ -5,10 +5,15 @@ */ namespace Magento\Cron\Test\Unit\Model\Config\Reader; +/** + * Test reading for cron parameters from data base storage + * + * @package Magento\Cron\Test\Unit\Model\Config\Reader + */ class DbTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Store\Model\Config\Reader\DefaultReader|\PHPUnit_Framework_MockObject_MockObject + * @var \PHPUnit_Framework_MockObject_MockObject */ protected $_defaultReader; @@ -28,8 +33,8 @@ class DbTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_defaultReader = $this->getMockBuilder( - \Magento\Store\Model\Config\Reader\DefaultReader::class - )->disableOriginalConstructor()->getMock(); + \Magento\Framework\App\Config\Scope\ReaderInterface::class + )->getMockForAbstractClass(); $this->_converter = new \Magento\Cron\Model\Config\Converter\Db(); $this->_reader = new \Magento\Cron\Model\Config\Reader\Db($this->_defaultReader, $this->_converter); } diff --git a/app/code/Magento/Cron/etc/di.xml b/app/code/Magento/Cron/etc/di.xml index 740eff2aed432..a1fcb7dc80c79 100644 --- a/app/code/Magento/Cron/etc/di.xml +++ b/app/code/Magento/Cron/etc/di.xml @@ -10,7 +10,7 @@ - Magento\Store\Model\Config\Reader\DefaultReader + DefaultScopeReader diff --git a/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php b/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php new file mode 100644 index 0000000000000..b4e4fef8fb2f9 --- /dev/null +++ b/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php @@ -0,0 +1,83 @@ +writer = $writer; + $this->sources = $sources; + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('app:config:dump'); + $this->setDescription('Create dump of application'); + parent::configure(); + } + + /** + * Dump Application + * + * @param InputInterface $input + * @param OutputInterface $output + * @return boolean + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $dump = []; + foreach ($this->sources as $sourceData) { + /** @var SourceInterface $source */ + $source = $sourceData['source']; + $namespace = $sourceData['namespace']; + $dump[$namespace] = $source->get(); + } + + $this->writer + ->saveConfig( + [ConfigFilePool::APP_CONFIG => $dump], + true, + ConfigFilePool::LOCAL + ); + $output->writeln('Done.'); + return Cli::RETURN_SUCCESS; + } +} diff --git a/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php b/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php index aa112a7001331..c879a512d26c2 100644 --- a/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php +++ b/app/code/Magento/Deploy/Model/Deploy/LocaleDeploy.php @@ -6,11 +6,13 @@ namespace Magento\Deploy\Model\Deploy; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\Utility\Files; use Magento\Framework\App\View\Asset\Publisher; use Magento\Framework\View\Asset\ContentProcessorException; use Magento\Framework\View\Asset\PreProcessor\AlternativeSourceInterface; use Magento\Framework\View\Design\Theme\ThemeProviderInterface; +use Magento\Framework\View\Design\Theme\ListInterface; use Symfony\Component\Console\Output\OutputInterface; use Magento\Framework\Config\Theme; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; @@ -20,6 +22,8 @@ use Magento\Framework\Console\Cli; /** + * Class which allows deploy by locales + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) */ @@ -115,6 +119,11 @@ class LocaleDeploy implements DeployInterface */ private $alternativeSources; + /** + * @var ListInterface + */ + private $themeList; + /** * @var array */ @@ -242,7 +251,10 @@ public function deploy($area, $themePath, $locale) private function deployRequireJsConfig($area, $themePath) { if (!$this->getOption(Options::DRY_RUN) && !$this->getOption(Options::NO_JAVASCRIPT)) { - $design = $this->designFactory->create()->setDesignTheme($themePath, $area); + + /** @var \Magento\Framework\View\Design\ThemeInterface $theme */ + $theme = $this->getThemeList()->getThemeByFullPath($area . '/' . $themePath); + $design = $this->designFactory->create()->setDesignTheme($theme, $area); $assetRepo = $this->assetRepoFactory->create(['design' => $design]); /** @var \Magento\RequireJs\Model\FileManager $fileManager */ $fileManager = $this->fileManagerFactory->create( @@ -450,4 +462,16 @@ private function findAncestors($themeFullPath) } return $ancestorThemeFullPath; } + + /** + * @deprecated + * @return ListInterface + */ + private function getThemeList() + { + if ($this->themeList === null) { + $this->themeList = ObjectManager::getInstance()->get(ListInterface::class); + } + return $this->themeList; + } } diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php new file mode 100644 index 0000000000000..686cf19d8f311 --- /dev/null +++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php @@ -0,0 +1,91 @@ +input = $this->getMockBuilder(InputInterface::class) + ->getMockForAbstractClass(); + $this->output = $this->getMockBuilder(OutputInterface::class) + ->getMockForAbstractClass(); + $this->writer = $this->getMockBuilder(Writer::class) + ->disableOriginalConstructor() + ->getMock(); + $this->source = $this->getMockBuilder(SourceInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->command = new ApplicationDumpCommand($this->writer, [[ + 'namespace' => 'system', + 'source' => $this->source + ]]); + } + + public function testExport() + { + $dump = [ + 'system' => ['systemDATA'] + ]; + $data = [ConfigFilePool::APP_CONFIG => $dump]; + $this->source + ->expects($this->once()) + ->method('get') + ->willReturn(['systemDATA']); + $this->output->expects($this->once()) + ->method('writeln') + ->with('Done.'); + $this->writer->expects($this->once()) + ->method('saveConfig') + ->with($data); + $method = new \ReflectionMethod(ApplicationDumpCommand::class, 'execute'); + $method->setAccessible(true); + $this->assertEquals( + Cli::RETURN_SUCCESS, + $method->invokeArgs( + $this->command, + [$this->input, $this->output] + ) + ); + } +} diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleDeployTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleDeployTest.php index 757da133ddbc3..f43c8f111146c 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleDeployTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Deploy/LocaleDeployTest.php @@ -5,210 +5,134 @@ */ namespace Magento\Deploy\Test\Unit\Model\Deploy; +use Magento\Deploy\Model\Deploy\LocaleDeploy; use Magento\Framework\App\Utility\Files; use Magento\Framework\App\View\Asset\Publisher; use Magento\Framework\Translate\Js\Config; use Magento\Framework\View\Asset\Minification; use Magento\Framework\View\Asset\Repository; use Magento\Framework\View\Asset\RepositoryFactory; +use Magento\RequireJs\Model\FileManagerFactory; +use Magento\Framework\RequireJs\ConfigFactory; +use Magento\Framework\View\Asset\Bundle\Manager; +use Magento\Framework\View\Design\Theme\ThemeProviderInterface; +use Magento\Framework\View\DesignInterfaceFactory; +use Magento\Framework\Locale\ResolverInterface; +use Magento\Framework\View\Design\Theme\ListInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Output\OutputInterface; /** + * Test class which allows deploy by locales * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class LocaleDeployTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|Config + * @var string */ - private $jsTranslationMock; + private $area; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Minification + * @var string */ - private $minificationMock; + private $locale; /** - * @var \PHPUnit_Framework_MockObject_MockObject|RepositoryFactory + * @var string */ - private $assetRepoFactoryMock; + private $themePath; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\RequireJs\Model\FileManagerFactory + * @var \Magento\Deploy\Model\Deploy\LocaleDeploy */ - private $fileManagerFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\RequireJs\ConfigFactory - */ - private $configFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\View\Asset\Bundle\Manager - */ - private $bundleManagerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|Files - */ - private $filesUtilMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\View\DesignInterfaceFactory - */ - private $designFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Locale\ResolverInterface - */ - private $localeResolverMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|OutputInterface - */ - private $outputMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|LoggerInterface - */ - private $loggerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $assetRepoMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $assetPublisherMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $themeProviderMock; + private $model; protected function setUp() { - $this->outputMock = $this->getMock(OutputInterface::class, [], [], '', false); - $this->loggerMock = $this->getMock(LoggerInterface::class, [], [], '', false); - $this->filesUtilMock = $this->getMock(Files::class, [], [], '', false); - $this->assetRepoMock = $this->getMock(Repository::class, [], [], '', false); - $this->minificationMock = $this->getMock(Minification::class, [], [], '', false); - $this->jsTranslationMock = $this->getMock(Config::class, [], [], '', false); - $this->assetPublisherMock = $this->getMock(Publisher::class, [], [], '', false); - $this->assetRepoFactoryMock = $this->getMock( - RepositoryFactory::class, - ['create'], - [], - '', - false - ); - $this->fileManagerFactoryMock = $this->getMock( - \Magento\RequireJs\Model\FileManagerFactory::class, - ['create'], - [], - '', - false - ); - $this->configFactoryMock = $this->getMock( - \Magento\Framework\RequireJs\ConfigFactory::class, - ['create'], - [], - '', - false - ); - $this->bundleManagerMock = $this->getMock( - \Magento\Framework\View\Asset\Bundle\Manager::class, - [], - [], - '', - false - ); - $this->themeProviderMock = $this->getMock( - \Magento\Framework\View\Design\Theme\ThemeProviderInterface::class, - [], - [], - '', - false - ); - $this->designFactoryMock = $this->getMock( - \Magento\Framework\View\DesignInterfaceFactory::class, - ['create'], - [], - '', - false - ); - $this->localeResolverMock = $this->getMock( - \Magento\Framework\Locale\ResolverInterface::class, - [], - [], - '', - false - ); - } - - public function testDeploy() - { - $area = 'adminhtml'; - $themePath = '/theme/path'; - $locale = 'en_US'; - + $this->area = 'adminhtml'; + $this->themePath = '/theme/path'; + $this->locale = 'en_US'; + + $outputMock = $this->getMock(OutputInterface::class, [], [], '', false); + $jsTranslationMock = $this->getMock(Config::class, [], [], '', false); + $jsTranslationMock->expects($this->once())->method('dictionaryEnabled')->willReturn(false); + $minificationMock = $this->getMock(Minification::class, [], [], '', false); + $minificationMock->expects($this->once())->method('isEnabled')->with('js')->willReturn(true); + + $themeMock = $this->getMockBuilder(\Magento\Framework\View\Design\ThemeInterface::class) + ->disableOriginalConstructor() + ->getMock(); $designMock = $this->getMock(\Magento\Framework\View\DesignInterface::class, [], [], '', false); + $designMock->expects($this->once())->method('setDesignTheme')->with($themeMock, $this->area)->willReturnSelf(); $assetRepoMock = $this->getMock(Repository::class, [], [], '', false); - $requireJsConfigMock = $this->getMock(\Magento\Framework\RequireJs\Config::class, [], [], '', false); - $fileManagerMock = $this->getMock(\Magento\RequireJs\Model\FileManager::class, [], [], '', false); - - $model = $this->getModel([\Magento\Deploy\Console\Command\DeployStaticOptionsInterface::NO_JAVASCRIPT => 0]); - - $this->localeResolverMock->expects($this->once())->method('setLocale')->with($locale); - $this->designFactoryMock->expects($this->once())->method('create')->willReturn($designMock); - $designMock->expects($this->once())->method('setDesignTheme')->with($themePath, $area)->willReturnSelf(); - $this->assetRepoFactoryMock->expects($this->once())->method('create')->with(['design' => $designMock]) + $assetRepoFactoryMock = $this->getMock(RepositoryFactory::class, ['create'], [], '', false); + $assetRepoFactoryMock->expects($this->once()) + ->method('create') + ->with(['design' => $designMock]) ->willReturn($assetRepoMock); - $this->configFactoryMock->expects($this->once())->method('create')->willReturn($requireJsConfigMock); - $this->fileManagerFactoryMock->expects($this->once())->method('create')->willReturn($fileManagerMock); + $fileManagerMock = $this->getMock(\Magento\RequireJs\Model\FileManager::class, [], [], '', false); $fileManagerMock->expects($this->once())->method('createRequireJsConfigAsset')->willReturnSelf(); - $this->filesUtilMock->expects($this->once())->method('getStaticPreProcessingFiles')->willReturn([]); - $this->filesUtilMock->expects($this->once())->method('getStaticLibraryFiles')->willReturn([]); - - $this->jsTranslationMock->expects($this->once())->method('dictionaryEnabled')->willReturn(false); - $this->minificationMock->expects($this->once())->method('isEnabled')->with('js')->willReturn(true); $fileManagerMock->expects($this->once())->method('createMinResolverAsset')->willReturnSelf(); + $fileManagerFactoryMock = $this->getMock(FileManagerFactory::class, ['create'], [], '', false); + $fileManagerFactoryMock->expects($this->once())->method('create')->willReturn($fileManagerMock); - $this->bundleManagerMock->expects($this->once())->method('flush'); - - $this->assertEquals( - \Magento\Framework\Console\Cli::RETURN_SUCCESS, - $model->deploy($area, $themePath, $locale) + $requireJsConfigMock = $this->getMock(\Magento\Framework\RequireJs\Config::class, [], [], '', false); + $configFactoryMock = $this->getMock(ConfigFactory::class, ['create'], [], '', false); + $configFactoryMock->expects($this->once())->method('create')->willReturn($requireJsConfigMock); + + $assetPublisherMock = $this->getMock(Publisher::class, [], [], '', false); + + $bundleManagerMock = $this->getMock(Manager::class, [], [], '', false); + $bundleManagerMock->expects($this->once())->method('flush'); + + $themeProviderMock = $this->getMock(ThemeProviderInterface::class, [], [], '', false); + $loggerMock = $this->getMock(LoggerInterface::class, [], [], '', false); + + $filesUtilMock = $this->getMock(Files::class, [], [], '', false); + $filesUtilMock->expects($this->once())->method('getStaticPreProcessingFiles')->willReturn([]); + $filesUtilMock->expects($this->once())->method('getStaticLibraryFiles')->willReturn([]); + + $designFactoryMock = $this->getMock(DesignInterfaceFactory::class, ['create'], [], '', false); + $designFactoryMock->expects($this->once())->method('create')->willReturn($designMock); + + $localeResolverMock = $this->getMock(ResolverInterface::class, [], [], '', false); + $localeResolverMock->expects($this->once())->method('setLocale')->with($this->locale); + + $themeList = $this->getMock(ListInterface::class, [], [], '', false); + $themeList->expects($this->once())->method('getThemeByFullPath') + ->with($this->area . '/' . $this->themePath) + ->willReturn($themeMock); + + $this->model = new LocaleDeploy( + $outputMock, + $jsTranslationMock, + $minificationMock, + $assetRepoMock, + $assetRepoFactoryMock, + $fileManagerFactoryMock, + $configFactoryMock, + $assetPublisherMock, + $bundleManagerMock, + $themeProviderMock, + $loggerMock, + $filesUtilMock, + $designFactoryMock, + $localeResolverMock, + [], + [\Magento\Deploy\Console\Command\DeployStaticOptionsInterface::NO_JAVASCRIPT => 0] ); + $property = new \ReflectionProperty(get_class($this->model), 'themeList'); + $property->setAccessible(true); + $property->setValue($this->model, $themeList); } - /** - * @param array $options - * @return \Magento\Deploy\Model\Deploy\LocaleDeploy - */ - private function getModel($options = []) + public function testDeploy() { - return new \Magento\Deploy\Model\Deploy\LocaleDeploy( - $this->outputMock, - $this->jsTranslationMock, - $this->minificationMock, - $this->assetRepoMock, - $this->assetRepoFactoryMock, - $this->fileManagerFactoryMock, - $this->configFactoryMock, - $this->assetPublisherMock, - $this->bundleManagerMock, - $this->themeProviderMock, - $this->loggerMock, - $this->filesUtilMock, - $this->designFactoryMock, - $this->localeResolverMock, - [], - $options + $this->assertEquals( + \Magento\Framework\Console\Cli::RETURN_SUCCESS, + $this->model->deploy($this->area, $this->themePath, $this->locale) ); } } diff --git a/app/code/Magento/Deploy/etc/di.xml b/app/code/Magento/Deploy/etc/di.xml index 52c880c28d0a7..2d7c805994f11 100644 --- a/app/code/Magento/Deploy/etc/di.xml +++ b/app/code/Magento/Deploy/etc/di.xml @@ -26,6 +26,7 @@ Magento\Deploy\Console\Command\DeployStaticContentCommand Magento\Deploy\Console\Command\SetModeCommand Magento\Deploy\Console\Command\ShowModeCommand + \Magento\Deploy\Console\Command\App\ApplicationDumpCommand diff --git a/app/code/Magento/Email/Model/Template/Css/Processor.php b/app/code/Magento/Email/Model/Template/Css/Processor.php index ae7d083750863..0386a9ace5ea5 100644 --- a/app/code/Magento/Email/Model/Template/Css/Processor.php +++ b/app/code/Magento/Email/Model/Template/Css/Processor.php @@ -8,6 +8,9 @@ use Magento\Framework\View\Asset\NotationResolver\Variable; use Magento\Framework\View\Asset\Repository; +/** + * Class for processing css placeholders + */ class Processor { /** diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index d9409d62f159c..f860108037a26 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -333,6 +333,31 @@ public function setDesignParams(array $designParams) return $this; } + /** + * @deprecated + * @return Css\Processor + */ + private function getCssProcessor() + { + if (!$this->cssProcessor) { + $this->cssProcessor = ObjectManager::getInstance()->get(Css\Processor::class); + } + return $this->cssProcessor; + } + + /** + * @deprecated + * @param string $dirType + * @return ReadInterface + */ + private function getPubDirectory($dirType) + { + if (!$this->pubDirectory) { + $this->pubDirectory = ObjectManager::getInstance()->get(Filesystem::class)->getDirectoryRead($dirType); + } + return $this->pubDirectory; + } + /** * Get design parameters * diff --git a/app/code/Magento/Store/App/Config/Source/RuntimeConfigSource.php b/app/code/Magento/Store/App/Config/Source/RuntimeConfigSource.php new file mode 100644 index 0000000000000..015ba1d6ef633 --- /dev/null +++ b/app/code/Magento/Store/App/Config/Source/RuntimeConfigSource.php @@ -0,0 +1,197 @@ +websiteCollectionFactory = $websiteCollectionFactory; + $this->groupCollectionFactory = $groupCollectionFactory; + $this->storeCollectionFactory = $storeCollectionFactory; + $this->deploymentConfig = $deploymentConfig; + $this->websiteFactory = $websiteFactory; + $this->groupFactory = $groupFactory; + $this->storeFactory = $storeFactory; + } + + /** + * @inheritdoc + */ + public function get($path = '') + { + if (strpos($path, '/') === false) { + $scopePool = $path; + $scopeCode = null; + } else { + list($scopePool, $scopeCode) = explode('/', $path); + } + + $data = []; + if ($this->canUseDatabase()) { + switch ($scopePool) { + case 'websites': + $data = $this->getWebsitesData($scopeCode); + break; + case 'groups': + $data = $this->getGroupsData($scopeCode); + break; + case 'stores': + $data = $this->getStoresData($scopeCode); + break; + default: + $data = [ + 'websites' => $this->getWebsitesData(), + 'groups' => $this->getGroupsData(), + 'stores' => $this->getStoresData(), + ]; + break; + } + } + + return $data; + } + + /** + * @param string|null $code + * @return array + */ + private function getWebsitesData($code = null) + { + if ($code) { + $website = $this->websiteFactory->create(); + $website->load($code); + $data = $website->getData(); + } else { + $collection = $this->websiteCollectionFactory->create(); + $collection->setLoadDefault(true); + $data = []; + foreach ($collection as $website) { + $data[$website->getCode()] = $website->getData(); + } + } + return $data; + } + + /** + * @param string|null $id + * @return array + */ + private function getGroupsData($id = null) + { + if ($id) { + $group = $this->groupFactory->create(); + $group->load($id); + $data = $group->getData(); + } else { + $collection = $this->groupCollectionFactory->create(); + $collection->setLoadDefault(true); + $data = []; + foreach ($collection as $group) { + $data[$group->getId()] = $group->getData(); + } + } + return $data; + } + + /** + * @param string|null $code + * @return array + */ + private function getStoresData($code = null) + { + if ($code) { + $store = $this->storeFactory->create(); + $store->load($code, 'code'); + $data = $store->getData(); + } else { + $collection = $this->storeCollectionFactory->create(); + $collection->setLoadDefault(true); + $data = []; + foreach ($collection as $store) { + $data[$store->getCode()] = $store->getData(); + } + return $data; + } + return $data; + } + + /** + * Check whether db connection is available and can be used + * + * @return bool + */ + private function canUseDatabase() + { + return $this->deploymentConfig->get('db'); + } +} diff --git a/app/code/Magento/Store/App/Config/Type/Scopes.php b/app/code/Magento/Store/App/Config/Type/Scopes.php new file mode 100644 index 0000000000000..f66e172bc638e --- /dev/null +++ b/app/code/Magento/Store/App/Config/Type/Scopes.php @@ -0,0 +1,97 @@ +source = $source; + $this->cache = $cache; + $this->cachingNestedLevel = $cachingNestedLevel; + } + + /** + * @inheritdoc + */ + public function get($path = '') + { + if (!$this->data) { + /** @var DataObject $data */ + $data = $this->cache->load(self::CONFIG_TYPE); + if (!$data) { + $this->data = new DataObject($this->source->get()); + $this->cache->save( + serialize($this->data), + self::CONFIG_TYPE, + [Group::CACHE_TAG, Store::CACHE_TAG, Website::CACHE_TAG] + ); + } else { + $this->data = unserialize($data); + } + } + + return $this->data->getData($path); + } + + /** + * Clean cache + * + * @return void + */ + public function clean() + { + $this->data = null; + $this->cache->clean( + \Zend_Cache::CLEANING_MODE_MATCHING_TAG, + [Group::CACHE_TAG, Store::CACHE_TAG, Website::CACHE_TAG] + ); + } +} diff --git a/app/code/Magento/Store/Model/Config/Converter.php b/app/code/Magento/Store/Model/Config/Converter.php index 9cc898e58207a..939544399d517 100644 --- a/app/code/Magento/Store/Model/Config/Converter.php +++ b/app/code/Magento/Store/Model/Config/Converter.php @@ -7,21 +7,11 @@ */ namespace Magento\Store\Model\Config; +/** + * Class Converter. + */ class Converter extends \Magento\Framework\App\Config\Scope\Converter { - /** - * @var \Magento\Store\Model\Config\Processor\Placeholder - */ - protected $_processor; - - /** - * @param \Magento\Store\Model\Config\Processor\Placeholder $processor - */ - public function __construct(\Magento\Store\Model\Config\Processor\Placeholder $processor) - { - $this->_processor = $processor; - } - /** * Convert config data * @@ -31,7 +21,6 @@ public function __construct(\Magento\Store\Model\Config\Processor\Placeholder $p */ public function convert($source, $initialConfig = []) { - $config = array_replace_recursive($initialConfig, parent::convert($source)); - return $this->_processor->process($config); + return array_replace_recursive($initialConfig, parent::convert($source)); } } diff --git a/app/code/Magento/Store/Model/Config/Placeholder.php b/app/code/Magento/Store/Model/Config/Placeholder.php new file mode 100644 index 0000000000000..af313c82b949a --- /dev/null +++ b/app/code/Magento/Store/Model/Config/Placeholder.php @@ -0,0 +1,165 @@ +request = $request; + $this->urlPaths = $urlPaths; + $this->urlPlaceholder = $urlPlaceholder; + } + + /** + * Replace placeholders with config values + * + * @param array $data + * @return array + */ + public function process(array $data = []) + { + foreach (array_keys($data) as $key) { + $this->_processData($data, $key); + } + return $data; + } + + /** + * Process array data recursively + * + * @param array &$data + * @param string $path + * @return void + */ + protected function _processData(&$data, $path) + { + $configValue = $this->_getValue($path, $data); + if (is_array($configValue)) { + foreach (array_keys($configValue) as $key) { + $this->_processData($data, $path . '/' . $key); + } + } else { + $this->_setValue($data, $path, $this->_processPlaceholders($configValue, $data)); + } + } + + /** + * Replace placeholders with config values + * + * @param string $value + * @param array $data + * @return string + */ + protected function _processPlaceholders($value, $data) + { + $placeholder = $this->_getPlaceholder($value); + if ($placeholder) { + $url = false; + if ($placeholder == 'unsecure_base_url') { + $url = $this->_getValue($this->urlPaths['unsecureBaseUrl'], $data); + } elseif ($placeholder == 'secure_base_url') { + $url = $this->_getValue($this->urlPaths['secureBaseUrl'], $data); + } + + if ($url) { + $value = str_replace('{{' . $placeholder . '}}', $url, $value); + } elseif (strpos($value, $this->urlPlaceholder) !== false) { + $distroBaseUrl = $this->request->getDistroBaseUrl(); + $value = str_replace($this->urlPlaceholder, $distroBaseUrl, $value); + } + + if (null !== $this->_getPlaceholder($value)) { + $value = $this->_processPlaceholders($value, $data); + } + } + return $value; + } + + /** + * Get placeholder from value + * + * @param string $value + * @return string|null + */ + protected function _getPlaceholder($value) + { + if (is_string($value) && preg_match('/{{(.*)}}.*/', $value, $matches)) { + $placeholder = $matches[1]; + if ($placeholder == 'unsecure_base_url' || $placeholder == 'secure_base_url' || strpos( + $value, + $this->urlPlaceholder + ) !== false + ) { + return $placeholder; + } + } + return null; + } + + /** + * Get array value by path + * + * @param string $path + * @param array $data + * @return array|null + */ + protected function _getValue($path, array $data) + { + $keys = explode('/', $path); + foreach ($keys as $key) { + if (is_array($data) && (isset($data[$key]) || array_key_exists($key, $data))) { + $data = $data[$key]; + } else { + return null; + } + } + return $data; + } + + /** + * Set array value by path + * + * @param array &$container + * @param string $path + * @param string $value + * @return void + */ + protected function _setValue(array &$container, $path, $value) + { + $segments = explode('/', $path); + $currentPointer = & $container; + foreach ($segments as $segment) { + if (!isset($currentPointer[$segment])) { + $currentPointer[$segment] = []; + } + $currentPointer = & $currentPointer[$segment]; + } + $currentPointer = $value; + } +} diff --git a/app/code/Magento/Store/Model/Config/Processor/Fallback.php b/app/code/Magento/Store/Model/Config/Processor/Fallback.php new file mode 100644 index 0000000000000..612f0514e77c1 --- /dev/null +++ b/app/code/Magento/Store/Model/Config/Processor/Fallback.php @@ -0,0 +1,115 @@ +scopes = $scopes; + } + + /** + * @inheritdoc + */ + public function process(array $data) + { + $defaultConfig = isset($data['default']) ? $data['default'] : []; + $result = [ + 'default' => $defaultConfig, + 'websites' => [], + 'stores' => [] + ]; + + $websitesConfig = isset($data['websites']) ? $data['websites'] : []; + $result['websites'] = $this->prepareWebsitesConfig($defaultConfig, $websitesConfig); + + $storesConfig = isset($data['stores']) ? $data['stores'] : []; + $result['stores'] = $this->prepareStoresConfig($defaultConfig, $websitesConfig, $storesConfig); + + return $result; + } + + /** + * Prepare website data from Config/Type/Scopes + * + * @param array $defaultConfig + * @param array $websitesConfig + * @return array + */ + private function prepareWebsitesConfig(array $defaultConfig, array $websitesConfig) + { + $result = []; + foreach ($this->scopes->get('websites') as $websiteData) { + $code = $websiteData['code']; + $id = $websiteData['website_id']; + $websiteConfig = isset($websitesConfig[$code]) ? $websitesConfig[$code] : []; + $result[$code] = array_replace_recursive($defaultConfig, $websiteConfig); + $result[$id] = $result[$code]; + } + return $result; + } + + /** + * Prepare stores data from Config/Type/Scopes + * + * @param array $defaultConfig + * @param array $websitesConfig + * @param array $storesConfig + * @return array + */ + private function prepareStoresConfig(array $defaultConfig, array $websitesConfig, array $storesConfig) + { + $result = []; + foreach ($this->scopes->get('stores') as $storeData) { + $code = $storeData['code']; + $id = $storeData['store_id']; + $websiteConfig = []; + if (isset($storeData['website_id'])) { + $websiteConfig = $this->getWebsiteConfig($websitesConfig, $storeData['website_id']); + } + $storeConfig = isset($storesConfig[$code]) ? $storesConfig[$code] : []; + $result[$code] = array_replace_recursive($defaultConfig, $websiteConfig, $storeConfig); + $result[$id] = $result[$code]; + } + return $result; + } + + /** + * Retrieve Website Config + * + * @param array $websites + * @param int $id + * @return array + */ + private function getWebsiteConfig(array $websites, $id) + { + foreach ($this->scopes->get('websites') as $websiteData) { + if ($websiteData['website_id'] == $id) { + $code = $websiteData['code']; + return isset($websites[$code]) ? $websites[$code] : []; + } + } + return []; + } +} diff --git a/app/code/Magento/Store/Model/Config/Processor/Placeholder.php b/app/code/Magento/Store/Model/Config/Processor/Placeholder.php index ac15026705388..3695a9a9d66ce 100644 --- a/app/code/Magento/Store/Model/Config/Processor/Placeholder.php +++ b/app/code/Magento/Store/Model/Config/Processor/Placeholder.php @@ -7,159 +7,44 @@ */ namespace Magento\Store\Model\Config\Processor; -class Placeholder -{ - /** - * @var \Magento\Framework\App\RequestInterface - */ - protected $request; - - /** - * @var string[] - */ - protected $urlPaths; - - /** - * @var string - */ - protected $urlPlaceholder; - - /** - * @param \Magento\Framework\App\RequestInterface $request - * @param string[] $urlPaths - * @param string $urlPlaceholder - */ - public function __construct(\Magento\Framework\App\RequestInterface $request, $urlPaths, $urlPlaceholder) - { - $this->request = $request; - $this->urlPaths = $urlPaths; - $this->urlPlaceholder = $urlPlaceholder; - } - - /** - * Replace placeholders with config values - * - * @param array $data - * @return array - */ - public function process(array $data = []) - { - foreach (array_keys($data) as $key) { - $this->_processData($data, $key); - } - return $data; - } - - /** - * Process array data recursively - * - * @param array &$data - * @param string $path - * @return void - */ - protected function _processData(&$data, $path) - { - $configValue = $this->_getValue($path, $data); - if (is_array($configValue)) { - foreach (array_keys($configValue) as $key) { - $this->_processData($data, $path . '/' . $key); - } - } else { - $this->_setValue($data, $path, $this->_processPlaceholders($configValue, $data)); - } - } +use Magento\Framework\App\Config\Spi\PostProcessorInterface; +use Magento\Store\Model\Config\Placeholder as ConfigPlaceholder; +/** + * Placeholder configuration values processor. Replace placeholders in configuration with config values + * @package Magento\Store\Model\Config\Processor + */ +class Placeholder implements PostProcessorInterface +{ /** - * Replace placeholders with config values - * - * @param string $value - * @param array $data - * @return string + * @var ConfigPlaceholder */ - protected function _processPlaceholders($value, $data) - { - $placeholder = $this->_getPlaceholder($value); - if ($placeholder) { - $url = false; - if ($placeholder == 'unsecure_base_url') { - $url = $this->_getValue($this->urlPaths['unsecureBaseUrl'], $data); - } elseif ($placeholder == 'secure_base_url') { - $url = $this->_getValue($this->urlPaths['secureBaseUrl'], $data); - } - - if ($url) { - $value = str_replace('{{' . $placeholder . '}}', $url, $value); - } elseif (strpos($value, $this->urlPlaceholder) !== false) { - $distroBaseUrl = $this->request->getDistroBaseUrl(); - $value = str_replace($this->urlPlaceholder, $distroBaseUrl, $value); - } - - if (null !== $this->_getPlaceholder($value)) { - $value = $this->_processPlaceholders($value, $data); - } - } - return $value; - } + private $configPlaceholder; /** - * Get placeholder from value - * - * @param string $value - * @return string|null + * Placeholder constructor. + * @param ConfigPlaceholder $configPlaceholder */ - protected function _getPlaceholder($value) + public function __construct(ConfigPlaceholder $configPlaceholder) { - if (is_string($value) && preg_match('/{{(.*)}}.*/', $value, $matches)) { - $placeholder = $matches[1]; - if ($placeholder == 'unsecure_base_url' || $placeholder == 'secure_base_url' || strpos( - $value, - $this->urlPlaceholder - ) !== false - ) { - return $placeholder; - } - } - return null; + $this->configPlaceholder = $configPlaceholder; } /** - * Get array value by path - * - * @param string $path - * @param array $data - * @return array|null + * @inheritdoc */ - protected function _getValue($path, array $data) + public function process(array $data) { - $keys = explode('/', $path); - foreach ($keys as $key) { - if (is_array($data) && (isset($data[$key]) || array_key_exists($key, $data))) { - $data = $data[$key]; + foreach ($data as $scope => &$scopeData) { + if ($scope === 'default') { + $scopeData = $this->configPlaceholder->process($scopeData); } else { - return null; + foreach ($scopeData as &$sData) { + $sData = $this->configPlaceholder->process($sData); + } } } - return $data; - } - /** - * Set array value by path - * - * @param array &$container - * @param string $path - * @param string $value - * @return void - */ - protected function _setValue(array &$container, $path, $value) - { - $segments = explode('/', $path); - $currentPointer = & $container; - foreach ($segments as $segment) { - if (!isset($currentPointer[$segment])) { - $currentPointer[$segment] = []; - } - $currentPointer = & $currentPointer[$segment]; - } - $currentPointer = $value; + return $data; } } diff --git a/app/code/Magento/Store/Model/Config/Reader/DefaultReader.php b/app/code/Magento/Store/Model/Config/Reader/DefaultReader.php deleted file mode 100644 index 6436f1895a675..0000000000000 --- a/app/code/Magento/Store/Model/Config/Reader/DefaultReader.php +++ /dev/null @@ -1,73 +0,0 @@ -_initialConfig = $initialConfig; - $this->_converter = $converter; - $this->_collectionFactory = $collectionFactory; - } - - /** - * Read configuration data - * - * @param null|string $scope - * @throws LocalizedException Exception is thrown when scope other than default is given - * @return array - */ - public function read($scope = null) - { - $scope = $scope === null ? ScopeConfigInterface::SCOPE_TYPE_DEFAULT : $scope; - if ($scope !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT) { - throw new \Magento\Framework\Exception\LocalizedException(__("Only default scope allowed")); - } - - $config = $this->_initialConfig->getData($scope); - - $collection = $this->_collectionFactory->create( - ['scope' => $scope] - ); - $dbDefaultConfig = []; - foreach ($collection as $item) { - $dbDefaultConfig[$item->getPath()] = $item->getValue(); - } - $dbDefaultConfig = $this->_converter->convert($dbDefaultConfig); - $config = array_replace_recursive($config, $dbDefaultConfig); - - return $config; - } -} diff --git a/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/DefaultScope.php b/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/DefaultScope.php new file mode 100644 index 0000000000000..1f25a29856a78 --- /dev/null +++ b/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/DefaultScope.php @@ -0,0 +1,61 @@ +collectionFactory = $collectionFactory; + $this->converter = $converter; + } + + /** + * Retrieve config by default scope + * + * @param string|null $scopeCode + * @return array + */ + public function get($scopeCode = null) + { + try { + $collection = $this->collectionFactory->create( + ['scope' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT] + ); + } catch (\DomainException $e) { + $collection = []; + } + $config = []; + foreach ($collection as $item) { + $config[$item->getPath()] = $item->getValue(); + } + return $this->converter->convert($config); + } +} diff --git a/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/Store.php b/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/Store.php new file mode 100644 index 0000000000000..e1d0eaf51e05c --- /dev/null +++ b/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/Store.php @@ -0,0 +1,92 @@ +collectionFactory = $collectionFactory; + $this->converter = $converter; + $this->websiteFactory = $websiteFactory; + $this->websiteSource = $websiteSource; + $this->storeManager = $storeManager; + } + + /** + * Retrieve config by store scope + * + * @param string|null $scopeCode + * @return array + */ + public function get($scopeCode = null) + { + try { + $store = $this->storeManager->getStore($scopeCode); + $collection = $this->collectionFactory->create( + ['scope' => ScopeInterface::SCOPE_STORES, 'scopeId' => $store->getId()] + ); + + $config = []; + foreach ($collection as $item) { + $config[$item->getPath()] = $item->getValue(); + } + return $this->converter->convert(array_replace_recursive( + $this->websiteSource->get($store->getWebsiteId()), + $this->converter->convert($config) + )); + } catch (\DomainException $e) { + return []; + } + } +} diff --git a/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/Website.php b/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/Website.php new file mode 100644 index 0000000000000..0edd12fd28098 --- /dev/null +++ b/app/code/Magento/Store/Model/Config/Reader/Source/Dynamic/Website.php @@ -0,0 +1,80 @@ +collectionFactory = $collectionFactory; + $this->converter = $converter; + $this->websiteFactory = $websiteFactory; + $this->defaultScope = $defaultScope; + } + + /** + * Retrieve config by website scope + * + * @param string|null $scopeCode + * @return array + */ + public function get($scopeCode = null) + { + try { + $website = $this->websiteFactory->create(); + $website->load($scopeCode); + $collection = $this->collectionFactory->create( + ['scope' => ScopeInterface::SCOPE_WEBSITES, 'scopeId' => $website->getId()] + ); + $config = []; + foreach ($collection as $item) { + $config[$item->getPath()] = $item->getValue(); + } + return array_replace_recursive($this->defaultScope->get(), $this->converter->convert($config)); + } catch (\DomainException $e) { + return []; + } + } +} diff --git a/app/code/Magento/Store/Model/Config/Reader/Source/Initial/DefaultScope.php b/app/code/Magento/Store/Model/Config/Reader/Source/Initial/DefaultScope.php new file mode 100644 index 0000000000000..071599d2df56b --- /dev/null +++ b/app/code/Magento/Store/Model/Config/Reader/Source/Initial/DefaultScope.php @@ -0,0 +1,50 @@ +initialConfig = $initialConfig; + $this->converter = $converter; + } + + /** + * Retrieve config by default scope + * + * @param string|null $scopeCode + * @return array + */ + public function get($scopeCode = null) + { + return $this->converter->convert($this->initialConfig->getData(ScopeConfigInterface::SCOPE_TYPE_DEFAULT)); + } +} diff --git a/app/code/Magento/Store/Model/Config/Reader/Source/Initial/Store.php b/app/code/Magento/Store/Model/Config/Reader/Source/Initial/Store.php new file mode 100644 index 0000000000000..8a36fa76ed335 --- /dev/null +++ b/app/code/Magento/Store/Model/Config/Reader/Source/Initial/Store.php @@ -0,0 +1,75 @@ +initialConfig = $initialConfig; + $this->websiteSource = $website; + $this->storeManager = $storeManager; + $this->converter = $converter; + } + + /** + * Retrieve config by store scope + * + * @param string|null $scopeCode + * @return array + */ + public function get($scopeCode = null) + { + try { + /** @var \Magento\Store\Model\Store $store */ + $store = $this->storeManager->getStore($scopeCode); + return $this->converter->convert(array_replace_recursive( + $this->websiteSource->get($store->getData('website_code')), + $this->initialConfig->getData("stores|{$scopeCode}") + )); + } catch (\Exception $e) { + return []; + } + } +} diff --git a/app/code/Magento/Store/Model/Config/Reader/Source/Initial/Website.php b/app/code/Magento/Store/Model/Config/Reader/Source/Initial/Website.php new file mode 100644 index 0000000000000..efd85e83a593e --- /dev/null +++ b/app/code/Magento/Store/Model/Config/Reader/Source/Initial/Website.php @@ -0,0 +1,60 @@ +initialConfig = $initialConfig; + $this->defaultScope = $defaultScope; + $this->converter = $converter; + } + + /** + * Retrieve config by website scope + * + * @param string|null $scopeCode + * @return array + */ + public function get($scopeCode = null) + { + return $this->converter->convert(array_replace_recursive( + $this->defaultScope->get(), + $this->initialConfig->getData("websites|{$scopeCode}") + )); + } +} diff --git a/app/code/Magento/Store/Model/Config/Reader/Store.php b/app/code/Magento/Store/Model/Config/Reader/Store.php deleted file mode 100644 index 8b4eb2d673651..0000000000000 --- a/app/code/Magento/Store/Model/Config/Reader/Store.php +++ /dev/null @@ -1,84 +0,0 @@ -_initialConfig = $initialConfig; - $this->_scopePool = $scopePool; - $this->_converter = $converter; - $this->_collectionFactory = $collectionFactory; - $this->_storeManager = $storeManager; - } - - /** - * Read configuration by code - * - * @param null|string $code - * @return array - * @throws NoSuchEntityException - */ - public function read($code = null) - { - $store = $this->_storeManager->getStore($code); - - $websiteConfig = $this->_scopePool->getScope( - \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE, - $store->getWebsite()->getCode() - )->getSource(); - $config = array_replace_recursive($websiteConfig, $this->_initialConfig->getData("stores|{$code}")); - - $collection = $this->_collectionFactory->create( - ['scope' => \Magento\Store\Model\ScopeInterface::SCOPE_STORES, 'scopeId' => $store->getId()] - ); - $dbStoreConfig = []; - foreach ($collection as $item) { - $dbStoreConfig[$item->getPath()] = $item->getValue(); - } - return $this->_converter->convert($dbStoreConfig, $config); - } -} diff --git a/app/code/Magento/Store/Model/Config/Reader/Website.php b/app/code/Magento/Store/Model/Config/Reader/Website.php deleted file mode 100644 index 3ae30ea86a506..0000000000000 --- a/app/code/Magento/Store/Model/Config/Reader/Website.php +++ /dev/null @@ -1,88 +0,0 @@ -_initialConfig = $initialConfig; - $this->_scopePool = $scopePool; - $this->_converter = $converter; - $this->_collectionFactory = $collectionFactory; - $this->_websiteFactory = $websiteFactory; - } - - /** - * Read configuration by code - * - * @param string $code - * @return array - */ - public function read($code = null) - { - $config = array_replace_recursive( - $this->_scopePool->getScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT)->getSource(), - $this->_initialConfig->getData("websites|{$code}") - ); - - $website = $this->_websiteFactory->create(); - $website->load($code); - $collection = $this->_collectionFactory->create( - ['scope' => \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES, 'scopeId' => $website->getId()] - ); - $dbWebsiteConfig = []; - foreach ($collection as $configValue) { - $dbWebsiteConfig[$configValue->getPath()] = $configValue->getValue(); - } - $dbWebsiteConfig = $this->_converter->convert($dbWebsiteConfig); - - if (count($dbWebsiteConfig)) { - $config = array_replace_recursive($config, $dbWebsiteConfig); - } - - return $config; - } -} diff --git a/app/code/Magento/Store/Model/Group.php b/app/code/Magento/Store/Model/Group.php index cd6044dd7f786..f95d0aaded312 100644 --- a/app/code/Magento/Store/Model/Group.php +++ b/app/code/Magento/Store/Model/Group.php @@ -442,7 +442,7 @@ public function isReadOnly($value = null) */ public function getIdentities() { - return [self::CACHE_TAG . '_' . $this->getId()]; + return [self::CACHE_TAG]; } /** diff --git a/app/code/Magento/Store/Model/GroupRepository.php b/app/code/Magento/Store/Model/GroupRepository.php index 3cc833138b241..dadcc6fb24e68 100644 --- a/app/code/Magento/Store/Model/GroupRepository.php +++ b/app/code/Magento/Store/Model/GroupRepository.php @@ -5,8 +5,15 @@ */ namespace Magento\Store\Model; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\App\Config; +/** + * Information Expert in store groups handling + * + * @package Magento\Store\Model + */ class GroupRepository implements \Magento\Store\Api\GroupRepositoryInterface { /** @@ -29,6 +36,11 @@ class GroupRepository implements \Magento\Store\Api\GroupRepositoryInterface */ protected $groupCollectionFactory; + /** + * @var Config + */ + private $appConfig; + /** * @param GroupFactory $groupFactory * @param \Magento\Store\Model\ResourceModel\Group\CollectionFactory $groupCollectionFactory @@ -49,8 +61,21 @@ public function get($id) if (isset($this->entities[$id])) { return $this->entities[$id]; } - $group = $this->groupFactory->create(); - $group->load($id); + + $groupData = []; + $groups = $this->getAppConfig()->get('scopes', 'groups', []); + if ($groups) { + foreach ($groups as $data) { + if (isset($data['group_id']) && $data['group_id'] == $id) { + $groupData = $data; + break; + } + } + } + $group = $this->groupFactory->create([ + 'data' => $groupData + ]); + if (null === $group->getId()) { throw new NoSuchEntityException(); } @@ -64,14 +89,16 @@ public function get($id) public function getList() { if (!$this->allLoaded) { - /** @var \Magento\Store\Model\ResourceModel\Group\Collection $groupCollection */ - $groupCollection = $this->groupCollectionFactory->create(); - $groupCollection->setLoadDefault(true); - foreach ($groupCollection as $item) { - $this->entities[$item->getId()] = $item; + $groups = $this->getAppConfig()->get('scopes', 'groups', []); + foreach ($groups as $data) { + $group = $this->groupFactory->create([ + 'data' => $data + ]); + $this->entities[$group->getId()] = $group; } $this->allLoaded = true; } + return $this->entities; } @@ -83,4 +110,18 @@ public function clean() $this->entities = []; $this->allLoaded = false; } + + /** + * Retrieve application config. + * + * @deprecated + * @return Config + */ + private function getAppConfig() + { + if (!$this->appConfig) { + $this->appConfig = ObjectManager::getInstance()->get(Config::class); + } + return $this->appConfig; + } } diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 270b621407d46..ccd1aed947d78 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -1036,6 +1036,18 @@ public function getWebsiteId() return $this->_getData('website_id'); } + /** + * Reinit Stores on after save + * + * @deprecated + * @return $this + */ + public function afterSave() + { + $this->_storeManager->reinitStores(); + return parent::afterSave(); + } + /** * @inheritdoc */ @@ -1272,7 +1284,7 @@ public function getFormattedAddress() */ public function getIdentities() { - return [self::CACHE_TAG . '_' . $this->getId()]; + return [self::CACHE_TAG]; } /** diff --git a/app/code/Magento/Store/Model/StoreManager.php b/app/code/Magento/Store/Model/StoreManager.php index c34f4e1bd2a58..13840b1206367 100644 --- a/app/code/Magento/Store/Model/StoreManager.php +++ b/app/code/Magento/Store/Model/StoreManager.php @@ -10,6 +10,8 @@ use Magento\Store\Model\ResourceModel\StoreWebsiteRelation; /** + * Service contract, which manage scopes + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class StoreManager implements @@ -198,9 +200,12 @@ public function getWebsite($websiteId = null) $website = $websiteId; } elseif ($websiteId === true) { $website = $this->websiteRepository->getDefault(); - } else { + } elseif (is_numeric($websiteId)) { $website = $this->websiteRepository->getById($websiteId); + } else { + $website = $this->websiteRepository->get($websiteId); } + return $website; } @@ -228,6 +233,7 @@ public function getWebsites($withDefault = false, $codeKey = false) */ public function reinitStores() { + $this->scopeConfig->clean(); $this->currentStoreId = null; $this->storeRepository->clean(); $this->websiteRepository->clean(); diff --git a/app/code/Magento/Store/Model/StoreRepository.php b/app/code/Magento/Store/Model/StoreRepository.php index 47e185f48cc52..c9e7a0ebc9d31 100644 --- a/app/code/Magento/Store/Model/StoreRepository.php +++ b/app/code/Magento/Store/Model/StoreRepository.php @@ -5,8 +5,15 @@ */ namespace Magento\Store\Model; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\App\Config; +/** + * Information Expert in stores handling + * + * @package Magento\Store\Model + */ class StoreRepository implements \Magento\Store\Api\StoreRepositoryInterface { /** @@ -34,6 +41,11 @@ class StoreRepository implements \Magento\Store\Api\StoreRepositoryInterface */ protected $allLoaded = false; + /** + * @var Config + */ + private $appConfig; + /** * @param StoreFactory $storeFactory * @param \Magento\Store\Model\ResourceModel\Store\CollectionFactory $storeCollectionFactory @@ -54,8 +66,12 @@ public function get($code) if (isset($this->entities[$code])) { return $this->entities[$code]; } - $store = $this->storeFactory->create(); - $store->load($code, 'code'); + + $storeData = $this->getAppConfig()->get('scopes', "stores/$code", []); + $store = $this->storeFactory->create([ + 'data' => $storeData + ]); + if ($store->getId() === null) { throw new NoSuchEntityException(__('Requested store is not found')); } @@ -85,11 +101,23 @@ public function getById($id) if (isset($this->entitiesById[$id])) { return $this->entitiesById[$id]; } - $store = $this->storeFactory->create(); - $store->load($id); + + $storeData = []; + $stores = $this->getAppConfig()->get('scopes', "stores", []); + foreach ($stores as $data) { + if (isset($data['store_id']) && $data['store_id'] == $id) { + $storeData = $data; + break; + } + } + $store = $this->storeFactory->create([ + 'data' => $storeData + ]); + if ($store->getId() === null) { throw new NoSuchEntityException(__('Requested store is not found')); } + $this->entitiesById[$id] = $store; $this->entities[$store->getCode()] = $store; return $store; @@ -113,19 +141,35 @@ public function getActiveStoreById($id) */ public function getList() { - if (!$this->allLoaded) { - /** @var $storeCollection \Magento\Store\Model\ResourceModel\Store\Collection */ - $storeCollection = $this->storeCollectionFactory->create(); - $storeCollection->setLoadDefault(true); - foreach ($storeCollection as $item) { - $this->entities[$item->getCode()] = $item; - $this->entitiesById[$item->getId()] = $item; - } - $this->allLoaded = true; + if ($this->allLoaded) { + return $this->entities; } + $stores = $this->getAppConfig()->get('scopes', "stores", []); + foreach ($stores as $data) { + $store = $this->storeFactory->create([ + 'data' => $data + ]); + $this->entities[$store->getCode()] = $store; + $this->entitiesById[$store->getId()] = $store; + } + $this->allLoaded = true; return $this->entities; } + /** + * Retrieve application config. + * + * @deprecated + * @return Config + */ + private function getAppConfig() + { + if (!$this->appConfig) { + $this->appConfig = ObjectManager::getInstance()->get(Config::class); + } + return $this->appConfig; + } + /** * {@inheritdoc} */ diff --git a/app/code/Magento/Store/Model/Website.php b/app/code/Magento/Store/Model/Website.php index 1370cea5cf42b..a3a6b6dbc3f7f 100644 --- a/app/code/Magento/Store/Model/Website.php +++ b/app/code/Magento/Store/Model/Website.php @@ -652,7 +652,7 @@ public function isReadOnly($value = null) */ public function getIdentities() { - return [self::CACHE_TAG . '_' . $this->getId()]; + return [self::CACHE_TAG]; } /** diff --git a/app/code/Magento/Store/Model/WebsiteRepository.php b/app/code/Magento/Store/Model/WebsiteRepository.php index 0aeb65f47cdb4..dffcef921bc22 100644 --- a/app/code/Magento/Store/Model/WebsiteRepository.php +++ b/app/code/Magento/Store/Model/WebsiteRepository.php @@ -5,9 +5,16 @@ */ namespace Magento\Store\Model; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Store\Model\ResourceModel\Website\CollectionFactory; +use Magento\Framework\App\Config; +/** + * Information Expert in store websites handling + * + * @package Magento\Store\Model + */ class WebsiteRepository implements \Magento\Store\Api\WebsiteRepositoryInterface { /** @@ -40,6 +47,11 @@ class WebsiteRepository implements \Magento\Store\Api\WebsiteRepositoryInterface */ protected $default; + /** + * @var Config + */ + private $appConfig; + /** * @param WebsiteFactory $factory * @param CollectionFactory $websiteCollectionFactory @@ -60,8 +72,12 @@ public function get($code) if (isset($this->entities[$code])) { return $this->entities[$code]; } - $website = $this->factory->create(); - $website->load($code, 'code'); + + $websiteData = $this->getAppConfig()->get('scopes', "websites/$code", []); + $website = $this->factory->create([ + 'data' => $websiteData + ]); + if ($website->getId() === null) { throw new NoSuchEntityException(); } @@ -78,14 +94,23 @@ public function getById($id) if (isset($this->entitiesById[$id])) { return $this->entitiesById[$id]; } - /** @var Website $website */ - $website = $this->factory->create(); - $website->load($id); + $websiteData = []; + $websites = $this->getAppConfig()->get('scopes', 'websites', []); + foreach ($websites as $data) { + if (isset($data['website_id']) && $data['website_id'] == $id) { + $websiteData = $data; + break; + } + } + $website = $this->factory->create([ + 'data' => $websiteData + ]); + if ($website->getId() === null) { throw new NoSuchEntityException(); } - $this->entitiesById[$id] = $website; $this->entities[$website->getCode()] = $website; + $this->entitiesById[$id] = $website; return $website; } @@ -95,10 +120,13 @@ public function getById($id) public function getList() { if (!$this->allLoaded) { - $collection = $this->websiteCollectionFactory->create(); - $collection->setLoadDefault(true); - foreach ($collection as $item) { - $this->entities[$item->getCode()] = $item; + $websites = $this->getAppConfig()->get('scopes', 'websites', []); + foreach ($websites as $data) { + $website = $this->factory->create([ + 'data' => $data + ]); + $this->entities[$website->getCode()] = $website; + $this->entitiesById[$website->getId()] = $website; } $this->allLoaded = true; } @@ -118,23 +146,13 @@ public function getDefault() } } if (!$this->allLoaded) { - /** @var \Magento\Store\Model\ResourceModel\Website\Collection $collection */ - $collection = $this->websiteCollectionFactory->create(); - $collection->addFieldToFilter('is_default', 1); - $items = $collection->getItems(); - if (count($items) > 1) { - throw new \DomainException(__('More than one default website is defined')); - } - if (count($items) === 0) { - throw new \DomainException(__('Default website is not defined')); - } - $this->default = $collection->getFirstItem(); - $this->entities[$this->default->getCode()] = $this->default; - $this->entitiesById[$this->default->getId()] = $this->default; - } else { + $this->initDefaultWebsite(); + } + if (!$this->default) { throw new \DomainException(__('Default website is not defined')); } } + return $this->default; } @@ -148,4 +166,40 @@ public function clean() $this->default = null; $this->allLoaded = false; } + + /** + * Retrieve application config. + * + * @deprecated + * @return Config + */ + private function getAppConfig() + { + if (!$this->appConfig) { + $this->appConfig = ObjectManager::getInstance()->get(Config::class); + } + return $this->appConfig; + } + + /** + * Initialize default website. + * @return void + */ + private function initDefaultWebsite() + { + $websites = (array)$this->getAppConfig()->get('scopes', 'websites', []); + foreach ($websites as $data) { + if (isset($data['is_default']) && $data['is_default'] == 1) { + if ($this->default) { + throw new \DomainException(__('More than one default website is defined')); + } + $website = $this->factory->create([ + 'data' => $data + ]); + $this->default = $website; + $this->entities[$this->default->getCode()] = $this->default; + $this->entitiesById[$this->default->getId()] = $this->default; + } + } + } } diff --git a/app/code/Magento/Store/Test/Unit/App/Config/Source/RuntimeConfigSourceTest.php b/app/code/Magento/Store/Test/Unit/App/Config/Source/RuntimeConfigSourceTest.php new file mode 100644 index 0000000000000..8b3ffeafd8b2b --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/App/Config/Source/RuntimeConfigSourceTest.php @@ -0,0 +1,358 @@ +data = [ + 'group' => [ + 'code' => 'myGroup', + 'data' => [ + 'name' => 'My Group', + 'group_id' => $this->data['group']['code'] + ] + ], + 'website' => [ + 'code' => 'myWebsite', + 'data' => [ + 'name' => 'My Website', + 'website_code' => $this->data['website']['code'] + ] + ], + 'store' => [ + 'code' => 'myStore', + 'data' => [ + 'name' => 'My Store', + 'store_code' => $this->data['store']['code'] + ] + ], + ]; + $this->websiteCollectionFactory = $this->getMockBuilder(CollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->groupCollectionFactory = $this->getMockBuilder(GroupCollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->storeCollectionFactory = $this->getMockBuilder(StoreCollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->websiteCollection = $this->getMockBuilder(WebsiteCollection::class) + ->disableOriginalConstructor() + ->setMethods(['setLoadDefault', 'getIterator']) + ->getMock(); + $this->groupCollection = $this->getMockBuilder(GroupCollection::class) + ->disableOriginalConstructor() + ->setMethods(['setLoadDefault', 'getIterator']) + ->getMock(); + $this->storeCollection = $this->getMockBuilder(StoreCollection::class) + ->disableOriginalConstructor() + ->setMethods(['setLoadDefault', 'getIterator']) + ->getMock(); + + $this->websiteFactory = $this->getMockBuilder(WebsiteFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->groupFactory = $this->getMockBuilder(GroupFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->storeFactory = $this->getMockBuilder(StoreFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->website = $this->getMockBuilder(Website::class) + ->disableOriginalConstructor() + ->getMock(); + $this->group = $this->getMockBuilder(Group::class) + ->disableOriginalConstructor() + ->getMock(); + $this->store = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->getMock(); + $this->deploymentConfig = $this->getMockBuilder(DeploymentConfig::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->configSource = new RuntimeConfigSource( + $this->websiteCollectionFactory, + $this->groupCollectionFactory, + $this->storeCollectionFactory, + $this->websiteFactory, + $this->groupFactory, + $this->storeFactory, + $this->deploymentConfig + ); + } + + /** + * @param string $path + * @dataProvider getDataProvider + * @return void + */ + public function testGet($path) + { + $this->deploymentConfig->expects($this->once()) + ->method('get') + ->with('db') + ->willReturn(true); + $this->prepareWebsites($path); + $this->prepareGroups($path); + $this->prepareStores($path); + $this->assertEquals($this->getExpectedResult($path), $this->configSource->get($path)); + } + + private function getExpectedResult($path) + { + switch ($this->getScope($path)) { + case 'websites': + $result = $this->data['website']['data']; + break; + case 'groups': + $result = $this->data['group']['data']; + break; + case 'stores': + $result = $this->data['store']['data']; + break; + default: + $result = [ + 'websites' => [ + $this->data['website']['code'] => $this->data['website']['data'] + ], + 'groups' => [ + $this->data['group']['code'] => $this->data['group']['data'] + ], + 'stores' => [ + $this->data['store']['code'] => $this->data['store']['data'] + ], + ]; + break; + } + return $result; + } + + private function prepareStores($path) + { + $scope = $this->getScope($path); + if ($scope == 'stores' || $scope == 'default') { + if ($this->getScopeCode($path)) { + $this->storeFactory->expects($this->once()) + ->method('create') + ->willReturn($this->store); + $this->store->expects($this->once()) + ->method('load') + ->with($this->data['store']['code'], 'code') + ->willReturnSelf(); + } else { + $this->storeCollectionFactory->expects($this->once()) + ->method('create') + ->willReturn($this->storeCollection); + $this->storeCollection->expects($this->once()) + ->method('setLoadDefault') + ->with(true) + ->willReturnSelf(); + $this->storeCollection->expects($this->once()) + ->method('getIterator') + ->willReturn(new \ArrayIterator([$this->store])); + $this->store->expects($this->once()) + ->method('getCode') + ->willReturn($this->data['store']['code']); + } + $this->store->expects($this->once()) + ->method('getData') + ->willReturn($this->data['store']['data']); + } + } + + private function prepareGroups($path) + { + $scope = $this->getScope($path); + if ($scope == 'groups' || $scope == 'default') { + if ($this->getScopeCode($path)) { + $this->groupFactory->expects($this->once()) + ->method('create') + ->willReturn($this->group); + $this->group->expects($this->once()) + ->method('load') + ->with($this->data['group']['code']) + ->willReturnSelf(); + } else { + $this->groupCollectionFactory->expects($this->once()) + ->method('create') + ->willReturn($this->groupCollection); + $this->groupCollection->expects($this->once()) + ->method('setLoadDefault') + ->with(true) + ->willReturnSelf(); + $this->groupCollection->expects($this->once()) + ->method('getIterator') + ->willReturn(new \ArrayIterator([$this->group])); + $this->group->expects($this->once()) + ->method('getId') + ->willReturn($this->data['group']['code']); + } + $this->group->expects($this->once()) + ->method('getData') + ->willReturn($this->data['group']['data']); + } + } + + private function prepareWebsites($path) + { + $scope = $this->getScope($path); + if ($scope == 'websites' || $scope == 'default') { + if ($this->getScopeCode($path)) { + $this->websiteFactory->expects($this->once()) + ->method('create') + ->willReturn($this->website); + $this->website->expects($this->once()) + ->method('load') + ->with($this->data['website']['code']) + ->willReturnSelf(); + } else { + $this->websiteCollectionFactory->expects($this->once()) + ->method('create') + ->willReturn($this->websiteCollection); + $this->websiteCollection->expects($this->once()) + ->method('setLoadDefault') + ->with(true) + ->willReturnSelf(); + $this->websiteCollection->expects($this->once()) + ->method('getIterator') + ->willReturn(new \ArrayIterator([$this->website])); + $this->website->expects($this->once()) + ->method('getCode') + ->willReturn($this->data['website']['code']); + } + $this->website->expects($this->once()) + ->method('getData') + ->willReturn($this->data['website']['data']); + } + } + + private function getScopeCode($path) + { + return implode('/', array_slice(explode('/', $path), 1, 1)); + } + + private function getScope($path) + { + return implode('/', array_slice(explode('/', $path), 0, 1)); + } + + /** + * @return array + */ + public function getDataProvider() + { + return [ + ['websites/myWebsite'], + ['groups/myGroup'], + ['stores/myStore'], + ['default'] + ]; + } +} diff --git a/app/code/Magento/Store/Test/Unit/App/Config/Type/ScopesTest.php b/app/code/Magento/Store/Test/Unit/App/Config/Type/ScopesTest.php new file mode 100644 index 0000000000000..12e85d8631031 --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/App/Config/Type/ScopesTest.php @@ -0,0 +1,90 @@ +source = $this->getMockBuilder(ConfigSourceInterface::class) + ->getMockForAbstractClass(); + $this->cache = $this->getMockBuilder(FrontendInterface::class) + ->getMockForAbstractClass(); + + $this->configType = new Scopes($this->source, $this->cache); + } + + /** + * @param bool $isCached + * @dataProvider getDataProvider + */ + public function testGet($isCached) + { + $storeCode = 'myStore'; + $storeData = [ + 'name' => 'My store' + ]; + $data = [ + 'stores' => [ + $storeCode => $storeData + ] + ]; + $this->cache->expects($this->once()) + ->method('load') + ->with(Scopes::CONFIG_TYPE) + ->willReturn($isCached ? serialize(new DataObject($data)) : false); + + if (!$isCached) { + $this->source->expects($this->once()) + ->method('get') + ->with('') + ->willReturn($data); + $this->cache->expects($this->once()) + ->method('save') + ->with( + serialize(new DataObject($data)), + Scopes::CONFIG_TYPE, + [Group::CACHE_TAG, Store::CACHE_TAG, Website::CACHE_TAG] + ); + } + + $this->assertEquals($storeData, $this->configType->get('stores/' . $storeCode)); + } + + /** + * @return array + */ + public function getDataProvider() + { + return [ + [true], + [false] + ]; + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/ConverterTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/ConverterTest.php index 7cd9fd91aedb8..2a154bcea3431 100644 --- a/app/code/Magento/Store/Test/Unit/Model/Config/ConverterTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/Config/ConverterTest.php @@ -10,19 +10,9 @@ class ConverterTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Store\Model\Config\Converter */ protected $_model; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_processorMock; - protected function setUp() { - $this->_processorMock = $this->getMock( - \Magento\Store\Model\Config\Processor\Placeholder::class, - [], - [], - '', - false - ); - $this->_model = new \Magento\Store\Model\Config\Converter($this->_processorMock); + $this->_model = new \Magento\Store\Model\Config\Converter(); } public function testConvert() @@ -34,17 +24,6 @@ public function testConvert() 'to' => ['save' => 'saved value', 'overwrite' => 'overwritten', 'added' => 'added value'], ], ]; - $processorResult = '123Value'; - $this->_processorMock->expects( - $this->once() - )->method( - 'process' - )->with( - $mergeResult - )->will( - $this->returnValue($processorResult) - ); - - $this->assertEquals($processorResult, $this->_model->convert($source, $initial)); + $this->assertEquals($mergeResult, $this->_model->convert($source, $initial)); } } diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/PlaceholderTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/PlaceholderTest.php new file mode 100644 index 0000000000000..ed545572cfb5f --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Model/Config/PlaceholderTest.php @@ -0,0 +1,64 @@ +_requestMock = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false); + $this->_requestMock->expects( + $this->any() + )->method( + 'getDistroBaseUrl' + )->will( + $this->returnValue('http://localhost/') + ); + $this->_model = new \Magento\Store\Model\Config\Placeholder( + $this->_requestMock, + [ + 'unsecureBaseUrl' => Store::XML_PATH_UNSECURE_BASE_URL, + 'secureBaseUrl' => Store::XML_PATH_SECURE_BASE_URL + ], + \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER + ); + } + + public function testProcess() + { + $data = [ + 'web' => [ + 'unsecure' => [ + 'base_url' => 'http://localhost/', + 'base_link_url' => '{{unsecure_base_url}}website/de', + ], + 'secure' => [ + 'base_url' => 'https://localhost/', + 'base_link_url' => '{{secure_base_url}}website/de', + ], + ], + 'path' => 'value', + 'some_url' => '{{base_url}}some', + ]; + $expectedResult = $data; + $expectedResult['web']['unsecure']['base_link_url'] = 'http://localhost/website/de'; + $expectedResult['web']['secure']['base_link_url'] = 'https://localhost/website/de'; + $expectedResult['some_url'] = 'http://localhost/some'; + $this->assertEquals($expectedResult, $this->_model->process($data)); + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Processor/PlaceholderTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Processor/PlaceholderTest.php index 493895ddabe74..d566b6aca43d3 100644 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Processor/PlaceholderTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Processor/PlaceholderTest.php @@ -5,60 +5,55 @@ */ namespace Magento\Store\Test\Unit\Model\Config\Processor; -use Magento\Store\Model\Store; - +/** + * Class PlaceholderTest + */ class PlaceholderTest extends \PHPUnit_Framework_TestCase { /** * @var \Magento\Store\Model\Config\Processor\Placeholder */ - protected $_model; + private $model; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\Config\Placeholder|\PHPUnit_Framework_MockObject_MockObject */ - protected $_requestMock; + private $configPlaceholderMock; protected function setUp() { - $this->_requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false); - $this->_requestMock->expects( + $this->configPlaceholderMock = $this->getMock('Magento\Store\Model\Config\Placeholder', [], [], '', false); + + $this->configPlaceholderMock->expects( $this->any() )->method( - 'getDistroBaseUrl' - )->will( - $this->returnValue('http://localhost/') - ); - $this->_model = new \Magento\Store\Model\Config\Processor\Placeholder( - $this->_requestMock, - [ - 'unsecureBaseUrl' => Store::XML_PATH_UNSECURE_BASE_URL, - 'secureBaseUrl' => Store::XML_PATH_SECURE_BASE_URL - ], - \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER - ); + 'process' + )->withConsecutive( + [['key1' => 'value1']], + [['key2' => 'value2']] + )->willReturnOnConsecutiveCalls( + ['key1' => 'value1-processed'], + ['key2' => 'value2-processed'] + ); + + $this->model = new \Magento\Store\Model\Config\Processor\Placeholder($this->configPlaceholderMock); } public function testProcess() { $data = [ - 'web' => [ - 'unsecure' => [ - 'base_url' => 'http://localhost/', - 'base_link_url' => '{{unsecure_base_url}}website/de', - ], - 'secure' => [ - 'base_url' => 'https://localhost/', - 'base_link_url' => '{{secure_base_url}}website/de', - ], - ], - 'path' => 'value', - 'some_url' => '{{base_url}}some', + 'default' => ['key1' => 'value1'], + 'websites' => [ + 'code' => ['key2' => 'value2'] + ] + ]; + $expected = [ + 'default' => ['key1' => 'value1-processed'], + 'websites' => [ + 'code' => ['key2' => 'value2-processed'] + ] ]; - $expectedResult = $data; - $expectedResult['web']['unsecure']['base_link_url'] = 'http://localhost/website/de'; - $expectedResult['web']['secure']['base_link_url'] = 'https://localhost/website/de'; - $expectedResult['some_url'] = 'http://localhost/some'; - $this->assertEquals($expectedResult, $this->_model->process($data)); + + $this->assertEquals($expected, $this->model->process($data)); } } diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/DefaultReaderTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/DefaultReaderTest.php deleted file mode 100644 index dccabb9048dd3..0000000000000 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/DefaultReaderTest.php +++ /dev/null @@ -1,74 +0,0 @@ -_initialConfigMock = $this->getMock(\Magento\Framework\App\Config\Initial::class, [], [], '', false); - $this->_collectionFactory = $this->getMock( - \Magento\Store\Model\ResourceModel\Config\Collection\ScopedFactory::class, - ['create'], - [], - '', - false - ); - $this->_model = new \Magento\Store\Model\Config\Reader\DefaultReader( - $this->_initialConfigMock, - new \Magento\Framework\App\Config\Scope\Converter(), - $this->_collectionFactory - ); - } - - public function testRead() - { - $this->_initialConfigMock->expects( - $this->any() - )->method( - 'getData' - )->with( - ScopeConfigInterface::SCOPE_TYPE_DEFAULT - )->will( - $this->returnValue(['config' => ['key1' => 'default_value1', 'key2' => 'default_value2']]) - ); - $this->_collectionFactory->expects( - $this->once() - )->method( - 'create' - )->with( - ['scope' => 'default'] - )->will( - $this->returnValue( - [ - new \Magento\Framework\DataObject(['path' => 'config/key1', 'value' => 'default_db_value1']), - new \Magento\Framework\DataObject(['path' => 'config/key3', 'value' => 'default_db_value3']), - ] - ) - ); - $expectedData = [ - 'config' => ['key1' => 'default_db_value1', 'key2' => 'default_value2', 'key3' => 'default_db_value3'], - ]; - $this->assertEquals($expectedData, $this->_model->read()); - } -} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/ReaderPoolTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/ReaderPoolTest.php deleted file mode 100644 index fb814415fd2dd..0000000000000 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/ReaderPoolTest.php +++ /dev/null @@ -1,83 +0,0 @@ -_defaultReaderMock = $this->getMock( - \Magento\Store\Model\Config\Reader\DefaultReader::class, [], [], '', false - ); - $this->_websiteReaderMock = $this->getMock( - \Magento\Store\Model\Config\Reader\Website::class, [], [], '', false - ); - $this->_storeReaderMock = $this->getMock( - \Magento\Store\Model\Config\Reader\Store::class, [], [], '', false - ); - - $this->_model = new \Magento\Store\Model\Config\Reader\ReaderPool([ - 'default' => $this->_defaultReaderMock, - 'website' => $this->_websiteReaderMock, - 'store' => $this->_storeReaderMock, - ]); - } - - /** - * @covers \Magento\Store\Model\Config\Reader\ReaderPool::getReader - * @dataProvider getReaderDataProvider - * @param string $scope - * @param string $instanceType - */ - public function testGetReader($scope, $instanceType) - { - $this->assertInstanceOf($instanceType, $this->_model->getReader($scope)); - } - - /** - * @return array - */ - public function getReaderDataProvider() - { - return [ - [ - 'scope' => 'default', - 'expectedResult' => \Magento\Store\Model\Config\Reader\DefaultReader::class, - ], - [ - 'scope' => 'website', - 'expectedResult' => \Magento\Store\Model\Config\Reader\Website::class - ], - [ - 'scope' => 'store', - 'expectedResult' => \Magento\Store\Model\Config\Reader\Store::class - ], - ]; - } -} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/DefaultScopeTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/DefaultScopeTest.php new file mode 100644 index 0000000000000..2680bde4c00dc --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/DefaultScopeTest.php @@ -0,0 +1,46 @@ + 'default_db_value1', + 'config/key3' => 'default_db_value3', + ]; + $collectionFactory = $this->getMockBuilder(ScopedFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $collectionFactory->expects($this->once()) + ->method('create') + ->with(['scope' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT]) + ->willReturn([ + new DataObject(['path' => 'config/key1', 'value' => 'default_db_value1']), + new DataObject(['path' => 'config/key3', 'value' => 'default_db_value3']), + ]); + $converter = $this->getMockBuilder(Converter::class) + ->disableOriginalConstructor() + ->getMock(); + $converter->expects($this->once()) + ->method('convert') + ->with($expectedResult) + ->willReturnArgument(0); + $source = new DefaultScope( + $collectionFactory, + $converter + ); + $this->assertEquals($expectedResult, $source->get()); + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/StoreTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/StoreTest.php new file mode 100644 index 0000000000000..3fef89f4c22d4 --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/StoreTest.php @@ -0,0 +1,144 @@ +collectionFactory = $this->getMockBuilder(ScopedFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMockForAbstractClass(); + $this->converter = $this->getMockBuilder(Converter::class) + ->disableOriginalConstructor() + ->getMock(); + $this->websiteFactory = $this->getMockBuilder(\Magento\Store\Model\WebsiteFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMockForAbstractClass(); + $this->website = $this->getMockBuilder(\Magento\Store\Model\Website::class) + ->disableOriginalConstructor() + ->getMock(); + $this->websiteSource = $this->getMockBuilder(WebsiteSource::class) + ->disableOriginalConstructor() + ->getMock(); + $this->storeManager = $this->getMockBuilder(StoreManagerInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->store = $this->getMockBuilder(StoreInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->storeSource = new StoreSource( + $this->collectionFactory, + $this->converter, + $this->websiteFactory, + $this->websiteSource, + $this->storeManager + ); + } + + public function testGet() + { + $scopeCode = 'myStore'; + $expectedResult = [ + 'config/key1' => 'default_db_value1', + 'config/key3' => 'default_db_value3', + ]; + $this->storeManager->expects($this->once()) + ->method('getStore') + ->with($scopeCode) + ->willReturn($this->store); + $this->store->expects($this->once()) + ->method('getId') + ->willReturn(1); + $this->store->expects($this->once()) + ->method('getWebsiteId') + ->willReturn(1); + $this->collectionFactory->expects($this->once()) + ->method('create') + ->with(['scope' => ScopeInterface::SCOPE_STORES, 'scopeId' => 1]) + ->willReturn([ + new DataObject(['path' => 'config/key1', 'value' => 'default_db_value1']), + new DataObject(['path' => 'config/key3', 'value' => 'default_db_value3']), + ]); + $this->websiteSource->expects($this->once()) + ->method('get') + ->with(1) + ->willReturn([]); + + $this->converter->expects($this->at(0)) + ->method('convert') + ->with([ + 'config/key1' => 'default_db_value1', + 'config/key3' => 'default_db_value3' + ]) + ->willReturnArgument(0); + + $this->converter->expects($this->at(1)) + ->method('convert') + ->with($expectedResult) + ->willReturnArgument(0); + + $this->assertEquals($expectedResult, $this->storeSource->get($scopeCode)); + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/WebsiteTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/WebsiteTest.php new file mode 100644 index 0000000000000..b07dafd2fe67b --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Dynamic/WebsiteTest.php @@ -0,0 +1,113 @@ +collectionFactory = $this->getMockBuilder(ScopedFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMockForAbstractClass(); + $this->converter = $this->getMockBuilder(Converter::class) + ->disableOriginalConstructor() + ->getMock(); + $this->websiteFactory = $this->getMockBuilder(\Magento\Store\Model\WebsiteFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMockForAbstractClass(); + $this->website = $this->getMockBuilder(\Magento\Store\Model\Website::class) + ->disableOriginalConstructor() + ->getMock(); + $this->defaultScopeReader = $this->getMockBuilder(DefaultScope::class) + ->disableOriginalConstructor() + ->getMock(); + $this->websiteSource = new WebsiteSource( + $this->collectionFactory, + $this->converter, + $this->websiteFactory, + $this->defaultScopeReader + ); + } + + public function testGet() + { + $scopeCode = 'myWebsite'; + $expectedResult = [ + 'config/key1' => 'default_db_value1', + 'config/key3' => 'default_db_value3', + ]; + $this->websiteFactory->expects($this->once()) + ->method('create') + ->willReturn($this->website); + $this->website->expects($this->once()) + ->method('load') + ->with($scopeCode); + $this->website->expects($this->once()) + ->method('getId') + ->willReturn(1); + $this->collectionFactory->expects($this->once()) + ->method('create') + ->with(['scope' => ScopeInterface::SCOPE_WEBSITES, 'scopeId' => 1]) + ->willReturn([ + new DataObject(['path' => 'config/key1', 'value' => 'default_db_value1']), + new DataObject(['path' => 'config/key3', 'value' => 'default_db_value3']), + ]); + $this->defaultScopeReader->expects($this->once()) + ->method('get') + ->willReturn([]); + $this->converter->expects($this->once()) + ->method('convert') + ->with($expectedResult) + ->willReturnArgument(0); + $this->assertEquals($expectedResult, $this->websiteSource->get($scopeCode)); + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/DefaultScopeTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/DefaultScopeTest.php new file mode 100644 index 0000000000000..d0b68c59749f8 --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/DefaultScopeTest.php @@ -0,0 +1,34 @@ +getMockBuilder(\Magento\Framework\App\Config\Initial::class) + ->disableOriginalConstructor() + ->getMock(); + $initialConfig->expects($this->once()) + ->method('getData') + ->with(ScopeConfigInterface::SCOPE_TYPE_DEFAULT) + ->willReturn([]); + $converter = $this->getMockBuilder(Converter::class) + ->disableOriginalConstructor() + ->getMock(); + $converter->expects($this->once()) + ->method('convert') + ->with([]) + ->willReturnArgument(0); + + $defaultSource = new DefaultScope($initialConfig, $converter); + $this->assertEquals([], $defaultSource->get()); + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/StoreTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/StoreTest.php new file mode 100644 index 0000000000000..14531490cf4d0 --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/StoreTest.php @@ -0,0 +1,81 @@ +getMockBuilder(Initial::class) + ->disableOriginalConstructor() + ->getMock(); + $initialConfig->expects($this->once()) + ->method('getData') + ->with("stores|$scopeCode") + ->willReturn([ + 'general' => [ + 'locale' => [ + 'code'=> 'en_US' + ] + ] + ]); + $websiteSource = $this->getMockBuilder(Website::class) + ->disableOriginalConstructor() + ->getMock(); + $websiteSource->expects($this->once()) + ->method('get') + ->with($websiteCode) + ->willReturn([ + 'general' => [ + 'locale' => [ + 'code'=> 'ru_RU' + ] + ] + ]); + $storeManager = $this->getMockBuilder(StoreManagerInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $store = $this->getMockBuilder(\Magento\Store\Model\Store::class) + ->disableOriginalConstructor() + ->getMock(); + $store->expects($this->once()) + ->method('getData') + ->with('website_code') + ->willReturn('myWebsite'); + + $storeManager->expects($this->once()) + ->method('getStore') + ->with($scopeCode) + ->willReturn($store); + + $converter = $this->getMockBuilder(Converter::class) + ->disableOriginalConstructor() + ->getMock(); + $converter->expects($this->once()) + ->method('convert') + ->willReturnArgument(0); + + $storeSource = new Store($initialConfig, $websiteSource, $storeManager, $converter); + $this->assertEquals( + [ + 'general' => [ + 'locale' => [ + 'code'=> 'en_US' + ] + ] + ], + $storeSource->get($scopeCode) + ); + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/WebsiteTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/WebsiteTest.php new file mode 100644 index 0000000000000..6a4f3dd189eac --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/Source/Initial/WebsiteTest.php @@ -0,0 +1,62 @@ +getMockBuilder(Initial::class) + ->disableOriginalConstructor() + ->getMock(); + $initialConfig->expects($this->once()) + ->method('getData') + ->with("websites|$scopeCode") + ->willReturn([ + 'general' => [ + 'locale' => [ + 'code'=> 'en_US' + ] + ] + ]); + $defaultScopeReader = $this->getMockBuilder(DefaultScope::class) + ->disableOriginalConstructor() + ->getMock(); + $defaultScopeReader->expects($this->once()) + ->method('get') + ->willReturn([ + 'general' => [ + 'locale' => [ + 'code'=> 'ru_RU' + ] + ] + ]); + $converter = $this->getMockBuilder(Converter::class) + ->disableOriginalConstructor() + ->getMock(); + $converter->expects($this->once()) + ->method('convert') + ->willReturnArgument(0); + + $websiteSource = new Website($initialConfig, $defaultScopeReader, $converter); + $this->assertEquals( + [ + 'general' => [ + 'locale' => [ + 'code'=> 'en_US' + ] + ] + ], + $websiteSource->get($scopeCode) + ); + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/StoreTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/StoreTest.php deleted file mode 100644 index a3db4f89c1b87..0000000000000 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/StoreTest.php +++ /dev/null @@ -1,159 +0,0 @@ -_scopePullMock = $this->getMock(\Magento\Framework\App\Config\ScopePool::class, [], [], '', false); - $this->_storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class); - $this->_initialConfigMock = $this->getMock(\Magento\Framework\App\Config\Initial::class, [], [], '', false); - $this->_collectionFactory = $this->getMock( - \Magento\Store\Model\ResourceModel\Config\Collection\ScopedFactory::class, - ['create'], - [], - '', - false - ); - $this->_storeMock = $this->getMock(\Magento\Store\Model\Store::class, [], [], '', false); - $placeholderProcessor = $this->getMock( - \Magento\Store\Model\Config\Processor\Placeholder::class, - [], - [], - '', - false - ); - $placeholderProcessor->expects($this->any())->method('process')->will($this->returnArgument(0)); - $this->_model = new \Magento\Store\Model\Config\Reader\Store( - $this->_initialConfigMock, - $this->_scopePullMock, - new \Magento\Store\Model\Config\Converter($placeholderProcessor), - $this->_collectionFactory, - $this->_storeManagerMock - ); - } - - /** - * @dataProvider readDataProvider - * @param string|null $storeCode - */ - public function testRead($storeCode) - { - $websiteCode = 'default'; - $storeId = 1; - $websiteMock = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false); - $websiteMock->expects($this->any())->method('getCode')->will($this->returnValue($websiteCode)); - $this->_storeMock->expects($this->any())->method('getWebsite')->will($this->returnValue($websiteMock)); - $this->_storeMock->expects($this->any())->method('getId')->will($this->returnValue($storeId)); - $this->_storeMock->expects($this->any())->method('getCode')->will($this->returnValue($websiteCode)); - - $dataMock = $this->getMock(\Magento\Framework\App\Config\Data::class, [], [], '', false); - $dataMock->expects( - $this->any() - )->method( - 'getValue' - )->will( - $this->returnValue(['config' => ['key0' => 'website_value0', 'key1' => 'website_value1']]) - ); - - $dataMock->expects( - $this->once() - )->method( - 'getSource' - )->will( - $this->returnValue(['config' => ['key0' => 'website_value0', 'key1' => 'website_value1']]) - ); - $this->_scopePullMock->expects( - $this->once() - )->method( - 'getScope' - )->with( - 'website', - $websiteCode - )->will( - $this->returnValue($dataMock) - ); - - $this->_initialConfigMock->expects( - $this->once() - )->method( - 'getData' - )->with( - "stores|{$storeCode}" - )->will( - $this->returnValue(['config' => ['key1' => 'store_value1', 'key2' => 'store_value2']]) - ); - $this->_collectionFactory->expects( - $this->once() - )->method( - 'create' - )->with( - ['scope' => 'stores', 'scopeId' => $storeId] - )->will( - $this->returnValue( - [ - new \Magento\Framework\DataObject(['path' => 'config/key1', 'value' => 'store_db_value1']), - new \Magento\Framework\DataObject(['path' => 'config/key3', 'value' => 'store_db_value3']), - ] - ) - ); - - $this->_storeManagerMock - ->expects($this->any()) - ->method('getStore') - ->with($storeCode) - ->will($this->returnValue($this->_storeMock)); - $expectedData = [ - 'config' => [ - 'key0' => 'website_value0', - 'key1' => 'store_db_value1', - 'key2' => 'store_value2', - 'key3' => 'store_db_value3', - ], - ]; - $this->assertEquals($expectedData, $this->_model->read($storeCode)); - } - - public function readDataProvider() - { - return [ - ['default'], - [null], - ['code', ''] - ]; - } -} diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/WebsiteTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Reader/WebsiteTest.php deleted file mode 100644 index 8aed6de6dd235..0000000000000 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Reader/WebsiteTest.php +++ /dev/null @@ -1,131 +0,0 @@ -_initialConfigMock = $this->getMock(\Magento\Framework\App\Config\Initial::class, [], [], '', false); - $this->_scopePullMock = $this->getMock(\Magento\Framework\App\Config\ScopePool::class, [], [], '', false); - $this->_collectionFactory = $this->getMock( - \Magento\Store\Model\ResourceModel\Config\Collection\ScopedFactory::class, - ['create'], - [], - '', - false - ); - $websiteFactoryMock = $this->getMock( - \Magento\Store\Model\WebsiteFactory::class, - ['create'], - [], - '', - false - ); - $this->_websiteMock = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false); - $websiteFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->_websiteMock)); - - $this->_model = new \Magento\Store\Model\Config\Reader\Website( - $this->_initialConfigMock, - $this->_scopePullMock, - new \Magento\Framework\App\Config\Scope\Converter(), - $this->_collectionFactory, - $websiteFactoryMock - ); - } - - public function testRead() - { - $websiteCode = 'default'; - $websiteId = 1; - - $dataMock = $this->getMock(\Magento\Framework\App\Config\Data::class, [], [], '', false); - $dataMock->expects( - $this->any() - )->method( - 'getValue' - )->will( - $this->returnValue(['config' => ['key0' => 'default_value0', 'key1' => 'default_value1']]) - ); - $dataMock->expects( - $this->once() - )->method( - 'getSource' - )->will( - $this->returnValue(['config' => ['key0' => 'default_value0', 'key1' => 'default_value1']]) - ); - $this->_scopePullMock->expects( - $this->once() - )->method( - 'getScope' - )->with( - 'default', - null - )->will( - $this->returnValue($dataMock) - ); - - $this->_initialConfigMock->expects( - $this->any() - )->method( - 'getData' - )->with( - "websites|{$websiteCode}" - )->will( - $this->returnValue(['config' => ['key1' => 'website_value1', 'key2' => 'website_value2']]) - ); - $this->_websiteMock->expects($this->once())->method('load')->with($websiteCode); - $this->_websiteMock->expects($this->any())->method('getId')->will($this->returnValue($websiteId)); - $this->_collectionFactory->expects( - $this->once() - )->method( - 'create' - )->with( - ['scope' => 'websites', 'scopeId' => $websiteId] - )->will( - $this->returnValue( - [ - new \Magento\Framework\DataObject(['path' => 'config/key1', 'value' => 'website_db_value1']), - new \Magento\Framework\DataObject(['path' => 'config/key3', 'value' => 'website_db_value3']), - ] - ) - ); - $expectedData = [ - 'config' => [ - 'key0' => 'default_value0', - 'key1' => 'website_db_value1', - 'key2' => 'website_value2', - 'key3' => 'website_db_value3', - ], - ]; - $this->assertEquals($expectedData, $this->_model->read($websiteCode)); - } -} diff --git a/app/code/Magento/Store/Test/Unit/Model/StoreManagerTest.php b/app/code/Magento/Store/Test/Unit/Model/StoreManagerTest.php index 8e32ba2f989a9..f9d110359895e 100644 --- a/app/code/Magento/Store/Test/Unit/Model/StoreManagerTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/StoreManagerTest.php @@ -6,6 +6,8 @@ namespace Magento\Store\Test\Unit\Model; +use Magento\Framework\App\DeploymentConfig; + class StoreManagerTest extends \PHPUnit_Framework_TestCase { /** diff --git a/app/code/Magento/Store/Test/Unit/Model/StoreRepositoryTest.php b/app/code/Magento/Store/Test/Unit/Model/StoreRepositoryTest.php new file mode 100644 index 0000000000000..43bb331c017b2 --- /dev/null +++ b/app/code/Magento/Store/Test/Unit/Model/StoreRepositoryTest.php @@ -0,0 +1,185 @@ +storeFactory = $this->getMockBuilder(StoreFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $this->storeCollectionFactory = $this->getMockBuilder(CollectionFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $this->storeRepository = new StoreRepository( + $this->storeFactory, + $this->storeCollectionFactory + ); + $this->appConfigMock = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + $this->initDistroList(); + } + + private function initDistroList() + { + $repositoryReflection = new \ReflectionClass($this->storeRepository); + $deploymentProperty = $repositoryReflection->getProperty('appConfig'); + $deploymentProperty->setAccessible(true); + $deploymentProperty->setValue($this->storeRepository, $this->appConfigMock); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage Requested store is not found + */ + public function testGetWithException() + { + $storeMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->getMock(); + $this->storeFactory->expects($this->once()) + ->method('create') + ->willReturn($storeMock); + + $this->storeRepository->get('some_code'); + } + + public function testGetWithAvailableStoreFromScope() + { + $storeMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->getMock(); + $storeMock->expects($this->exactly(2)) + ->method('getId') + ->willReturn(1); + $this->storeFactory->expects($this->once()) + ->method('create') + ->willReturn($storeMock); + + $this->assertEquals($storeMock, $this->storeRepository->get('some_code')); + } + + public function testGetByIdWithAvailableStoreFromScope() + { + $storeMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->getMock(); + $storeMock->expects($this->once()) + ->method('getId') + ->willReturn(1); + $storeMock->expects($this->once()) + ->method('getCode') + ->willReturn('some_code'); + $this->storeFactory->expects($this->once()) + ->method('create') + ->willReturn($storeMock); + $this->appConfigMock->expects($this->once()) + ->method('get') + ->willReturn([]); + + $this->assertEquals($storeMock, $this->storeRepository->getById(1)); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage Requested store is not found + */ + public function testGetByIdWithException() + { + $storeMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->getMock(); + $this->storeFactory->expects($this->once()) + ->method('create') + ->willReturn($storeMock); + $this->appConfigMock->expects($this->once()) + ->method('get') + ->willReturn([]); + $this->storeRepository->getById(1); + } + + public function testGetList() + { + $storeMock1 = $this->getMock(StoreInterface::class); + $storeMock1->expects($this->once()) + ->method('getCode') + ->willReturn('some_code'); + $storeMock1->expects($this->once()) + ->method('getId') + ->willReturn(1); + $storeMock2 = $this->getMock(StoreInterface::class); + $storeMock2->expects($this->once()) + ->method('getCode') + ->willReturn('some_code_2'); + $storeMock2->expects($this->once()) + ->method('getId') + ->willReturn(2); + $this->appConfigMock->expects($this->once()) + ->method('get') + ->willReturn([ + [ + 'code' => 'some_code' + ], + [ + 'code' => 'some_code_2' + ] + ]); + $this->storeFactory->expects($this->at(0)) + ->method('create') + ->willReturn($storeMock1); + $this->storeFactory->expects($this->at(1)) + ->method('create') + ->willReturn($storeMock2); + + $this->assertEquals( + ['some_code' => $storeMock1, 'some_code_2' => $storeMock2], + $this->storeRepository->getList() + ); + } +} diff --git a/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php b/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php index 3cc8b646f75d4..fdb2e4530bfdb 100644 --- a/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php @@ -6,6 +6,8 @@ namespace Magento\Store\Test\Unit\Model; +use Magento\Framework\App\Config; + class WebsiteRepositoryTest extends \PHPUnit_Framework_TestCase { /** @@ -13,14 +15,29 @@ class WebsiteRepositoryTest extends \PHPUnit_Framework_TestCase */ protected $model; + /** + * @var \Magento\Store\Model\WebsiteFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $websiteFactoryMock; + /** * @var \Magento\Store\Model\ResourceModel\Website\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $websiteCollectionFactoryMock; + /** + * @var Config | \PHPUnit_Framework_MockObject_MockObject + */ + private $appConfigMock; + protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->websiteFactoryMock = + $this->getMockBuilder('Magento\Store\Model\WebsiteFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); $this->websiteCollectionFactoryMock = $this->getMockBuilder(\Magento\Store\Model\ResourceModel\Website\CollectionFactory::class) ->disableOriginalConstructor() @@ -29,26 +46,46 @@ protected function setUp() $this->model = $objectManager->getObject( \Magento\Store\Model\WebsiteRepository::class, [ + 'factory' => $this->websiteFactoryMock, 'websiteCollectionFactory' => $this->websiteCollectionFactoryMock ] ); + $this->appConfigMock = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + $this->initDistroList(); + } + private function initDistroList() + { + $repositoryReflection = new \ReflectionClass($this->model); + $deploymentProperty = $repositoryReflection->getProperty('appConfig'); + $deploymentProperty->setAccessible(true); + $deploymentProperty->setValue($this->model, $this->appConfigMock); } public function testGetDefault() { - $collectionMock = $this->getMockBuilder(\Magento\Store\Model\ResourceModel\Website\Collection::class) - ->disableOriginalConstructor() - ->setMethods([]) - ->getMock(); $websiteMock = $this->getMockBuilder(\Magento\Store\Api\Data\WebsiteInterface::class) ->disableOriginalConstructor() ->setMethods([]) ->getMock(); - $this->websiteCollectionFactoryMock->expects($this->any())->method('create')->willReturn($collectionMock); - $collectionMock->expects($this->any())->method('addFieldToFilter'); - $collectionMock->expects($this->any())->method('getItems')->willReturn([1]); - $collectionMock->expects($this->any())->method('getFirstItem')->willReturn($websiteMock); + $this->appConfigMock->expects($this->once()) + ->method('get') + ->with('scopes', 'websites') + ->willReturn([ + 'some_code' => [ + 'code' => 'some_code', + 'is_default' => 1 + ], + 'some_code_2' => [ + 'code' => 'some_code_2', + 'is_default' => 0 + ] + ]); + $this->websiteFactoryMock->expects($this->at(0)) + ->method('create') + ->willReturn($websiteMock); $website = $this->model->getDefault(); $this->assertInstanceOf(\Magento\Store\Api\Data\WebsiteInterface::class, $website); @@ -61,13 +98,24 @@ public function testGetDefault() */ public function testGetDefaultIsSeveral() { - $collectionMock = $this->getMockBuilder(\Magento\Store\Model\ResourceModel\Website\Collection::class) + $websiteMock = $this->getMockBuilder(\Magento\Store\Api\Data\WebsiteInterface::class) ->disableOriginalConstructor() ->setMethods([]) ->getMock(); - $this->websiteCollectionFactoryMock->expects($this->any())->method('create')->willReturn($collectionMock); - $collectionMock->expects($this->any())->method('addFieldToFilter'); - $collectionMock->expects($this->any())->method('getItems')->willReturn([1, 2]); + $this->appConfigMock->expects($this->once()) + ->method('get') + ->with('scopes', 'websites') + ->willReturn([ + 'some_code' => [ + 'code' => 'some_code', + 'is_default' => 1 + ], + 'some_code_2' => [ + 'code' => 'some_code_2', + 'is_default' => 1 + ] + ]); + $this->websiteFactoryMock->expects($this->any())->method('create')->willReturn($websiteMock); $this->model->getDefault(); } @@ -78,13 +126,24 @@ public function testGetDefaultIsSeveral() */ public function testGetDefaultIsZero() { - $collectionMock = $this->getMockBuilder(\Magento\Store\Model\ResourceModel\Website\Collection::class) + $websiteMock = $this->getMockBuilder(\Magento\Store\Api\Data\WebsiteInterface::class) ->disableOriginalConstructor() ->setMethods([]) ->getMock(); - $this->websiteCollectionFactoryMock->expects($this->any())->method('create')->willReturn($collectionMock); - $collectionMock->expects($this->any())->method('addFieldToFilter'); - $collectionMock->expects($this->any())->method('getItems')->willReturn([]); + $this->appConfigMock->expects($this->once()) + ->method('get') + ->with('scopes', 'websites') + ->willReturn([ + 'some_code' => [ + 'code' => 'some_code', + 'is_default' => 0 + ], + 'some_code_2' => [ + 'code' => 'some_code_2', + 'is_default' => 0 + ] + ]); + $this->websiteFactoryMock->expects($this->any())->method('create')->willReturn($websiteMock); $this->model->getDefault(); } diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index b9f76f6c2c313..a03aa6fee9e2d 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -10,6 +10,9 @@ "magento/module-media-storage": "100.2.*", "magento/framework": "100.2.*" }, + "suggest": { + "magento/module-deploy": "100.2.*" + }, "type": "magento2-module", "version": "100.2.0-dev", "license": [ diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml index 57bf057af2724..ad1766bae3291 100644 --- a/app/code/Magento/Store/etc/di.xml +++ b/app/code/Magento/Store/etc/di.xml @@ -35,7 +35,7 @@ - Magento\Store\Model\Config\Reader\ReaderPool\Proxy + Magento\Framework\Config\ReaderPool\Proxy Magento\Framework\App\Cache\Type\Config @@ -44,17 +44,6 @@ store - - - Magento\Framework\App\Config\ScopePool\Proxy - - - - - Magento\Framework\App\Config\ScopePool\Proxy - Magento\Store\Model\StoreManagerInterface\Proxy - - Magento\Store\Model\StoreManagerInterface\Proxy @@ -70,18 +59,7 @@ Magento\Store\Model\StoreManagerInterface\Proxy - - - - Magento\Store\Model\Config\Reader\DefaultReader - Magento\Store\Model\Config\Reader\Website - Magento\Store\Model\Config\Reader\Website - Magento\Store\Model\Config\Reader\Store - Magento\Store\Model\Config\Reader\Store - - - - + @@ -164,7 +142,7 @@ false - + Magento\Framework\App\Request\Http\Proxy @@ -344,4 +322,120 @@ + + + + + DefaultScopeReader + WebsiteScopeReader + WebsiteScopeReader + StoreScopeReader + StoreScopeReader + + + + + + + + Magento\Store\Model\Config\Reader\Source\Initial\DefaultScope + false + 10 + + + Magento\Store\Model\Config\Reader\Source\Dynamic\DefaultScope + false + 100 + + + + + + + + + Magento\Store\Model\Config\Reader\Source\Initial\Website + false + 10 + + + Magento\Store\Model\Config\Reader\Source\Dynamic\Website + false + 100 + + + + + + + + + Magento\Store\Model\Config\Reader\Source\Initial\Store + false + 10 + + + Magento\Store\Model\Config\Reader\Source\Dynamic\Store + false + 100 + + + + + + + + Magento\Store\Model\Config\Processor\Placeholder + + + + + + + Magento\Store\App\Config\Type\Scopes + + + + + + scopesConfigSourceAggregatedProxy + Magento\Framework\App\Cache\Type\Config + + + + + scopesConfigSourceAggregated + + + + + + + scopesConfigInitialDataProvider + 10 + + + Magento\Store\App\Config\Source\RuntimeConfigSource + 10 + + + + + + + Magento\Framework\App\DeploymentConfig\Reader + Magento\Store\App\Config\Type\Scopes::CONFIG_TYPE + Magento\Framework\Config\File\ConfigFilePool::APP_CONFIG + + + + + + + scopesConfigSourceAggregated + Magento\Store\App\Config\Type\Scopes::CONFIG_TYPE + + + + diff --git a/app/code/Magento/Theme/Model/Theme/ThemeProvider.php b/app/code/Magento/Theme/Model/Theme/ThemeProvider.php index 9fd3ce94dac45..89d7bfc18d30c 100644 --- a/app/code/Magento/Theme/Model/Theme/ThemeProvider.php +++ b/app/code/Magento/Theme/Model/Theme/ThemeProvider.php @@ -5,6 +5,13 @@ */ namespace Magento\Theme\Model\Theme; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\View\Design\Theme\ListInterface; +use Magento\Framework\App\DeploymentConfig; + +/** + * Provide data for theme grid and for theme edit page + */ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProviderInterface { /** @@ -27,6 +34,16 @@ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProvide */ private $themes; + /** + * @var ListInterface + */ + private $themeList; + + /** + * @var DeploymentConfig + */ + private $deploymentConfig; + /** * ThemeProvider constructor. * @@ -52,6 +69,11 @@ public function getThemeByFullPath($fullPath) if (isset($this->themes[$fullPath])) { return $this->themes[$fullPath]; } + + if (! $this->getDeploymentConfig()->isDbAvailable()) { + return $this->getThemeList()->getThemeByFullPath($fullPath); + } + /** @var $themeCollection \Magento\Theme\Model\ResourceModel\Theme\Collection */ $theme = $this->cache->load('theme'. $fullPath); if ($theme) { @@ -105,4 +127,28 @@ public function getThemeById($themeId) } return $themeModel; } + + /** + * @deprecated + * @return ListInterface + */ + private function getThemeList() + { + if ($this->themeList === null) { + $this->themeList = ObjectManager::getInstance()->get(ListInterface::class); + } + return $this->themeList; + } + + /** + * @deprecated + * @return DeploymentConfig + */ + private function getDeploymentConfig() + { + if ($this->deploymentConfig === null) { + $this->deploymentConfig = ObjectManager::getInstance()->get(DeploymentConfig::class); + } + return $this->deploymentConfig; + } } diff --git a/app/code/Magento/Theme/Test/Unit/Model/Theme/ThemeProviderTest.php b/app/code/Magento/Theme/Test/Unit/Model/Theme/ThemeProviderTest.php index 54120d2369983..fb0e1f9897587 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Theme/ThemeProviderTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Theme/ThemeProviderTest.php @@ -10,6 +10,10 @@ use Magento\Theme\Model\Theme\ThemeProvider; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +/** + * Class ThemeProviderTest + * @covers \Magento\Theme\Model\Theme\ThemeProvider + */ class ThemeProviderTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ @@ -52,6 +56,21 @@ public function testGetByFullPath() ] ); + $deploymentConfig = $this->getMockBuilder(\Magento\Framework\App\DeploymentConfig::class) + ->disableOriginalConstructor() + ->getMock(); + $deploymentConfig->expects($this->once()) + ->method('isDbAvailable') + ->willReturn(true); + + $objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); + $objectManagerMock->expects($this->any()) + ->method('get') + ->willReturnMap([ + [\Magento\Framework\App\DeploymentConfig::class, $deploymentConfig], + ]); + \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock); + $this->assertSame($theme, $themeProvider->getThemeByFullPath($path)); } @@ -66,6 +85,9 @@ public function testGetById() false ); $theme = $this->getMock(\Magento\Theme\Model\Theme::class, [], [], '', false); + $theme->expects($this->once()) + ->method('getId') + ->willReturn(1); $theme->expects($this->once())->method('load')->with($themeId)->will($this->returnSelf()); $theme->expects($this->once())->method('getId')->will($this->returnValue(1)); $theme->expects($this->once())->method('__sleep')->will($this->returnValue([])); diff --git a/app/code/Magento/Translation/App/Config/Type/Translation.php b/app/code/Magento/Translation/App/Config/Type/Translation.php new file mode 100644 index 0000000000000..937b586c83908 --- /dev/null +++ b/app/code/Magento/Translation/App/Config/Type/Translation.php @@ -0,0 +1,102 @@ +source = $source; + $this->cache = $cache; + $this->cachingNestedLevel = $cachingNestedLevel; + } + + /** + * @inheritDoc + */ + public function get($path = '') + { + $cachePath = $this->getCachePath($path); + if (!isset($this->data[$cachePath])) { + $data = $this->cache->load(self::CONFIG_TYPE . '/' . $cachePath); + if (!$data) { + $this->data[$cachePath] = new DataObject([$cachePath => $this->source->get($cachePath)]); + $this->cache->save( + serialize($this->data), + self::CONFIG_TYPE . '/' . $cachePath, + [Translate::TYPE_IDENTIFIER] + ); + } else { + $this->data = unserialize($data); + } + } + return $this->data[$cachePath]->getData($path); + } + + /** + * Build cache path + * + * @param string $path + * @return string + */ + private function getCachePath($path) + { + return implode('/', array_slice(explode('/', $path), 0, $this->cachingNestedLevel)); + } + + /** + * Clean cache + * + * @return void + */ + public function clean() + { + $this->data = null; + $this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, [Translate::TYPE_IDENTIFIER]); + } +} diff --git a/app/code/Magento/Translation/Model/ResourceModel/Translate.php b/app/code/Magento/Translation/Model/ResourceModel/Translate.php index 0d40a7254eba1..49a8bcdbb43a8 100644 --- a/app/code/Magento/Translation/Model/ResourceModel/Translate.php +++ b/app/code/Magento/Translation/Model/ResourceModel/Translate.php @@ -5,6 +5,11 @@ */ namespace Magento\Translation\Model\ResourceModel; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\App\Config; +use Magento\Translation\App\Config\Type\Translation; + class Translate extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb implements \Magento\Framework\Translate\ResourceInterface { @@ -18,6 +23,16 @@ class Translate extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb imp */ protected $scope; + /** + * @var Config + */ + private $appConfig; + + /** + * @var DeploymentConfig + */ + private $deployedConfig; + /** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver @@ -57,21 +72,25 @@ public function getTranslationArray($storeId = null, $locale = null) if ($storeId === null) { $storeId = $this->getStoreId(); } + $locale = (string) $locale; + $data = $this->getAppConfig()->get( + Translation::CONFIG_TYPE, + $locale . '/' . $this->getStoreCode($storeId), + [] + ); $connection = $this->getConnection(); - if (!$connection) { - return []; + if ($connection) { + $select = $connection->select() + ->from($this->getMainTable(), ['string', 'translate']) + ->where('store_id IN (0 , :store_id)') + ->where('locale = :locale') + ->order('store_id'); + $bind = [':locale' => $locale, ':store_id' => $storeId]; + $dbData = $connection->fetchPairs($select, $bind); + $data = array_replace($data, $dbData); } - - $select = $connection->select() - ->from($this->getMainTable(), ['string', 'translate']) - ->where('store_id IN (0 , :store_id)') - ->where('locale = :locale') - ->order('store_id'); - - $bind = [':locale' => (string)$locale, ':store_id' => $storeId]; - - return $connection->fetchPairs($select, $bind); + return $data; } /** @@ -115,6 +134,19 @@ public function getMainChecksum() return $this->getChecksum($this->getMainTable()); } + /** + * Get connection + * + * @return \Magento\Framework\DB\Adapter\AdapterInterface|false + */ + public function getConnection() + { + if (!$this->getDeployedConfig()->isDbAvailable()) { + return false; + } + return parent::getConnection(); + } + /** * Retrieve current store identifier * @@ -124,4 +156,39 @@ protected function getStoreId() { return $this->scopeResolver->getScope($this->scope)->getId(); } + + /** + * Retrieve store code by store id + * + * @param int $storeId + * @return string + */ + private function getStoreCode($storeId) + { + return $this->scopeResolver->getScope($storeId)->getCode(); + } + + /** + * @deprecated + * @return DeploymentConfig + */ + private function getDeployedConfig() + { + if ($this->deployedConfig === null) { + $this->deployedConfig = ObjectManager::getInstance()->get(DeploymentConfig::class); + } + return $this->deployedConfig; + } + + /** + * @deprecated + * @return Config + */ + private function getAppConfig() + { + if ($this->appConfig === null) { + $this->appConfig = ObjectManager::getInstance()->get(Config::class); + } + return $this->appConfig; + } } diff --git a/app/code/Magento/Translation/Model/Source/InitialTranslationSource.php b/app/code/Magento/Translation/Model/Source/InitialTranslationSource.php new file mode 100644 index 0000000000000..22828cfb1be05 --- /dev/null +++ b/app/code/Magento/Translation/Model/Source/InitialTranslationSource.php @@ -0,0 +1,82 @@ +translateFactory = $translateFactory; + $this->storeManager = $storeManager; + $this->deploymentConfig = $deploymentConfig; + } + + /** + * Read translations for the given 'path' from application initial configuration. + * + * @param string $path + * @return mixed + */ + public function get($path = '') + { + if (!$this->deploymentConfig->isDbAvailable()) { + return []; + } + + if (!$this->data) { + /** @var Translate $translate */ + $translate = $this->translateFactory->create(); + $select = $translate->getConnection()->select() + ->from($translate->getMainTable(), ['string', 'translate', 'store_id', 'locale']) + ->order('store_id'); + $translations = []; + foreach ($translate->getConnection()->fetchAll($select) as $item) { + $store = $this->storeManager->getStore($item['store_id']); + $translations[$item['locale']][$store->getCode()][$item['string']] = $item['translate']; + } + $this->data = new DataObject($translations); + } + return $this->data->getData($path) ?: []; + } +} diff --git a/app/code/Magento/Translation/Test/Unit/App/Config/Type/TranslationTest.php b/app/code/Magento/Translation/Test/Unit/App/Config/Type/TranslationTest.php new file mode 100644 index 0000000000000..82e0313dc55e0 --- /dev/null +++ b/app/code/Magento/Translation/Test/Unit/App/Config/Type/TranslationTest.php @@ -0,0 +1,95 @@ +source = $this->getMockBuilder(ConfigSourceInterface::class) + ->getMockForAbstractClass(); + $this->cache = $this->getMockBuilder(FrontendInterface::class) + ->getMockForAbstractClass(); + + $this->configType = new Translation($this->source, $this->cache); + } + + /** + * @param bool $isCached + * @dataProvider getDataProvider + */ + public function testGet($isCached) + { + $path = 'en_US/default'; + $data = [ + 'default' => [ + 'hello' => 'bonjour' + ] + ]; + + $this->cache->expects($this->once()) + ->method('load') + ->with(Translation::CONFIG_TYPE . '/en_US') + ->willReturn($isCached ? serialize(['en_US' => new DataObject(['en_US' => $data])]) : false); + + if (!$isCached) { + $this->source->expects($this->once()) + ->method('get') + ->with('en_US') + ->willReturn([ + 'default' => [ + 'hello' => 'bonjour' + ] + ]); + $this->cache + ->expects($this->once()) + ->method('save') + ->with( + serialize(['en_US' => new DataObject(['en_US' => $data])]), + Translation::CONFIG_TYPE . '/en_US', + [Translate::TYPE_IDENTIFIER] + ); + } + + $this->assertEquals(['hello' => 'bonjour'], $this->configType->get($path)); + } + + /** + * @return array + */ + public function getDataProvider() + { + return [ + [true], + [false] + ]; + } +} diff --git a/app/code/Magento/Translation/Test/Unit/Model/Source/InitialTranslationSourceTest.php b/app/code/Magento/Translation/Test/Unit/Model/Source/InitialTranslationSourceTest.php new file mode 100644 index 0000000000000..f6b3a39dcbf42 --- /dev/null +++ b/app/code/Magento/Translation/Test/Unit/Model/Source/InitialTranslationSourceTest.php @@ -0,0 +1,159 @@ +translationFactory = $this->getMockBuilder(TranslateFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->translation = $this->getMockBuilder(Translate::class) + ->disableOriginalConstructor() + ->getMock(); + $this->storeManager = $this->getMockBuilder(StoreManager::class) + ->disableOriginalConstructor() + ->getMock(); + $this->store = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->getMock(); + $this->connection = $this->getMockBuilder(AdapterInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->select = $this->getMockBuilder(Select::class) + ->disableOriginalConstructor() + ->getMock(); + $this->deploymentConfigMock = $this->getMockBuilder(DeploymentConfig::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->source = new InitialTranslationSource( + $this->translationFactory, + $this->storeManager, + $this->deploymentConfigMock + ); + } + + public function testGet() + { + $this->deploymentConfigMock->expects($this->once()) + ->method('isDbAvailable') + ->willReturn(true); + $this->translationFactory->expects($this->once()) + ->method('create') + ->willReturn($this->translation); + $this->translation->expects($this->atLeastOnce()) + ->method('getConnection') + ->willReturn($this->connection); + $this->connection->expects($this->once()) + ->method('select') + ->willReturn($this->select); + $this->translation->expects($this->once()) + ->method('getMainTable') + ->willReturn('main_table.translate'); + $this->select->expects($this->once()) + ->method('from') + ->with('main_table.translate', ['string', 'translate', 'store_id', 'locale']) + ->willReturnSelf(); + $this->select->expects($this->once()) + ->method('order') + ->with('store_id') + ->willReturnSelf(); + $this->connection->expects($this->once()) + ->method('fetchAll') + ->with($this->select) + ->willReturn([ + [ + 'store_id' => 2, + 'locale' => 'en_US', + 'string' => 'hello', + 'translate' => 'bonjour' + ] + ]); + $this->storeManager->expects($this->once()) + ->method('getStore') + ->with(2) + ->willReturn($this->store); + $this->store->expects($this->once()) + ->method('getCode') + ->willReturn('myStore'); + + $this->assertEquals( + [ + 'en_US' => [ + 'myStore' => [ + 'hello' => 'bonjour' + ] + ] + ], + $this->source->get() + ); + } + + public function testGetWithoutAvailableDb() + { + $this->deploymentConfigMock->expects($this->once()) + ->method('isDbAvailable') + ->willReturn(false); + $this->assertEquals([], $this->source->get()); + } +} diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json index 9ea00544d8050..6359d59251496 100644 --- a/app/code/Magento/Translation/composer.json +++ b/app/code/Magento/Translation/composer.json @@ -9,6 +9,9 @@ "magento/module-theme": "100.2.*", "magento/framework": "100.2.*" }, + "suggest": { + "magento/module-deploy": "100.2.*" + }, "type": "magento2-module", "version": "100.2.0-dev", "license": [ diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml index 8e29e94149912..8e27e7bf0daec 100644 --- a/app/code/Magento/Translation/etc/di.xml +++ b/app/code/Magento/Translation/etc/di.xml @@ -70,7 +70,6 @@ - @@ -87,7 +86,6 @@ - @@ -95,4 +93,27 @@ + + + Magento\Translation\Model\Source\InitialTranslationSource\Proxy + Magento\Framework\App\Cache\Type\Config + + + + + + Magento\Translation\App\Config\Type\Translation + + + + + + + + Magento\Translation\Model\Source\InitialTranslationSource + Magento\Translation\App\Config\Type\Translation::CONFIG_TYPE + + + + diff --git a/app/code/Magento/User/Model/ResourceModel/User.php b/app/code/Magento/User/Model/ResourceModel/User.php index b35deb6c5c6f1..d3e228d443581 100644 --- a/app/code/Magento/User/Model/ResourceModel/User.php +++ b/app/code/Magento/User/Model/ResourceModel/User.php @@ -34,13 +34,6 @@ class User extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb */ protected $dateTime; - /** - * Users table - * - * @var string - */ - protected $_usersTable; - /** * Construct * @@ -61,7 +54,6 @@ public function __construct( $this->_aclCache = $aclCache; $this->_roleFactory = $roleFactory; $this->dateTime = $dateTime; - $this->_usersTable = $this->getTable('admin_user'); } /** @@ -473,7 +465,7 @@ public function updateRoleUsersAcl(\Magento\Authorization\Model\Role $role) if (sizeof($users) > 0) { $bind = ['reload_acl_flag' => 1]; $where = ['user_id IN(?)' => $users]; - $rowsCount = $connection->update($this->_usersTable, $bind, $where); + $rowsCount = $connection->update($this->getTable('admin_user'), $bind, $where); } return $rowsCount > 0; diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php index 43134e838c9c7..ac12160359fb0 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php @@ -1,13 +1,18 @@ objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $appConfig = $this->objectManager->get(Config::class); + $appConfig->clean(); } public function tearDown() diff --git a/dev/tests/integration/etc/di/preferences/ce.php b/dev/tests/integration/etc/di/preferences/ce.php index cec08b1d91da7..f1654cba97d74 100644 --- a/dev/tests/integration/etc/di/preferences/ce.php +++ b/dev/tests/integration/etc/di/preferences/ce.php @@ -1,5 +1,7 @@ \Magento\TestFramework\View\Layout::class, \Magento\Framework\App\ResourceConnection\ConnectionAdapterInterface::class => \Magento\TestFramework\Db\ConnectionAdapter::class, - \Magento\Framework\Filesystem\DriverInterface::class => \Magento\Framework\Filesystem\Driver\File::class + \Magento\Framework\Filesystem\DriverInterface::class => \Magento\Framework\Filesystem\Driver\File::class, + \Magento\Framework\App\Config\ScopeConfigInterface::class => \Magento\TestFramework\App\Config::class, ]; diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/AdminConfigFixture.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/AdminConfigFixture.php index 780beaef7cc44..5b687d4d5a466 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/AdminConfigFixture.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/AdminConfigFixture.php @@ -9,6 +9,11 @@ */ namespace Magento\TestFramework\Annotation; +/** + * Handler for applying magentoAdminConfig annotation + * + * @package Magento\TestFramework\Annotation + */ class AdminConfigFixture { /** @@ -34,7 +39,7 @@ class AdminConfigFixture protected function _getConfigValue($configPath) { return \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Backend\App\ConfigInterface::class + \Magento\Framework\App\Config\MutableScopeConfigInterface::class )->getValue( $configPath ); @@ -49,7 +54,7 @@ protected function _getConfigValue($configPath) protected function _setConfigValue($configPath, $value) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Backend\App\ConfigInterface::class + \Magento\Framework\App\Config\MutableScopeConfigInterface::class )->setValue( $configPath, $value diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php index 25863089bd630..d9df69b7b76e5 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php @@ -11,6 +11,11 @@ use Magento\Framework\App\Config\ScopeConfigInterface; +/** + * Handler which works with magentoConfigFixture annotations + * + * @package Magento\TestFramework\Annotation + */ class ConfigFixture { /** diff --git a/dev/tests/integration/framework/Magento/TestFramework/App/Config.php b/dev/tests/integration/framework/Magento/TestFramework/App/Config.php new file mode 100644 index 0000000000000..43a47debf9064 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/App/Config.php @@ -0,0 +1,137 @@ +data[$configType] = new DataObject($data); + } + + /** + * Retrieve Scope Code Resolver + * + * @return ScopeCodeResolver + */ + private function getScopeCodeResolver() + { + if (!$this->scopeCodeResolver) { + $this->scopeCodeResolver = ObjectManager::getInstance()->get(ScopeCodeResolver::class); + } + + return $this->scopeCodeResolver; + } + + /** + * Set config value in the corresponding config scope + * + * @param string $path + * @param mixed $value + * @param string $scope + * @param null|string $scopeCode + * @return void + */ + public function setValue( + $path, + $value, + $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + $scopeCode = null + ) { + $result = $this->get('system'); + + if ($scope === 'store') { + $scope = 'stores'; + } elseif ($scope === 'website') { + $scope = 'websites'; + } + + if (empty($scopeCode)) { + $scopeCode = $this->getScopeCodeResolver()->resolve($scope, $scopeCode); + } + + $keys = explode('/', $path); + if ($scope !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT) { + $searchKeys = array_merge([$scope, $scopeCode], $keys); + } else { + $searchKeys = array_merge([$scope], $keys); + } + + $this->updateResult($searchKeys, $result, $value); + $this->setData($result, 'system'); + } + + /** + * Recursively update results in global variable, which hold configs + * + * @param array $keys + * @param array $result + * @param mixed $value + * @return void + */ + private function updateResult(array $keys, & $result, $value) + { + $key = array_shift($keys); + + if (empty($keys)) { + $result[$key] = $value; + } else { + $this->updateResult($keys, $result[$key], $value); + } + } + + /** + * Flush all muted settings + * + * @return void + */ + public function clean() + { + $this->data = null; + $this->scopeCodeResolver = null; + parent::clean(); + } + + /** + * @inheritdoc + */ + public function get($configType, $path = null, $default = null) + { + $path = $path === null ? '' : $path; + if (!isset($this->data[$configType]) || $this->data[$configType]->getData($path) === null) { + return parent::get($configType, $path, $default); + } + + return $this->data[$configType]->getData($path); + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/App/MutableScopeConfig.php b/dev/tests/integration/framework/Magento/TestFramework/App/MutableScopeConfig.php new file mode 100644 index 0000000000000..3af325bab0ec1 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/App/MutableScopeConfig.php @@ -0,0 +1,80 @@ +getTestAppConfig()->isSetFlag($path, $scopeType, $scopeCode); + } + + /** + * @inheritdoc + */ + public function getValue($path, $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null) + { + return $this->getTestAppConfig()->getValue($path, $scopeType, $scopeCode); + } + + /** + * @inheritdoc + */ + public function setValue( + $path, + $value, + $scopeType = \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + $scopeCode = null + ) { + return $this->getTestAppConfig()->setValue($path, $value, $scopeType, $scopeCode); + } + + /** + * Clean app config cache + * + * @param string|null $type + * @return void + */ + public function clean() + { + $this->getTestAppConfig()->clean(); + } + + /** + * Retrieve test app config instance + * + * @return \Magento\TestFramework\App\Config + */ + private function getTestAppConfig() + { + if (!$this->testAppConfig) { + $this->testAppConfig = ObjectManager::getInstance()->get(ScopeConfigInterface::class); + } + + return $this->testAppConfig; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/App/ReinitableConfig.php b/dev/tests/integration/framework/Magento/TestFramework/App/ReinitableConfig.php new file mode 100644 index 0000000000000..6d0b52555a395 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/App/ReinitableConfig.php @@ -0,0 +1,43 @@ +getTestScopeConfig()->clean(); + return $this; + } + + /** + * Retrieve Test Scope Config + * + * @return Config + */ + public function getTestScopeConfig() + { + if (!$this->testAppConfig) { + $this->testAppConfig = ObjectManager::getInstance()->get(Config::class); + } + + return $this->testAppConfig; + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index 3ae2c994511c7..15407f2cd572f 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -6,8 +6,6 @@ namespace Magento\TestFramework; use Magento\Framework\Autoload\AutoloaderInterface; -use Magento\Framework\Filesystem; -use Magento\Framework\Filesystem\DriverInterface; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\DeploymentConfig; use Magento\Framework\Config\ConfigOptionsListConstants; @@ -561,7 +559,6 @@ protected function _resetApp() /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->clearCache(); - \Magento\Framework\Data\Form::setElementRenderer(null); \Magento\Framework\Data\Form::setFieldsetRenderer(null); \Magento\Framework\Data\Form::setFieldsetElementRenderer(null); diff --git a/dev/tests/integration/framework/Magento/TestFramework/Backend/App/Config.php b/dev/tests/integration/framework/Magento/TestFramework/Backend/App/Config.php new file mode 100644 index 0000000000000..7907cf5a82d2e --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Backend/App/Config.php @@ -0,0 +1,46 @@ +mutableScopeConfig = $mutableScopeConfig; + } + + /** + * @inheritdoc + */ + public function setValue( + $path, + $value, + $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + $scopeCode = null + ) { + $this->mutableScopeConfig->setValue($path, $value, $scope, $scopeCode); + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/DocBlock.php b/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/DocBlock.php index 2349ae949876e..bf890b2448e23 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/DocBlock.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/DocBlock.php @@ -53,6 +53,7 @@ protected function _getSubscribers(\Magento\TestFramework\Application $applicati new \Magento\TestFramework\Isolation\WorkingDirectory(), new \Magento\TestFramework\Isolation\DeploymentConfig(), new \Magento\TestFramework\Annotation\AppIsolation($application), + new \Magento\TestFramework\Isolation\AppConfig(), new \Magento\TestFramework\Annotation\ConfigFixture(), new \Magento\TestFramework\Annotation\DataFixtureBeforeTransaction($this->_fixturesBaseDir), new \Magento\TestFramework\Event\Transaction( @@ -66,7 +67,7 @@ protected function _getSubscribers(\Magento\TestFramework\Application $applicati new \Magento\TestFramework\Annotation\ComponentRegistrarFixture($this->_fixturesBaseDir), new \Magento\TestFramework\Annotation\AppArea($application), new \Magento\TestFramework\Annotation\Cache($application), - new \Magento\TestFramework\Annotation\AdminConfigFixture() + new \Magento\TestFramework\Annotation\AdminConfigFixture(), ]; } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php b/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php new file mode 100644 index 0000000000000..bc5e05d2a9da0 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php @@ -0,0 +1,62 @@ +getTestAppConfig()->clean(); + } + + /** + * Retrieve Test App Config + * + * @return Config + */ + private function getTestAppConfig() + { + if (!$this->testAppConfig) { + $this->testAppConfig = ObjectManager::getInstance()->get(Config::class); + } + + return $this->testAppConfig; + } + + /**Clean memorized and cached setting values + * Checks if deployment configuration has been changed by a test + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @param \PHPUnit_Framework_TestCase $test + * @return void + */ + public function endTest(\PHPUnit_Framework_TestCase $test) + { + $this->getTestAppConfig()->clean(); + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php index c65ce09079128..ad685845cde00 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php @@ -5,6 +5,7 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\TestFramework; class ObjectManager extends \Magento\Framework\App\ObjectManager @@ -23,6 +24,8 @@ class ObjectManager extends \Magento\Framework\App\ObjectManager * @var array */ protected $persistedInstances = [ + \Magento\TestFramework\App\Config::class, + \Magento\Framework\App\Config\ScopeConfigInterface::class, \Magento\Framework\App\ResourceConnection::class, \Magento\Framework\Config\Scope::class, \Magento\Framework\ObjectManager\RelationsInterface::class, diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php index b4a9819228e5f..08b530e9c98de 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php @@ -1,14 +1,26 @@ [ - \Magento\Framework\Stdlib\CookieManagerInterface::class => \Magento\TestFramework\CookieManager::class, - \Magento\Store\Model\StoreManagerInterface::class => \Magento\TestFramework\Store\StoreManager::class, + CookieManagerInterface::class => \Magento\TestFramework\CookieManager::class, + StoreManagerInterface::class => \Magento\TestFramework\Store\StoreManager::class, + ScopeConfigInterface::class => \Magento\TestFramework\App\Config::class, + \Magento\Framework\App\Config::class => \Magento\TestFramework\App\Config::class, + BackendConfig::class => \Magento\TestFramework\Backend\App\Config::class, + ReinitableConfig::class => \Magento\TestFramework\App\ReinitableConfig::class, + MutableScopeConfig::class => \Magento\TestFramework\App\MutableScopeConfig::class, ] ]; } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Store/StoreManager.php b/dev/tests/integration/framework/Magento/TestFramework/Store/StoreManager.php index 9f0124593ac1e..5b2546765a132 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Store/StoreManager.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Store/StoreManager.php @@ -5,6 +5,14 @@ */ namespace Magento\TestFramework\Store; +use Magento\TestFramework\App\Config; +use Magento\TestFramework\ObjectManager; + +/** + * Integration tests decoration of store manager + * + * @package Magento\TestFramework\Store + */ class StoreManager implements \Magento\Store\Model\StoreManagerInterface { /** @@ -117,7 +125,16 @@ public function getWebsites($withDefault = false, $codeKey = false) */ public function reinitStores() { + //In order to restore configFixture values + $testAppConfig = ObjectManager::getInstance()->get(Config::class); + $reflection = new \ReflectionClass($testAppConfig); + $dataProperty = $reflection->getProperty('data'); + $dataProperty->setAccessible(true); + $savedConfig = $dataProperty->getValue($testAppConfig); + $this->decoratedStoreManager->reinitStores(); + + $dataProperty->setValue($testAppConfig, $savedConfig); $this->dispatchInitCurrentStoreAfterEvent(); } diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/App/ConfigTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/App/ConfigTest.php new file mode 100644 index 0000000000000..541122a45571d --- /dev/null +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/App/ConfigTest.php @@ -0,0 +1,54 @@ +getMockBuilder(ScopePool::class) + ->disableOriginalConstructor() + ->getMock(); + $scopeCodeResolver = $this->getMockBuilder(ScopeCodeResolver::class) + ->disableOriginalConstructor() + ->getMock(); + $this->model = new Config($scopePool, $scopeCodeResolver); + } + + public function testGet() + { + $configType = "system"; + $path = "stores/one"; + $value = 1; + $this->model->setValue($path, $value, 'default', 'one'); + + $this->assertEquals($value, $this->model->get($configType, 'default/stores/one')); + } + + public function testClean() + { + $configType = "system"; + $path = "stores/one"; + $value = 1; + $this->model->setValue($path, $value, 'default', 'one'); + $this->assertEquals($value, $this->model->get($configType, 'default/stores/one')); + $this->model->clean(); + $this->assertNull($this->model->get($configType, 'default/stores/one')); + } +} diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php new file mode 100644 index 0000000000000..58166992ced15 --- /dev/null +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php @@ -0,0 +1,49 @@ +model = new \Magento\TestFramework\Isolation\AppConfig(); + } + + protected function tearDown() + { + $this->model = null; + } + + public function testStartTestEndTest() + { + $test = $this->getMockBuilder(\PHPUnit_Framework_TestCase::class) + ->disableOriginalConstructor() + ->getMock(); + $modelReflection = new \ReflectionClass($this->model); + $testAppConfigProperty = $modelReflection->getProperty('testAppConfig'); + $testAppConfigProperty->setAccessible(true); + $testAppConfigMock = $this->getMockBuilder(\Magento\TestFramework\App\Config::class) + ->disableOriginalConstructor() + ->getMock(); + $testAppConfigProperty->setValue($this->model, $testAppConfigMock); + $testAppConfigMock->expects($this->exactly(2)) + ->method('clean'); + $this->model->startTest($test); + $this->model->endTest($test); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php index 650c84f17a366..071c2499bb332 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php @@ -397,7 +397,7 @@ public function getTaxPriceDataProvider() ], 'price include tax, display excluding tax, high rate product tax class, round' => [ (new \Magento\Framework\DataObject())->setPrice(3.256)->setRoundPrice(true), - '2.67', + '2.97', [ [ 'path' => Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/FlatTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/FlatTest.php index 0d6f18dbacbc8..9252f87079fa5 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/FlatTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/FlatTest.php @@ -27,11 +27,6 @@ protected function setUp() ); } - public function testIsEnabledDefault() - { - $this->assertFalse($this->_state->isFlatEnabled()); - } - /** * @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1 */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php index ed8f12020a977..2d811ea59bfa9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php @@ -11,6 +11,7 @@ /** * Class SourceTest + * @magentoAppIsolation enabled */ class SourceTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php index 963de3e46fea6..6b1e53242cb3d 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php @@ -3,7 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - /* Create attribute */ /** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_rollback.php new file mode 100644 index 0000000000000..6fe9f0d2b4898 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute_rollback.php @@ -0,0 +1,18 @@ +get('Magento\Framework\Registry'); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ +$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\ResourceModel\Eav\Attribute' +); +$attribute->load('multiselect_attribute', 'attribute_code'); +$attribute->delete(); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php index f252447a1586d..259b7a9166c32 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php @@ -3,8 +3,14 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ + +/** + * Create multiselect attribute + */ require __DIR__ . '/multiselect_attribute.php'; +/** Create product with options and multiselect attribute */ + /** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Catalog\Setup\CategorySetup::class diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute_rollback.php new file mode 100644 index 0000000000000..97937bc3509ea --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute_rollback.php @@ -0,0 +1,23 @@ +get('Magento\Framework\Registry'); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var $productCollection \Magento\Catalog\Model\ResourceModel\Product */ +$productCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product') + ->getCollection(); + +foreach ($productCollection as $product) { + $product->delete(); +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/text_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/text_attribute_rollback.php new file mode 100644 index 0000000000000..c81afcaf95d2e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/text_attribute_rollback.php @@ -0,0 +1,18 @@ +get('Magento\Framework\Registry'); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ +$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\ResourceModel\Eav\Attribute' +); +$attribute->load('text_attribute', 'attribute_code'); +$attribute->delete(); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php index 3f566bda2d352..d3f34c76752f5 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php @@ -6,9 +6,12 @@ namespace Magento\CatalogImportExport\Model; use Magento\Framework\App\Bootstrap; +use Magento\Framework\App\Config; use Magento\Framework\App\Filesystem\DirectoryList; /** + * Abstract class for testing product export and import scenarios + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ abstract class AbstractProductExportImportTestCase extends \PHPUnit_Framework_TestCase @@ -64,6 +67,8 @@ protected function setUp() $this->productResource = $this->objectManager->create( \Magento\Catalog\Model\ResourceModel\Product::class ); + $appConfig = $this->objectManager->get(Config::class); + $appConfig->clean(); } protected function tearDown() diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php index dc9e440b045f8..9087aefa11e83 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php @@ -7,6 +7,8 @@ /** * @magentoDataFixtureBeforeTransaction Magento/Catalog/_files/enable_reindex_schedule.php + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled */ class ProductTest extends \PHPUnit_Framework_TestCase { @@ -66,6 +68,7 @@ protected function setUp() /** * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php + * @magentoDbIsolationEnabled */ public function testExport() { @@ -88,6 +91,7 @@ public function testExport() /** * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_with_product_links_data.php + * @magentoDbIsolationEnabled */ public function testExportWithProductLinks() { @@ -101,7 +105,9 @@ public function testExportWithProductLinks() /** * Verify that all stock item attribute values are exported (aren't equal to empty string) - * + * + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled * @covers \Magento\CatalogImportExport\Model\Export\Product::export * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php */ @@ -163,7 +169,7 @@ public function verifyRow(array $rowData) /** * Verifies if exception processing works properly - * + * @magentoDbIsolation enabled * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php */ public function testExceptionInGetExportData() diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 9ab7db147d811..0bbf2613febcf 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -24,7 +24,8 @@ /** * Class ProductTest - * + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled * @magentoDataFixtureBeforeTransaction Magento/Catalog/_files/enable_reindex_schedule.php * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php index ffee568b0622f..f7fd7cec31996 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php @@ -3,12 +3,13 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - -\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(); - +/** Create category */ require dirname(dirname(__DIR__)) . '/Catalog/_files/category.php'; +/** Create fixture store */ require dirname(dirname(__DIR__)) . '/Store/_files/second_store.php'; +/** Create product with multiselect attribute and values */ require dirname(dirname(__DIR__)) . '/Catalog/_files/products_with_multiselect_attribute.php'; +/** Create dummy text attribute */ require dirname(dirname(__DIR__)) . '/Catalog/_files/product_text_attribute.php'; $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_rollback.php new file mode 100644 index 0000000000000..fdb65e731f825 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_rollback.php @@ -0,0 +1,10 @@ +create( diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data_rollback.php new file mode 100644 index 0000000000000..519568103b9da --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data_rollback.php @@ -0,0 +1,12 @@ +save($attribute); + + /* Assign attribute to attribute set */ + $installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId()); } -/* Assign attribute to attribute set */ -$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId()); $eavConfig->clear(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_non_default_website_id.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_non_default_website_id.php index 305a6e699125f..79a2ff32eed54 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_non_default_website_id.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_non_default_website_id.php @@ -1,5 +1,7 @@ setName('new Website')->setCode('newwebsite')->save(); $websiteId = $website->getId(); - -$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( +$storeManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(\Magento\Store\Model\StoreManager::class); +$storeManager->reinitStores(); +$customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Customer\Model\Customer::class); /** @var Magento\Customer\Model\Customer $customer */ $customer->setWebsiteId( @@ -47,7 +51,7 @@ $customer->isObjectNew(true); /** @var \Magento\Customer\Model\Address $addressOne */ -$addressOne = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( +$addressOne = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Customer\Model\Address::class); $addressOneData = [ 'firstname' => 'Firstname', @@ -63,7 +67,7 @@ $customer->addAddress($addressOne); /** @var \Magento\Customer\Model\Address $addressTwo */ -$addressTwo = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( +$addressTwo = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Customer\Model\Address::class); $addressTwoData = [ 'firstname' => 'test firstname', @@ -79,7 +83,7 @@ $customer->addAddress($addressTwo); /** @var \Magento\Customer\Model\Address $addressThree */ -$addressThree = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( +$addressThree = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Customer\Model\Address::class); $addressThreeData = [ 'firstname' => 'removed firstname', diff --git a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php new file mode 100644 index 0000000000000..684b2498bca7e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php @@ -0,0 +1,33 @@ +command = Bootstrap::getObjectManager()->get(ApplicationDumpCommand::class); + } + + public function testExecute() + { + $inputMock = $this->getMock(InputInterface::class); + $outputMock = $this->getMock(OutputInterface::class); + $outputMock->expects($this->once()) + ->method('writeln') + ->with('Done.'); + $this->assertEquals(0, $this->command->run($inputMock, $outputMock)); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php index be9c2afe32f42..5144c31bfd148 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -12,6 +12,7 @@ use Magento\Setup\Module\I18n\Locale; /** + * @magentoAppIsolation enabled * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class FilterTest extends \PHPUnit_Framework_TestCase diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Config/DataTest.php index 25187acef3950..5a5a6fa0cf99c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Config/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Config/DataTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\App\Config; +use Magento\Framework\App\Config; +use Magento\Framework\App\ObjectManager; + class DataTest extends \PHPUnit_Framework_TestCase { const SAMPLE_CONFIG_PATH = 'web/unsecure/base_url'; @@ -45,6 +48,8 @@ protected static function _refreshConfiguration() \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\App\CacheInterface::class) ->clean([\Magento\Framework\App\Config::CACHE_TAG]); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(); + $appConfig = ObjectManager::getInstance()->get(Config::class); + $appConfig->clean(); } protected function setUp() diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/_files/filterable_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Framework/Search/_files/filterable_attribute_rollback.php index 9498a4251be12..214f2b1dda5de 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Search/_files/filterable_attribute_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Search/_files/filterable_attribute_rollback.php @@ -3,7 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - /* Create attribute */ /** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php b/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php index fbbc2ffc7bd1b..e2b1982ba534c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php @@ -6,8 +6,12 @@ namespace Magento\Framework; use Magento\TestFramework\Helper\Bootstrap; -use Magento\Framework\Phrase; +/** + * Class TranslateCachingTest + * @package Magento\Framework + * @magentoAppIsolation enabled + */ class TranslateCachingTest extends \PHPUnit_Framework_TestCase { /** diff --git a/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php b/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php index 2af602ff91850..0b3566a129b7f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php @@ -8,6 +8,7 @@ use Magento\TestFramework\Helper\Bootstrap; /** + * @magentoAppIsolation enabled * @magentoCache all disabled * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php index 13d7636b0cbac..fe12480e25879 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/ShipmentTest.php @@ -5,6 +5,11 @@ */ namespace Magento\Sales\Model\Order; +/** + * Class ShipmentTest + * @magentoAppIsolation enabled + * @package Magento\Sales\Model\Order + */ class ShipmentTest extends \PHPUnit_Framework_TestCase { /** diff --git a/dev/tests/integration/testsuite/Magento/Store/Controller/Store/SwitchActionTest.php b/dev/tests/integration/testsuite/Magento/Store/Controller/Store/SwitchActionTest.php index cdf0a38d24915..155431ba67f1e 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Controller/Store/SwitchActionTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Controller/Store/SwitchActionTest.php @@ -21,7 +21,7 @@ class SwitchActionTest extends \Magento\TestFramework\TestCase\AbstractControlle */ public function testExecuteWithCustomDefaultStore() { - + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(); $defaultStoreCode = 'default'; $modifiedDefaultCode = 'modified_default_code'; $this->changeStoreCode($defaultStoreCode, $modifiedDefaultCode); diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/scope.config.fixture.php b/dev/tests/integration/testsuite/Magento/Store/_files/scope.config.fixture.php new file mode 100644 index 0000000000000..1bf8fa8111833 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/_files/scope.config.fixture.php @@ -0,0 +1,11 @@ +save(); - - /* Refresh stores memory cache */ - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Store\Model\StoreManagerInterface::class - )->reinitStores(); } + +/* Refresh stores memory cache */ +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + \Magento\Store\Model\StoreManagerInterface::class +)->reinitStores(); + diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/store.php b/dev/tests/integration/testsuite/Magento/Store/_files/store.php index 9bb761f0b6a13..35ade6fe3a435 100644 --- a/dev/tests/integration/testsuite/Magento/Store/_files/store.php +++ b/dev/tests/integration/testsuite/Magento/Store/_files/store.php @@ -1,5 +1,7 @@ save(); } +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +/* Refresh stores memory cache */ +$objectManager->get('Magento\Store\Model\StoreManagerInterface')->reinitStores(); diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/website.php b/dev/tests/integration/testsuite/Magento/Store/_files/website.php index 4e1f03fcadb58..dfe04879548cc 100644 --- a/dev/tests/integration/testsuite/Magento/Store/_files/website.php +++ b/dev/tests/integration/testsuite/Magento/Store/_files/website.php @@ -8,3 +8,7 @@ $website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Website::class); $website->setData(['code' => 'test', 'name' => 'Test Website', 'default_group_id' => '1', 'is_default' => '0']); $website->save(); + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +/* Refresh stores memory cache */ +$objectManager->get('Magento\Store\Model\StoreManagerInterface')->reinitStores(); diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php index 54f4a03099280..8e820c1d22c10 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php @@ -146,6 +146,7 @@ public function testStoreElementMultiStores() * Test fields disabled status * @dataProvider fieldsStateDataProvider * @magentoAppIsolation enabled + * @magentoConfigFixture current_store general/single_store_mode/enabled 0 */ public function testReadonlyFields($urlRewrite, $fields) { diff --git a/dev/tests/integration/testsuite/Magento/User/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/User/Helper/DataTest.php index 4c0a81b41efd4..c197f3f86d22f 100644 --- a/dev/tests/integration/testsuite/Magento/User/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Helper/DataTest.php @@ -42,7 +42,7 @@ public function testGetResetPasswordLinkExpirationPeriod() { /** @var $configModel \Magento\Backend\App\ConfigInterface */ $configModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Backend\App\ConfigInterface::class + \Magento\Framework\App\Config\MutableScopeConfigInterface::class ); $this->assertEquals( 2, diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php index 2f3d312fb41ff..5c8c2fdf05016 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ModuleDBChangeTest.php @@ -15,12 +15,7 @@ class ModuleDBChangeTest extends \PHPUnit_Framework_TestCase /** * @var string */ - private static $branchesFilesPattern = __DIR__ . '/../_files/branches*'; - - /** - * @var string - */ - private static $changedFilesPattern = __DIR__ . '/../_files/changed_files*'; + protected static $changedFilesPattern = __DIR__ . '/../_files/changed_files*'; /** * @var string @@ -37,24 +32,6 @@ class ModuleDBChangeTest extends \PHPUnit_Framework_TestCase */ public static function setUpBeforeClass() { - foreach (glob(self::$branchesFilesPattern) as $branchesFile) { - //get the current branchname from the first line - $branchName = trim(file($branchesFile)[0]); - if ($branchName === 'develop') { - self::$actualBranch = true; - } else { - //get current minor branch name - preg_match('|^(\d+\.\d+)|', $branchName, $minorBranch); - $branchName = $minorBranch[0]; - - //get all version branches - preg_match_all('|^(\d+\.\d+)|m', file_get_contents($branchesFile), $matches); - - //check is this a latest release branch - self::$actualBranch = ($branchName == max($matches[0])); - } - } - foreach (glob(self::$changedFilesPattern) as $changedFile) { self::$changedFileList .= file_get_contents($changedFile) . PHP_EOL; } diff --git a/lib/internal/Magento/Framework/App/Config.php b/lib/internal/Magento/Framework/App/Config.php index e8aaaa0bbe570..7cc78b8f22457 100644 --- a/lib/internal/Magento/Framework/App/Config.php +++ b/lib/internal/Magento/Framework/App/Config.php @@ -7,9 +7,15 @@ */ namespace Magento\Framework\App; +use Magento\Framework\App\Config\ScopePool; +use Magento\Framework\App\Config\ScopeCodeResolver; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\Config\ConfigTypeInterface; -class Config implements \Magento\Framework\App\Config\ScopeConfigInterface +/** + * Class Config + */ +class Config implements ScopeConfigInterface { /** * Config cache tag @@ -17,16 +23,35 @@ class Config implements \Magento\Framework\App\Config\ScopeConfigInterface const CACHE_TAG = 'CONFIG'; /** - * @var \Magento\Framework\App\Config\ScopePool + * @var ScopePool */ protected $_scopePool; /** - * @param \Magento\Framework\App\Config\ScopePool $scopePool + * @var ScopeCodeResolver */ - public function __construct(\Magento\Framework\App\Config\ScopePool $scopePool) - { + private $scopeCodeResolver; + + /** + * @var ConfigTypeInterface[] + */ + private $types; + + /** + * Config constructor. + * + * @param ScopePool $scopePool + * @param ScopeCodeResolver $scopeCodeResolver + * @param array $types + */ + public function __construct( + ScopePool $scopePool, + ScopeCodeResolver $scopeCodeResolver, + array $types = [] + ) { $this->_scopePool = $scopePool; + $this->scopeCodeResolver = $scopeCodeResolver; + $this->types = $types; } /** @@ -42,7 +67,26 @@ public function getValue( $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null ) { - return $this->_scopePool->getScope($scope, $scopeCode)->getValue($path); + if ($scope === 'store') { + $scope = 'stores'; + } elseif ($scope === 'website') { + $scope = 'websites'; + } + $configPath = $scope; + if ($scope !== 'default') { + if (is_numeric($scopeCode) || $scopeCode === null) { + $scopeCode = $this->scopeCodeResolver->resolve($scope, $scopeCode); + } else if ($scopeCode instanceof \Magento\Framework\App\ScopeInterface) { + $scopeCode = $scopeCode->getCode(); + } + if ($scopeCode) { + $configPath .= '/' . $scopeCode; + } + } + if ($path) { + $configPath .= '/' . $path; + } + return $this->get('system', $configPath); } /** @@ -55,6 +99,45 @@ public function getValue( */ public function isSetFlag($path, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null) { - return (bool) $this->getValue($path, $scope, $scopeCode); + return !!$this->getValue($path, $scope, $scopeCode); + } + + /** + * Invalidate cache by type + * + * @return void + */ + public function clean() + { + foreach ($this->types as $type) { + $type->clean(); + } + } + + /** + * Retrieve configuration. + * + * ('modules') - modules status configuration data + * ('scopes', 'websites/base') - base website data + * ('scopes', 'stores/default') - default store data + * + * ('system', 'default/web/seo/use_rewrites') - default system configuration data + * ('system', 'websites/base/web/seo/use_rewrites') - 'base' website system configuration data + * + * ('i18n', 'default/en_US') - translations for default store and 'en_US' locale + * + * @param string $configType + * @param string|null $path + * @param mixed|null $default + * @return array + */ + public function get($configType, $path = '', $default = null) + { + $result = null; + if (isset($this->types[$configType])) { + $result = $this->types[$configType]->get($path); + } + + return $result !== null ? $result : $default; } } diff --git a/lib/internal/Magento/Framework/App/Config/ConfigSourceAggregated.php b/lib/internal/Magento/Framework/App/Config/ConfigSourceAggregated.php new file mode 100644 index 0000000000000..c1a9259a4329b --- /dev/null +++ b/lib/internal/Magento/Framework/App/Config/ConfigSourceAggregated.php @@ -0,0 +1,56 @@ +sources = $sources; + } + + /** + * Retrieve aggregated configuration from all available sources. + * + * @param string $path + * @return array + */ + public function get($path = '') + { + $this->sortSources(); + $data = []; + foreach ($this->sources as $sourceConfig) { + /** @var ConfigSourceInterface $source */ + $source = $sourceConfig['source']; + $data = array_replace_recursive($data, $source->get($path)); + } + return $data; + } + + /** + * Sort sources + * + * @return void + */ + private function sortSources() + { + uasort($this->sources, function ($firstItem, $secondItem) { + return $firstItem['sortOrder'] > $secondItem['sortOrder']; + }); + } +} diff --git a/lib/internal/Magento/Framework/App/Config/ConfigSourceInterface.php b/lib/internal/Magento/Framework/App/Config/ConfigSourceInterface.php new file mode 100644 index 0000000000000..c070125de9f35 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Config/ConfigSourceInterface.php @@ -0,0 +1,22 @@ +reader = $reader; + $this->configType = $configType; + $this->fileKey = $fileKey; + } + + /** + * @inheritdoc + */ + public function get($path = '') + { + $data = new DataObject($this->reader->load($this->fileKey)); + if ($path !== '' && $path !== null) { + $path = '/' . $path; + } + return $data->getData($this->configType . $path) ?: []; + } +} diff --git a/lib/internal/Magento/Framework/App/Config/PostProcessorComposite.php b/lib/internal/Magento/Framework/App/Config/PostProcessorComposite.php new file mode 100644 index 0000000000000..a008b1abd0595 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Config/PostProcessorComposite.php @@ -0,0 +1,39 @@ +processors = $processors; + } + + /** + * @param array $config + * @return array + */ + public function process(array $config) + { + foreach ($this->processors as $processor) { + $config = $processor->process($config); + } + + return $config; + } +} diff --git a/lib/internal/Magento/Framework/App/Config/Reader/Source/SourceInterface.php b/lib/internal/Magento/Framework/App/Config/Reader/Source/SourceInterface.php new file mode 100644 index 0000000000000..2f1061fb7b6bd --- /dev/null +++ b/lib/internal/Magento/Framework/App/Config/Reader/Source/SourceInterface.php @@ -0,0 +1,22 @@ +scopeResolverPool = $scopeResolverPool; + } + + /** + * Resolve scope code + * + * @param string $scopeType + * @param string $scopeCode + * @return string + */ + public function resolve($scopeType, $scopeCode) + { + if (isset($this->resolvedScopeCodes[$scopeType][$scopeCode])) { + return $this->resolvedScopeCodes[$scopeType][$scopeCode]; + } + if (($scopeCode === null || is_numeric($scopeCode)) + && $scopeType !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT + ) { + $scopeResolver = $this->scopeResolverPool->get($scopeType); + $resolverScopeCode = $scopeResolver->getScope($scopeCode); + } else { + $resolverScopeCode = $scopeCode; + } + + if ($resolverScopeCode instanceof \Magento\Framework\App\ScopeInterface) { + $resolverScopeCode = $resolverScopeCode->getCode(); + } + + $this->resolvedScopeCodes[$scopeType][$scopeCode] = $resolverScopeCode; + return $resolverScopeCode; + } +} diff --git a/lib/internal/Magento/Framework/App/Config/ScopePool.php b/lib/internal/Magento/Framework/App/Config/ScopePool.php index 9e6a47d918f76..140ef710b6d8c 100644 --- a/lib/internal/Magento/Framework/App/Config/ScopePool.php +++ b/lib/internal/Magento/Framework/App/Config/ScopePool.php @@ -5,10 +5,12 @@ */ namespace Magento\Framework\App\Config; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\RequestInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @deprecated */ class ScopePool { @@ -49,6 +51,11 @@ class ScopePool */ private $request; + /** + * @var ScopeCodeResolver + */ + private $scopeCodeResolver; + /** * @param \Magento\Framework\App\Config\Scope\ReaderPoolInterface $readerPool * @param DataFactory $dataFactory @@ -71,15 +78,28 @@ public function __construct( } /** + * @deprecated * @return RequestInterface */ private function getRequest() { if ($this->request === null) { - $this->request = \Magento\Framework\App\ObjectManager::getInstance()->get(RequestInterface::class); + $this->request = ObjectManager::getInstance()->get(RequestInterface::class); } return $this->request; } + + /** + * @deprecated + * @return ScopeCodeResolver + */ + public function getScopeCodeResolver() + { + if ($this->scopeCodeResolver === null) { + $this->scopeCodeResolver = ObjectManager::getInstance()->get(ScopeCodeResolver::class); + } + return $this->scopeCodeResolver; + } /** * Retrieve config section @@ -113,6 +133,7 @@ public function getScope($scopeType, $scopeCode = null) } else { $data = $reader->read($scopeCode); } + $this->_cache->save(serialize($data), $cacheKey, [self::CACHE_TAG]); } $this->_scopes[$code] = $this->_dataFactory->create(['data' => $data]); @@ -140,17 +161,6 @@ public function clean() */ protected function _getScopeCode($scopeType, $scopeCode) { - if (($scopeCode === null || is_numeric($scopeCode)) - && $scopeType !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT - ) { - $scopeResolver = $this->_scopeResolverPool->get($scopeType); - $scopeCode = $scopeResolver->getScope($scopeCode); - } - - if ($scopeCode instanceof \Magento\Framework\App\ScopeInterface) { - $scopeCode = $scopeCode->getCode(); - } - - return $scopeCode; + return $this->getScopeCodeResolver()->resolve($scopeType, $scopeCode); } } diff --git a/lib/internal/Magento/Framework/App/Config/Spi/PostProcessorInterface.php b/lib/internal/Magento/Framework/App/Config/Spi/PostProcessorInterface.php new file mode 100644 index 0000000000000..53c348170761f --- /dev/null +++ b/lib/internal/Magento/Framework/App/Config/Spi/PostProcessorInterface.php @@ -0,0 +1,27 @@ +data = null; } + /** + * Check if data from deploy files is avaiable + * + * @return bool + */ + public function isDbAvailable() + { + $this->load(); + return isset($this->data['db']); + } + /** * Loads the configuration data * diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php index 6a4af75512d4d..c20e1394ad3d3 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php @@ -11,7 +11,7 @@ use Magento\Framework\Filesystem\DriverPool; /** - * Deployment configuration reader + * Deployment configuration reader from files: env.php, config.php (config.local.php, config.dist.php) */ class Reader { @@ -72,7 +72,26 @@ public function __construct( */ public function getFiles() { - return $this->files; + $path = $this->dirList->getPath(DirectoryList::CONFIG); + $fileDriver = $this->driverPool->getDriver(DriverPool::FILE); + $initialFilePools = $this->configFilePool->getInitialFilePools(); + + $files = []; + foreach ($this->files as $fileKey => $filePath) { + $files[$fileKey] = $filePath; + if (!$fileDriver->isExists($path . "/" . $filePath)) { + foreach ($initialFilePools as $initialFiles) { + if ( + isset($initialFiles[$fileKey]) + && $fileDriver->isExists($path . '/' . $initialFiles[$fileKey]) + ) { + $files[$fileKey] = $initialFiles[$fileKey]; + } + } + } + } + + return $files; } /** @@ -84,26 +103,19 @@ public function getFiles() */ public function load($fileKey = null) { - $path = $this->dirList->getPath(DirectoryList::CONFIG); - $fileDriver = $this->driverPool->getDriver(DriverPool::FILE); - $result = []; if ($fileKey) { - $filePath = $path . '/' . $this->configFilePool->getPath($fileKey); - if ($fileDriver->isExists($filePath)) { - $result = include $filePath; - } + $pathConfig = $this->configFilePool->getPath($fileKey); + return $this->loadConfigFile($fileKey, $pathConfig); } else { $configFiles = $this->configFilePool->getPaths(); $allFilesData = []; $result = []; - foreach (array_keys($configFiles) as $fileKey) { - $configFile = $path . '/' . $this->configFilePool->getPath($fileKey); - if ($fileDriver->isExists($configFile)) { - $fileData = include $configFile; - } else { + foreach ($configFiles as $fileKey => $pathConfig) { + $fileData = $this->loadConfigFile($fileKey, $pathConfig); + if (!$fileData) { continue; } - $allFilesData[$configFile] = $fileData; + $allFilesData[$fileKey] = $fileData; if (!empty($fileData)) { $intersection = array_intersect_key($result, $fileData); if (!empty($intersection)) { @@ -116,8 +128,31 @@ public function load($fileKey = null) $result = array_merge($result, $fileData); } } + return $result; + } + } + + /** + * @param string $fileKey + * @param string $pathConfig + * @return array + */ + private function loadConfigFile($fileKey, $pathConfig) + { + $initialFilePools = $this->configFilePool->getInitialFilePools(); + $path = $this->dirList->getPath(DirectoryList::CONFIG); + $fileDriver = $this->driverPool->getDriver(DriverPool::FILE); + if ($fileDriver->isExists($path . '/' . $pathConfig)) { + $result = include $path . '/' . $pathConfig; + } else { + $result = []; + foreach ($initialFilePools as $initialFiles) { + if (isset($initialFiles[$fileKey]) && $fileDriver->isExists($path . '/' . $initialFiles[$fileKey])) { + $result = include $path . '/' . $initialFiles[$fileKey]; + } + } } - return $result ?: []; + return is_array($result) ? $result : []; } /** diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php index ac1e5f6ecf897..8f9b857f601bb 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php @@ -14,7 +14,7 @@ use Magento\Framework\Phrase; /** - * Deployment configuration writer + * Deployment configuration writer to files: env.php, config.php (config.local.php, config.dist.php) */ class Writer { @@ -93,17 +93,18 @@ public function checkIfWritable() * * @param array $data * @param bool $override + * @param string $pool * @return void + * @throws FileSystemException */ - public function saveConfig(array $data, $override = false) + public function saveConfig(array $data, $override = false, $pool = null) { - $paths = $this->configFilePool->getPaths(); - foreach ($data as $fileKey => $config) { - if (isset($paths[$fileKey])) { + $paths = $pool ? $this->configFilePool->getPathsByPool($pool) : $this->configFilePool->getPaths(); - if ($this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->isExist($paths[$fileKey])) { - $currentData = $this->reader->load($fileKey); + if (isset($paths[$fileKey])) { + $currentData = $this->reader->load($fileKey); + if ($currentData) { if ($override) { $config = array_merge($currentData, $config); } else { @@ -113,7 +114,8 @@ public function saveConfig(array $data, $override = false) $contents = $this->formatter->format($config); try { - $this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->writeFile($paths[$fileKey], $contents); + $writeFilePath = $paths[$fileKey]; + $this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->writeFile($writeFilePath, $contents); } catch (FileSystemException $e) { throw new FileSystemException( new Phrase('Deployment config file %1 is not writable.', [$paths[$fileKey]]) diff --git a/lib/internal/Magento/Framework/App/MutableScopeConfig.php b/lib/internal/Magento/Framework/App/MutableScopeConfig.php index 5cbf108bc2031..6166dac40e8c9 100644 --- a/lib/internal/Magento/Framework/App/MutableScopeConfig.php +++ b/lib/internal/Magento/Framework/App/MutableScopeConfig.php @@ -11,6 +11,9 @@ use Magento\Framework\App\Config\MutableScopeConfigInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +/** + * @inheritdoc + */ class MutableScopeConfig extends Config implements MutableScopeConfigInterface { /** diff --git a/lib/internal/Magento/Framework/App/ReinitableConfig.php b/lib/internal/Magento/Framework/App/ReinitableConfig.php index 9944978785f54..b98ede77fe133 100644 --- a/lib/internal/Magento/Framework/App/ReinitableConfig.php +++ b/lib/internal/Magento/Framework/App/ReinitableConfig.php @@ -7,6 +7,9 @@ use Magento\Framework\App\Config\ReinitableConfigInterface; +/** + * @inheritdoc + */ class ReinitableConfig extends MutableScopeConfig implements ReinitableConfigInterface { /** diff --git a/lib/internal/Magento/Framework/App/ResourceConnection/Config.php b/lib/internal/Magento/Framework/App/ResourceConnection/Config.php index 9cd03c8372e17..d9410bc9f7dd8 100644 --- a/lib/internal/Magento/Framework/App/ResourceConnection/Config.php +++ b/lib/internal/Magento/Framework/App/ResourceConnection/Config.php @@ -18,6 +18,16 @@ class Config extends \Magento\Framework\Config\Data\Scoped implements ConfigInte */ protected $_connectionNames = []; + /** + * @var \Magento\Framework\App\DeploymentConfig + */ + private $deploymentConfig; + + /** + * @var bool + */ + private $initialized = false; + /** * @param Config\Reader $reader * @param \Magento\Framework\Config\ScopeInterface $configScope @@ -34,14 +44,7 @@ public function __construct( $cacheId = 'resourcesCache' ) { parent::__construct($reader, $configScope, $cache, $cacheId); - - $resource = $deploymentConfig->getConfigData(ConfigOptionsListConstants::KEY_RESOURCE); - foreach ($resource as $resourceName => $resourceData) { - if (!isset($resourceData['connection'])) { - throw new \InvalidArgumentException('Invalid initial resource configuration'); - } - $this->_connectionNames[$resourceName] = $resourceData['connection']; - } + $this->deploymentConfig = $deploymentConfig; } /** @@ -52,6 +55,7 @@ public function __construct( */ public function getConnectionName($resourceName) { + $this->initConnections(); $connectionName = \Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION; $resourceName = preg_replace("/_setup$/", '', $resourceName); @@ -80,4 +84,23 @@ public function getConnectionName($resourceName) return $connectionName; } + + /** + * Initialise connections + * + * @return void + */ + private function initConnections() + { + if (!$this->initialized) { + $this->initialized = true; + $resource = $this->deploymentConfig->getConfigData(ConfigOptionsListConstants::KEY_RESOURCE) ?: []; + foreach ($resource as $resourceName => $resourceData) { + if (!isset($resourceData['connection'])) { + throw new \InvalidArgumentException('Invalid initial resource configuration'); + } + $this->_connectionNames[$resourceName] = $resourceData['connection']; + } + } + } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigSourceAggregatedTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigSourceAggregatedTest.php new file mode 100644 index 0000000000000..9ddd8e325671a --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ConfigSourceAggregatedTest.php @@ -0,0 +1,69 @@ +sourceMock = $this->getMockBuilder(ConfigSourceInterface::class) + ->getMockForAbstractClass(); + $this->sourceMockTwo = $this->getMockBuilder(ConfigSourceInterface::class) + ->getMockForAbstractClass(); + + $sources = [ + [ + 'source' => $this->sourceMockTwo, + 'sortOrder' => 100 + ], + [ + 'source' => $this->sourceMock, + 'sortOrder' => 10 + ], + + ]; + + $this->source = new ConfigSourceAggregated($sources); + } + + public function testGet() + { + $path = 'path'; + $this->sourceMock->expects($this->once()) + ->method('get') + ->with($path) + ->willReturn(['key' => 'value1', 'test' => false]); + $this->sourceMockTwo->expects($this->once()) + ->method('get') + ->with($path) + ->willReturn(['key' => 'value2']); + $this->assertEquals( + [ + 'test' => false, + 'key' => 'value2' + ], + $this->source->get($path) + ); + } +} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php new file mode 100644 index 0000000000000..e1b8d1e465141 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php @@ -0,0 +1,54 @@ +reader = $this->getMockBuilder(Reader::class) + ->disableOriginalConstructor() + ->getMock(); + $this->configType = 'configType'; + $this->fileKey = 'file.php'; + $this->source = new InitialConfigSource($this->reader, $this->configType, $this->fileKey); + } + + public function testGet() + { + $path = 'path'; + $this->reader->expects($this->once()) + ->method('load') + ->with($this->fileKey) + ->willReturn([$this->configType => [$path => 'value']]); + $this->assertEquals('value', $this->source->get($path)); + } +} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopeCodeResolverTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopeCodeResolverTest.php new file mode 100644 index 0000000000000..cbf671479877b --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopeCodeResolverTest.php @@ -0,0 +1,68 @@ +scopeResolverPool = $this->getMockBuilder(ScopeResolverPool::class) + ->disableOriginalConstructor() + ->getMock(); + $this->scopeResolver = $this->getMockBuilder(ScopeResolverInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->scope = $this->getMockBuilder(ScopeInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->scopeCodeResolver = new ScopeCodeResolver($this->scopeResolverPool); + } + + public function testResolve() + { + $scopeType = 'website'; + $scopeCode = 'myWebsite'; + $scopeId = 4; + $this->scopeResolverPool->expects($this->once()) + ->method('get') + ->with($scopeType) + ->willReturn($this->scopeResolver); + $this->scopeResolver->expects($this->once()) + ->method('getScope') + ->with($scopeId) + ->willReturn($this->scope); + $this->scope->expects($this->once()) + ->method('getCode') + ->willReturn($scopeCode); + $this->assertEquals($scopeCode, $this->scopeCodeResolver->resolve($scopeType, $scopeId)); + } +} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php index 6c9ae8a09a77d..d252ede3a6241 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php @@ -7,7 +7,13 @@ use Magento\Framework\App\Config\Scope\ReaderInterface; use Magento\Framework\App\Config\Scope\ReaderPoolInterface; +use Magento\Framework\App\Config\ScopeCodeResolver; +/** + * Class ScopePoolTest + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class ScopePoolTest extends \PHPUnit_Framework_TestCase { /** @@ -30,6 +36,11 @@ class ScopePoolTest extends \PHPUnit_Framework_TestCase */ protected $_cache; + /** + * @var \Magento\Framework\App\Config\ScopeCodeResolver|\PHPUnit_Framework_MockObject_MockObject + */ + private $scopeCodeResolver; + /** * @var \Magento\Framework\App\Config\ScopePool */ @@ -79,6 +90,14 @@ protected function setUp() $requestMock->expects($this->any()) ->method('getBasePath') ->willReturn('baseUrl'); + + $this->scopeCodeResolver = $this->getMockBuilder(ScopeCodeResolver::class) + ->disableOriginalConstructor() + ->getMock(); + $reflection = new \ReflectionClass(get_class($this->_object)); + $reflectionProperty = $reflection->getProperty('scopeCodeResolver'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->_object, $this->scopeCodeResolver); } /** @@ -94,6 +113,10 @@ public function testGetScope($scopeType, $scope, array $data, $cachedData) $scopeCode = $scope instanceof \Magento\Framework\App\ScopeInterface ? $scope->getCode() : $scope; $cacheKey = "test_cache_id|{$scopeType}|{$scopeCode}|baseUrl"; + $this->scopeCodeResolver->expects($this->atLeastOnce()) + ->method('resolve') + ->willReturn($scopeCode); + $this->_readerPool->expects( $this->any() )->method( @@ -155,6 +178,9 @@ public function getScopeDataProvider() public function testClean() { + $this->scopeCodeResolver->expects($this->never()) + ->method('resolve') + ->willReturnArgument(1); $this->_cache->expects( $this->once() )->method( diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php new file mode 100644 index 0000000000000..97b5cc752adf9 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php @@ -0,0 +1,87 @@ +getMockBuilder(ScopePool::class) + ->disableOriginalConstructor() + ->getMock(); + $this->scopeCodeResolver = $this->getMockBuilder(ScopeCodeResolver::class) + ->disableOriginalConstructor() + ->getMock(); + $this->configType = $this->getMockBuilder(ConfigTypeInterface::class) + ->getMockForAbstractClass(); + $this->scope = $this->getMockBuilder(ScopeInterface::class) + ->getMockForAbstractClass(); + + $this->appConfig = new Config($scopePool, $this->scopeCodeResolver, ['system' => $this->configType]); + } + + /** + * @param string $scope + * @param string|null $scopeCode + * + * @dataProvider getValueDataProvider + * @return void + */ + public function testGetValue($scope, $scopeCode = null) + { + $path = 'path'; + if (!is_string($scope)) { + $this->scopeCodeResolver->expects($this->once()) + ->method('resolve') + ->with('stores', $scopeCode) + ->willReturn('myStore'); + } elseif (!$scopeCode) { + $this->scope->expects($this->once()) + ->method('getCode') + ->willReturn('myWebsite'); + } + $this->configType->expects($this->once()) + ->method('get') + ->with($scope =='store' ? 'stores/path' : 'websites/myWebsite/path') + ->willReturn(true); + + $this->assertTrue($this->appConfig->getValue($path, $scope, $scopeCode ?: $this->scope)); + } + + public function getValueDataProvider() + { + return [ + ['store', 1], + ['website'], + ]; + } +} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php index b78e5a536ac9d..dc1187093c3b6 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/ReaderTest.php @@ -61,6 +61,10 @@ protected function setUp() ->expects($this->any()) ->method('getPaths') ->willReturn(['configKeyOne' => 'config.php', 'configKeyTwo' => 'env.php']); + $this->configFilePool + ->expects($this->any()) + ->method('getInitialFilePools') + ->willReturn([]); } public function testGetFile() @@ -103,6 +107,7 @@ public function testCustomLoad($file, $expected) $configFilePool = $this->getMock(\Magento\Framework\Config\File\ConfigFilePool::class, [], [], '', false); $configFilePool->expects($this->any())->method('getPaths')->willReturn([$file]); $configFilePool->expects($this->any())->method('getPath')->willReturn($file); + $configFilePool->expects($this->any())->method('getInitialFilePools')->willReturn([]); $object = new Reader($this->dirList, $this->driverPool, $configFilePool, $file); $this->assertSame($expected, $object->load($file)); } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php index de06f6f18a590..3a3b7b7cec0be 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php @@ -18,6 +18,11 @@ use Magento\Framework\Filesystem\Directory\WriteInterface; use Magento\Framework\Phrase; +/** + * @covers \Magento\Framework\App\DeploymentConfig\Writer + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @package Magento\Framework\App\Test\Unit\DeploymentConfig + */ class WriterTest extends \PHPUnit_Framework_TestCase { /** @var Writer */ @@ -76,8 +81,7 @@ protected function setUp() public function testSaveConfig() { $configFiles = [ - ConfigFilePool::APP_CONFIG => 'test_conf.php', - 'test_key' => 'test2_conf.php' + ConfigFilePool::APP_CONFIG => 'config.php' ]; $testSetExisting = [ @@ -119,7 +123,7 @@ public function testSaveConfig() ->method('format') ->with($testSetExpected[ConfigFilePool::APP_CONFIG]) ->willReturn([]); - $this->dirWrite->expects($this->once())->method('writeFile')->with('test_conf.php', []); + $this->dirWrite->expects($this->once())->method('writeFile')->with('config.php', []); $this->object->saveConfig($testSetUpdate); } @@ -127,8 +131,7 @@ public function testSaveConfig() public function testSaveConfigOverride() { $configFiles = [ - ConfigFilePool::APP_CONFIG => 'test_conf.php', - 'test_key' => 'test2_conf.php' + ConfigFilePool::APP_CONFIG => 'config.php' ]; $testSetExisting = [ @@ -169,7 +172,7 @@ public function testSaveConfigOverride() ->method('format') ->with($testSetExpected[ConfigFilePool::APP_CONFIG]) ->willReturn([]); - $this->dirWrite->expects($this->once())->method('writeFile')->with('test_conf.php', []); + $this->dirWrite->expects($this->once())->method('writeFile')->with('config.php', []); $this->object->saveConfig($testSetUpdate, true); } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php index 936a806432419..dead64911174a 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php @@ -5,10 +5,12 @@ */ namespace Magento\Framework\App\Test\Unit\ResourceConnection; +use Magento\Framework\Config\ConfigOptionsListConstants; + class ConfigTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\App\\Config + * @var \Magento\Framework\App\ResourceConnection\Config */ protected $_model; @@ -33,9 +35,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_resourcesConfig; /** - * @var array + * @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject */ - protected $_initialResources; + private $deploymentConfig; protected function setUp() { @@ -53,10 +55,6 @@ protected function setUp() 'extendedResourceName' => ['name' => 'extendedResourceName', 'extends' => 'validResource'], ]; - $this->_initialResources = [ - 'validResource' => ['connection' => 'validConnectionName'], - ]; - $this->_cacheMock->expects( $this->any() )->method( @@ -65,17 +63,12 @@ protected function setUp() $this->returnValue(serialize($this->_resourcesConfig)) ); - $deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false); - $deploymentConfig->expects($this->once()) - ->method('getConfigData') - ->with('resource') - ->willReturn($this->_initialResources); - + $this->deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false); $this->_model = new \Magento\Framework\App\ResourceConnection\Config( $this->_readerMock, $this->_scopeMock, $this->_cacheMock, - $deploymentConfig, + $this->deploymentConfig, 'cacheId' ); } @@ -87,27 +80,34 @@ protected function setUp() */ public function testGetConnectionName($resourceName, $connectionName) { + $this->deploymentConfig->expects($this->once()) + ->method('getConfigData') + ->with(ConfigOptionsListConstants::KEY_RESOURCE) + ->willReturn([ + 'validResource' => ['connection' => 'validConnectionName'], + ]); $this->assertEquals($connectionName, $this->_model->getConnectionName($resourceName)); } /** * @expectedException \InvalidArgumentException */ - public function testExceptionConstructor() + public function testGetConnectionNameWithException() { $deploymentConfig = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false); $deploymentConfig->expects($this->once()) ->method('getConfigData') - ->with('resource') + ->with(ConfigOptionsListConstants::KEY_RESOURCE) ->willReturn(['validResource' => ['somekey' => 'validConnectionName']]); - new \Magento\Framework\App\ResourceConnection\Config( + $model = new \Magento\Framework\App\ResourceConnection\Config( $this->_readerMock, $this->_scopeMock, $this->_cacheMock, $deploymentConfig, 'cacheId' ); + $model->getConnectionName('default'); } /** diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratedFilesTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratedFilesTest.php index facf71854c575..ab5e0a594e14a 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratedFilesTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratedFilesTest.php @@ -12,12 +12,12 @@ class GeneratedFilesTest extends \PHPUnit_Framework_TestCase { /** - * @var Magento\Framework\App\Filesystem\DirectoryList | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\App\Filesystem\DirectoryList | \PHPUnit_Framework_MockObject_MockObject */ private $directoryList; /** - * @var Magento\Framework\Filesystem\Directory\WriteInterface | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Filesystem\Directory\WriteInterface | \PHPUnit_Framework_MockObject_MockObject */ private $writeInterface; diff --git a/lib/internal/Magento/Framework/Config/Converter.php b/lib/internal/Magento/Framework/Config/Converter.php index 5ea535bac5f29..b22d4d61a6867 100644 --- a/lib/internal/Magento/Framework/Config/Converter.php +++ b/lib/internal/Magento/Framework/Config/Converter.php @@ -7,6 +7,11 @@ use Magento\Framework\View\Xsd\Media\TypeDataExtractorPool; +/** + * Class Converter convert xml to appropriate array + * + * @package Magento\Framework\Config + */ class Converter implements \Magento\Framework\Config\ConverterInterface { /** diff --git a/lib/internal/Magento/Framework/Config/File/ConfigFilePool.php b/lib/internal/Magento/Framework/Config/File/ConfigFilePool.php index c9439d0a45e8f..e84f61383c7cc 100644 --- a/lib/internal/Magento/Framework/Config/File/ConfigFilePool.php +++ b/lib/internal/Magento/Framework/Config/File/ConfigFilePool.php @@ -14,6 +14,9 @@ class ConfigFilePool const APP_CONFIG = 'app_config'; const APP_ENV = 'app_env'; + const LOCAL = 'local'; + const DIST = 'dist'; + /** * Default files for configuration * @@ -24,6 +27,22 @@ class ConfigFilePool self::APP_ENV => 'env.php', ]; + /** + * Initial files for configuration + * + * @var array + */ + private $initialConfigFiles = [ + self::DIST => [ + self::APP_CONFIG => 'config.dist.php', + self::APP_ENV => 'env.dist.php', + ], + self::LOCAL => [ + self::APP_CONFIG => 'config.local.php', + self::APP_ENV => 'env.local.php', + ] + ]; + /** * Constructor * @@ -35,7 +54,7 @@ public function __construct($additionalConfigFiles = []) } /** - * Returns application config files + * Returns application config files. * * @return array */ @@ -58,4 +77,25 @@ public function getPath($fileKey) } return $this->applicationConfigFiles[$fileKey]; } + + /** + * Returns application initial config files. + * + * @return array + */ + public function getInitialFilePools() + { + return $this->initialConfigFiles; + } + + /** + * Retrieve all config file pools. + * + * @param string $pool + * @return array + */ + public function getPathsByPool($pool) + { + return $this->initialConfigFiles[$pool]; + } } diff --git a/lib/internal/Magento/Framework/Config/FileResolver.php b/lib/internal/Magento/Framework/Config/FileResolver.php index 1455eb355df7a..a6726b95526b3 100644 --- a/lib/internal/Magento/Framework/Config/FileResolver.php +++ b/lib/internal/Magento/Framework/Config/FileResolver.php @@ -7,7 +7,7 @@ */ namespace Magento\Framework\Config; -use Magento\Framework\Module\Dir\Reader; +use Magento\Framework\Module\Dir\Reader as DirReader; use Magento\Framework\Filesystem; use Magento\Framework\View\Design\ThemeInterface; use Magento\Framework\View\DesignInterface; @@ -24,7 +24,7 @@ class FileResolver implements \Magento\Framework\Config\FileResolverInterface, D /** * Module configuration file reader * - * @var \Magento\Framework\Module\Dir\Reader + * @var DirReader */ protected $moduleReader; @@ -54,7 +54,7 @@ class FileResolver implements \Magento\Framework\Config\FileResolverInterface, D protected $resolver; /** - * @param Reader $moduleReader + * @param DirReader $moduleReader * @param FileIteratorFactory $iteratorFactory * @param DesignInterface $designInterface * @param DirectoryList $directoryList @@ -62,7 +62,7 @@ class FileResolver implements \Magento\Framework\Config\FileResolverInterface, D * @param ResolverInterface $resolver */ public function __construct( - Reader $moduleReader, + DirReader $moduleReader, FileIteratorFactory $iteratorFactory, DesignInterface $designInterface, DirectoryList $directoryList, diff --git a/lib/internal/Magento/Framework/Config/Reader.php b/lib/internal/Magento/Framework/Config/Reader.php new file mode 100644 index 0000000000000..f99e4e3341860 --- /dev/null +++ b/lib/internal/Magento/Framework/Config/Reader.php @@ -0,0 +1,75 @@ +sources = $this->prepareSources($sources); + } + + /** + * Read configuration data + * + * @param null|string $scope + * @throws LocalizedException Exception is thrown when scope other than default is given + * @return array + */ + public function read($scope = null) + { + $config = []; + foreach ($this->sources as $sourceData) { + /** @var \Magento\Framework\App\Config\Reader\Source\SourceInterface $source */ + $source = $sourceData['class']; + $config = array_replace_recursive($config, $source->get($scope)); + } + + return $config; + } + + /** + * Prepare source for usage + * + * @param array $array + * @return array + */ + private function prepareSources(array $array) + { + $array = array_filter( + $array, + function ($item) { + return (!isset($item['disable']) || !$item['disable']) && $item['class']; + } + ); + uasort( + $array, + function ($firstItem, $nexItem) { + if ((int)$firstItem['sortOrder'] == (int)$nexItem['sortOrder']) { + return 0; + } + return (int)$firstItem['sortOrder'] < (int)$nexItem['sortOrder'] ? -1 : 1; + } + ); + + return $array; + } +} diff --git a/app/code/Magento/Store/Model/Config/Reader/ReaderPool.php b/lib/internal/Magento/Framework/Config/ReaderPool.php similarity index 93% rename from app/code/Magento/Store/Model/Config/Reader/ReaderPool.php rename to lib/internal/Magento/Framework/Config/ReaderPool.php index 55bbe33c3a93c..18bfd660c0e8a 100644 --- a/app/code/Magento/Store/Model/Config/Reader/ReaderPool.php +++ b/lib/internal/Magento/Framework/Config/ReaderPool.php @@ -3,7 +3,7 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Store\Model\Config\Reader; +namespace Magento\Framework\Config; class ReaderPool implements \Magento\Framework\App\Config\Scope\ReaderPoolInterface { diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/ReaderTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/ReaderTest.php new file mode 100644 index 0000000000000..b51fbd3598e11 --- /dev/null +++ b/lib/internal/Magento/Framework/Config/Test/Unit/ReaderTest.php @@ -0,0 +1,46 @@ +source = $this->getMockBuilder(SourceInterface::class) + ->getMockForAbstractClass(); + $this->reader = new Reader([['class' => $this->source]]); + } + + public function testRead() + { + $config = [ + 'default' => [ + 'general/locale/code'=> 'ru_RU', + 'general/locale/timezone'=> 'America/Chicago', + ] + ]; + $this->source->expects($this->once()) + ->method('get') + ->with(null) + ->willReturn($config); + $this->assertEquals($config, $this->reader->read()); + } +} diff --git a/lib/internal/Magento/Framework/Console/Cli.php b/lib/internal/Magento/Framework/Console/Cli.php index 4da186fcf8864..8f534c4f67afe 100644 --- a/lib/internal/Magento/Framework/Console/Cli.php +++ b/lib/internal/Magento/Framework/Console/Cli.php @@ -135,7 +135,7 @@ protected function getApplicationCommands() $commands = array_merge($commands, $setupCommandList->getCommands()); } - if ($objectManager->get(\Magento\Framework\App\DeploymentConfig::class)->isAvailable()) { + if (count($objectManager->get(\Magento\Framework\App\DeploymentConfig::class)->get('modules'))) { /** @var \Magento\Framework\Console\CommandListInterface */ $commandList = $objectManager->create(\Magento\Framework\Console\CommandListInterface::class); $commands = array_merge($commands, $commandList->getCommands()); From 6a125721f0af598f52aca713a47e38bcbc9c4376 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Fri, 21 Oct 2016 11:23:20 +0300 Subject: [PATCH 1368/3232] MAGETWO-56989: Deployment process can't be executed on separate machine --- .../Model/Category/Plugin/Store/View.php | 18 ++++++------- .../Model/Category/Plugin/Store/ViewTest.php | 11 ++++++++ .../Magento/Email/Model/Template/Filter.php | 25 ------------------- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php index 0bdbee03d7911..5612db7efc5da 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php @@ -1,10 +1,10 @@ origStore = $store; @@ -95,6 +92,10 @@ public function afterSave( $this->urlPersist->deleteByData([UrlRewrite::STORE_ID => $this->origStore->getId()]); } + $this->urlPersist->replace( + $this->generateCategoryUrls($this->origStore->getRootCategoryId(), $this->origStore->getId()) + ); + $this->urlPersist->replace( $this->generateProductUrls( $this->origStore->getWebsiteId(), @@ -125,7 +126,6 @@ protected function generateProductUrls($websiteId, $originWebsiteId, $storeId) ->addCategoryIds() ->addAttributeToSelect(['name', 'url_path', 'url_key', 'visibility']) ->addWebsiteFilter($websiteIds); - foreach ($collection as $product) { $product->setStoreId($storeId); /** @var \Magento\Catalog\Model\Product $product */ @@ -134,7 +134,6 @@ protected function generateProductUrls($websiteId, $originWebsiteId, $storeId) $this->productUrlRewriteGenerator->generate($product) ); } - return $urls; } @@ -155,7 +154,6 @@ protected function generateCategoryUrls($rootCategoryId, $storeId) $this->categoryUrlRewriteGenerator->generate($category) ); } - return $urls; } diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/ViewTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/ViewTest.php index d30c2dde6e033..ac2e42ebea783 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/ViewTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Store/ViewTest.php @@ -137,6 +137,17 @@ protected function setUp() public function testAfterSave() { + $origStoreMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) + ->disableOriginalConstructor() + ->getMock(); + $reflectionStore = new \ReflectionClass($this->plugin); + $origStore = $reflectionStore->getProperty('origStore'); + $origStore->setAccessible(true); + $origStore->setValue($this->plugin, $origStoreMock); + $origStoreMock->expects($this->atLeastOnce()) + ->method('isObjectNew') + ->willReturn(true); + $this->abstractModelMock->expects($this->any()) ->method('isObjectNew') ->willReturn(true); diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index f860108037a26..658b2977fdf73 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -216,31 +216,6 @@ public function __construct( parent::__construct($string, $variables); } - /** - * @deprecated - * @return Css\Processor - */ - private function getCssProcessor() - { - if (!$this->cssProcessor) { - $this->cssProcessor = ObjectManager::getInstance()->get(Css\Processor::class); - } - return $this->cssProcessor; - } - - /** - * @deprecated - * @param string $dirType - * @return ReadInterface - */ - private function getPubDirectory($dirType) - { - if (!$this->pubDirectory) { - $this->pubDirectory = ObjectManager::getInstance()->get(Filesystem::class)->getDirectoryRead($dirType); - } - return $this->pubDirectory; - } - /** * Set use absolute links flag * From 7420329f66e460414510674212b926d0bc6d96bf Mon Sep 17 00:00:00 2001 From: "Palamar, Mykola" Date: Tue, 18 Oct 2016 13:50:25 +0000 Subject: [PATCH 1369/3232] MAGETWO-47017: [Github] Add Configurable Product To Cart from Category Page #2574 #5850 #5882 #6572 #5558 - CR changes --- .../frontend/web/js/catalog-add-to-cart.js | 35 +++--- .../templates/product/listing/renderer.phtml | 2 +- .../frontend/web/js/catalog-add-to-cart.js | 16 +++ .../view/frontend/web/js/swatch-renderer.js | 7 ++ .../Block/Product/ProductList/ProductItem.php | 20 +++- .../Test/Block/Product/ViewWithSwatches.php | 39 +++++++ .../AssertSwatchConfigurableProductPage.php | 102 ++++++++++++++++++ .../Swatches/Test/Fixture/Cart/Item.php | 2 +- .../Test/Fixture/ConfigurableProduct.xml | 1 - .../ConfigurableAttributesData.php | 18 ---- .../Test/Fixture/SwatchProductAttribute.xml | 2 +- .../Handler/SwatchProductAttribute/Curl.php | 12 +-- .../SwatchProductAttributeInterface.php | 1 + .../Test/Page/Product/CatalogProductView.xml | 12 +++ .../Test/Repository/ConfigurableProduct.xml | 40 ++++++- .../ConfigurableProduct/CheckoutData.xml | 18 +++- .../ConfigurableAttributesData.xml | 62 +++++++++++ ...ableProductWithSwatchToShopingCartTest.php | 7 +- ...ableProductWithSwatchToShopingCartTest.xml | 5 +- ...ableProductWithSwatchToShopingCartTest.php | 38 +++++++ ...ableProductWithSwatchToShopingCartTest.xml | 16 +++ ...oductToCartFromCatalogCategoryPageStep.php | 98 +++++++++++++++++ .../TestStep/CategoryAddToCartProductStep.php | 79 -------------- .../TestStep/CategoryConfigureProductStep.php | 58 ---------- ...igurableProductWithSwatchAttributeStep.php | 42 -------- .../TestStep/OpenProductInCatalogStep.php | 69 ------------ .../Magento/Swatches/Test/etc/testcase.xml | 13 +-- 27 files changed, 495 insertions(+), 319 deletions(-) create mode 100644 app/code/Magento/Swatches/view/frontend/web/js/catalog-add-to-cart.js create mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ViewWithSwatches.php create mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php delete mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php create mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/Page/Product/CatalogProductView.xml create mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/TryToAddConfigurableProductWithSwatchToShopingCartTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/TryToAddConfigurableProductWithSwatchToShopingCartTest.xml create mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/AddProductToCartFromCatalogCategoryPageStep.php delete mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/CategoryAddToCartProductStep.php delete mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/CategoryConfigureProductStep.php delete mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/CreateConfigurableProductWithSwatchAttributeStep.php delete mode 100644 dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/OpenProductInCatalogStep.php diff --git a/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js b/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js index 542231fac0e17..7db4f5d745626 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js @@ -64,30 +64,10 @@ define([ }, ajaxSubmit: function(form) { - var self = this, - swatchAttributesValue = [], - urlHashParams = ''; + var self = this; $(self.options.minicartSelector).trigger('contentLoading'); self.disableAddToCartButton(form); - $(form.prop("elements")).each(function(index, item){ - item = $(item); - if (item.attr('name') && item.attr('name').search('super') != -1) { - var r = /\[(\d+)\]/; - var matches = r.exec(item.attr('name')); - - if (matches) { - swatchAttributesValue.push(item.attr('data-attr-name') + '=' + item.val()); - } - } - }); - - console.log(form.serialize()); - if (swatchAttributesValue.length > 0) { - urlHashParams = '#' + swatchAttributesValue.join('&'); - } - - $.ajax({ url: form.attr('action'), data: form.serialize(), @@ -104,7 +84,18 @@ define([ } if (res.backUrl) { - window.location = res.backUrl + urlHashParams; + var eventData = { + 'form': form, + 'redirectParameters': [] + } + // trigger global event, so other modules will be able add parameters to redirect url + $('body').trigger('catalogCategoryAddToCartRedirect', eventData); + if (eventData.redirectParameters.length > 0) { + var parameters = res.backUrl.split('#'); + parameters.push(eventData.redirectParameters.join('&')); + res.backUrl = parameters.join('#'); + } + window.location = res.backUrl; return; } if (res.messages) { diff --git a/app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml b/app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml index 86046fdce4b6e..9c46f32bf35fd 100644 --- a/app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml +++ b/app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml @@ -7,7 +7,7 @@
    diff --git a/app/code/Magento/Swatches/view/frontend/web/js/catalog-add-to-cart.js b/app/code/Magento/Swatches/view/frontend/web/js/catalog-add-to-cart.js index ad00b077fac70..7900ff67b09be 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/catalog-add-to-cart.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/catalog-add-to-cart.js @@ -10,7 +10,8 @@ require([ $('body').on('catalogCategoryAddToCartRedirect', function (event, data) { $(data.form).find('[name*="super"]').each(function (index, item) { var $item = $(item); + data.redirectParameters.push($item.attr('data-attr-name') + '=' + $item.val()); }); - }) + }); }); diff --git a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js index 8cc3c4ff45780..452c9b6f94d3c 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js @@ -639,12 +639,13 @@ define([ /** * Get human readable attribute code (eg. size, color) by it ID from configuration * - * @param attributeId + * @param {Number} attributeId * @returns {*} * @private */ _getAttributeCodeById: function (attributeId) { var attribute = this.options.jsonConfig.mappedAttributes[attributeId]; + return attribute ? attribute.code : attributeId; }, diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductAttribute/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductAttribute/Curl.php index 13db78b45a6fb..db43cc535ca01 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductAttribute/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductAttribute/Curl.php @@ -118,7 +118,8 @@ public function persist(FixtureInterface $fixture = null) * @param array $data * @return array */ - protected function changeStructureOfTheData(array $data) { + protected function changeStructureOfTheData(array $data) + { return $data; } } diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Handler/ConfigurableProduct/Curl.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Handler/ConfigurableProduct/Curl.php index a3d4b13f0f74e..626be7dee3652 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Handler/ConfigurableProduct/Curl.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Handler/ConfigurableProduct/Curl.php @@ -172,7 +172,7 @@ protected function prepareConfigurableMatrix(FixtureInterface $product) $keyIds[] = $attribute['options'][$optionKey]['id']; $configurableAttribute[] = sprintf( '"%s":"%s"', - isset($attribute['attribute_code']) ? $attribute['attribute_code'] : $attribute['frontend_label'] , + isset($attribute['attribute_code']) ? $attribute['attribute_code'] : $attribute['frontend_label'], $attribute['options'][$optionKey]['id'] ); } diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php index c666cf8587484..be7186c0368b9 100755 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php @@ -27,7 +27,8 @@ class ProductItem extends CatalogProductItem * @param \Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct $product * @return void */ - public function fillData(\Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct $product) { + public function fillData(\Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct $product) + { $checkoutData = $product->getCheckoutData(); $options = $checkoutData['options']['configurable_options']; $confAttrData = $product->getDataFieldConfig('configurable_attributes_data'); @@ -52,7 +53,8 @@ public function fillData(\Magento\ConfigurableProduct\Test\Fixture\ConfigurableP * * @param $optionId */ - private function clickOnSwatch($optionId) { + private function clickOnSwatch($optionId) + { $selector = sprintf($this->swatchSelector, $optionId); $this->_rootElement->find($selector, Locator::SELECTOR_CSS)->click(); } diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php index deed1c48c34b6..651718382da34 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php @@ -17,22 +17,17 @@ class AssertSwatchConfigurableProductPage extends AssertProductPage { /** - * Assert that configurable product with swatches displays correctly. - * - * @param BrowserInterface $browser - * @param CatalogProductView $catalogProductView - * @param FixtureInterface $product - */ + * {@inheritdoc} + */ public function processAssert( BrowserInterface $browser, CatalogProductView $catalogProductView, FixtureInterface $product - ) - { + ) { $this->product = $product; $this->productView = $catalogProductView->getProductViewWithSwatchesBlock(); $this->objectManager->create( - \Magento\Swatches\Test\TestStep\AddProductToCartFromCatalogCategoryPageStep ::class, + \Magento\Swatches\Test\TestStep\AddProductToCartFromCatalogCategoryPageStep::class, [ 'product' => $product ] diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Handler/SwatchProductAttribute/Curl.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Handler/SwatchProductAttribute/Curl.php index 4408bd0af355f..86de2d651da1e 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Handler/SwatchProductAttribute/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Handler/SwatchProductAttribute/Curl.php @@ -36,7 +36,8 @@ public function __construct(DataInterface $configuration, EventManagerInterface * @param array $data * @return array */ - protected function changeStructureOfTheData(array $data) { + protected function changeStructureOfTheData(array $data) + { $data = parent::changeStructureOfTheData($data); $data['optiontext'] = $data['option']; $data['swatchtext'] = [ diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/AddProductToCartFromCatalogCategoryPageStep.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/AddProductToCartFromCatalogCategoryPageStep.php index d4a2755f3527c..e19f9d7b3c362 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/AddProductToCartFromCatalogCategoryPageStep.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/TestStep/AddProductToCartFromCatalogCategoryPageStep.php @@ -46,7 +46,6 @@ class AddProductToCartFromCatalogCategoryPageStep implements TestStepInterface */ private $cmsIndex; - /** * @constructor * @param FixtureFactory $fixtureFactory @@ -59,8 +58,7 @@ public function __construct( CmsIndex $cmsIndex, CatalogCategoryView $categoryView, InjectableFixture $product - ) - { + ) { $this->fixtureFactory = $fixtureFactory; $this->cmsIndex = $cmsIndex; $this->categoryView = $categoryView; From 4b96c90fbbe501692195de1f2d0f497ba4cea99c Mon Sep 17 00:00:00 2001 From: "Palamar, Mykola" Date: Fri, 21 Oct 2016 12:02:31 +0000 Subject: [PATCH 1377/3232] MAGETWO-47017: [Github] Add Configurable Product To Cart from Category Page #2574 #5850 #5882 #6572 #5558 - CR changes --- .../Test/Constraint/AssertSwatchConfigurableProductPage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php index 651718382da34..98ac0bf9e1412 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php @@ -16,8 +16,8 @@ */ class AssertSwatchConfigurableProductPage extends AssertProductPage { - /** - * {@inheritdoc} + /** + * {@inheritdoc} */ public function processAssert( BrowserInterface $browser, From 564801df4a7e2174095dec2de576fe91ae2b417d Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Fri, 21 Oct 2016 16:00:00 +0300 Subject: [PATCH 1378/3232] MAGETWO-59715: Impossible to import additional_images with labels which have a comma separator --- .../Model/Import/Product.php | 101 ++++++++++---- .../Model/Import/Product/Validator/Media.php | 7 +- .../Import/Product/Validator/MediaTest.php | 29 +++- .../Test/Unit/Model/Import/ProductTest.php | 37 +++++ .../Model/Import/ProductTest.php | 128 ++++++++++++------ .../_files/import_media_update_label.csv | 2 + 6 files changed, 226 insertions(+), 78 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_media_update_label.csv diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index afb2e86b6248a..877f2cfc23911 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1437,6 +1437,17 @@ protected function getExistingImages($bunch) ['mgvte' => $this->mediaGalleryEntityToValueTableName], '(mg.value_id = mgvte.value_id)', [$this->getProductEntityLinkField() => 'mgvte.' . $this->getProductEntityLinkField()] + )->joinInner( + ['mgv' => $this->mediaGalleryValueTableName], + sprintf( + '(mg.value_id = mgv.value_id AND mgv.%s = mgvte.%s)', + $this->getProductEntityLinkField(), + $this->getProductEntityLinkField() + ), + [ + 'label' => 'mgv.label', + 'value_id' => 'mgv.value_id' + ] )->joinInner( ['pe' => $this->productEntityTableName], "(mgvte.{$this->getProductEntityLinkField()} = pe.{$this->getProductEntityLinkField()})", @@ -1447,7 +1458,7 @@ protected function getExistingImages($bunch) ); foreach ($this->_connection->fetchAll($select) as $image) { - $result[$image['sku']][$image['value']] = true; + $result[$image['sku']][$image['value']] = $image; } return $result; @@ -1462,22 +1473,24 @@ public function getImagesFromRow(array $rowData) $images = []; $labels = []; foreach ($this->_imagesArrayKeys as $column) { - $images[$column] = []; - $labels[$column] = []; if (!empty($rowData[$column])) { $images[$column] = array_unique( - explode($this->getMultipleValueSeparator(), $rowData[$column]) + array_map( + 'trim', + explode($this->getMultipleValueSeparator(), $rowData[$column]) + ) ); - } - if (!empty($rowData[$column . '_label'])) { - $labels[$column] = explode($this->getMultipleValueSeparator(), $rowData[$column . '_label']); - } + if (!empty($rowData[$column . '_label'])) { + $labels[$column] = $this->parseMultiselectValues( + $rowData[$column . '_label'], + $this->getMultipleValueSeparator() + ); - if (count($labels[$column]) > count($images[$column])) { - $labels[$column] = array_slice($labels[$column], 0, count($images[$column])); - } elseif (count($labels[$column]) < count($images[$column])) { - $labels[$column] = array_pad($labels[$column], count($images[$column]), ''); + if (count($labels[$column]) > count($images[$column])) { + $labels[$column] = array_slice($labels[$column], 0, count($images[$column])); + } + } } } @@ -1616,7 +1629,7 @@ protected function _saveProducts() foreach ($rowImages as $column => $columnImages) { foreach ($columnImages as $position => $columnImage) { if (!isset($uploadedImages[$columnImage])) { - $uploadedFile = $this->uploadMediaFiles(trim($columnImage), true); + $uploadedFile = $this->uploadMediaFiles($columnImage, true); if ($uploadedFile) { $uploadedImages[$columnImage] = $uploadedFile; } else { @@ -1636,20 +1649,26 @@ protected function _saveProducts() $rowData[$column] = $uploadedFile; } - $imageNotAssigned = !isset($existingImages[$rowSku][$uploadedFile]); - - if ($uploadedFile && $imageNotAssigned) { - if ($column == self::COL_MEDIA_IMAGE) { - $rowData[$column][] = $uploadedFile; + if ($uploadedFile && !isset($mediaGallery[$rowSku][$uploadedFile])) { + if (isset($existingImages[$rowSku][$uploadedFile])) { + if (isset($rowLabels[$column][$position])) { + $this->updateMediaGalleryItemLabel( + $rowLabels[$column][$position], + $existingImages[$rowSku][$uploadedFile] + ); + } + } else { + if ($column == self::COL_MEDIA_IMAGE) { + $rowData[$column][] = $uploadedFile; + } + $mediaGallery[$rowSku][$uploadedFile] = [ + 'attribute_id' => $this->getMediaGalleryAttributeId(), + 'label' => isset($rowLabels[$column][$position]) ? $rowLabels[$column][$position] : '', + 'position' => $position + 1, + 'disabled' => isset($disabledImages[$columnImage]) ? '1' : '0', + 'value' => $uploadedFile, + ]; } - $mediaGallery[$rowSku][] = [ - 'attribute_id' => $this->getMediaGalleryAttributeId(), - 'label' => isset($rowLabels[$column][$position]) ? $rowLabels[$column][$position] : '', - 'position' => $position + 1, - 'disabled' => isset($disabledImages[$columnImage]) ? '1' : '0', - 'value' => $uploadedFile, - ]; - $existingImages[$rowSku][$uploadedFile] = true; } } } @@ -2535,12 +2554,13 @@ private function parseAttributesWithWrappedValues($attributesData) * Parse values of multiselect attributes depends on "Fields Enclosure" parameter * * @param string $values + * @param string $delimiter * @return array */ - public function parseMultiselectValues($values) + public function parseMultiselectValues($values, $delimiter = self::PSEUDO_MULTI_LINE_SEPARATOR) { if (empty($this->_parameters[Import::FIELDS_ENCLOSURE])) { - return explode(self::PSEUDO_MULTI_LINE_SEPARATOR, $values); + return explode($delimiter, $values); } if (preg_match_all('~"((?:[^"]|"")*)"~', $values, $matches)) { return $values = array_map(function ($value) { @@ -2752,4 +2772,29 @@ private function getProductIdentifierField() } return $this->productEntityIdentifierField; } + + /** + * Update media gallery item label + * + * @param string $newLabel + * @param array $mediaData + */ + private function updateMediaGalleryItemLabel($newLabel, array $mediaData) + { + if ($newLabel == $mediaData['label']) { + return; + } + + $this->_connection->update( + $this->mediaGalleryValueTableName, + [ + 'label' => $newLabel + ], + [ + 'entity_id = ?' => $mediaData['entity_id'], + 'value_id = ?' => $mediaData['value_id'], + 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID + ] + ); + } } diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php index 0b728ee503887..e05c7bd9ebaf1 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php @@ -5,7 +5,6 @@ */ namespace Magento\CatalogImportExport\Model\Import\Product\Validator; -use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator; use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface; class Media extends AbstractImportValidator implements RowValidatorInterface @@ -16,6 +15,10 @@ class Media extends AbstractImportValidator implements RowValidatorInterface const ADDITIONAL_IMAGES = 'additional_images'; + /** + * @deprecated + * @see \Magento\CatalogImportExport\Model\Import\Product::getMultipleValueSeparator() + */ const ADDITIONAL_IMAGES_DELIMITER = ','; /** @var array */ @@ -83,7 +86,7 @@ public function isValid($value) } } if (isset($value[self::ADDITIONAL_IMAGES]) && strlen($value[self::ADDITIONAL_IMAGES])) { - foreach (explode(self::ADDITIONAL_IMAGES_DELIMITER, $value[self::ADDITIONAL_IMAGES]) as $image) { + foreach (explode($this->context->getMultipleValueSeparator(), $value[self::ADDITIONAL_IMAGES]) as $image) { if (!$this->checkPath($image) && !$this->checkValidUrl($image)) { $this->_addMessages( [ diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/MediaTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/MediaTest.php index a4a937f25cf81..df7b33c72995b 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/MediaTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/MediaTest.php @@ -6,11 +6,14 @@ namespace Magento\CatalogImportExport\Test\Unit\Model\Import\Product\Validator; +use Magento\CatalogImportExport\Model\Import\Product; +use Magento\CatalogImportExport\Model\Import\Product\Validator\Media; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\ImportExport\Model\Import; class MediaTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\CatalogImportExport\Model\Import\Product\Validator\Media */ + /** @var Media */ protected $media; /** @var ObjectManagerHelper */ @@ -21,7 +24,7 @@ protected function setUp() $this->objectManagerHelper = new ObjectManagerHelper($this); $this->media = $this->objectManagerHelper->getObject( - \Magento\CatalogImportExport\Model\Import\Product\Validator\Media::class, + Media::class, [ ] @@ -41,6 +44,18 @@ public function testInit() */ public function testIsValid($data, $expected) { + $contextMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + $contextMock->expects($this->any()) + ->method('getMultipleValueSeparator') + ->willReturn(Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR); + $contextMock->expects($this->any()) + ->method('retrieveMessageTemplate') + ->with(Media::ERROR_INVALID_MEDIA_URL_OR_PATH) + ->willReturn('%s'); + $this->media->init($contextMock); + $result = $this->media->isValid($data); $this->assertEquals($expected['result'], $result); $messages = $this->media->getMessages(); @@ -50,7 +65,7 @@ public function testIsValid($data, $expected) public function testIsValidClearMessagesCall() { $media = $this->getMock( - \Magento\CatalogImportExport\Model\Import\Product\Validator\Media::class, + Media::class, ['_clearMessages'], [], '', @@ -78,6 +93,14 @@ public function isMediaValidDataProvider() 'invalid' => [ ['_media_image' => 1], ['result' => true,'messages' => []], + ], + 'additional_images' => [ + ['additional_images' => 'image1.png,image2.jpg'], + ['result' => true, 'messages' => []] + ], + 'additional_images_fail' => [ + ['additional_images' => 'image1.png|image2.jpg|image3.gif'], + ['result' => false, 'messages' => [0 => 'additional_images']] ] ]; } diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php index bf9c694d949d4..cd1fedf82fe85 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php @@ -1280,6 +1280,43 @@ public function testValidateValidateOptionEntity() $importProduct->validateRow($rowData, $rowNum); } + /** + * @dataProvider getImagesFromRowDataProvider + */ + public function testGetImagesFromRow($rowData, $expectedResult) + { + $this->assertEquals( + $this->importProduct->getImagesFromRow($rowData), + $expectedResult + ); + } + + public function getImagesFromRowDataProvider() + { + return [ + [ + [], + [[], []] + ], + [ + [ + 'image' => 'image3.jpg', + '_media_image' => 'image1.jpg,image2.png', + '_media_image_label' => 'label1,label2' + ], + [ + [ + 'image' => ['image3.jpg'], + '_media_image' => ['image1.jpg', 'image2.png'] + ], + [ + '_media_image' => ['label1', 'label2'] + ], + ] + ] + ]; + } + public function validateRowValidateNewProductTypeAddRowErrorCallDataProvider() { return [ diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 9ab7db147d811..40909109aa310 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -568,52 +568,9 @@ protected function getOptionValues(\Magento\Catalog\Model\Product\Option $option */ public function testSaveMediaImage() { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create(\Magento\Framework\Filesystem::class); - $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); - - $source = $this->objectManager->create( - \Magento\ImportExport\Model\Import\Source\Csv::class, - [ - 'file' => __DIR__ . '/_files/import_media.csv', - 'directory' => $directory - ] - ); - $this->_model->setParameters( - [ - 'behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, - 'entity' => 'catalog_product', - 'import_images_file_dir' => 'pub/media/import' - ] - ); - $appParams = \Magento\TestFramework\Helper\Bootstrap::getInstance() - ->getBootstrap() - ->getApplication() - ->getInitParams()[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS]; - $uploader = $this->_model->getUploader(); + $this->importDataForMediaTest('import_media.csv'); + $product = $this->getProductBySku('simple_new'); - $destDir = $directory->getRelativePath($appParams[DirectoryList::MEDIA][DirectoryList::PATH] . '/catalog/product'); - $tmpDir = $directory->getRelativePath($appParams[DirectoryList::MEDIA][DirectoryList::PATH] . '/import'); - - $directory->create($destDir); - $this->assertTrue($uploader->setDestDir($destDir)); - $this->assertTrue($uploader->setTmpDir($tmpDir)); - $errors = $this->_model->setSource( - $source - )->validateData(); - - $this->assertTrue($errors->getErrorsCount() == 0); - $this->_model->importData(); - $this->assertTrue($this->_model->getErrorAggregator()->getErrorsCount() == 0); - - $resource = $objectManager->get(\Magento\Catalog\Model\ResourceModel\Product::class); - $productId = $resource->getIdBySku('simple_new'); - - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Catalog\Model\Product::class - ); - $product->load($productId); $this->assertEquals('/m/a/magento_image.jpg', $product->getData('swatch_image')); $gallery = $product->getMediaGalleryImages(); $this->assertInstanceOf(\Magento\Framework\Data\Collection::class, $gallery); @@ -625,6 +582,25 @@ public function testSaveMediaImage() $this->assertEquals('Image Label', $item->getLabel()); } + /** + * Test that image labels updates after import + * + * @magentoDataFixture mediaImportImageFixture + * @magentoDataFixture Magento/Catalog/_files/product_with_image.php + */ + public function testUpdateImageLabel() + { + $this->importDataForMediaTest('import_media_update_label.csv'); + $product = $this->getProductBySku('simple'); + + $gallery = $product->getMediaGalleryImages(); + $items = $gallery->getItems(); + $this->assertCount(1, $items); + $item = array_pop($items); + $this->assertInstanceOf(\Magento\Framework\DataObject::class, $item); + $this->assertEquals('Updated Image Label', $item->getLabel()); + } + /** * Copy a fixture image into media import directory */ @@ -1431,4 +1407,66 @@ public function testProductWithWrappedAdditionalAttributes() $this->assertEquals(implode(',', [$multiselectOptions[1]->getValue(), $multiselectOptions[2]->getValue()]), $product2->getData('multiselect_attribute')); } + + /** + * Import and check data from file + * + * @param string $fileName + */ + private function importDataForMediaTest($fileName) + { + $filesystem = $this->objectManager->create(\Magento\Framework\Filesystem::class); + $directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); + + $source = $this->objectManager->create( + \Magento\ImportExport\Model\Import\Source\Csv::class, + [ + 'file' => __DIR__ . '/_files/' . $fileName, + 'directory' => $directory + ] + ); + $this->_model->setParameters( + [ + 'behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, + 'entity' => 'catalog_product', + 'import_images_file_dir' => 'pub/media/import' + ] + ); + $appParams = \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->getBootstrap() + ->getApplication() + ->getInitParams()[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS]; + $uploader = $this->_model->getUploader(); + + $mediaPath = $appParams[DirectoryList::MEDIA][DirectoryList::PATH]; + $destDir = $directory->getRelativePath($mediaPath . '/catalog/product'); + $tmpDir = $directory->getRelativePath($mediaPath . '/import'); + + $directory->create($destDir); + $this->assertTrue($uploader->setDestDir($destDir)); + $this->assertTrue($uploader->setTmpDir($tmpDir)); + $errors = $this->_model->setSource( + $source + )->validateData(); + $this->assertTrue($errors->getErrorsCount() == 0); + + $this->_model->importData(); + $this->assertTrue($this->_model->getErrorAggregator()->getErrorsCount() == 0); + } + + /** + * Load product by given product sku + * + * @param string $sku + * @return \Magento\Catalog\Model\Product + */ + private function getProductBySku($sku) + { + $resource = $this->objectManager->get(\Magento\Catalog\Model\ResourceModel\Product::class); + $productId = $resource->getIdBySku($sku); + $product = $this->objectManager->create(\Magento\Catalog\Model\Product::class); + $product->load($productId); + + return $product; + } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_media_update_label.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_media_update_label.csv new file mode 100644 index 0000000000000..4e62e28af7ff3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_media_update_label.csv @@ -0,0 +1,2 @@ +sku,store_view_code,attribute_set_code,product_type,categories,product_websites,name,description,short_description,weight,product_online,tax_class_name,visibility,price,special_price,special_price_from_date,special_price_to_date,url_key,meta_title,meta_keywords,meta_description,base_image,base_image_label,small_image,small_image_label,thumbnail_image,thumbnail_image_label,swatch_image,swatch_image_label1,created_at,updated_at,new_from_date,new_to_date,display_product_options_in,map_price,msrp_price,map_enabled,gift_message_available,custom_design,custom_design_from,custom_design_to,custom_layout_update,page_layout,product_options_container,msrp_display_actual_price_type,country_of_manufacture,additional_attributes,qty,out_of_stock_qty,use_config_min_qty,is_qty_decimal,allow_backorders,use_config_backorders,min_cart_qty,use_config_min_sale_qty,max_cart_qty,use_config_max_sale_qty,is_in_stock,notify_on_stock_below,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,related_skus,crosssell_skus,upsell_skus,additional_images,additional_image_labels,hide_from_product_page,custom_options,bundle_price_type,bundle_sku_type,bundle_price_view,bundle_weight_type,bundle_values,associated_skus +simple,,Default,simple,,base,New Product,,,,1,Taxable Goods,"Catalog, Search",10,,,,new-product,New Product,New Product,New Product ,magento_image.jpg,,magento_image.jpg,,magento_image.jpg,,magento_image.jpg,,10/20/15 07:05,10/20/15 07:05,,,Block after Info Column,,,,,,,,,,,,,"has_options=1,quantity_and_stock_status=In Stock,required_options=1",100,0,1,0,0,1,1,1,10000,1,1,1,1,1,0,1,1,0,0,0,1,,,,magento_image.jpg,Updated Image Label,,,,,,,, From 9abe24189c2cc8aac9c50c930d99d14797e7e0fc Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 21 Oct 2016 08:48:32 -0500 Subject: [PATCH 1379/3232] MAGETWO-59444: Create serializer interface and json class in framework - Address code review comments --- .../Source/CountryofmanufactureTest.php | 21 ++++---- .../Directory/Test/Unit/Block/DataTest.php | 8 +-- .../Unit/Model/DataObjectProcessorTest.php | 9 ++-- .../App/Test/Unit/Route/ConfigTest.php | 53 +++++++++---------- 4 files changed, 41 insertions(+), 50 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Source/CountryofmanufactureTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Source/CountryofmanufactureTest.php index 8c0e090bfe941..9ae3f94924855 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Source/CountryofmanufactureTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Source/CountryofmanufactureTest.php @@ -32,6 +32,11 @@ class CountryofmanufactureTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Model\Product\Attribute\Source\Countryofmanufacture */ private $countryOfManufacture; + /** + * @var \Magento\Framework\Serialize\SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializerMock; + protected function setUp() { $this->storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class); @@ -46,19 +51,11 @@ protected function setUp() ] ); - $serializerMock = $this->getMock(SerializerInterface::class, [], [], '', false); - $serializerMock->method('serialize') - ->willReturnCallback(function ($string) { - return json_encode($string); - }); - $serializerMock->method('unserialize') - ->willReturnCallback(function ($string) { - return json_decode($string, true); - }); + $this->serializerMock = $this->getMock(SerializerInterface::class, [], [], '', false); $this->objectManagerHelper->setBackwardCompatibleProperty( $this->countryOfManufacture, 'serializer', - $serializerMock + $this->serializerMock ); } @@ -78,7 +75,9 @@ public function testGetAllOptions($cachedDataSrl, $cachedDataUnsrl) ->method('load') ->with($this->equalTo('COUNTRYOFMANUFACTURE_SELECT_STORE_store_code')) ->will($this->returnValue($cachedDataSrl)); - + $this->serializerMock->expects($this->once()) + ->method('unserialize') + ->willReturn($cachedDataUnsrl); $this->assertEquals($cachedDataUnsrl, $this->countryOfManufacture->getAllOptions()); } diff --git a/app/code/Magento/Directory/Test/Unit/Block/DataTest.php b/app/code/Magento/Directory/Test/Unit/Block/DataTest.php index 6b41140240a30..5aabfe04708bf 100644 --- a/app/code/Magento/Directory/Test/Unit/Block/DataTest.php +++ b/app/code/Magento/Directory/Test/Unit/Block/DataTest.php @@ -80,13 +80,9 @@ protected function setUp() $serializerMock = $this->getMock(SerializerInterface::class, [], [], '', false); $serializerMock->method('serialize') - ->willReturnCallback(function ($string) { - return json_encode($string); - }); + ->willReturn('serializedData'); $serializerMock->method('unserialize') - ->willReturnCallback(function ($string) { - return json_decode($string, true); - }); + ->willReturn(['unserializedData']); $objectManagerHelper->setBackwardCompatibleProperty( $this->block, 'serializer', diff --git a/app/code/Magento/Webapi/Test/Unit/Model/DataObjectProcessorTest.php b/app/code/Magento/Webapi/Test/Unit/Model/DataObjectProcessorTest.php index 8c62cfcbc09d4..0565832932a3f 100644 --- a/app/code/Magento/Webapi/Test/Unit/Model/DataObjectProcessorTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Model/DataObjectProcessorTest.php @@ -34,13 +34,10 @@ protected function setup() ); $serializerMock = $this->getMock(SerializerInterface::class); $serializerMock->method('serialize') - ->willReturnCallback(function ($data) { - return json_encode($data); - }); + ->willReturn('serializedData'); $serializerMock->method('unserialize') - ->willReturnCallback(function ($string) { - return json_decode($string, true); - }); + ->willReturn(['unserializedData']); + $objectManager->setBackwardCompatibleProperty( $methodsMapProcessor, 'serializer', diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigTest.php index 2d30c9ae48893..05bbf68daf5af 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigTest.php @@ -32,6 +32,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $_areaList; + /** + * @var \Magento\Framework\Serialize\SerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializerMock; + protected function setUp() { $this->_readerMock = $this->getMock(\Magento\Framework\App\Route\Config\Reader::class, [], [], '', false); @@ -51,16 +56,8 @@ protected function setUp() 'areaList' => $this->_areaList ] ); - $serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class); - $objectManager->setBackwardCompatibleProperty($this->_config, 'serializer', $serializerMock); - $serializerMock->method('serialize') - ->willReturnCallback(function ($string) { - return json_encode($string); - }); - $serializerMock->method('unserialize') - ->willReturnCallback(function ($string) { - return json_decode($string, true); - }); + $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class); + $objectManager->setBackwardCompatibleProperty($this->_config, 'serializer', $this->serializerMock); } public function testGetRouteFrontNameIfCacheIfRouterIdNotExist() @@ -74,14 +71,14 @@ public function testGetRouteFrontNameIfCacheIfRouterIdNotExist() public function testGetRouteByFrontName() { + $data = ['routerCode' => ['frontName' => 'routerName']]; + $serializedData = json_encode($data); $this->_cacheMock->expects($this->once()) ->method('load') ->with('areaCode::RoutesConfig') - ->willReturn(json_encode(['routerCode' => ['frontName' => 'routerName']])); - - $this->assertEquals('routerCode', $this->_config->getRouteByFrontName('routerName')); - - // check internal caching in $this->_routes array + ->willReturn($serializedData); + $this->serializerMock->method('unserialize') + ->willReturn($data); $this->assertEquals('routerCode', $this->_config->getRouteByFrontName('routerName')); } @@ -90,11 +87,9 @@ public function testGetRouteByFrontNameNoRoutes() $this->_cacheMock->expects($this->once()) ->method('load') ->with('areaCode::RoutesConfig') - ->willReturn(json_encode([])); - - $this->assertFalse($this->_config->getRouteByFrontName('routerName')); - - // check caching in $this->_routes array + ->willReturn('[]'); + $this->serializerMock->method('unserialize') + ->willReturn([]); $this->assertFalse($this->_config->getRouteByFrontName('routerName')); } @@ -117,6 +112,8 @@ public function testGetRouteByFrontNameNoCache() ], ]; + $serializedData = json_encode($routes); + $this->_readerMock->expects( $this->once() )->method( @@ -137,24 +134,26 @@ public function testGetRouteByFrontNameNoCache() $this->returnValue('default_router') ); + $this->serializerMock->method('serialize') + ->willReturn($serializedData); + $this->_cacheMock->expects($this->once()) ->method('save') - ->with(json_encode($routes), 'scope::RoutesConfig'); - - $this->assertEquals('routerCode', $this->_config->getRouteByFrontName('routerName', 'scope')); + ->with($serializedData, 'scope::RoutesConfig'); - // check caching in $this->_routes array $this->assertEquals('routerCode', $this->_config->getRouteByFrontName('routerName', 'scope')); } public function testGetModulesByFrontName() { + $data = ['routerCode' => ['frontName' => 'routerName', 'modules' => ['Module1']]]; + $serializedData = json_encode($data); $this->_cacheMock->expects($this->once()) ->method('load') ->with('areaCode::RoutesConfig') - ->willReturn( - json_encode(['routerCode' => ['frontName' => 'routerName', 'modules' => ['Module1']]]) - ); + ->willReturn($serializedData); + $this->serializerMock->method('unserialize') + ->willReturn($data); $this->assertEquals(['Module1'], $this->_config->getModulesByFrontName('routerName')); } } From e4cf56c9ccec8b8aa1fc75383134860b4a5347df Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 21 Oct 2016 09:28:35 -0500 Subject: [PATCH 1380/3232] MAGETWO-59444: Create serializer interface and json class in framework - Address code review comments --- .../Directory/Test/Unit/Block/DataTest.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Directory/Test/Unit/Block/DataTest.php b/app/code/Magento/Directory/Test/Unit/Block/DataTest.php index 5aabfe04708bf..fce1e50b04931 100644 --- a/app/code/Magento/Directory/Test/Unit/Block/DataTest.php +++ b/app/code/Magento/Directory/Test/Unit/Block/DataTest.php @@ -53,6 +53,9 @@ class DataTest extends \PHPUnit_Framework_TestCase /** @var LayoutInterface |\PHPUnit_Framework_MockObject_MockObject */ private $layoutMock; + /** @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */ + private $serializerMock; + protected function setUp() { $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -78,15 +81,11 @@ protected function setUp() ] ); - $serializerMock = $this->getMock(SerializerInterface::class, [], [], '', false); - $serializerMock->method('serialize') - ->willReturn('serializedData'); - $serializerMock->method('unserialize') - ->willReturn(['unserializedData']); + $this->serializerMock = $this->getMock(SerializerInterface::class, [], [], '', false); $objectManagerHelper->setBackwardCompatibleProperty( $this->block, 'serializer', - $serializerMock + $this->serializerMock ); } @@ -171,13 +170,16 @@ public function testGetCountryHtmlSelect( ->method('getCode') ->willReturn($storeCode); + $this->serializerMock->method('serialize') + ->willReturn('serializedData'); + $this->cacheTypeConfigMock->expects($this->once()) ->method('load') ->with('DIRECTORY_COUNTRY_SELECT_STORE_' . $storeCode) ->willReturn(false); $this->cacheTypeConfigMock->expects($this->once()) ->method('save') - ->with(json_encode($options), 'DIRECTORY_COUNTRY_SELECT_STORE_' . $storeCode) + ->with('serializedData', 'DIRECTORY_COUNTRY_SELECT_STORE_' . $storeCode) ->willReturnSelf(); $this->scopeConfigMock->expects($this->once()) From 7460b123befeb8269cdc313c7643053cbd983272 Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Fri, 21 Oct 2016 17:31:14 +0300 Subject: [PATCH 1381/3232] MAGETWO-59715: Impossible to import additional_images with labels which have a comma separator --- app/code/Magento/CatalogImportExport/Model/Import/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 877f2cfc23911..6e051a30a95a5 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -2791,7 +2791,7 @@ private function updateMediaGalleryItemLabel($newLabel, array $mediaData) 'label' => $newLabel ], [ - 'entity_id = ?' => $mediaData['entity_id'], + 'entity_id = ?' => $mediaData[$this->getProductEntityLinkField()], 'value_id = ?' => $mediaData['value_id'], 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID ] From 214d7fa22ce2e54bda2427ab4e66cbd4d6bce3d9 Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 21 Oct 2016 09:35:04 -0500 Subject: [PATCH 1382/3232] MAGETWO-59444: Create serializer interface and json class in framework - Fix static test failure --- .../Test/Unit/Model/ShippingInformationManagementTest.php | 3 +++ .../Magento/Customer/Test/Unit/Model/Address/ConfigTest.php | 3 +++ app/code/Magento/SalesRule/Test/Unit/Model/RuleTest.php | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php index c0649bef17f0a..c19abf318aaf1 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php @@ -106,6 +106,9 @@ class ShippingInformationManagementTest extends \PHPUnit_Framework_TestCase */ private $shippingMock; + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); diff --git a/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php b/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php index d9499812cead9..9209a96101cfe 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Customer\Test\Unit\Model\Address; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class ConfigTest extends \PHPUnit_Framework_TestCase { /** diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/RuleTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/RuleTest.php index d7f58dce73790..c17c6dfe98bc1 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/RuleTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/RuleTest.php @@ -5,6 +5,9 @@ */ namespace Magento\SalesRule\Test\Unit\Model; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class RuleTest extends \PHPUnit_Framework_TestCase { /** From d8a2550befa33fa4db055f5dff0037b9a4dd7d68 Mon Sep 17 00:00:00 2001 From: "Palamar, Mykola" Date: Fri, 21 Oct 2016 15:23:52 +0000 Subject: [PATCH 1383/3232] MAGETWO-47017: [Github] Add Configurable Product To Cart from Category Page #2574 #5850 #5882 #6572 #5558 --- .../Test/Constraint/AssertSwatchConfigurableProductPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php index 98ac0bf9e1412..460a13ce49d70 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Constraint/AssertSwatchConfigurableProductPage.php @@ -18,7 +18,7 @@ class AssertSwatchConfigurableProductPage extends AssertProductPage { /** * {@inheritdoc} - */ + */ public function processAssert( BrowserInterface $browser, CatalogProductView $catalogProductView, From ee995f28b483ef90f02b08a091f3cebc217391ab Mon Sep 17 00:00:00 2001 From: cspruiell Date: Fri, 21 Oct 2016 14:27:57 -0500 Subject: [PATCH 1384/3232] MAGETWO-58348: Cannot create configurable product with child by REST API - code cleanup --- app/code/Magento/Catalog/Model/Product.php | 1 + app/code/Magento/ConfigurableProduct/i18n/en_US.csv | 2 -- .../Magento/ConfigurableProduct/Api/LinkManagementTest.php | 3 ++- .../Magento/ConfigurableProduct/_files/product_simple_77.php | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 9fbd6b7184e87..c913c82de1acd 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -2616,6 +2616,7 @@ private function getMediaGalleryProcessor() /** * Set the associated products + * * @param array $productIds * @return $this */ diff --git a/app/code/Magento/ConfigurableProduct/i18n/en_US.csv b/app/code/Magento/ConfigurableProduct/i18n/en_US.csv index bb3848dc45d84..59ae9a2016707 100644 --- a/app/code/Magento/ConfigurableProduct/i18n/en_US.csv +++ b/app/code/Magento/ConfigurableProduct/i18n/en_US.csv @@ -117,8 +117,6 @@ Done,Done "Please select attribute(s).","Please select attribute(s)." "Generate Products","Generate Products" "Configurable Product Image","Configurable Product Image" -"Parent product does not have configurable product options","Parent product does not have configurable product options" -"Child product does not have attribute value %1","Child product does not have attribute value %1" Select...,Select... Status,Status ID,ID diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php index 2bc98060524e3..1a06be978d34c 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php @@ -74,7 +74,8 @@ public function testAddChild() } /** - * Test case to cover bug MAGETWO-58401 + * Test the full flow of creating a configurable product and adding a child via REST + * * @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php */ public function testAddChildFullRestCreation() diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_simple_77.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_simple_77.php index 90662c6d259ed..0d8361b4751e3 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_simple_77.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_simple_77.php @@ -1,5 +1,7 @@ Date: Fri, 21 Oct 2016 15:46:42 -0500 Subject: [PATCH 1385/3232] MAGETWO-59923: Configuration in \Magento\Indexer\Model\Config\Data contains objects --- .../Paypal/Model/Config/Rules/Converter.php | 2 +- .../Magento/Indexer/Model/Config/DataTest.php | 68 +++++++++++++++++++ .../Indexer/Model/Config/_files/result.php | 4 +- .../Framework/Indexer/Config/Converter.php | 2 +- 4 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Indexer/Model/Config/DataTest.php diff --git a/app/code/Magento/Paypal/Model/Config/Rules/Converter.php b/app/code/Magento/Paypal/Model/Config/Rules/Converter.php index d65078212d89f..d14bc6597599c 100644 --- a/app/code/Magento/Paypal/Model/Config/Rules/Converter.php +++ b/app/code/Magento/Paypal/Model/Config/Rules/Converter.php @@ -85,7 +85,7 @@ protected function createPredicate(\DOMElement $node) if ($this->hasNodeElement($child)) { $result = [ 'name' => $child->getAttribute('name'), - 'message' => __($child->getAttribute('message')), + 'message' => __($child->getAttribute('message'))->__toString(), 'event' => $child->getAttribute('event'), 'argument' => $this->createArgument($child), ]; diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/DataTest.php new file mode 100644 index 0000000000000..673933c69143c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/DataTest.php @@ -0,0 +1,68 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + } + + public function testConstructor() + { + $pathFiles = __DIR__ . '/_files'; + $expectedResult = require $pathFiles . '/result.php'; + $path = $pathFiles . '/indexer.xml'; + $fileResolverMock = $this->getMock(\Magento\Framework\Config\FileResolverInterface::class); + $fileIterator = $this->objectManager->create( + \Magento\Framework\Config\FileIterator::class, + [ + 'paths' => [$path], + ] + ); + $fileResolverMock->method('get') + ->willReturn($fileIterator); + $this->cleanAllCache(); + + $reader = $this->objectManager->create( + \Magento\Framework\Indexer\Config\Reader::class, + [ + 'fileResolver' => $fileResolverMock, + ] + ); + $model = $this->objectManager->create( + \Magento\Indexer\Model\Config\Data::class, + [ + 'reader' => $reader, + ] + ); + $this->assertEquals($expectedResult['catalogsearch_fulltext'], $model->get('catalogsearch_fulltext')); + $model2 = $this->objectManager->create( + \Magento\Indexer\Model\Config\Data::class, + [ + 'reader' => $reader, + ] + ); + $this->assertEquals($expectedResult['catalogsearch_fulltext'], $model2->get('catalogsearch_fulltext')); + } + + private function cleanAllCache() + { + /** @var \Magento\Framework\App\Cache\Frontend\Pool $cachePool */ + $cachePool = $this->objectManager->get(\Magento\Framework\App\Cache\Frontend\Pool::class); + /** @var \Magento\Framework\Cache\FrontendInterface $cacheType */ + foreach ($cachePool as $cacheType) { + $cacheType->getBackend()->clean(); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php index fc3d466dd499b..aed5bbfd99df1 100644 --- a/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php +++ b/dev/tests/integration/testsuite/Magento/Indexer/Model/Config/_files/result.php @@ -12,8 +12,8 @@ 'primary' => 'first', 'view_id' => 'catalogsearch_fulltext', 'action_class' => \Magento\CatalogSearch\Model\Indexer\Fulltext::class, - 'title' => __('Catalog Search'), - 'description' => __('Rebuild Catalog product fulltext search index'), + 'title' => __('Catalog Search')->__toString(), + 'description' => __('Rebuild Catalog product fulltext search index')->__toString(), 'fieldsets' => [ [ diff --git a/lib/internal/Magento/Framework/Indexer/Config/Converter.php b/lib/internal/Magento/Framework/Indexer/Config/Converter.php index b8b17b185a1f2..14b3ebaacc827 100644 --- a/lib/internal/Magento/Framework/Indexer/Config/Converter.php +++ b/lib/internal/Magento/Framework/Indexer/Config/Converter.php @@ -212,7 +212,7 @@ protected function getTranslatedNodeValue(\DOMNode $node) { $value = $node->nodeValue; if ($this->getAttributeValue($node, 'translate') == 'true') { - $value = new \Magento\Framework\Phrase($value); + $value = (new \Magento\Framework\Phrase($value))->__toString(); } return $value; } From 00363d017abff16665387088c30acd37315408a1 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 21 Oct 2016 16:32:08 -0500 Subject: [PATCH 1386/3232] MAGETWO-59764: Create Serialize implementation of SerializerInterface Creating Serialize implementation --- .../Test/Unit/Model/Config/DataTest.php | 6 +-- .../Framework/App/Config/ScopePool.php | 6 +-- .../App/ObjectManager/ConfigCache.php | 10 ++-- .../App/ObjectManager/ConfigLoader.php | 10 ++-- .../ObjectManager/ConfigLoader/Compiled.php | 23 +-------- .../Framework/App/Router/ActionList.php | 8 ++-- .../App/Test/Unit/Config/ScopePoolTest.php | 6 +-- .../Unit/ObjectManager/ConfigCacheTest.php | 7 +-- .../Unit/ObjectManager/ConfigLoaderTest.php | 12 ++--- .../Config/Test/Unit/Data/ScopedTest.php | 12 ++--- .../Framework/Interception/Config/Config.php | 3 +- .../Interception/PluginList/PluginList.php | 18 ++++++- .../Test/Unit/Config/ConfigTest.php | 3 +- .../Test/Unit/PluginList/PluginListTest.php | 2 +- .../ObjectManager/Config/Compiled.php | 1 + .../Test/Unit/Config/ConfigTest.php | 6 +-- .../Magento/Framework/Serialize/README.md | 7 ++- .../Serialize/Serializer/Serialize.php | 40 ++++++++++++++++ .../Test/Unit/Serializer/SerializeTest.php | 48 +++++++++++++++++++ .../Magento/Framework/Unserialize/README.md | 3 +- .../Framework/Unserialize/Unserialize.php | 3 ++ .../Di/Compiler/Config/Writer/Filesystem.php | 23 +-------- 22 files changed, 164 insertions(+), 93 deletions(-) create mode 100644 lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php create mode 100644 lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/SerializeTest.php diff --git a/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php b/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php index 9096bb8af1b82..7ab42a5b914bb 100644 --- a/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/Config/DataTest.php @@ -95,15 +95,15 @@ private function mockObjectManager($dependencies) public function testConstructorWithCache() { - $jsonString = json_encode($this->indexers); + $serializedData = 'serialized data'; $this->cache->expects($this->once())->method('test')->with($this->cacheId)->will($this->returnValue(true)); $this->cache->expects($this->once()) ->method('load') ->with($this->cacheId) - ->willReturn($jsonString); + ->willReturn($serializedData); $this->serializerMock->method('unserialize') - ->with($jsonString) + ->with($serializedData) ->willReturn($this->indexers); $this->stateCollection->expects($this->never())->method('getItems'); diff --git a/lib/internal/Magento/Framework/App/Config/ScopePool.php b/lib/internal/Magento/Framework/App/Config/ScopePool.php index 018e21f86a782..4b4be9cfc5310 100644 --- a/lib/internal/Magento/Framework/App/Config/ScopePool.php +++ b/lib/internal/Magento/Framework/App/Config/ScopePool.php @@ -7,6 +7,7 @@ use Magento\Framework\App\RequestInterface; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -168,9 +169,8 @@ protected function _getScopeCode($scopeType, $scopeCode) */ private function getSerializer() { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); + if (null === $this->serializer) { + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get(Serialize::class); } return $this->serializer; } diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigCache.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigCache.php index dbb3bed895697..4e685e3472ef8 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigCache.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigCache.php @@ -8,6 +8,7 @@ namespace Magento\Framework\App\ObjectManager; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; class ConfigCache implements \Magento\Framework\ObjectManager\ConfigCacheInterface { @@ -24,7 +25,7 @@ class ConfigCache implements \Magento\Framework\ObjectManager\ConfigCacheInterfa protected $_prefix = 'diConfig'; /** - * @var \Magento\Framework\Serialize\SerializerInterface + * @var SerializerInterface */ private $serializer; @@ -62,14 +63,13 @@ public function save(array $config, $key) /** * Get serializer * - * @return \Magento\Framework\Serialize\SerializerInterface + * @return SerializerInterface * @deprecated */ private function getSerializer() { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); + if (null === $this->serializer) { + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get(Serialize::class); } return $this->serializer; } diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader.php index 2cfa2b006ff1e..2770443b6d7e2 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader.php @@ -8,6 +8,7 @@ namespace Magento\Framework\App\ObjectManager; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Framework\ObjectManager\ConfigLoaderInterface; class ConfigLoader implements ConfigLoaderInterface @@ -34,7 +35,7 @@ class ConfigLoader implements ConfigLoaderInterface protected $_cache; /** - * @var \Magento\Framework\Serialize\SerializerInterface + * @var SerializerInterface */ private $serializer; @@ -82,16 +83,15 @@ public function load($area) } /** - * Get json encoder/decoder + * Get serializer * * @return SerializerInterface * @deprecated */ private function getSerializer() { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); + if (null === $this->serializer) { + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get(Serialize::class); } return $this->serializer; } diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index d1dc30ee7c9ef..f39904988328d 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -18,11 +18,6 @@ class Compiled implements ConfigLoaderInterface */ private $configCache = []; - /** - * @var \Magento\Framework\Serialize\SerializerInterface - */ - private $serializer; - /** * {inheritdoc} */ @@ -31,7 +26,7 @@ public function load($area) if (isset($this->configCache[$area])) { return $this->configCache[$area]; } - $this->configCache[$area] = $this->getSerializer()->unserialize(\file_get_contents(self::getFilePath($area))); + $this->configCache[$area] = unserialize(\file_get_contents(self::getFilePath($area))); return $this->configCache[$area]; } @@ -44,20 +39,6 @@ public function load($area) public static function getFilePath($area) { $diPath = DirectoryList::getDefaultConfig()[DirectoryList::DI][DirectoryList::PATH]; - return BP . $diPath . '/' . $area . '.json'; - } - - /** - * Get serializer - * - * @return \Magento\Framework\Serialize\SerializerInterface - * @deprecated - */ - private function getSerializer() - { - if ($this->serializer === null) { - $this->serializer = new \Magento\Framework\Serialize\Serializer\Json(); - } - return $this->serializer; + return BP . '/' . $diPath . '/' . $area . '.json'; } } diff --git a/lib/internal/Magento/Framework/App/Router/ActionList.php b/lib/internal/Magento/Framework/App/Router/ActionList.php index dbfc9d2b9f502..c31059a146224 100644 --- a/lib/internal/Magento/Framework/App/Router/ActionList.php +++ b/lib/internal/Magento/Framework/App/Router/ActionList.php @@ -7,6 +7,7 @@ namespace Magento\Framework\App\Router; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Framework\Module\Dir\Reader as ModuleReader; class ActionList @@ -102,14 +103,13 @@ public function get($module, $area, $namespace, $action) /** * Get serializer * - * @return \Magento\Framework\Serialize\SerializerInterface + * @return SerializerInterface * @deprecated */ private function getSerializer() { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); + if (null === $this->serializer) { + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get(Serialize::class); } return $this->serializer; } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php index 06f35c94a4661..b0465f28e24f1 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/ScopePoolTest.php @@ -113,14 +113,14 @@ public function testGetScopeConfigNotCached($scopeType, $scope, array $data) ->method('read') ->with('testScope') ->willReturn($data); - $jsonString = json_encode($data); + $serializedData = 'serialized data'; $this->serializerMock->method('serialize') ->with($data) - ->willReturn($jsonString); + ->willReturn($serializedData); $this->_cache->expects($this->once()) ->method('save') ->with( - $jsonString, + $serializedData, $cacheKey, [\Magento\Framework\App\Config\ScopePool::CACHE_TAG] ); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigCacheTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigCacheTest.php index 21dce94bb6c73..7f05857f7cc81 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigCacheTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigCacheTest.php @@ -72,7 +72,7 @@ public function getDataProvider() { return [ [false, false], - ['["some data"]', ['some data']], + ['serialized data', ['some data']], ]; } @@ -80,10 +80,11 @@ public function testSave() { $key = 'key'; $config = ['config']; + $serializedData = 'serialized data'; $this->serializerMock->expects($this->once()) ->method('serialize') - ->willReturn('["config"]'); - $this->cacheFrontendMock->expects($this->once())->method('save')->with('["config"]', 'diConfig' . $key); + ->willReturn($serializedData); + $this->cacheFrontendMock->expects($this->once())->method('save')->with($serializedData, 'diConfig' . $key); $this->configCache->save($config, $key); } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php index bb048218a768a..90dba092f054e 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php @@ -88,7 +88,7 @@ protected function setUp() public function testLoadNotCached($area) { $configData = ['some' => 'config', 'data' => 'value']; - $serializedConfigData = '{"some":"config","data":"value"}'; + $serializedData = 'serialized data'; $this->cacheMock->expects($this->once()) ->method('load') @@ -97,12 +97,12 @@ public function testLoadNotCached($area) $this->cacheMock->expects($this->once()) ->method('save') - ->with($serializedConfigData); + ->with($serializedData); $this->readerMock->expects($this->once())->method('read')->with($area)->will($this->returnValue($configData)); $this->serializerMock->expects($this->once()) ->method('serialize') - ->willReturn($serializedConfigData); + ->willReturn($serializedData); $this->serializerMock->expects($this->never())->method('unserialize'); @@ -126,17 +126,17 @@ public function loadDataProvider() public function testLoadCached() { $configData = ['some' => 'config', 'data' => 'value']; - $serializedConfigData = '{"some":"config","data":"value"}'; + $serializedData = 'serialized data'; $this->cacheMock->expects($this->once()) ->method('load') - ->willReturn($serializedConfigData); + ->willReturn($serializedData); $this->cacheMock->expects($this->never()) ->method('save'); $this->readerMock->expects($this->never())->method('read'); $this->serializerMock->expects($this->once()) ->method('unserialize') - ->with($serializedConfigData) + ->with($serializedData) ->willReturn($configData); $this->serializerMock->expects($this->never())->method('serialize'); $this->assertEquals($configData, $this->object->load('testArea')); diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php index 2b0a677b51848..f07eaad289fb3 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/Data/ScopedTest.php @@ -102,7 +102,7 @@ public function getConfigByPathDataProvider() public function testGetScopeSwitchingWithNonCachedData() { $testValue = ['some' => 'testValue']; - $jsonString = '{"some":"testValue"}'; + $serializedData = 'serialized data'; /** change current area */ $this->_configScopeMock->expects( @@ -137,12 +137,12 @@ public function testGetScopeSwitchingWithNonCachedData() $this->serializerMock->method('serialize') ->with($testValue) - ->willReturn($jsonString); + ->willReturn($serializedData); /** test cache saving */ $this->_cacheMock->expects($this->once()) ->method('save') - ->with($jsonString, 'adminhtml::tag'); + ->with($serializedData, 'adminhtml::tag'); /** test config value existence */ $this->assertEquals('testValue', $this->_model->get('some')); @@ -154,7 +154,7 @@ public function testGetScopeSwitchingWithNonCachedData() public function testGetScopeSwitchingWithCachedData() { $testValue = ['some' => 'testValue']; - $jsonString = '{"some":"testValue"}'; + $serializedData = 'serialized data'; /** change current area */ $this->_configScopeMock->expects( @@ -166,14 +166,14 @@ public function testGetScopeSwitchingWithCachedData() ); $this->serializerMock->method('unserialize') - ->with($jsonString) + ->with($serializedData) ->willReturn($testValue); /** set cache data */ $this->_cacheMock->expects($this->once()) ->method('load') ->with('adminhtml::tag') - ->willReturn($jsonString); + ->willReturn($serializedData); /** test preventing of getting data from reader */ $this->_readerMock->expects($this->never())->method('read'); diff --git a/lib/internal/Magento/Framework/Interception/Config/Config.php b/lib/internal/Magento/Framework/Interception/Config/Config.php index a536a8c759432..25039b5e09c83 100644 --- a/lib/internal/Magento/Framework/Interception/Config/Config.php +++ b/lib/internal/Magento/Framework/Interception/Config/Config.php @@ -8,6 +8,7 @@ namespace Magento\Framework\Interception\Config; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; class Config implements \Magento\Framework\Interception\ConfigInterface { @@ -193,7 +194,7 @@ private function getSerializer() { if ($this->serializer === null) { $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); + ->get(Serialize::class); } return $this->serializer; } diff --git a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php index 5d67a9077b2cf..e3ee36ac3c7a8 100644 --- a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php +++ b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php @@ -17,6 +17,8 @@ use Magento\Framework\ObjectManager\RelationsInterface; use Magento\Framework\ObjectManager\DefinitionInterface as ClassDefinitions; use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -375,7 +377,7 @@ private function filterPlugins(array &$plugins) } /** - * Returns logger instance + * Get logger * * @deprecated * @return \Psr\Log\LoggerInterface @@ -387,4 +389,18 @@ private function getLogger() } return $this->logger; } + + /** + * Get serializer + * + * @return SerializerInterface + * @deprecated + */ + protected function getSerializer() + { + if (null === $this->serializer) { + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get(Serialize::class); + } + return $this->serializer; + } } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php index 7ff809810cc08..22c935b176d3c 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php @@ -7,6 +7,7 @@ namespace Magento\Framework\Interception\Test\Unit\Config; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; require_once __DIR__ . '/../Custom/Module/Model/Item.php'; require_once __DIR__ . '/../Custom/Module/Model/Item/Enhanced.php'; @@ -77,7 +78,7 @@ protected function setUp() ); $this->serializerMock = $this->getMock(SerializerInterface::class); $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->mockObjectManager([SerializerInterface::class => $this->serializerMock]); + $this->mockObjectManager([Serialize::class => $this->serializerMock]); } protected function tearDown() diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/PluginList/PluginListTest.php b/lib/internal/Magento/Framework/Interception/Test/Unit/PluginList/PluginListTest.php index dd0d2f68ac6ad..f70af781df643 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/PluginList/PluginListTest.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/PluginList/PluginListTest.php @@ -274,7 +274,7 @@ public function testLoadScopedDataCached() ->will($this->returnValue('scope')); $data = [['key'], ['key'], ['key']]; - $serializedData = '[["key"],["key"],["key"]]'; + $serializedData = 'serialized data'; $this->serializerMock->expects($this->never()) ->method('serialize'); diff --git a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php index 95331616b5b9f..aa1fd86dbf7cf 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php +++ b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php @@ -7,6 +7,7 @@ namespace Magento\Framework\ObjectManager\Config; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Framework\ObjectManager\ConfigCacheInterface; use Magento\Framework\ObjectManager\RelationsInterface; diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/ConfigTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/ConfigTest.php index 11dd0aeff1b63..4cc51652fdb74 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/ConfigTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/ConfigTest.php @@ -52,10 +52,8 @@ public function testExtendWithCacheMock() $config = new Config(null, $definitions); $serializerMock = $this->getMock(SerializerInterface::class); - $serializerMock->method('serialize') - ->willReturnCallback(function ($data) { - return json_encode($data, true); - }); + $serializerMock->expects($this->exactly(2)) + ->method('serialize'); $this->objectManagerHelper->setBackwardCompatibleProperty( $config, 'serializer', diff --git a/lib/internal/Magento/Framework/Serialize/README.md b/lib/internal/Magento/Framework/Serialize/README.md index e636fc79818af..5af8fb7f71b6b 100644 --- a/lib/internal/Magento/Framework/Serialize/README.md +++ b/lib/internal/Magento/Framework/Serialize/README.md @@ -1,5 +1,8 @@ # Serialize -**Serialize** libaray provides *SerializerInterface* and multiple implementations of serializer to support different kinds of needs of serializing/unserializing of data. Here are list of serializers in this library: +**Serialize** library provides interface *SerializerInterface* and multiple implementations: - * **Json** (default) - It can be used to serialize string, integer, float, boolean, or array data to json string; it unserializes json string to string, integer, float, boolean, or array. This is the recommended serializer. \ No newline at end of file + * *Json* - default implementation. Uses PHP native json_encode/json_decode functions; + * *Serialize* - less secure than *Json*, but gives higher performance on big arrays. Uses PHP native serialize/unserialize functions, does not unserialize objects on PHP 7. + +Using *Serialize* implementation directly is discouraged, always use *SerializerInterface*, using *Serialize* implementation may lead to security vulnerabilities. \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php b/lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php new file mode 100644 index 0000000000000..ef400e43e3c0e --- /dev/null +++ b/lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php @@ -0,0 +1,40 @@ +getPhpVersion() >= 7) { + return unserialize($string, ['allowed_classes' => false]); + } + return unserialize($string); + } + + /** + * Return major PHP version + * + * @return int + */ + private function getPhpVersion() + { + return PHP_MAJOR_VERSION; + } +} diff --git a/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/SerializeTest.php b/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/SerializeTest.php new file mode 100644 index 0000000000000..9a9252029d0b6 --- /dev/null +++ b/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/SerializeTest.php @@ -0,0 +1,48 @@ +serialize = $objectManager->getObject(Serialize::class); + } + + /** + * @param string|int|bool|array|null $value + * @dataProvider serializeUnserializeDataProvider + */ + public function testSerializeUnserialize($value) + { + $this->assertEquals( + $this->serialize->unserialize($this->serialize->serialize($value)), + $value + ); + } + + public function serializeUnserializeDataProvider() + { + return [ + ['string'], + [''], + [null], + [false], + [['a' => 'b']], + ]; + } +} diff --git a/lib/internal/Magento/Framework/Unserialize/README.md b/lib/internal/Magento/Framework/Unserialize/README.md index 971bd6980abb1..2dbf7436aa60f 100644 --- a/lib/internal/Magento/Framework/Unserialize/README.md +++ b/lib/internal/Magento/Framework/Unserialize/README.md @@ -1,2 +1 @@ -Library provides custom unserialize method. Method checks if serialized string contains serialized object and do not -unserialize it. If string doesn't contain serialized object, method calls native PHP function unserialize. \ No newline at end of file +This library is deprecated, please use Magento\Framework\Serialize\SerializerInterface instead. \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Unserialize/Unserialize.php b/lib/internal/Magento/Framework/Unserialize/Unserialize.php index 9d4785915a6dd..cfd3e81ca6b09 100644 --- a/lib/internal/Magento/Framework/Unserialize/Unserialize.php +++ b/lib/internal/Magento/Framework/Unserialize/Unserialize.php @@ -6,6 +6,9 @@ namespace Magento\Framework\Unserialize; +/** + * @deprecated + */ class Unserialize { /** diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php b/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php index 3207e590adf97..33203df3e7249 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php @@ -8,7 +8,6 @@ namespace Magento\Setup\Module\Di\Compiler\Config\Writer; use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\Serialize\SerializerInterface; use Magento\Setup\Module\Di\Compiler\Config\WriterInterface; class Filesystem implements WriterInterface @@ -18,11 +17,6 @@ class Filesystem implements WriterInterface */ private $directoryList; - /** - * @var SerializerInterface - */ - private $serializer; - /** * Constructor * @@ -46,7 +40,7 @@ public function write($key, array $config) file_put_contents( $this->directoryList->getPath(DirectoryList::DI) . '/' . $key . '.json', - $this->getSerializer()->serialize($config) + serialize($config) ); } @@ -61,19 +55,4 @@ private function initialize() mkdir($this->directoryList->getPath(DirectoryList::DI)); } } - - /** - * Get serializer - * - * @return SerializerInterface - * @deprecated - */ - private function getSerializer() - { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); - } - return $this->serializer; - } } From 9b7be0eabb13c6d3c1623dca3922696f0db01216 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 21 Oct 2016 16:41:33 -0500 Subject: [PATCH 1387/3232] MAGETWO-59764: Create Serialize implementation of SerializerInterface Creating Serialize implementation --- .../ObjectManager/ConfigLoader/Compiled.php | 25 +++++++++++++++++-- .../Di/Compiler/Config/Writer/Filesystem.php | 24 +++++++++++++++++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index f39904988328d..a16c172537c9e 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -8,6 +8,8 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\ObjectManager\ConfigLoaderInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; class Compiled implements ConfigLoaderInterface { @@ -18,6 +20,11 @@ class Compiled implements ConfigLoaderInterface */ private $configCache = []; + /** + * @var SerializerInterface + */ + private $serializer; + /** * {inheritdoc} */ @@ -26,7 +33,7 @@ public function load($area) if (isset($this->configCache[$area])) { return $this->configCache[$area]; } - $this->configCache[$area] = unserialize(\file_get_contents(self::getFilePath($area))); + $this->configCache[$area] = $this->getSerializer()->unserialize(\file_get_contents(self::getFilePath($area))); return $this->configCache[$area]; } @@ -39,6 +46,20 @@ public function load($area) public static function getFilePath($area) { $diPath = DirectoryList::getDefaultConfig()[DirectoryList::DI][DirectoryList::PATH]; - return BP . '/' . $diPath . '/' . $area . '.json'; + return BP . $diPath . '/' . $area . '.json'; + } + + /** + * Get serializer + * + * @return SerializerInterface + * @deprecated + */ + private function getSerializer() + { + if (null === $this->serializer) { + $this->serializer = new \Magento\Framework\Serialize\Serializer\Serialize(); + } + return $this->serializer; } } diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php b/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php index 33203df3e7249..3e2620fc20861 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Config/Writer/Filesystem.php @@ -9,6 +9,8 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Setup\Module\Di\Compiler\Config\WriterInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Serialize\Serializer\Serialize; class Filesystem implements WriterInterface { @@ -17,6 +19,11 @@ class Filesystem implements WriterInterface */ private $directoryList; + /** + * @var SerializerInterface + */ + private $serializer; + /** * Constructor * @@ -40,7 +47,7 @@ public function write($key, array $config) file_put_contents( $this->directoryList->getPath(DirectoryList::DI) . '/' . $key . '.json', - serialize($config) + $this->getSerializer()->serialize($config) ); } @@ -55,4 +62,19 @@ private function initialize() mkdir($this->directoryList->getPath(DirectoryList::DI)); } } + + /** + * Get serializer + * + * @return SerializerInterface + * @deprecated + */ + private function getSerializer() + { + if (null === $this->serializer) { + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() + ->get(Serialize::class); + } + return $this->serializer; + } } From a598228a59bb0f07991b597e5fd4eaf5a5567c40 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 21 Oct 2016 16:42:59 -0500 Subject: [PATCH 1388/3232] MAGETWO-59764: Create Serialize implementation of SerializerInterface Creating Serialize implementation --- .../Magento/Framework/App/Test/Unit/Router/ActionListTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php index 744e293029f0e..28764c86b35a2 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/ActionListTest.php @@ -51,7 +51,7 @@ protected function setUp() ); $this->serializerMock = $this->getMock(\Magento\Framework\Serialize\SerializerInterface::class); $this->mockObjectManager( - [\Magento\Framework\Serialize\SerializerInterface::class => $this->serializerMock] + [\Magento\Framework\Serialize\Serializer\Serialize::class => $this->serializerMock] ); } From 9a928e867aacb58a8265aaf13884d9b797a0ab84 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 21 Oct 2016 17:00:51 -0500 Subject: [PATCH 1389/3232] MAGETWO-59764: Create Serialize implementation of SerializerInterface Creating Serialize implementation --- .../Framework/App/ObjectManager/ConfigLoader/Compiled.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php index a16c172537c9e..26ef880e151ff 100644 --- a/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php +++ b/lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php @@ -58,7 +58,7 @@ public static function getFilePath($area) private function getSerializer() { if (null === $this->serializer) { - $this->serializer = new \Magento\Framework\Serialize\Serializer\Serialize(); + $this->serializer = new Serialize(); } return $this->serializer; } From 8d76f77d7529d806dd6ba613b9f918edad405af8 Mon Sep 17 00:00:00 2001 From: vnayda Date: Thu, 13 Oct 2016 16:03:15 +0300 Subject: [PATCH 1390/3232] MAGETWO-59307: "As low as" is displayed for configurable product on Category page if min price configuration isn't available --- .../Product/Indexer/Price/Configurable.php | 14 ++++ .../Indexer/Price/ConfigurableTest.php | 70 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php index 4e6fa8ae5210d..9a5aba2c0b526 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php @@ -8,6 +8,7 @@ namespace Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice { @@ -166,6 +167,9 @@ protected function _applyConfigurableOption() $this->_prepareConfigurableOptionAggregateTable(); $this->_prepareConfigurableOptionPriceTable(); + $statusAttribute = $this->_getAttribute(ProductInterface::STATUS); + $linkField = $metadata->getLinkField(); + $select = $connection->select()->from( ['i' => $this->_getDefaultFinalPriceTable()], [] @@ -186,6 +190,16 @@ protected function _applyConfigurableOption() [] )->where( 'le.required_options=0' + )->join( + ['product_status' => $this->getTable($statusAttribute->getBackend()->getTable())], + sprintf( + 'le.entity_id = product_status.%s AND product_status.attribute_id = %s', + $linkField, + $statusAttribute->getAttributeId() + ), + [] + )->where( + 'product_status.value=' . ProductStatus::STATUS_ENABLED )->group( ['parent_id', 'i.customer_group_id', 'i.website_id', 'l.product_id'] ); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php new file mode 100644 index 0000000000000..5db97cc366149 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php @@ -0,0 +1,70 @@ +storeManager = Bootstrap::getObjectManager()->get(StoreManagerInterface::class); + $this->productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class); + } + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + */ + public function testGetProductFinalPriceIfOneOfChildIsDisabled() + { + /** @var Collection $collection */ + $collection = Bootstrap::getObjectManager()->get(CollectionFactory::class) + ->create(); + $configurableProduct = $collection + ->addIdFilter([1]) + ->addMinimalPrice() + ->load() + ->getFirstItem(); + $this->assertEquals(10, $configurableProduct->getMinimalPrice()); + + $childProduct = $this->productRepository->getById(10, false, null, true); + $childProduct->setStatus(Status::STATUS_DISABLED); + // update in global scope + $currentStoreId = $this->storeManager->getStore()->getId(); + $this->storeManager->setCurrentStore(Store::ADMIN_CODE); + $this->productRepository->save($childProduct); + $this->storeManager->setCurrentStore($currentStoreId); + + /** @var Collection $collection */ + $collection = Bootstrap::getObjectManager()->get(CollectionFactory::class) + ->create(); + $configurableProduct = $collection + ->addIdFilter([1]) + ->addMinimalPrice() + ->load() + ->getFirstItem(); + $this->assertEquals(20, $configurableProduct->getMinimalPrice()); + } +} From 3ac2db1cecd0456bbc951b320a7c8115a670b573 Mon Sep 17 00:00:00 2001 From: vnayda Date: Wed, 19 Oct 2016 15:10:14 +0300 Subject: [PATCH 1391/3232] MAGETWO-59307: "As low as" is displayed for configurable product on Category page if min price configuration isn't available --- .../Product/Indexer/Price/Configurable.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php index 9a5aba2c0b526..fbb69798ff94f 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php @@ -179,7 +179,7 @@ protected function _applyConfigurableOption() ['parent_id' => 'e.entity_id'] )->join( ['l' => $this->getTable('catalog_product_super_link')], - 'l.parent_id = e.' . $metadata->getLinkField(), + 'l.parent_id = e.' . $linkField, ['product_id'] )->columns( ['customer_group_id', 'website_id'], @@ -193,7 +193,7 @@ protected function _applyConfigurableOption() )->join( ['product_status' => $this->getTable($statusAttribute->getBackend()->getTable())], sprintf( - 'le.entity_id = product_status.%s AND product_status.attribute_id = %s', + 'le.%1$s = product_status.%1$s AND product_status.attribute_id = %2$s', $linkField, $statusAttribute->getAttributeId() ), @@ -201,10 +201,10 @@ protected function _applyConfigurableOption() )->where( 'product_status.value=' . ProductStatus::STATUS_ENABLED )->group( - ['parent_id', 'i.customer_group_id', 'i.website_id', 'l.product_id'] + ['e.entity_id', 'i.customer_group_id', 'i.website_id', 'l.product_id'] ); - $priceColumn = $this->_addAttributeToSelect($select, 'price', 'l.product_id', 0, null, true); - $tierPriceColumn = $connection->getCheckSql("MIN(i.tier_price) IS NOT NULL", "i.tier_price", 'NULL'); + $priceColumn = $this->_addAttributeToSelect($select, 'price', 'le.' . $linkField, 0, null, true); + $tierPriceColumn = $connection->getIfNullSql('MIN(i.tier_price)', 'NULL'); $select->columns( ['price' => $priceColumn, 'tier_price' => $tierPriceColumn] From 331571858b5b10840b6f1f5773b8c3a0d74d8ef1 Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Mon, 24 Oct 2016 10:16:24 +0300 Subject: [PATCH 1392/3232] MAGETWO-59715: Impossible to import additional_images with labels which have a comma separator --- app/code/Magento/CatalogImportExport/Model/Import/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 6e051a30a95a5..63dd3c533b55f 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -2791,7 +2791,7 @@ private function updateMediaGalleryItemLabel($newLabel, array $mediaData) 'label' => $newLabel ], [ - 'entity_id = ?' => $mediaData[$this->getProductEntityLinkField()], + $this->getProductEntityLinkField() . ' = ?' => $mediaData[$this->getProductEntityLinkField()], 'value_id = ?' => $mediaData['value_id'], 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID ] From e66f0b03f34f7bb3ed3d12371861ea4623633a27 Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Mon, 24 Oct 2016 12:10:37 +0300 Subject: [PATCH 1393/3232] MAGETWO-59715: Impossible to import additional_images with labels which have a comma separator --- app/code/Magento/CatalogImportExport/Model/Import/Product.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 63dd3c533b55f..f5586a23b59a0 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -2781,7 +2781,9 @@ private function getProductIdentifierField() */ private function updateMediaGalleryItemLabel($newLabel, array $mediaData) { - if ($newLabel == $mediaData['label']) { + if ($newLabel == $mediaData['label'] + || !isset($mediaData[$this->getProductEntityLinkField()]) + ) { return; } From cce06d294cbad9020837052fe3c9086766d89145 Mon Sep 17 00:00:00 2001 From: "Palamar, Mykola" Date: Mon, 24 Oct 2016 09:11:10 +0000 Subject: [PATCH 1394/3232] MAGETWO-47017: [Github] Add Configurable Product To Cart from Category Page #2574 #5850 #5882 #6572 #5558 --- .../Swatches/Test/Block/Product/ViewWithSwatches.php | 6 ++++++ .../AddConfigurableProductWithSwatchToShopingCartTest.php | 2 +- ...yToAddConfigurableProductWithSwatchToShopingCartTest.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ViewWithSwatches.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ViewWithSwatches.php index 85c7188b57461..c1405b4a80771 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ViewWithSwatches.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ViewWithSwatches.php @@ -21,6 +21,12 @@ class ViewWithSwatches extends View */ private $swatchAttributeSelector = '.swatch-attribute.%s .swatch-attribute-selected-option'; + /** + * Get chosen options from the product view page. + * + * @param InjectableFixture $product + * @return array + */ public function getSelectedSwatchOptions(InjectableFixture $product) { $checkoutData = $product->getCheckoutData(); diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/AddConfigurableProductWithSwatchToShopingCartTest.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/AddConfigurableProductWithSwatchToShopingCartTest.php index 6009707cc47e8..60cc61f7f0f79 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/AddConfigurableProductWithSwatchToShopingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/AddConfigurableProductWithSwatchToShopingCartTest.php @@ -22,7 +22,7 @@ * 4. Perform asserts * * @group Configurable_Product - * @ZephyrId TODO: add zephyr id + * @ZephyrId MAGETWO-59958 */ class AddConfigurableProductWithSwatchToShopingCartTest extends Scenario { diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/TryToAddConfigurableProductWithSwatchToShopingCartTest.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/TryToAddConfigurableProductWithSwatchToShopingCartTest.php index 4e5a5106b5373..ac3016ade3f01 100644 --- a/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/TryToAddConfigurableProductWithSwatchToShopingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/TestCase/TryToAddConfigurableProductWithSwatchToShopingCartTest.php @@ -22,7 +22,7 @@ * 4. Perform asserts * * @group Configurable_Product - * @ZephyrId TODO: add zephyr id + * @ZephyrId TODO: MAGETWO-59979 */ class TryToAddConfigurableProductWithSwatchToShopingCartTest extends Scenario { From 199456abdea4c98f616092a44810b8b3e201d31e Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Mon, 24 Oct 2016 13:14:02 +0300 Subject: [PATCH 1395/3232] MAGETWO-59512: [GitHub] Products in wishlist show $0.00 price #6866 -- functional test --- .../Block/Customer/Wishlist/Items/Product.php | 11 +++++ .../AssertProductPriceIsNotZero.php | 47 +++++++++++++++++++ .../AddProductToWishlistEntityTest.php | 5 +- .../AddProductToWishlistEntityTest.xml | 7 +++ 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductPriceIsNotZero.php diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php index 076739590e1f1..493caf3c63d70 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php @@ -164,6 +164,17 @@ public function hoverProductBlock() $this->_rootElement->find($this->price)->hover(); } + /** + * Returns product price + * + * @return string + */ + public function getPrice() + { + $price = $this->_rootElement->find($this->price)->getText(); + return str_replace('$', '', $price); + } + /** * Get Wish List data for the Product. * diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductPriceIsNotZero.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductPriceIsNotZero.php new file mode 100644 index 0000000000000..24f6222dac09e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductPriceIsNotZero.php @@ -0,0 +1,47 @@ +getLinksBlock()->openLink('My Account'); + $customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List'); + $wishlistItem = $wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct($product); + + \PHPUnit_Framework_Assert::assertNotEquals( + '0.00', + $wishlistItem->getPrice(), + $product->getName() . ' has zero price on Wish List page.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Product price is not zero in default Wish List.'; + } +} 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 9959796828df2..bd922feee99d0 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 @@ -48,15 +48,16 @@ public function __prepare(Customer $customer) * * @param Customer $customer * @param string $product + * @param bool $configure * @return array */ - public function test(Customer $customer, $product) + public function test(Customer $customer, $product, $configure = true) { $product = $this->createProducts($product)[0]; // Steps: $this->loginCustomer($customer); - $this->addToWishlist([$product], true); + $this->addToWishlist([$product], $configure); return ['product' => $product]; } 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 0557fa298ce98..550cffa488130 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 @@ -49,5 +49,12 @@ + + configurableProduct::default + false + + + + From 8004271d50fa2baefbbf0ee056eb8ace5d298ec8 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Mon, 24 Oct 2016 13:16:14 +0300 Subject: [PATCH 1396/3232] MAGETWO-56317: [GitHub] -[2.1.0] underscore in site url breaks admin redirect - The page isn't redirecting properly #5809 --- .../tests/app/Magento/Install/Test/Block/WebConfiguration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Install/Test/Block/WebConfiguration.php b/dev/tests/functional/tests/app/Magento/Install/Test/Block/WebConfiguration.php index 03dbfee05ca69..bf4886a9f208d 100644 --- a/dev/tests/functional/tests/app/Magento/Install/Test/Block/WebConfiguration.php +++ b/dev/tests/functional/tests/app/Magento/Install/Test/Block/WebConfiguration.php @@ -21,7 +21,7 @@ class WebConfiguration extends Form * * @var string */ - protected $next = "[ng-click*='next']"; + protected $next = "[ng-click*='validateUrl']"; /** * 'Advanced Options' locator. From 107e62f88b26fad5ca5dc7d6a381f094cf116e88 Mon Sep 17 00:00:00 2001 From: Olga Nakonechna Date: Fri, 16 Sep 2016 17:04:16 +0300 Subject: [PATCH 1397/3232] MAGETWO-54815: Bundle option items are not updated after delete --- .../Product/Form/Modifier/BundlePanel.php | 21 +-- .../js/components/bundle-dynamic-rows-grid.js | 59 +++++++ .../web/js/components/bundle-dynamic-rows.js | 98 +++++++++++ .../web/js/dynamic-rows/dynamic-rows-grid.js | 10 +- .../dynamic-rows/templates/collapsible.html | 1 + .../Catalog/Product/Edit/Section/Bundle.php | 58 ++++-- .../Constraint/AssertBundleOptionsDeleted.php | 78 +++++++++ .../Bundle/Test/Repository/BundleProduct.xml | 22 +++ .../BundleProduct/BundleSelections.xml | 165 ++++++++++++++++++ .../Test/TestCase/UpdateBundleOptionsTest.php | 94 ++++++++++ .../Test/TestCase/UpdateBundleOptionsTest.xml | 19 ++ 11 files changed, 597 insertions(+), 28 deletions(-) create mode 100644 app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js create mode 100644 app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleOptionsDeleted.php create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleOptionsTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/UpdateBundleOptionsTest.xml diff --git a/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php b/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php index 50a3caaf68b3b..538c80d9b1cf2 100644 --- a/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php +++ b/app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php @@ -268,15 +268,12 @@ protected function getBundleOptions() 'arguments' => [ 'data' => [ 'config' => [ - 'componentType' => 'dynamicRows', + 'componentType' => Container::NAME, + 'component' => 'Magento_Bundle/js/components/bundle-dynamic-rows', 'template' => 'ui/dynamic-rows/templates/collapsible', - 'label' => '', 'additionalClasses' => 'admin__field-wide', - 'collapsibleHeader' => true, - 'columnsHeader' => false, - 'deleteProperty' => false, - 'addButton' => false, 'dataScope' => 'data.bundle_options', + 'bundleSelectionsName' => 'product_bundle_container.bundle_selections' ], ], ], @@ -318,14 +315,11 @@ protected function getBundleOptions() 'arguments' => [ 'data' => [ 'config' => [ - 'componentType' => DynamicRows::NAME, - 'label' => '', + 'componentType' => Container::NAME, + 'component' => 'Magento_Bundle/js/components/bundle-dynamic-rows-grid', 'sortOrder' => 50, 'additionalClasses' => 'admin__field-wide', - 'component' => 'Magento_Ui/js/dynamic-rows/dynamic-rows-grid', 'template' => 'ui/dynamic-rows/templates/default', - 'columnsHeader' => false, - 'columnsHeaderAfterRender' => true, 'provider' => 'product_form.product_form_data_source', 'dataProvider' => '${ $.dataScope }' . '.bundle_button_proxy', 'identificationDRProperty' => 'product_id', @@ -343,8 +337,7 @@ protected function getBundleOptions() 'selection_qty' => '', ], 'links' => ['insertData' => '${ $.provider }:${ $.dataProvider }'], - 'source' => 'product', - 'addButton' => false, + 'source' => 'product' ], ], ], @@ -561,7 +554,7 @@ protected function getBundleSelections() 'componentType' => Container::NAME, 'isTemplate' => true, 'component' => 'Magento_Ui/js/dynamic-rows/record', - 'is_collection' => true, + 'is_collection' => true ], ], ], diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js new file mode 100644 index 0000000000000..e9a924e1cffe6 --- /dev/null +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js @@ -0,0 +1,59 @@ +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'underscore', + 'Magento_Ui/js/dynamic-rows/dynamic-rows-grid' +], function (_, dynamicRowsGrid) { + 'use strict'; + + return dynamicRowsGrid.extend({ + defaults: { + label: '', + columnsHeader: false, + columnsHeaderAfterRender: true, + addButton: false + }, + + /** + * Initialize elements from grid + * + * @param {Array} data + * + * @returns {Object} Chainable. + */ + initElements: function (data) { + var newData = this.getNewData(data), + recordIndex; + + this.parsePagesData(data); + + if (newData.length) { + if (this.insertData().length) { + recordIndex = data.length - newData.length - 1; + + _.each(newData, function (newRecord) { + this.processingAddChild(newRecord, ++recordIndex, newRecord[this.identificationProperty]); + }, this); + } + } + + return this; + }, + + /** + * Mapping value from grid + * + * @param {Array} data + */ + mappingValue: function (data) { + if (_.isEmpty(data)) { + return; + } + + this._super(); + } + }); +}); diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js new file mode 100644 index 0000000000000..b36d8003a399f --- /dev/null +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js @@ -0,0 +1,98 @@ +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'underscore', + 'mageUtils', + 'uiRegistry', + 'Magento_Ui/js/dynamic-rows/dynamic-rows' +], function (_, utils, registry, dynamicRows) { + 'use strict'; + + return dynamicRows.extend({ + defaults: { + label: '', + collapsibleHeader: true, + columnsHeader: false, + deleteProperty: false, + addButton: false + }, + + /** + * Set new data to dataSource, + * delete element + * + * @param {Array} data - record data + */ + _updateData: function (data) { + var elems = _.clone(this.elems()), + path, + dataArr, + optionBaseData; + + dataArr = this.recordData.splice(this.startIndex, this.recordData().length - this.startIndex); + dataArr.splice(0, this.pageSize); + elems = _.sortBy(this.elems(), function (elem) { + return ~~elem.index; + }); + + data.concat(dataArr).forEach(function (rec, idx) { + if (elems[idx]) { + elems[idx].recordId = rec[this.identificationProperty]; + } + + if (!rec.position) { + rec.position = this.maxPosition; + this.setMaxPosition(); + } + + path = this.dataScope + '.' + this.index + '.' + (this.startIndex + idx); + optionBaseData = _.pick(rec, function (value) { + return !_.isObject(value); + }); + this.source.set(path, optionBaseData); + this.source.set(path + '.bundle_button_proxy', []); + this.source.set(path + '.bundle_selections', []); + this.removeBundleItemsFromOption(idx); + _.each(rec['bundle_selections'], function (obj, index) { + this.source.set(path + '.bundle_button_proxy' + '.' + index, rec['bundle_button_proxy'][index]); + this.source.set(path + '.bundle_selections' + '.' + index, obj); + }, this); + }, this); + + this.elems(elems); + }, + + /** + * Removes nested dynamic-rows-grid rendered records from option + * + * @param {Number|String} index - element index + */ + removeBundleItemsFromOption: function (index) { + var bundleSelections = registry.get(this.name + '.' + index + '.' + this.bundleSelectionsName), + bundleSelectionsLength = (bundleSelections.elems() || []).length, + i; + + if (bundleSelectionsLength) { + for (i = 0; i < bundleSelectionsLength; i++) { + bundleSelections.elems()[0].destroy(); + } + } + }, + + /** + * {@inheritdoc} + */ + processingAddChild: function (ctx, index, prop) { + var recordIds = _.map(this.recordData(), function (rec) { + return parseInt(rec['record_id'], 10); + }), + maxRecordId = _.max(recordIds); + + prop = maxRecordId > -1 ? maxRecordId + 1 : prop; + this._super(ctx, index, prop); + } + }); +}); diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js index de10c065d123b..518f09fa73ba6 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js @@ -52,13 +52,15 @@ define([ obj; if (this.recordData().length && !this.update) { - this.recordData.each(function (recordData) { + _.each(this.recordData(), function (recordData) { obj = {}; obj[this.map[this.identificationProperty]] = recordData[this.identificationProperty]; insertData.push(obj); }, this); - this.source.set(this.dataProvider, insertData); + if (insertData.length) { + this.source.set(this.dataProvider, insertData); + } } }, @@ -178,7 +180,7 @@ define([ tmpObj = {}; if (data.length !== this.relatedData.length) { - data.forEach(function (obj) { + _.each(data, function (obj) { tmpObj[this.identificationDRProperty] = obj[this.identificationDRProperty]; if (!_.findWhere(this.relatedData, tmpObj)) { @@ -193,7 +195,7 @@ define([ /** * Processing insert data * - * @param {Array} data + * @param {Object} data */ processingInsertData: function (data) { var changes, diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html index f3319a05525f2..d1ec1d26df6c5 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html @@ -43,6 +43,7 @@ helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?> - getIsSalable()): ?> -
    +
    escapeHtml(__('In stock')) ?>
    -
    +
    escapeHtml(__('Out of stock')) ?>
    @@ -93,18 +88,14 @@
    helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - + data-post='getAddToWishlistParams($_item); ?>' class="action towishlist" data-action="add-to-wishlist" title="escapeHtmlAttr(__('Add to Wish List')) ?>"> + escapeHtml(__('Add to Wish List')) ?> getAddToCompareUrl() && $showCompare): ?> helper('Magento\Catalog\Helper\Product\Compare');?> - - + + escapeHtml(__('Add to Compare')) ?>
    From 778255b136ecf8ad05857e890d2ec76240d29b4f Mon Sep 17 00:00:00 2001 From: Islam Elkhalifa Date: Tue, 25 Oct 2016 16:59:29 -0500 Subject: [PATCH 1451/3232] MAGETWO-57798: Automate-MAGETWO-49037-Password protection for modifying user Role - Fixing code styles. --- .../Test/TestCase/LockAdminUserWhenEditingRoleTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingRoleTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingRoleTest.php index 86df06311a8b6..bd7c8cef92d8a 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingRoleTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingRoleTest.php @@ -4,12 +4,14 @@ * See COPYING.txt for license details. */ namespace Magento\Security\Test\TestCase; + use Magento\User\Test\Page\Adminhtml\UserRoleEditRole; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; use Magento\Mtf\TestCase\Injectable; use Magento\User\Test\Fixture\User; use Magento\User\Test\Fixture\Role; use Magento\Backend\Test\Page\AdminAuthLogin; + /** * Preconditions: * 1. Create new admin user and assign it to new role. @@ -34,30 +36,35 @@ class LockAdminUserWhenEditingRoleTest extends Injectable const MVP = 'yes'; const SEVERITY = 'S2'; /* end tags */ + /** * UserRoleIndex page. * * @var UserRoleIndex */ protected $userRoleIndex; + /** * UserRoleEditRole page. * * @var UserRoleEditRole */ protected $userRoleEditRole; + /** * Configuration setting. * * @var string */ protected $configData; + /** * Admin login Page. * * @var AdminAuthLogin */ protected $adminAuthLogin; + /** * Setup data for test. * @@ -75,6 +82,7 @@ public function __inject( $this->userRoleEditRole = $userRoleEditRole; $this->adminAuthLogin = $adminAuthLogin; } + /** * Runs Lock admin user when editing existing role test. * @@ -116,6 +124,7 @@ public function test( $this->adminAuthLogin->getLoginBlock()->fill($customAdmin); $this->adminAuthLogin->getLoginBlock()->submit(); } + /** * Clean data after running test. * From fef7c6a55c8da8b00098c3f58ca279fc654a060d Mon Sep 17 00:00:00 2001 From: Islam Elkhalifa Date: Tue, 25 Oct 2016 17:00:31 -0500 Subject: [PATCH 1452/3232] MAGETWO-57908: Automate - MAGETWO-49035 Password protection for modifying user - Fixing code styles. --- .../Security/Test/TestCase/LockAdminUserWhenEditingUserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingUserTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingUserTest.php index ae88503053eaf..912ebef9e9105 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingUserTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingUserTest.php @@ -88,7 +88,7 @@ public function test( $attempts, User $customAdmin, User $user, - $configData + $configData ) { $this->configData = $configData; From 0e0f0ef2be522247ee87bdfe16e1a140ae396a2f Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 25 Oct 2016 17:04:43 -0500 Subject: [PATCH 1453/3232] MAGETWO-57253: Eliminate @escapeNotVerified in Cms Module Escaping translation in templates --- .../Cms/view/adminhtml/templates/browser/content/files.phtml | 4 ++-- .../view/adminhtml/templates/browser/content/uploader.phtml | 2 +- .../Magento/Cms/view/adminhtml/templates/browser/tree.phtml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml index a6185c4541897..94980b3cd42fa 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml @@ -21,11 +21,11 @@ $_height = $block->getImagesHeight();

    getFileWidth($file)): ?> - escapeHtml($block->getFileWidth($file)) ?>xescapeHtml($block->getFileHeight($file)) ?>
    + escapeHtml($block->getFileWidth($file)) ?>xescapeHtml($block->getFileHeight($file)) ?> escapeHtml(__('px.')) ?>
    escapeHtml($block->getFileShortName($file)); ?> -
    +
    escapeHtml(__('No files found')) ?>
    diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index 6a29cb1497175..23a8bf8f5976a 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -11,7 +11,7 @@
    - + escapeHtml(__('Browse Files...')) ?>
    diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml index 90a00c32015b7..405881496fa9a 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml @@ -11,9 +11,9 @@
    jsonEncode($block->getTreeWidgetOptions())); ?>'> From 1243ad8a9e1db72b04eb9e5b6ca37f4f8c41f1ca Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 25 Oct 2016 15:36:12 -0500 Subject: [PATCH 1454/3232] MAGETWO-59439: Refactor Module_Catalog - refactored the classes --- .../Plugin/Model/ResourceModel/Config.php | 21 ++++-- .../Plugin/Model/ResourceModel/ConfigTest.php | 64 ++++++++++++++++--- .../Product/Form/Modifier/Categories.php | 14 +++- 3 files changed, 81 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/Catalog/Plugin/Model/ResourceModel/Config.php b/app/code/Magento/Catalog/Plugin/Model/ResourceModel/Config.php index 699feef76c67e..69c693f4fd01a 100644 --- a/app/code/Magento/Catalog/Plugin/Model/ResourceModel/Config.php +++ b/app/code/Magento/Catalog/Plugin/Model/ResourceModel/Config.php @@ -5,6 +5,9 @@ */ namespace Magento\Catalog\Plugin\Model\ResourceModel; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\SerializerInterface; + class Config { /**#@+ @@ -20,16 +23,24 @@ class Config /** @var bool|null */ protected $isCacheEnabled = null; + /** + * @var SerializerInterface + */ + private $serializer; + /** * @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Framework\App\Cache\StateInterface $cacheState + * @param SerializerInterface $serializer */ public function __construct( \Magento\Framework\App\CacheInterface $cache, - \Magento\Framework\App\Cache\StateInterface $cacheState + \Magento\Framework\App\Cache\StateInterface $cacheState, + SerializerInterface $serializer = null ) { $this->cache = $cache; $this->isCacheEnabled = $cacheState->isEnabled(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER); + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -43,12 +54,12 @@ public function aroundGetAttributesUsedInListing( ) { $cacheId = self::PRODUCT_LISTING_ATTRIBUTES_CACHE_ID . $config->getEntityTypeId() . '_' . $config->getStoreId(); if ($this->isCacheEnabled && ($attributes = $this->cache->load($cacheId))) { - return unserialize($attributes); + return $this->serializer->unserialize($attributes); } $attributes = $proceed(); if ($this->isCacheEnabled) { $this->cache->save( - serialize($attributes), + $this->serializer->serialize($attributes), $cacheId, [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, @@ -71,12 +82,12 @@ public function aroundGetAttributesUsedForSortBy( $cacheId = self::PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID . $config->getEntityTypeId() . '_' . $config->getStoreId(); if ($this->isCacheEnabled && ($attributes = $this->cache->load($cacheId))) { - return unserialize($attributes); + return $this->serializer->unserialize($attributes); } $attributes = $proceed(); if ($this->isCacheEnabled) { $this->cache->save( - serialize($attributes), + $this->serializer->serialize($attributes), $cacheId, [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, diff --git a/app/code/Magento/Catalog/Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php b/app/code/Magento/Catalog/Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php index 01f9964f2d83e..24d2f1fcd0f92 100644 --- a/app/code/Magento/Catalog/Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php @@ -6,27 +6,46 @@ namespace Magento\Catalog\Test\Unit\Plugin\Model\ResourceModel; +use Magento\Catalog\Plugin\Model\ResourceModel\Config; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class ConfigTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Catalog\Plugin\Model\ResourceModel\Config */ - protected $config; + /** @var Config */ + private $config; /** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $cache; + private $cache; /** @var \Magento\Framework\App\Cache\StateInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $cacheState; + private $cacheState; + + /** @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */ + private $serializer; /** @var \Magento\Catalog\Model\ResourceModel\Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $subject; + private $subject; + + /** + * @var Config + */ + private $object; protected function setUp() { $this->cache = $this->getMock(\Magento\Framework\App\CacheInterface::class); $this->cacheState = $this->getMock(\Magento\Framework\App\Cache\StateInterface::class); + $this->serializer = $this->getMock(SerializerInterface::class); $this->subject = $this->getMock(\Magento\Catalog\Model\ResourceModel\Config::class, [], [], '', false); + $this->object = (new ObjectManager($this))->getObject( + Config::class, + [ + 'cache' => $this->cache, + 'cacheState' => $this->cacheState, + 'serializer' => $this->serializer, + ] + ); } public function testGetAttributesUsedInListingOnCacheDisabled() @@ -47,12 +66,17 @@ public function testGetAttributesUsedInListingFromCache() $entityTypeId = 'type'; $storeId = 'store'; $attributes = ['attributes']; + $serializedAttributes = '["attributes"]'; $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId); $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId); $cacheId = \Magento\Catalog\Plugin\Model\ResourceModel\Config::PRODUCT_LISTING_ATTRIBUTES_CACHE_ID . $entityTypeId . '_' . $storeId; - $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes)); + $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn($serializedAttributes); + $this->serializer->expects($this->once()) + ->method('unserialize') + ->with($serializedAttributes) + ->willReturn($attributes); $this->assertEquals( $attributes, @@ -68,14 +92,21 @@ public function testGetAttributesUsedInListingWithCacheSave() $entityTypeId = 'type'; $storeId = 'store'; $attributes = ['attributes']; + $serializedAttributes = '["attributes"]'; $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId); $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId); $cacheId = \Magento\Catalog\Plugin\Model\ResourceModel\Config::PRODUCT_LISTING_ATTRIBUTES_CACHE_ID . $entityTypeId . '_' . $storeId; $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false); + $this->serializer->expects($this->never()) + ->method('unserialize'); + $this->serializer->expects($this->once()) + ->method('serialize') + ->with($attributes) + ->willReturn($serializedAttributes); $this->cache->expects($this->any())->method('save')->with( - serialize($attributes), + $serializedAttributes, $cacheId, [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, @@ -110,11 +141,16 @@ public function testGetAttributesUsedForSortByFromCache() $entityTypeId = 'type'; $storeId = 'store'; $attributes = ['attributes']; + $serializedAttributes = '["attributes"]'; $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId); $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId); $cacheId = \Magento\Catalog\Plugin\Model\ResourceModel\Config::PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID . $entityTypeId . '_' . $storeId; - $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes)); + $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn($serializedAttributes); + $this->serializer->expects($this->once()) + ->method('unserialize') + ->with($serializedAttributes) + ->willReturn($attributes); $this->assertEquals( $attributes, @@ -130,13 +166,20 @@ public function testGetAttributesUsedForSortByWithCacheSave() $entityTypeId = 'type'; $storeId = 'store'; $attributes = ['attributes']; + $serializedAttributes = '["attributes"]'; $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId); $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId); $cacheId = \Magento\Catalog\Plugin\Model\ResourceModel\Config::PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID . $entityTypeId . '_' . $storeId; $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false); + $this->serializer->expects($this->never()) + ->method('unserialize'); + $this->serializer->expects($this->once()) + ->method('serialize') + ->with($attributes) + ->willReturn($serializedAttributes); $this->cache->expects($this->any())->method('save')->with( - serialize($attributes), + $serializedAttributes, $cacheId, [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, @@ -165,7 +208,8 @@ protected function getConfig($cacheEnabledFlag) \Magento\Catalog\Plugin\Model\ResourceModel\Config::class, [ 'cache' => $this->cache, - 'cacheState' => $this->cacheState + 'cacheState' => $this->cacheState, + 'serializer' => $this->serializer, ] ); } diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index 0e46b5899851f..b05bd229a832d 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -11,6 +11,7 @@ use Magento\Framework\App\CacheInterface; use Magento\Framework\DB\Helper as DbHelper; use Magento\Catalog\Model\Category as CategoryModel; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\UrlInterface; use Magento\Framework\Stdlib\ArrayManager; @@ -61,6 +62,10 @@ class Categories extends AbstractModifier * @var CacheInterface */ private $cacheManager; + /** + * @var SerializerInterface + */ + private $serializer; /** * @param LocatorInterface $locator @@ -68,19 +73,22 @@ class Categories extends AbstractModifier * @param DbHelper $dbHelper * @param UrlInterface $urlBuilder * @param ArrayManager $arrayManager + * @param SerializerInterface $serializer */ public function __construct( LocatorInterface $locator, CategoryCollectionFactory $categoryCollectionFactory, DbHelper $dbHelper, UrlInterface $urlBuilder, - ArrayManager $arrayManager + ArrayManager $arrayManager, + SerializerInterface $serializer = null ) { $this->locator = $locator; $this->categoryCollectionFactory = $categoryCollectionFactory; $this->dbHelper = $dbHelper; $this->urlBuilder = $urlBuilder; $this->arrayManager = $arrayManager; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -286,7 +294,7 @@ protected function getCategoriesTree($filter = null) { $categoryTree = $this->getCacheManager()->load(self::CATEGORY_TREE_ID . '_' . $filter); if ($categoryTree) { - return unserialize($categoryTree); + return $this->serializer->unserialize($categoryTree); } $storeId = $this->locator->getStore()->getId(); @@ -340,7 +348,7 @@ protected function getCategoriesTree($filter = null) } $this->getCacheManager()->save( - serialize($categoryById[CategoryModel::TREE_ROOT_ID]['optgroup']), + $this->serializer->serialize($categoryById[CategoryModel::TREE_ROOT_ID]['optgroup']), self::CATEGORY_TREE_ID . '_' . $filter, [ \Magento\Catalog\Model\Category::CACHE_TAG, From 59bb5fc078f6c367a54e1ddd7c7b88b60a71ebb7 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 25 Oct 2016 18:47:49 -0500 Subject: [PATCH 1455/3232] MAGETWO-59439: Refactor Module_Catalog - added an integration test for categories tree UI component --- .../Product/Form/Modifier/CategoriesTest.php | 43 +++++++++ .../Modifier/_files/expected_categories.php | 89 +++++++++++++++++++ .../_files/input_meta_for_categories.php | 56 ++++++++++++ 3 files changed, 188 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/expected_categories.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/input_meta_for_categories.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php new file mode 100644 index 0000000000000..b94cc197840ae --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php @@ -0,0 +1,43 @@ +get(\Magento\Framework\Registry::class); + /** @var $store \Magento\Store\Model\Store */ + $store = $objectManager->create(\Magento\Store\Model\Store::class); + $store->load('admin'); + $registry->register('current_store', $store); + $this->object = $objectManager->create(Categories::class); + } + + public function testModifyMeta() + { + $inputMeta = include __DIR__ . '/_files/input_meta_for_categories.php'; + $meta = $this->object->modifyMeta($inputMeta); + $expectedCategories = include __DIR__ . '/_files/expected_categories.php'; + $categoriesElement = $meta['product-details']['children']['container_category_ids']['children']['category_ids']; + $this->assertEquals($expectedCategories, $categoriesElement['arguments']['data']['config']['options']); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/expected_categories.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/expected_categories.php new file mode 100644 index 0000000000000..ed30676e16b07 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/expected_categories.php @@ -0,0 +1,89 @@ + + [ + 'value' => '2', + 'is_active' => '1', + 'label' => 'Default Category', + 'optgroup' => + [ + 0 => + [ + 'value' => '3', + 'is_active' => '1', + 'label' => 'Category 1', + 'optgroup' => + [ + 0 => + [ + 'value' => '4', + 'is_active' => '1', + 'label' => 'Category 1.1', + 'optgroup' => + [ + 0 => + [ + 'value' => '5', + 'is_active' => '1', + 'label' => 'Category 1.1.1', + ], + ], + ], + 1 => + [ + 'value' => '13', + 'is_active' => '1', + 'label' => 'Category 1.2', + ], + ], + ], + 1 => + [ + 'value' => '6', + 'is_active' => '1', + 'label' => 'Category 2', + ], + 2 => + [ + 'value' => '7', + 'is_active' => '1', + 'label' => 'Movable', + ], + 3 => + [ + 'value' => '8', + 'is_active' => '0', + 'label' => 'Inactive', + ], + 4 => + [ + 'value' => '9', + 'is_active' => '1', + 'label' => 'Movable Position 1', + ], + 5 => + [ + 'value' => '10', + 'is_active' => '1', + 'label' => 'Movable Position 2', + ], + 6 => + [ + 'value' => '11', + 'is_active' => '1', + 'label' => 'Movable Position 3', + ], + 7 => + [ + 'value' => '12', + 'is_active' => '1', + 'label' => 'Category 12', + ], + ], + ], +]; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/input_meta_for_categories.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/input_meta_for_categories.php new file mode 100644 index 0000000000000..d494ed8e95d97 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/input_meta_for_categories.php @@ -0,0 +1,56 @@ + + [ + 'children' => + ['container_category_ids' => + [ + 'arguments' => + [ + 'data' => + [ + 'config' => + [ + 'formElement' => 'container', + 'componentType' => 'container', + 'breakLine' => false, + 'label' => 'Categories', + 'required' => '0', + 'sortOrder' => 70, + ], + ], + ], + 'children' => + [ + 'category_ids' => + [ + 'arguments' => + [ + 'data' => + [ + 'config' => + [ + 'dataType' => 'text', + 'formElement' => 'input', + 'visible' => '1', + 'required' => '0', + 'notice' => NULL, + 'default' => NULL, + 'label' => 'Categories', + 'code' => 'category_ids', + 'source' => 'product-details', + 'scopeLabel' => '[GLOBAL]', + 'globalScope' => true, + 'sortOrder' => 70, + 'componentType' => 'field', + ], + ], + ], + ], + ], + ]]]]; From 388d1b2ba7d5edf2a820e9b279c6d5d5dad49078 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 25 Oct 2016 18:57:03 -0500 Subject: [PATCH 1456/3232] MAGETWO-59439: Refactor Module_Catalog - fixed code style --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index b05bd229a832d..0ee761646616e 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -62,6 +62,7 @@ class Categories extends AbstractModifier * @var CacheInterface */ private $cacheManager; + /** * @var SerializerInterface */ From 0cc8dad3113a988cf4d57e6a9d14fa0040edd166 Mon Sep 17 00:00:00 2001 From: Olga Kopylova Date: Tue, 25 Oct 2016 21:52:51 -0500 Subject: [PATCH 1457/3232] MAGETWO-59439: Refactor Module_Catalog - fixed code style --- .../Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php | 3 --- .../Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php | 4 +--- .../Form/Modifier/_files/input_meta_for_categories.php | 4 ++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php b/app/code/Magento/Catalog/Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php index 24d2f1fcd0f92..52e010fdd4e29 100644 --- a/app/code/Magento/Catalog/Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Plugin/Model/ResourceModel/ConfigTest.php @@ -12,9 +12,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { - /** @var Config */ - private $config; - /** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */ private $cache; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php index b94cc197840ae..33d419440d4a1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php @@ -4,9 +4,7 @@ * See COPYING.txt for license details. */ -namespace dev\tests\integration\testsuite\Magento\Catalog\Ui\DataProvider\Product\Form\Modifier; - -use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories; +namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier; /** * @magentoAppArea adminhtml diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/input_meta_for_categories.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/input_meta_for_categories.php index d494ed8e95d97..f43e9c916fcd2 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/input_meta_for_categories.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/_files/input_meta_for_categories.php @@ -39,8 +39,8 @@ 'formElement' => 'input', 'visible' => '1', 'required' => '0', - 'notice' => NULL, - 'default' => NULL, + 'notice' => null, + 'default' => null, 'label' => 'Categories', 'code' => 'category_ids', 'source' => 'product-details', From 6a08fad20c419e30837c718ad1e2ece940a25e97 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Wed, 26 Oct 2016 09:11:49 +0300 Subject: [PATCH 1458/3232] MAGETWO-59573: Braintree JS error on checkout after applying 100% discount coupon with free shipping enabled -- functional test --- .../Test/Constraint/AssertGrandTotalOrderReview.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php index 3bf6bda89ad93..dc1433506f262 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php @@ -14,6 +14,13 @@ */ class AssertGrandTotalOrderReview extends AbstractConstraint { + /** + * Wait element. + * + * @var string + */ + protected $waitElement = '.loading-mask'; + /** * Assert that Order Grand Total is correct on checkoutOnePage * @@ -23,6 +30,7 @@ class AssertGrandTotalOrderReview extends AbstractConstraint */ public function processAssert(CheckoutOnepage $checkoutOnepage, $grandTotal) { + $checkoutOnepage->getReviewBlock()->waitForElementNotVisible($this->waitElement); $checkoutReviewGrandTotal = $checkoutOnepage->getReviewBlock()->getGrandTotal(); \PHPUnit_Framework_Assert::assertEquals( From 058a78fe45ca20eaa4974a625f1c84270a9765d3 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Wed, 26 Oct 2016 10:50:44 +0300 Subject: [PATCH 1459/3232] MAGETWO-59702: [FT] Magento\Customer\Test\TestCase\RegisterCustomerFrontendEntityTest fails randomly on CI - Remove test from acceptance plan; --- .../Test/TestCase/RegisterCustomerFrontendEntityTest.xml | 2 -- 1 file changed, 2 deletions(-) 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 99bf76f4c387c..31a947ad1ab02 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 @@ -14,7 +14,6 @@ No 123123^q 123123^q - test_type:acceptance_test @@ -26,7 +25,6 @@ Yes 123123^q 123123^q - test_type:acceptance_test From d9ce136c22fcdc0a36f6c01064a64999f20365c1 Mon Sep 17 00:00:00 2001 From: Andrii Voskoboinikov Date: Wed, 26 Oct 2016 11:24:49 +0300 Subject: [PATCH 1460/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - integration test for isSaleable() on product --- .../Bundle/Model/Product/IsSaleableTest.php | 350 ++++++++++++++++++ .../Bundle/_files/issaleable_product.php | 210 +++++++++++ .../_files/issaleable_product_rollback.php | 27 ++ .../Bundle/_files/multiple_products.php | 128 +++++++ .../_files/multiple_products_rollback.php | 28 ++ 5 files changed, 743 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php new file mode 100644 index 0000000000000..20d0fb2e21f1f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/IsSaleableTest.php @@ -0,0 +1,350 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class); + } + + /** + * check bundle product is saleable if his status is enabled + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnEnabledStatus() + { + + $bundleProduct = $this->productRepository->get('bundle-product'); + $bundleProduct->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED); + + $this->assertTrue( + $bundleProduct->isSalable(), + 'Bundle product supposed to be saleable if his status is enabled' + ); + } + + /** + * check bundle product is NOT saleable if his status is disabled + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnDisabledStatus() + { + $bundleProduct = $this->productRepository->get('bundle-product'); + $bundleProduct->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be non saleable if his status is disabled' + ); + } + + /** + * check bundle product is saleable if his status is enabled + * and it has internal data is_salable = true + * + * @magentoDataFixtureBeforeTransaction Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnEnabledStatusAndIsSalableIsTrue() + { + $bundleProduct = $this->productRepository->get('bundle-product'); + $bundleProduct->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED); + $bundleProduct->setData('is_salable', true); + + $this->assertTrue( + $bundleProduct->isSalable(), + 'Bundle product supposed to be saleable if his status is enabled and it has data is_salable = true' + ); + } + + /** + * check bundle product is NOT saleable if + * his status is enabled but his data is_salable = false + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnEnabledStatusAndIsSalableIsFalse() + { + $bundleProduct = $this->productRepository->get('bundle-product'); + $bundleProduct->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED); + $bundleProduct->setData('is_salable', false); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be non saleable if his status is enabled but his data is_salable = false' + ); + } + + /** + * check bundle product is saleable if it has all_items_salable = true + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnAllItemsSalableIsTrue() + { + $bundleProduct = $this->productRepository->get('bundle-product'); + $bundleProduct->setData('all_items_salable', true); + + $this->assertTrue( + $bundleProduct->isSalable(), + 'Bundle product supposed to be saleable if it has data all_items_salable = true' + ); + } + + /** + * check bundle product is NOT saleable if it has all_items_salable = false + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnAllItemsSalableIsFalse() + { + $bundleProduct = $this->productRepository->get('bundle-product'); + $bundleProduct->setData('all_items_salable', false); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be non saleable if it has data all_items_salable = false' + ); + } + + /** + * check bundle product is NOT saleable if it has no options + * + * @magentoDataFixtureBeforeTransaction Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithoutOptions() + { + $optionRepository = $this->objectManager->create(\Magento\Bundle\Api\ProductOptionRepositoryInterface::class); + + $bundleProduct = $this->productRepository->get('bundle-product'); + + // TODO: make cleaner option deletion after fix MAGETWO-59465 + $ea = $bundleProduct->getExtensionAttributes(); + foreach ($ea->getBundleProductOptions() as $option) { + $optionRepository->delete($option); + } + $ea->setBundleProductOptions([]); + $bundleProduct->setExtensionAttributes($ea); + $bundleProduct->setBundleOptionsData([]); + $this->productRepository->save($bundleProduct); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be non saleable if it has no options' + ); + } + + /** + * check bundle product is NOT saleable if it has no selections + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithoutSelections() + { + $bundleProductSku = 'bundle-product'; + + $bundleProduct = $this->productRepository->get($bundleProductSku, true, null, true); + $bundleType = $bundleProduct->getTypeInstance(); + /** @var \Magento\Bundle\Model\LinkManagement $linkManager */ + $linkManager = $this->objectManager->create(\Magento\Bundle\Model\LinkManagement::class); + + /** @var \Magento\Bundle\Model\Product\Type $bundleType */ + $options = $bundleType->getOptionsCollection($bundleProduct); + $selections = $bundleType->getSelectionsCollection($options->getAllIds(), $bundleProduct); + + foreach ($selections as $link) { + /** @var \Magento\Bundle\Model\Selection $link */ + $linkManager->removeChild($bundleProductSku, $link->getOptionId(), $link->getSku()); + } + + $bundleProduct = $this->productRepository->get($bundleProductSku, true, null, true); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be non saleable if it has no selections' + ); + } + + /** + * check bundle product is NOT saleable if + * all his selections are not saleable + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithoutSaleableSelections() + { + $productsSku = ['simple1', 'simple2', 'simple3', 'simple4', 'simple5']; + foreach ($productsSku as $productSku) { + $product = $this->productRepository->get($productSku); + $product->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED); + $this->productRepository->save($product); + } + + $bundleProduct = $this->productRepository->get('bundle-product'); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be non saleable if all his selections are not saleable' + ); + } + + /** + * check bundle product is NOT saleable if + * it has at least one required option without saleable selections + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithoutSaleableSelectionsOnRequiredOption() + { + $productsSku = ['simple1', 'simple2', 'simple3']; + foreach ($productsSku as $productSku) { + $product = $this->productRepository->get($productSku); + $product->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED); + $this->productRepository->save($product); + } + + $bundleProduct = $this->productRepository->get('bundle-product'); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be non saleable if it has at least one required option with no saleable selections' + ); + } + + /** + * check bundle product is NOT saleable if + * there are not enough qty of selection on required option + * + * @magentoDataFixtureBeforeTransaction Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithNotEnoughQtyOfSelection() + { + $this->setQtyForSelections(['simple1', 'simple2', 'simple3'], 1); + + $bundleProduct = $this->productRepository->get('bundle-product'); + + $this->assertFalse( + $bundleProduct->isSalable(), + 'Bundle product supposed to be non saleable if there are not enough qty of selections on required options' + ); + } + + /** + * check bundle product is saleable if + * all his selections has not selection qty + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithoutSelectionQty() + { + $this->setQtyForSelections(['simple1', 'simple2', 'simple3', 'simple4', 'simple5'], 1); + + $bundleProduct = $this->productRepository->get('bundle-product', false, null, true); + $bundleType = $bundleProduct->getTypeInstance(); + + /** @var \Magento\Bundle\Model\Product\Type $bundleType */ + $options = $bundleType->getOptionsCollection($bundleProduct); + $selections = $bundleType->getSelectionsCollection($options->getAllIds(), $bundleProduct); + + foreach ($selections as $link) { + $link->setSelectionQty(null); + } + + $bundleProduct->setBundleOptionsData([]); + $bundleProduct->setBundleSelectionsData([]); + $this->productRepository->save($bundleProduct); + + $this->assertTrue( + $bundleProduct->isSalable(), + 'Bundle product supposed to be saleable if all his selections has no selection qty' + ); + } + + /** + * check bundle product is saleable if + * all his selections have selection_can_change_qty = 1 + * + * @magentoDataFixture Magento/Bundle/_files/issaleable_product.php + * @magentoAppIsolation enabled + * @covers \Magento\Bundle\Model\Product\Type::isSalable + */ + public function testIsSaleableOnBundleWithSelectionCanChangeQty() + { + $this->setQtyForSelections(['simple1', 'simple2', 'simple3', 'simple4', 'simple5'], 1); + + $bundleProduct = $this->productRepository->get('bundle-product', false, null, true); + $bundleType = $bundleProduct->getTypeInstance(); + + /** @var \Magento\Bundle\Model\Product\Type $bundleType */ + $options = $bundleType->getOptionsCollection($bundleProduct); + $selections = $bundleType->getSelectionsCollection($options->getAllIds(), $bundleProduct); + + foreach ($selections as $link) { + $link->setSelectionCanChangeQty(1); + } + + $bundleProduct->setBundleOptionsData([]); + $bundleProduct->setBundleSelectionsData([]); + $this->productRepository->save($bundleProduct); + + $this->assertTrue( + $bundleProduct->isSalable(), + 'Bundle product supposed to be saleable if all his selections have selection_can_change_qty = 1' + ); + } + + private function setQtyForSelections($productsSku, $qty) + { + foreach ($productsSku as $productSku) { + $product = $this->productRepository->get($productSku, false, null, true); + $ea = $product->getExtensionAttributes(); + $ea->getStockItem()->setQty($qty); + $this->productRepository->save($product); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product.php new file mode 100644 index 0000000000000..5e96221737241 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product.php @@ -0,0 +1,210 @@ +create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + +/** @var $product \Magento\Catalog\Model\Product */ +$product = $objectManager->create(\Magento\Catalog\Model\Product::class); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) + ->setId(3) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('Bundle Product') + ->setSku('bundle-product') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) + ->setPriceView(1) + ->setPriceType(1) + ->setPrice(10.0) + ->setShipmentType(0) + ->setBundleOptionsData( + [ + // Required "Drop-down" option + [ + 'title' => 'Option 1', + 'default_title' => 'Option 1', + 'type' => 'select', + 'required' => 1, + 'delete' => '', + ], + // Required "Radio Buttons" option + [ + 'title' => 'Option 2', + 'default_title' => 'Option 2', + 'type' => 'radio', + 'required' => 1, + 'delete' => '', + ], + // Required "Checkbox" option + [ + 'title' => 'Option 3', + 'default_title' => 'Option 3', + 'type' => 'checkbox', + 'required' => 1, + 'delete' => '', + ], + // Required "Multiple Select" option + [ + 'title' => 'Option 4', + 'default_title' => 'Option 4', + 'type' => 'multi', + 'required' => 1, + 'delete' => '', + ], + // Non-required "Multiple Select" option + [ + 'title' => 'Option 5', + 'default_title' => 'Option 5', + 'type' => 'multi', + 'required' => 0, + 'delete' => '', + ] + ] + )->setBundleSelectionsData( + [ + [ + [ + 'product_id' => 10, + 'selection_qty' => 10, + 'selection_can_change_qty' => 0, + 'delete' => '', + 'option_id' => 1 + ], + [ + 'product_id' => 11, + 'selection_qty' => 10, + 'selection_can_change_qty' => 0, + 'delete' => '', + 'option_id' => 1 + ], + [ + 'product_id' => 12, + 'selection_qty' => 10, + 'selection_can_change_qty' => 0, + 'delete' => '', + 'option_id' => 1 + ] + ], + [ + [ + 'product_id' => 10, + 'selection_qty' => 10, + 'selection_can_change_qty' => 0, + 'delete' => '', + 'option_id' => 2 + ], + [ + 'product_id' => 11, + 'selection_qty' => 10, + 'selection_can_change_qty' => 0, + 'delete' => '', + 'option_id' => 2 + ], + [ + 'product_id' => 13, + 'selection_qty' => 10, + 'selection_can_change_qty' => 0, + 'delete' => '', + 'option_id' => 2 + ] + ], + [ + [ + 'product_id' => 10, + 'selection_qty' => 10, + 'delete' => '', + 'option_id' => 3 + ], + [ + 'product_id' => 11, + 'selection_qty' => 10, + 'delete' => '', + 'option_id' => 3 + ], + [ + 'product_id' => 14, + 'selection_qty' => 10, + 'selection_can_change_qty' => 0, + 'delete' => '', + 'option_id' => 3 + ] + ], + [ + [ + 'product_id' => 13, + 'selection_qty' => 10, + 'delete' => '', + 'option_id' => 4 + ], + [ + 'product_id' => 14, + 'selection_qty' => 10, + 'delete' => '', + 'option_id' => 4 + ], + [ + 'product_id' => 12, + 'selection_qty' => 10, + 'selection_can_change_qty' => 0, + 'delete' => '', + 'option_id' => 4 + ] + ], + [ + [ + 'product_id' => 10, + 'selection_qty' => 10, + 'delete' => '', + 'option_id' => 5 + ], + [ + 'product_id' => 11, + 'selection_qty' => 10, + 'delete' => '', + 'option_id' => 5 + ] + ] + ] + ); + +if ($product->getBundleOptionsData()) { + $options = []; + foreach ($product->getBundleOptionsData() as $key => $optionData) { + if (!(bool)$optionData['delete']) { + $option = $objectManager->create(\Magento\Bundle\Api\Data\OptionInterfaceFactory::class) + ->create(['data' => $optionData]); + $option->setSku($product->getSku()); + $option->setOptionId(null); + + $links = []; + $bundleLinks = $product->getBundleSelectionsData(); + if (!empty($bundleLinks[$key])) { + foreach ($bundleLinks[$key] as $linkData) { + if (!(bool)$linkData['delete']) { + $link = $objectManager->create(\Magento\Bundle\Api\Data\LinkInterfaceFactory::class) + ->create(['data' => $linkData]); + $linkProduct = $productRepository->getById($linkData['product_id']); + $link->setSku($linkProduct->getSku()); + $link->setQty($linkData['selection_qty']); + $links[] = $link; + } + } + $option->setProductLinks($links); + $options[] = $option; + } + } + } + $extension = $product->getExtensionAttributes(); + $extension->setBundleProductOptions($options); + $product->setExtensionAttributes($extension); +} + +$productRepository->save($product, true); \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product_rollback.php new file mode 100644 index 0000000000000..f65dbbbb5435b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/issaleable_product_rollback.php @@ -0,0 +1,27 @@ +get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var $product \Magento\Catalog\Model\Product */ +$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + +try { + $product = $productRepository->get('bundle-product'); + $productRepository->delete($product); +} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { + //Product already removed +} + + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php new file mode 100644 index 0000000000000..04def919e6aa7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php @@ -0,0 +1,128 @@ +create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + +/** @var $product \Magento\Catalog\Model\Product */ +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(10) + ->setAttributeSetId(4) + ->setName('Simple Product') + ->setSku('simple1') + ->setTaxClassId('none') + ->setDescription('description') + ->setShortDescription('short description') + ->setOptionsContainer('container1') + ->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_IN_CART) + ->setPrice(10) + ->setWeight(1) + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setWebsiteIds([1]) + ->setCateroryIds([]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + +$productRepository->save($product); + +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(11) + ->setAttributeSetId(4) + ->setName('Simple Product2') + ->setSku('simple2') + ->setTaxClassId('none') + ->setDescription('description') + ->setShortDescription('short description') + ->setOptionsContainer('container1') + ->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_ON_GESTURE) + ->setPrice(20) + ->setWeight(1) + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setWebsiteIds([1]) + ->setCateroryIds([]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 50, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + +$productRepository->save($product); + +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(12) + ->setAttributeSetId(4) + ->setName('Simple Product 3') + ->setSku('simple3') + ->setTaxClassId('none') + ->setDescription('description') + ->setShortDescription('short description') + ->setPrice(30) + ->setWeight(1) + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setWebsiteIds([1]) + ->setCateroryIds([]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 140, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + +$productRepository->save($product); + +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(13) + ->setAttributeSetId(4) + ->setName('Simple Product 4') + ->setSku('simple4') + ->setTaxClassId('none') + ->setDescription('description') + ->setShortDescription('short description') + ->setOptionsContainer('container1') + ->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_IN_CART) + ->setPrice(13) + ->setWeight(12) + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setWebsiteIds([1]) + ->setCateroryIds([]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 20, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + +$productRepository->save($product); + +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(14) + ->setAttributeSetId(4) + ->setName('Simple Product 5') + ->setSku('simple5') + ->setTaxClassId('none') + ->setDescription('description') + ->setShortDescription('short description') + ->setOptionsContainer('container1') + ->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_IN_CART) + ->setPrice(14) + ->setWeight(10) + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setWebsiteIds([1]) + ->setCateroryIds([]) + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 15, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); + +$productRepository->save($product); \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products_rollback.php new file mode 100644 index 0000000000000..c13f33bcbf7bb --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products_rollback.php @@ -0,0 +1,28 @@ +get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + +foreach (['simple1', 'simple2', 'simple3', 'simple4', 'simple5'] as $sku) { + try { + $product = $productRepository->get($sku, false, null, true); + $productRepository->delete($product); + } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { + //Product already removed + } +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From dbf5cf7dfabc35fd3eb0da230c9c43be1cd96f1f Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Wed, 26 Oct 2016 13:53:43 +0300 Subject: [PATCH 1461/3232] MAGETWO-56989: Deployment process can't be executed on separate machine --- .../Magento/TestFramework/Isolation/AppConfig.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php b/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php index bc5e05d2a9da0..b32292cf1d83f 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php @@ -47,16 +47,4 @@ private function getTestAppConfig() return $this->testAppConfig; } - - /**Clean memorized and cached setting values - * Checks if deployment configuration has been changed by a test - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * @param \PHPUnit_Framework_TestCase $test - * @return void - */ - public function endTest(\PHPUnit_Framework_TestCase $test) - { - $this->getTestAppConfig()->clean(); - } } From e041b30c566ca470cd380eb7d6f4d0b00444bb85 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Wed, 26 Oct 2016 14:00:05 +0300 Subject: [PATCH 1462/3232] MAGETWO-56989: Deployment process can't be executed on separate machine --- .../Model/Category/Plugin/Store/View.php | 1 + .../Helper/Plugin/UpdateConfigurationsTest.php | 5 +++++ .../Test/Unit/Model/Config/PlaceholderTest.php | 2 +- .../Model/Config/Processor/PlaceholderTest.php | 18 ++++++++++++------ .../TestFramework/Isolation/AppConfig.php | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php index 5612db7efc5da..ea3a0f5fb8da4 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/View.php @@ -17,6 +17,7 @@ * Plugin which is listening store resource model and on save or on delete replace catalog url rewrites * * @see \Magento\Store\Model\ResourceModel\Store + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @package Magento\CatalogUrlRewrite\Model\Category\Plugin\Store */ class View diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurationsTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurationsTest.php index c027a90993b8d..79d77c66e0d05 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurationsTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurationsTest.php @@ -13,6 +13,11 @@ use Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper as ProductInitializationHelper; use Magento\Catalog\Model\Product; +/** + * Class UpdateConfigurationsTest + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @package Magento\ConfigurableProduct\Test\Unit\Controller\Adminhtml\Product\Initialization\Helper\Plugin + */ class UpdateConfigurationsTest extends \PHPUnit_Framework_TestCase { /** diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/PlaceholderTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/PlaceholderTest.php index ed545572cfb5f..7b952dd84fb38 100644 --- a/app/code/Magento/Store/Test/Unit/Model/Config/PlaceholderTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/Config/PlaceholderTest.php @@ -21,7 +21,7 @@ class PlaceholderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_requestMock = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false); + $this->_requestMock = $this->getMock(\Magento\Framework\App\Request\Http::class, [], [], '', false); $this->_requestMock->expects( $this->any() )->method( diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Processor/PlaceholderTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Processor/PlaceholderTest.php index d566b6aca43d3..7a258fe41a51d 100644 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Processor/PlaceholderTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Processor/PlaceholderTest.php @@ -22,19 +22,25 @@ class PlaceholderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->configPlaceholderMock = $this->getMock('Magento\Store\Model\Config\Placeholder', [], [], '', false); + $this->configPlaceholderMock = $this->getMock( + \Magento\Store\Model\Config\Placeholder::class, + [], + [], + '', + false + ); $this->configPlaceholderMock->expects( $this->any() )->method( 'process' )->withConsecutive( - [['key1' => 'value1']], - [['key2' => 'value2']] + [['key1' => 'value1']], + [['key2' => 'value2']] )->willReturnOnConsecutiveCalls( - ['key1' => 'value1-processed'], - ['key2' => 'value2-processed'] - ); + ['key1' => 'value1-processed'], + ['key2' => 'value2-processed'] + ); $this->model = new \Magento\Store\Model\Config\Processor\Placeholder($this->configPlaceholderMock); } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php b/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php index b32292cf1d83f..514b074d23366 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Isolation/AppConfig.php @@ -25,9 +25,9 @@ class AppConfig * Assumption: this is done once right before executing very first test suite. * It is assumed that deployment configuration is valid at this point * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @param \PHPUnit_Framework_TestCase $test * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function startTest(\PHPUnit_Framework_TestCase $test) { From 91b0aadb94883f62c1323828506f9c1d8c347157 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Wed, 26 Oct 2016 14:01:22 +0300 Subject: [PATCH 1463/3232] MAGETWO-56989: Deployment process can't be executed on separate machine --- .../unit/testsuite/Magento/Test/Isolation/AppConfigTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php index 58166992ced15..090c93c98efe8 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php @@ -18,7 +18,7 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase * @var \Magento\TestFramework\Isolation\WorkingDirectory */ private $model; - +x protected function setUp() { $this->model = new \Magento\TestFramework\Isolation\AppConfig(); @@ -41,9 +41,8 @@ public function testStartTestEndTest() ->disableOriginalConstructor() ->getMock(); $testAppConfigProperty->setValue($this->model, $testAppConfigMock); - $testAppConfigMock->expects($this->exactly(2)) + $testAppConfigMock->expects($this->once()) ->method('clean'); $this->model->startTest($test); - $this->model->endTest($test); } } From 0534b3b5070d5fc861d76f1e66dc7b5eb368245a Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Wed, 26 Oct 2016 14:03:45 +0300 Subject: [PATCH 1464/3232] MAGETWO-56989: Deployment process can't be executed on separate machine --- .../unit/testsuite/Magento/Test/Isolation/AppConfigTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php index 090c93c98efe8..34cf654dcf5c0 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Isolation/AppConfigTest.php @@ -18,7 +18,7 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase * @var \Magento\TestFramework\Isolation\WorkingDirectory */ private $model; -x + protected function setUp() { $this->model = new \Magento\TestFramework\Isolation\AppConfig(); From d774c53fa8f86b6967ffabe22a04ab9304cf6733 Mon Sep 17 00:00:00 2001 From: Max Lesechko Date: Wed, 26 Oct 2016 14:15:21 +0300 Subject: [PATCH 1465/3232] MAGETWO-59905: Order create page broken after refresh --- .../adminhtml/templates/order/create/sidebar/items.phtml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 59bb31a94fa0c..a8ccf82c5fe06 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 @@ -66,7 +66,13 @@ canDisplayPrice()): ?> -
    getItemPrice($_item) ?> + getDataId() == 'cart'): ?> + getItemPrice($_item->getProduct()) ?> + + getItemPrice($_item) ?> + +
    EOD; - $privacyAndCookiePolicyPage = $this->createPage()->load(self::PRIVACY_COOKIE_PAGE_ID); + $privacyAndCookiePolicyPage = $this->createPage()->load( + 'privacy-policy-cookie-restriction-mode', + 'identifier' + ); $privacyAndCookiePolicyPageId = $privacyAndCookiePolicyPage->getId(); if ($privacyAndCookiePolicyPageId) { $privacyAndCookiePolicyPage->setContent($newPageContent); From 723812d8374096682f656aeff17f39129b174fb2 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Fri, 4 Nov 2016 16:46:58 +0200 Subject: [PATCH 1652/3232] MAGETWO-55861: [IE11] User can't change/add new Address From Order page --- lib/web/css/source/components/_modals.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/web/css/source/components/_modals.less b/lib/web/css/source/components/_modals.less index daf325efd3a02..ea866d4775ac2 100644 --- a/lib/web/css/source/components/_modals.less +++ b/lib/web/css/source/components/_modals.less @@ -189,6 +189,8 @@ // If applied, switching outer popup scroll to inner &._inner-scroll { overflow-y: visible; + + .ie11 &, .ie10 &, .ie9 & { overflow-y: auto; @@ -196,6 +198,8 @@ .modal-inner-wrap { max-height: 90%; + + .ie11 &, .ie10 &, .ie9 & { max-height: none; From 046663d232f637b95251a18fd5223792980ee026 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Fri, 4 Nov 2016 17:08:39 +0200 Subject: [PATCH 1653/3232] MAGETWO-59739: [FT] Magento\Checkout\Test\TestCase\OnePageCheckoutTest fails randomly on CI --- .../tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php index cad6dda904598..82693052680aa 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php @@ -90,7 +90,7 @@ public function selectPaymentMethod(array $payment, InjectableFixture $creditCar } catch (\Exception $exception) { throw new \Exception('Such payment method is absent.'); } - + $this->waitForElementVisible($paymentSelector); $paymentRadioButton = $this->_rootElement->find($paymentSelector); if ($paymentRadioButton->isVisible()) { $paymentRadioButton->click(); From de215e1c84f5c1b28eb9269b8a886d4e48117211 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Fri, 4 Nov 2016 17:32:39 +0200 Subject: [PATCH 1654/3232] MAGETWO-59916: Problem arose when applying a coupon. ~QUANS~ --- .../Magento/Checkout/Controller/Cart/Index/CouponPostTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php index 3feb4bd061994..a6031429c6602 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index/CouponPostTest.php @@ -14,14 +14,14 @@ class CouponPostTest extends \Magento\TestFramework\TestCase\AbstractController /** * Test for \Magento\Checkout\Controller\Cart\CouponPost::execute() with simple product * - * @magentoDataFixture Magento/Checkout/_files/quote_with_simple_product.php + * @magentoDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php */ public function testExecute() { /** @var $session \Magento\Checkout\Model\Session */ $session = $this->_objectManager->create(\Magento\Checkout\Model\Session::class); $quote = $session->getQuote(); - $quote->setData('trigger_recollect', 1)->setTotalsCollectedFlag(true)->save(); + $quote->setData('trigger_recollect', 1)->setTotalsCollectedFlag(true); $inputData = [ 'remove' => 0, 'coupon_code' => 'test' From 0f2fcaf70a7b01a383a994395e4ee455c899add8 Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Fri, 4 Nov 2016 17:48:53 +0200 Subject: [PATCH 1655/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Helper/Image.php | 6 ++-- .../Magento/Catalog/Model/Product/Image.php | 29 ++----------------- .../Test/Unit/Model/Product/ImageTest.php | 6 ++-- .../Catalog/Model/Product/ImageTest.php | 2 +- 4 files changed, 9 insertions(+), 34 deletions(-) diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index 06e18ad3166b7..6f13e9077f473 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -194,7 +194,7 @@ public function init($product, $imageId, $attributes = []) */ protected function setImageProperties() { - $this->_getModel()->setType($this->getType()); + $this->_getModel()->setDestinationSubdir($this->getType()); $this->_getModel()->setWidth($this->getWidth()); $this->_getModel()->setHeight($this->getHeight()); @@ -442,7 +442,7 @@ public function getPlaceholder($placeholder = null) $placeholderFullPath = 'Magento_Catalog::images/product/placeholder/' . $placeholder . '.jpg'; } else { $placeholderFullPath = $this->_placeholder - ?: 'Magento_Catalog::images/product/placeholder/' . $this->_getModel()->getType() . '.jpg'; + ?: 'Magento_Catalog::images/product/placeholder/' . $this->_getModel()->getDestinationSubdir() . '.jpg'; } return $placeholderFullPath; } @@ -485,7 +485,7 @@ protected function initBaseFile() if ($this->getImageFile()) { $model->setBaseFile($this->getImageFile()); } else { - $model->setBaseFile($this->getProduct()->getData($model->getType())); + $model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir())); } } return $this; diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 36ef498774eef..16b900d4f3a0e 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -490,7 +490,7 @@ public function setBaseFile($file) $this->_isBaseFilePlaceholder = true; $this->imageAsset = $this->getViewAssetPlaceholderFactory()->create( [ - 'type' => $this->getType(), + 'type' => $this->getDestinationSubdir(), ] ); } @@ -676,8 +676,6 @@ public function getUrl() } /** - * @deprecated - * @see \Magento\Catalog\Model\Product\Image::setType($imageType) * @param string $dir * @return $this */ @@ -688,8 +686,6 @@ public function setDestinationSubdir($dir) } /** - * @deprecated - * @see \Magento\Catalog\Model\Product\Image::getType() * @return string */ public function getDestinationSubdir() @@ -944,7 +940,7 @@ private function getViewAssetPlaceholderFactory() private function getMiscParams() { $miscParams = [ - 'image_type' => $this->getType(), + 'image_type' => $this->getDestinationSubdir(), 'image_height' => $this->getHeight(), 'image_width' => $this->getWidth(), 'keep_aspect_ratio' => ($this->_keepAspectRatio ? '' : 'non') . 'proportional', @@ -967,25 +963,4 @@ private function getMiscParams() return $miscParams; } - - /** - * Set image type - * - * @param string $imageType - * @return void - */ - public function setType($imageType) - { - $this->imageType = $imageType; - } - - /** - * Retrieve image type - * - * @return string - */ - public function getType() - { - return $this->imageType; - } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php index d780c5be55246..e4cae1d88eb99 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php @@ -378,10 +378,10 @@ public function testGetUrlNoSelection() $this->assertEquals('Default Placeholder URL', $this->image->getUrl()); } - public function testSetGetType() + public function testSetGetDestinationSubdir() { - $this->image->setType('image_type'); - $this->assertEquals('image_type', $this->image->getType()); + $this->image->setDestinationSubdir('image_type'); + $this->assertEquals('image_type', $this->image->getDestinationSubdir()); } public function testIsCached() diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php index aaa450369bea8..8b0d1b393f467 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ImageTest.php @@ -29,7 +29,7 @@ public function testSetBaseFilePlaceholder() ['type' => 'image'] ); - $model->setType('image'); + $model->setDestinationSubdir('image'); $model->setBaseFile(''); $this->assertEquals($defualtPlaceholder->getSourceFile(), $model->getBaseFile()); return $model; From 90ed78f067122624bd476d914145b342c3f207da Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Fri, 4 Nov 2016 18:47:32 +0200 Subject: [PATCH 1656/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Model/Product/Image.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 16b900d4f3a0e..34b145ac113f4 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -185,12 +185,6 @@ class Image extends \Magento\Framework\Model\AbstractModel */ private $imageAsset; - /** - * Image type of thumbnail, small_image, image, swatch_image or swatch_thumb - * @var string - */ - private $imageType; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry From 5f2167dea9a8504d87066c31101ed51899538138 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Fri, 4 Nov 2016 18:48:42 +0200 Subject: [PATCH 1657/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -change copyright --- app/code/Magento/Eav/Model/Entity/AttributeCache.php | 2 +- lib/internal/Magento/Framework/App/Config.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/AttributeCache.php b/app/code/Magento/Eav/Model/Entity/AttributeCache.php index 0597b08746698..60727aa654e1c 100644 --- a/app/code/Magento/Eav/Model/Entity/AttributeCache.php +++ b/app/code/Magento/Eav/Model/Entity/AttributeCache.php @@ -120,7 +120,7 @@ public function saveAttributes($entityType, $attributes, $suffix = '') [ \Magento\Eav\Model\Cache\Type::CACHE_TAG, \Magento\Eav\Model\Entity\Attribute::CACHE_TAG, - \Magento\Framework\App\Config::SCOPE_CACHE_TAGE + \Magento\Config\App\Config\Type\System::CACHE_TAG ] ); } diff --git a/lib/internal/Magento/Framework/App/Config.php b/lib/internal/Magento/Framework/App/Config.php index 307744e137bae..d25739c5d1bf3 100644 --- a/lib/internal/Magento/Framework/App/Config.php +++ b/lib/internal/Magento/Framework/App/Config.php @@ -21,8 +21,6 @@ class Config implements ScopeConfigInterface */ const CACHE_TAG = 'CONFIG'; - const SCOPE_CACHE_TAGE = "config_scopes"; - /** * @var ScopeCodeResolver */ From c96d788b929e127a919fec29a1eb1b5b700c001d Mon Sep 17 00:00:00 2001 From: Ruslan Kostiv Date: Fri, 4 Nov 2016 18:49:37 +0200 Subject: [PATCH 1658/3232] MAGETWO-33564: [GitHub] Database Schema: Incorrect Unique Indexes #1002 --- .../CatalogInventory/Setup/InstallSchema.php | 4 +- .../CatalogInventory/Setup/UpgradeSchema.php | 69 +++++++++++++++++++ .../Magento/CatalogInventory/etc/module.xml | 2 +- 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/CatalogInventory/Setup/UpgradeSchema.php diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php index a19eb9d1cc573..cbe1aa3d06665 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -254,10 +254,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ->addIndex( $installer->getIdxName( 'cataloginventory_stock_item', - ['product_id', 'website_id'], + ['product_id', 'stock_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['product_id', 'website_id'], + ['product_id', 'stock_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addIndex( diff --git a/app/code/Magento/CatalogInventory/Setup/UpgradeSchema.php b/app/code/Magento/CatalogInventory/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..f582e2ff9391b --- /dev/null +++ b/app/code/Magento/CatalogInventory/Setup/UpgradeSchema.php @@ -0,0 +1,69 @@ +startSetup(); + + if (version_compare($context->getVersion(), $this->productCompositeKeyVersion, '<')) { + $this->upgradeProductCompositeKey($setup); + } + + $setup->endSetup(); + } + + /** + * @param SchemaSetupInterface $setup + * @return void + */ + private function upgradeProductCompositeKey(SchemaSetupInterface $setup) + { + $oldCompositeKeyColumns = ['product_id', 'website_id']; + $newCompositeKeyColumns = ['product_id', 'stock_id']; + + $oldIndexName = $setup->getIdxName( + \Magento\CatalogInventory\Model\Stock\Item::ENTITY, + $oldCompositeKeyColumns, + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ); + + $newIndexName = $setup->getIdxName( + \Magento\CatalogInventory\Model\Stock\Item::ENTITY, + $newCompositeKeyColumns, + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ); + + // Drop a key based on the following columns: "product_id","website_id" + $setup->getConnection()->dropIndex( + $setup->getTable(\Magento\CatalogInventory\Model\Stock\Item::ENTITY), + $oldIndexName + ); + + // Create a key based on the following columns: "product_id","stock_id" + $setup->getConnection()->addIndex( + \Magento\CatalogInventory\Model\Stock\Item::ENTITY, + $newIndexName, + $newCompositeKeyColumns, + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ); + } +} diff --git a/app/code/Magento/CatalogInventory/etc/module.xml b/app/code/Magento/CatalogInventory/etc/module.xml index 711d18bead9c9..7aff70e225831 100644 --- a/app/code/Magento/CatalogInventory/etc/module.xml +++ b/app/code/Magento/CatalogInventory/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + From 317f688d3e732269a844549867efd758a39c5f5d Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Fri, 4 Nov 2016 19:34:03 +0200 Subject: [PATCH 1659/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php index d06772088c425..4ed3495f9e348 100644 --- a/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php @@ -164,11 +164,11 @@ protected function prepareAttributes($data, $imageId) protected function prepareImageProperties($data) { $this->image->expects($this->once()) - ->method('setType') + ->method('setDestinationSubdir') ->with($data['type']) ->willReturnSelf(); $this->image->expects($this->any()) - ->method('getType') + ->method('getDestinationSubdir') ->willReturn($data['type']); $this->image->expects($this->once()) ->method('setWidth') @@ -458,7 +458,7 @@ public function testGetResizedImageInfo( ->method('getBaseFile') ->willReturn($baseFile); $this->image->expects($this->any()) - ->method('getType') + ->method('getDestinationSubdir') ->willReturn($destination); $this->image->expects($this->any()) ->method('isCached') From 8e052c803c15f2025a790ab0f9ac03b93b29f1b6 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Fri, 4 Nov 2016 19:42:44 +0200 Subject: [PATCH 1660/3232] MAGETWO-59586: Excessive loaders for order with virtual product - Added getPaymentData method; --- .../adminhtml/web/order/create/scripts.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 2c94e88c6232a..000a2b5577dcd 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 @@ -384,12 +384,39 @@ define([ block.show(); block.select('input', 'select', 'textarea').each(function(field) { field.disabled = false; + if (!el.include('_before') && !el.include('_after') && !field.bindChange) { + field.bindChange = true; + field.paymentContainer = form; + field.method = method; + } },this); } },this); } }, + getPaymentData : function(currentMethod){ + if (typeof(currentMethod) == 'undefined') { + if (this.paymentMethod) { + currentMethod = this.paymentMethod; + } else { + return false; + } + } + if (this.isPaymentValidationAvailable() == false) { + return false; + } + var data = {}; + var fields = $('payment_form_' + currentMethod).select('input', 'select'); + for(var i=0;i Date: Fri, 4 Nov 2016 14:17:35 -0500 Subject: [PATCH 1661/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Removing obsolete code --- .../ObjectManager/Definition/Compiled.php | 115 ------------------ 1 file changed, 115 deletions(-) delete mode 100644 lib/internal/Magento/Framework/ObjectManager/Definition/Compiled.php diff --git a/lib/internal/Magento/Framework/ObjectManager/Definition/Compiled.php b/lib/internal/Magento/Framework/ObjectManager/Definition/Compiled.php deleted file mode 100644 index e2a4f0c34a2a8..0000000000000 --- a/lib/internal/Magento/Framework/ObjectManager/Definition/Compiled.php +++ /dev/null @@ -1,115 +0,0 @@ -_signatures, $this->_definitions) = $definitions; - $this->reader = $reader ?: new \Magento\Framework\Code\Reader\ClassReader(); - } - - /** - * Unpack signature - * - * @param string $signature - * @return mixed - */ - protected function _unpack($signature) - { - return $this->getSerializer()->unserialize($signature); - } - - /** - * Get list of method parameters - * - * Retrieve an ordered list of constructor parameters. - * Each value is an array with following entries: - * - * array( - * 0, // string: Parameter name - * 1, // string|null: Parameter type - * 2, // bool: whether this param is required - * 3, // mixed: default value - * ); - * - * @param string $className - * @return array|null - */ - public function getParameters($className) - { - // if the definition isn't found in the list gathered from the compiled file then using reflection to find it - if (!array_key_exists($className, $this->_definitions)) { - return $this->reader->getConstructor($className); - } - - $definition = $this->_definitions[$className]; - if ($definition !== null) { - if (is_string($this->_signatures[$definition])) { - $this->_signatures[$definition] = $this->_unpack($this->_signatures[$definition]); - } - return $this->_signatures[$definition]; - } - return null; - } - - /** - * Retrieve list of all classes covered with definitions - * - * @return array - */ - public function getClasses() - { - return array_keys($this->_definitions); - } - - /** - * Get serializer - * - * @return SerializerInterface - * @deprecated - */ - private function getSerializer() - { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); - } - return $this->serializer; - } -} From c957071a0c4a20748a0f130100605ff9a2fd683e Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 4 Nov 2016 14:28:13 -0500 Subject: [PATCH 1662/3232] MAGETWO-60353: Replace json_decode in \Magento\Framework\ObjectManager\DefinitionFactory::_unpack with SerializerInterface Adding removed method back --- .../Framework/App/ObjectManagerFactory.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index fc47cc5aca3d9..530c7c43599df 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -277,4 +277,34 @@ protected function _loadPrimaryConfig(DirectoryList $directoryList, $driverPool, } return $configData; } + + /** + * Crete plugin list object + * + * @param \Magento\Framework\ObjectManagerInterface $objectManager + * @param \Magento\Framework\ObjectManager\RelationsInterface $relations + * @param \Magento\Framework\ObjectManager\DefinitionFactory $definitionFactory + * @param \Magento\Framework\ObjectManager\Config\Config $diConfig + * @param \Magento\Framework\ObjectManager\DefinitionInterface $definitions + * @return \Magento\Framework\Interception\PluginList\PluginList + * @deprecated + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function _createPluginList( + \Magento\Framework\ObjectManagerInterface $objectManager, + \Magento\Framework\ObjectManager\RelationsInterface $relations, + \Magento\Framework\ObjectManager\DefinitionFactory $definitionFactory, + \Magento\Framework\ObjectManager\Config\Config $diConfig, + \Magento\Framework\ObjectManager\DefinitionInterface $definitions + ) { + return $objectManager->create( + \Magento\Framework\Interception\PluginList\PluginList::class, + [ + 'relations' => $relations, + 'definitions' => $definitionFactory->createPluginDefinition(), + 'omConfig' => $diConfig, + 'classDefinitions' => null + ] + ); + } } From 61eda85b7da8f658b0c334f3ca744af180dfc784 Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 4 Nov 2016 15:46:16 -0500 Subject: [PATCH 1663/3232] MAGETWO-59444: Create serializer interface and json class in framework --- .../Framework/Serialize/Serializer/Json.php | 4 ++ .../Serialize/SerializerInterface.php | 3 + .../Test/Unit/Serializer/JsonTest.php | 55 +++++++++++++++---- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/lib/internal/Magento/Framework/Serialize/Serializer/Json.php b/lib/internal/Magento/Framework/Serialize/Serializer/Json.php index 009fee5e3639f..bf7a34c21fbdd 100644 --- a/lib/internal/Magento/Framework/Serialize/Serializer/Json.php +++ b/lib/internal/Magento/Framework/Serialize/Serializer/Json.php @@ -7,6 +7,10 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Class for serializing data to json string and unserializing json string to data + * + */ class Json implements SerializerInterface { /** diff --git a/lib/internal/Magento/Framework/Serialize/SerializerInterface.php b/lib/internal/Magento/Framework/Serialize/SerializerInterface.php index 1dc70da80f394..f7a15b31a826e 100644 --- a/lib/internal/Magento/Framework/Serialize/SerializerInterface.php +++ b/lib/internal/Magento/Framework/Serialize/SerializerInterface.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\Serialize; +/** + * Interface for serializing + */ interface SerializerInterface { /** diff --git a/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/JsonTest.php b/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/JsonTest.php index 38fa7d2a66f7f..88e06d89e3763 100644 --- a/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/JsonTest.php +++ b/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/JsonTest.php @@ -5,6 +5,7 @@ */ namespace Magento\Framework\Serialize\Test\Unit\Serializer; +use Magento\Framework\DataObject; use Magento\Framework\Serialize\Serializer\Json; class JsonTest extends \PHPUnit_Framework_TestCase @@ -21,25 +22,57 @@ protected function setUp() } /** - * @param null|bool|array $value - * @dataProvider serializeUnserializeDataProvider + * @param string|int|float|bool|array|null $value + * @param string $expected + * @dataProvider serializeDataProvider */ - public function testSerializeUnserialize($value) + public function testSerialize($value, $expected) { $this->assertEquals( - $this->json->unserialize($this->json->serialize($value)), - $value + $expected, + $this->json->serialize($value) ); } - public function serializeUnserializeDataProvider() + public function serializeDataProvider() { + $dataObject = new DataObject(['something']); return [ - [''], - ['string'], - [null], - [false], - [['a' => 'b']], + ['', '""'], + ['string', '"string"'], + [null, 'null'], + [false, 'false'], + [['a' => 'b', 'd' => 123], '{"a":"b","d":123}'], + [123, '123'], + [10.56, '10.56'], + [$dataObject, '{}'], + ]; + } + + /** + * @param string $value + * @param string|int|float|bool|array|null $expected + * @dataProvider unserializeDataProvider + */ + public function testUnserialize($value, $expected) + { + $this->assertEquals( + $expected, + $this->json->unserialize($value) + ); + } + + public function unserializeDataProvider() + { + return [ + ['""', ''], + ['"string"', 'string'], + ['null', null], + ['false', false], + ['{"a":"b","d":123}', ['a' => 'b', 'd' => 123]], + ['123', 123], + ['10.56', 10.56], + ['{}', []], ]; } } From 7439d1d4183ec4e37d7240108fb2550fd2b79f6b Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 4 Nov 2016 15:46:30 -0500 Subject: [PATCH 1664/3232] MAGETWO-59764: Create serialize class in framework --- .../Magento/Framework/Serialize/README.md | 7 +- .../Serialize/Serializer/Serialize.php | 45 ++++++++++++ .../Test/Unit/Serializer/SerializeTest.php | 71 +++++++++++++++++++ 3 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php create mode 100644 lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/SerializeTest.php diff --git a/lib/internal/Magento/Framework/Serialize/README.md b/lib/internal/Magento/Framework/Serialize/README.md index e636fc79818af..5af8fb7f71b6b 100644 --- a/lib/internal/Magento/Framework/Serialize/README.md +++ b/lib/internal/Magento/Framework/Serialize/README.md @@ -1,5 +1,8 @@ # Serialize -**Serialize** libaray provides *SerializerInterface* and multiple implementations of serializer to support different kinds of needs of serializing/unserializing of data. Here are list of serializers in this library: +**Serialize** library provides interface *SerializerInterface* and multiple implementations: - * **Json** (default) - It can be used to serialize string, integer, float, boolean, or array data to json string; it unserializes json string to string, integer, float, boolean, or array. This is the recommended serializer. \ No newline at end of file + * *Json* - default implementation. Uses PHP native json_encode/json_decode functions; + * *Serialize* - less secure than *Json*, but gives higher performance on big arrays. Uses PHP native serialize/unserialize functions, does not unserialize objects on PHP 7. + +Using *Serialize* implementation directly is discouraged, always use *SerializerInterface*, using *Serialize* implementation may lead to security vulnerabilities. \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php b/lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php new file mode 100644 index 0000000000000..3d2dc66e502ef --- /dev/null +++ b/lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php @@ -0,0 +1,45 @@ +getPhpVersion() >= 7) { + return unserialize($string, ['allowed_classes' => false]); + } + return unserialize($string); + } + + /** + * Return major PHP version + * + * @return int + */ + private function getPhpVersion() + { + return PHP_MAJOR_VERSION; + } +} diff --git a/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/SerializeTest.php b/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/SerializeTest.php new file mode 100644 index 0000000000000..874647b5d705f --- /dev/null +++ b/lib/internal/Magento/Framework/Serialize/Test/Unit/Serializer/SerializeTest.php @@ -0,0 +1,71 @@ +serialize = $objectManager->getObject(Serialize::class); + } + + /** + * @param string|int|float|bool|array|null $value + * @param string $serializedValue + * @dataProvider serializeDataProvider + */ + public function testSerialize($value, $serializedValue) + { + $this->assertEquals($serializedValue, $this->serialize->serialize($value)); + } + + public function serializeDataProvider() + { + return [ + ['string', 's:6:"string";'], + ['', 's:0:"";'], + [10, 'i:10;'], + [10.5, 'd:10.5;'], + [null, 'N;'], + [false, 'b:0;'], + [['foo' => 'bar'], 'a:1:{s:3:"foo";s:3:"bar";}'], + ]; + } + + /** + * @param string $serializedValue + * @param string|int|float|bool|array|null $value + * @dataProvider unserializeDataProvider + */ + public function testUnserialize($serializedValue, $value) + { + $this->assertEquals($value, $this->serialize->unserialize($serializedValue)); + } + + public function unserializeDataProvider() + { + return [ + ['s:6:"string";', 'string'], + ['s:0:"";', ''], + ['i:10;', 10], + ['d:10.5;', 10.5], + ['N;', null], + ['b:0;', false], + ['a:1:{s:3:"foo";s:3:"bar";}', ['foo' => 'bar']], + ]; + } +} From 47df808ef213e47d29c4ad1d9f3d0014fc797301 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 4 Nov 2016 16:15:13 -0500 Subject: [PATCH 1665/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding class and __constructor descriptions --- app/code/Magento/Catalog/Model/Attribute/Config/Data.php | 5 +++++ app/code/Magento/Catalog/Model/ProductOptions/Config.php | 5 +++++ app/code/Magento/Catalog/Model/ProductTypes/Config.php | 5 +++++ app/code/Magento/Config/Model/Config/Structure/Data.php | 5 +++++ app/code/Magento/Cron/Model/Config/Data.php | 5 +++++ app/code/Magento/Cron/Model/Groups/Config/Data.php | 5 +++++ app/code/Magento/Customer/Model/Address/Config.php | 7 ++++--- .../Directory/Model/Country/Postcode/Config/Data.php | 5 +++++ app/code/Magento/Eav/Model/Entity/Attribute/Config.php | 5 +++++ app/code/Magento/Email/Model/Template/Config/Data.php | 5 +++++ app/code/Magento/ImportExport/Model/Export/Config.php | 5 +++++ app/code/Magento/ImportExport/Model/Import/Config.php | 5 +++++ app/code/Magento/Indexer/Model/Config/Data.php | 7 +++++-- app/code/Magento/Sales/Model/Config/Data.php | 5 +++++ app/code/Magento/Search/Model/SearchEngine/Config/Data.php | 5 +++++ .../Magento/Framework/Api/ExtensionAttribute/Config.php | 2 ++ lib/internal/Magento/Framework/Cache/Config/Data.php | 2 ++ .../Magento/Framework/Communication/Config/Data.php | 5 +++++ lib/internal/Magento/Framework/Config/Data.php | 6 ++++-- lib/internal/Magento/Framework/Config/Data/Scoped.php | 5 +++++ .../Magento/Framework/DataObject/Copy/Config/Data.php | 3 +++ lib/internal/Magento/Framework/Event/Config/Data.php | 5 +++++ .../Framework/Interception/PluginList/PluginList.php | 2 ++ lib/internal/Magento/Framework/Mview/Config/Data.php | 5 +++++ .../Magento/Framework/ObjectManager/Config/Compiled.php | 5 +++++ lib/internal/Magento/Framework/Search/Request/Config.php | 5 +++++ .../Magento/Setup/Module/Di/Code/Generator/PluginList.php | 3 +++ 27 files changed, 120 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Attribute/Config/Data.php b/app/code/Magento/Catalog/Model/Attribute/Config/Data.php index 08128376439a3..1fac4e58c75c9 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Config/Data.php +++ b/app/code/Magento/Catalog/Model/Attribute/Config/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides catalog attributes configuration + */ class Data extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param \Magento\Catalog\Model\Attribute\Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/Catalog/Model/ProductOptions/Config.php b/app/code/Magento/Catalog/Model/ProductOptions/Config.php index f78eb0e4f508b..fa828832bf4a7 100644 --- a/app/code/Magento/Catalog/Model/ProductOptions/Config.php +++ b/app/code/Magento/Catalog/Model/ProductOptions/Config.php @@ -7,10 +7,15 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides product options configuration + */ class Config extends \Magento\Framework\Config\Data implements \Magento\Catalog\Model\ProductOptions\ConfigInterface { /** + * Constructor + * * @param \Magento\Catalog\Model\ProductOptions\Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config.php b/app/code/Magento/Catalog/Model/ProductTypes/Config.php index 7a5465e525bf7..f691e08a34b57 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/Config.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/Config.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides product types configuration + */ class Config extends \Magento\Framework\Config\Data implements \Magento\Catalog\Model\ProductTypes\ConfigInterface { /** + * Constructor + * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/Config/Model/Config/Structure/Data.php b/app/code/Magento/Config/Model/Config/Structure/Data.php index d785ce2b90861..6c926e7c1da1a 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Data.php +++ b/app/code/Magento/Config/Model/Config/Structure/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides configuration + */ class Data extends \Magento\Framework\Config\Data\Scoped { /** + * Constructor + * * @param Reader $reader * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache diff --git a/app/code/Magento/Cron/Model/Config/Data.php b/app/code/Magento/Cron/Model/Config/Data.php index 0e685aa910296..bcfaef37ece7b 100644 --- a/app/code/Magento/Cron/Model/Config/Data.php +++ b/app/code/Magento/Cron/Model/Config/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides cron configuration + */ class Data extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param Reader\Xml $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param Reader\Db $dbReader diff --git a/app/code/Magento/Cron/Model/Groups/Config/Data.php b/app/code/Magento/Cron/Model/Groups/Config/Data.php index 5c69cf9667b35..82c35abff22b0 100644 --- a/app/code/Magento/Cron/Model/Groups/Config/Data.php +++ b/app/code/Magento/Cron/Model/Groups/Config/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides cron groups configuration + */ class Data extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param \Magento\Cron\Model\Groups\Config\Reader\Xml $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/Customer/Model/Address/Config.php b/app/code/Magento/Customer/Model/Address/Config.php index 7170cf3d2383f..18a043bc019bb 100644 --- a/app/code/Magento/Customer/Model/Address/Config.php +++ b/app/code/Magento/Customer/Model/Address/Config.php @@ -11,7 +11,7 @@ use Magento\Store\Model\ScopeInterface; /** - * Customer address config + * Customer address configuration */ class Config extends ConfigData { @@ -36,8 +36,7 @@ class Config extends ConfigData protected $_store = null; /** - * Default types per store - * Using for invalid code + * Default types per store, used for invalid code * * @var array */ @@ -59,6 +58,8 @@ class Config extends ConfigData protected $_scopeConfig; /** + * Constructor + * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param \Magento\Store\Model\StoreManagerInterface $storeManager diff --git a/app/code/Magento/Directory/Model/Country/Postcode/Config/Data.php b/app/code/Magento/Directory/Model/Country/Postcode/Config/Data.php index 1a5241e0a11e5..c24da536e779c 100644 --- a/app/code/Magento/Directory/Model/Country/Postcode/Config/Data.php +++ b/app/code/Magento/Directory/Model/Country/Postcode/Config/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides country postcodes configuration + */ class Data extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Config.php b/app/code/Magento/Eav/Model/Entity/Attribute/Config.php index d7c5edd848566..1bc5bba6d5e79 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Config.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Config.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides EAV attributes configuration + */ class Config extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/Email/Model/Template/Config/Data.php b/app/code/Magento/Email/Model/Template/Config/Data.php index e1d00e20e8d16..1f6a4beb166e0 100644 --- a/app/code/Magento/Email/Model/Template/Config/Data.php +++ b/app/code/Magento/Email/Model/Template/Config/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides email templates configuration + */ class Data extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param \Magento\Email\Model\Template\Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/ImportExport/Model/Export/Config.php b/app/code/Magento/ImportExport/Model/Export/Config.php index a2e1a02ffd306..2d7b2c7a3af25 100644 --- a/app/code/Magento/ImportExport/Model/Export/Config.php +++ b/app/code/Magento/ImportExport/Model/Export/Config.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides export configuration + */ class Config extends \Magento\Framework\Config\Data implements \Magento\ImportExport\Model\Export\ConfigInterface { /** + * Constructor + * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/ImportExport/Model/Import/Config.php b/app/code/Magento/ImportExport/Model/Import/Config.php index 826303785210a..a1ec492da3e96 100644 --- a/app/code/Magento/ImportExport/Model/Import/Config.php +++ b/app/code/Magento/ImportExport/Model/Import/Config.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides import configuration + */ class Config extends \Magento\Framework\Config\Data implements \Magento\ImportExport\Model\Import\ConfigInterface { /** + * Constructor + * * @param Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/Indexer/Model/Config/Data.php b/app/code/Magento/Indexer/Model/Config/Data.php index cf6ea584196ce..3cedaa51ef4bb 100644 --- a/app/code/Magento/Indexer/Model/Config/Data.php +++ b/app/code/Magento/Indexer/Model/Config/Data.php @@ -6,9 +6,11 @@ namespace Magento\Indexer\Model\Config; use Magento\Framework\Serialize\SerializerInterface; -use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Framework\App\ObjectManager; +/** + * Provides indexer configuration + */ class Data extends \Magento\Framework\Config\Data { /** @@ -17,6 +19,8 @@ class Data extends \Magento\Framework\Config\Data protected $stateCollection; /** + * Constructor + * * @param \Magento\Framework\Indexer\Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param \Magento\Indexer\Model\ResourceModel\Indexer\State\Collection $stateCollection @@ -31,7 +35,6 @@ public function __construct( SerializerInterface $serializer = null ) { $this->stateCollection = $stateCollection; - $serializer = $serializer ?: ObjectManager::getInstance()->get(Serialize::class); $isCacheExists = $cache->test($cacheId); diff --git a/app/code/Magento/Sales/Model/Config/Data.php b/app/code/Magento/Sales/Model/Config/Data.php index bbd90a302f659..b6a1b43012f9e 100644 --- a/app/code/Magento/Sales/Model/Config/Data.php +++ b/app/code/Magento/Sales/Model/Config/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides sales configuration + */ class Data extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/app/code/Magento/Search/Model/SearchEngine/Config/Data.php b/app/code/Magento/Search/Model/SearchEngine/Config/Data.php index 213a92958ac0e..d128a9d50025d 100644 --- a/app/code/Magento/Search/Model/SearchEngine/Config/Data.php +++ b/app/code/Magento/Search/Model/SearchEngine/Config/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides search engine configuration + */ class Data extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param \Magento\Framework\Search\SearchEngine\Config\Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php b/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php index 32d2b75ed5e54..1dcfe02e56b3e 100644 --- a/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php +++ b/lib/internal/Magento/Framework/Api/ExtensionAttribute/Config.php @@ -20,6 +20,8 @@ class Config extends \Magento\Framework\Config\Data const CACHE_ID = 'extension_attributes_config'; /** + * Constructor + * * @param Reader $reader * @param CacheInterface $cache * @param string $cacheId|null diff --git a/lib/internal/Magento/Framework/Cache/Config/Data.php b/lib/internal/Magento/Framework/Cache/Config/Data.php index 3a2ba6c8c0d05..5909fff105e2b 100644 --- a/lib/internal/Magento/Framework/Cache/Config/Data.php +++ b/lib/internal/Magento/Framework/Cache/Config/Data.php @@ -20,6 +20,8 @@ class Data extends \Magento\Framework\Config\Data\Scoped protected $_scopePriorityScheme = ['global']; /** + * Constructor + * * @param \Magento\Framework\Cache\Config\Reader $reader * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache diff --git a/lib/internal/Magento/Framework/Communication/Config/Data.php b/lib/internal/Magento/Framework/Communication/Config/Data.php index ea2965b1a44b3..29667100b6860 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Data.php +++ b/lib/internal/Magento/Framework/Communication/Config/Data.php @@ -7,9 +7,14 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides communication configuration + */ class Data extends \Magento\Framework\Config\Data { /** + * Constructor + * * @param \Magento\Framework\Communication\Config\CompositeReader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/lib/internal/Magento/Framework/Config/Data.php b/lib/internal/Magento/Framework/Config/Data.php index 0723e40dbfef3..57b6769d3e559 100644 --- a/lib/internal/Magento/Framework/Config/Data.php +++ b/lib/internal/Magento/Framework/Config/Data.php @@ -16,14 +16,14 @@ class Data implements \Magento\Framework\Config\DataInterface { /** - * Configuration reader model + * Configuration reader * * @var ReaderInterface */ protected $_reader; /** - * Configuration cache model + * Configuration cache * * @var CacheInterface */ @@ -71,6 +71,8 @@ class Data implements \Magento\Framework\Config\DataInterface protected $serializer; /** + * Constructor + * * @param ReaderInterface $reader * @param CacheInterface $cache * @param string $cacheId diff --git a/lib/internal/Magento/Framework/Config/Data/Scoped.php b/lib/internal/Magento/Framework/Config/Data/Scoped.php index 55a354f0d2a67..02379834c5e78 100644 --- a/lib/internal/Magento/Framework/Config/Data/Scoped.php +++ b/lib/internal/Magento/Framework/Config/Data/Scoped.php @@ -8,6 +8,9 @@ use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\App\ObjectManager; +/** + * Provides scoped configuration + */ class Scoped extends \Magento\Framework\Config\Data { /** @@ -53,6 +56,8 @@ class Scoped extends \Magento\Framework\Config\Data protected $_loadedScopes = []; /** + * Constructor + * * @param \Magento\Framework\Config\ReaderInterface $reader * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache diff --git a/lib/internal/Magento/Framework/DataObject/Copy/Config/Data.php b/lib/internal/Magento/Framework/DataObject/Copy/Config/Data.php index 731eb9d685d51..5f2a1518d485a 100644 --- a/lib/internal/Magento/Framework/DataObject/Copy/Config/Data.php +++ b/lib/internal/Magento/Framework/DataObject/Copy/Config/Data.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\DataObject\Copy\Config; +/** + * Provides DataObject copier configuration + */ class Data extends \Magento\Framework\Config\Data { } diff --git a/lib/internal/Magento/Framework/Event/Config/Data.php b/lib/internal/Magento/Framework/Event/Config/Data.php index d5858be832fee..4b69e59793497 100644 --- a/lib/internal/Magento/Framework/Event/Config/Data.php +++ b/lib/internal/Magento/Framework/Event/Config/Data.php @@ -7,6 +7,9 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides event configuration + */ class Data extends \Magento\Framework\Config\Data\Scoped { /** @@ -17,6 +20,8 @@ class Data extends \Magento\Framework\Config\Data\Scoped protected $_scopePriorityScheme = ['global']; /** + * Constructor + * * @param \Magento\Framework\Event\Config\Reader $reader * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache diff --git a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php index f74213eaf4a06..dc3ddea2c6fa8 100644 --- a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php +++ b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php @@ -83,6 +83,8 @@ class PluginList extends Scoped implements InterceptionPluginList private $logger; /** + * Constructor + * * @param ReaderInterface $reader * @param ScopeInterface $configScope * @param CacheInterface $cache diff --git a/lib/internal/Magento/Framework/Mview/Config/Data.php b/lib/internal/Magento/Framework/Mview/Config/Data.php index 0ddf85d5d5c85..fed3021a161ee 100644 --- a/lib/internal/Magento/Framework/Mview/Config/Data.php +++ b/lib/internal/Magento/Framework/Mview/Config/Data.php @@ -7,6 +7,9 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides materialized view configuration + */ class Data extends \Magento\Framework\Config\Data { /** @@ -15,6 +18,8 @@ class Data extends \Magento\Framework\Config\Data protected $stateCollection; /** + * Constructor + * * @param Reader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param \Magento\Framework\Mview\View\State\CollectionInterface $stateCollection diff --git a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php index 0db65f3b6b5fa..0260af34ef108 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php +++ b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php @@ -11,6 +11,9 @@ use Magento\Framework\ObjectManager\ConfigCacheInterface; use Magento\Framework\ObjectManager\RelationsInterface; +/** + * Provides object manager configuration when in compiled mode + */ class Compiled implements ConfigInterface { /** @@ -34,6 +37,8 @@ class Compiled implements ConfigInterface private $serializer; /** + * Constructor + * * @param array $data */ public function __construct($data) diff --git a/lib/internal/Magento/Framework/Search/Request/Config.php b/lib/internal/Magento/Framework/Search/Request/Config.php index 4793c4b51c4d5..80a963af39b41 100644 --- a/lib/internal/Magento/Framework/Search/Request/Config.php +++ b/lib/internal/Magento/Framework/Search/Request/Config.php @@ -7,6 +7,9 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Provides search request configuration + */ class Config extends \Magento\Framework\Config\Data { /** @@ -15,6 +18,8 @@ class Config extends \Magento\Framework\Config\Data const CACHE_ID = 'request_declaration'; /** + * Constructor + * * @param \Magento\Framework\Search\Request\Config\FilesystemReader $reader * @param \Magento\Framework\Config\CacheInterface $cache * @param string|null $cacheId diff --git a/setup/src/Magento/Setup/Module/Di/Code/Generator/PluginList.php b/setup/src/Magento/Setup/Module/Di/Code/Generator/PluginList.php index 5853ae8a51cec..851bfa8c36313 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Generator/PluginList.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Generator/PluginList.php @@ -7,6 +7,9 @@ use Magento\Framework\Interception; +/** + * Provides plugin list configuration + */ class PluginList extends Interception\PluginList\PluginList { /** From 2db8223269b7e72c8706ed93cb3c6f640aecc1d1 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 27 Oct 2016 17:50:41 -0500 Subject: [PATCH 1666/3232] MAGETWO-58692: Refactor Module_Webapi, Module_Elasticsearch Fixing tests (cherry picked from commit 5b636d0) --- .../testsuite/Magento/Webapi/Model/ServiceMetadataTest.php | 7 ++++--- .../testsuite/Magento/Webapi/Model/Soap/ConfigTest.php | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php index 7bfbe08a34a09..8fac1c9b0e703 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php @@ -7,10 +7,11 @@ use Magento\TestFramework\Helper\Bootstrap; use Magento\Customer\Api\AccountManagementInterface; +use Magento\Framework\Exception\LocalizedException; class ServiceMetadataTest extends \PHPUnit_Framework_TestCase { - /**bootstrap.sh + /** * @var ServiceMetadata */ private $serviceMetadata; @@ -57,7 +58,7 @@ public function testGetServiceMetadata() ] ], 'throws' => [ - "\\Magento\\Framework\\Exception\\LocalizedException" + '\\' . LocalizedException::class ] ] ] @@ -106,7 +107,7 @@ public function testGetRouteMetadata() ] ], 'throws' => [ - "\\Magento\\Framework\\Exception\\LocalizedException" + '\\' . LocalizedException::class ] ] ] diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index 95743e9e10537..ff1634c60782a 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -8,6 +8,7 @@ use Magento\TestFramework\Helper\Bootstrap; use Magento\Customer\Api\AccountManagementInterface; use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\Exception\LocalizedException; class ConfigTest extends \PHPUnit_Framework_TestCase { @@ -60,7 +61,7 @@ public function testGetRequestedSoapServices() ] ], 'throws' => [ - "\\Magento\\Framework\\Exception\\LocalizedException" + '\\' . LocalizedException::class ] ] ] From 71335bdcd5a20cfea63cb7ca5a1ebe5bd8bcb1ad Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 4 Nov 2016 16:51:34 -0500 Subject: [PATCH 1667/3232] MAGETWO-59444: Create serializer interface and json class in framework --- lib/internal/Magento/Framework/Serialize/Serializer/Json.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Serialize/Serializer/Json.php b/lib/internal/Magento/Framework/Serialize/Serializer/Json.php index bf7a34c21fbdd..9c5e55b194165 100644 --- a/lib/internal/Magento/Framework/Serialize/Serializer/Json.php +++ b/lib/internal/Magento/Framework/Serialize/Serializer/Json.php @@ -9,7 +9,6 @@ /** * Class for serializing data to json string and unserializing json string to data - * */ class Json implements SerializerInterface { From 601895025643eb040921230c2021008726d0c372 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 4 Nov 2016 17:07:19 -0500 Subject: [PATCH 1668/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding class and __constructor descriptions --- .../Magento/TestFramework/Interception/PluginList.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php b/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php index 07c2c698eee00..c696e362841a2 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php @@ -7,6 +7,9 @@ use Magento\Framework\Serialize\SerializerInterface; +/** + * Plugin list configuration + */ class PluginList extends \Magento\Framework\Interception\PluginList\PluginList { /** @@ -15,6 +18,8 @@ class PluginList extends \Magento\Framework\Interception\PluginList\PluginList protected $_originScopeScheme = []; /** + * Constructor + * * @param \Magento\Framework\Config\ReaderInterface $reader * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache @@ -26,7 +31,6 @@ class PluginList extends \Magento\Framework\Interception\PluginList\PluginList * @param array $scopePriorityScheme * @param string|null $cacheId * @param SerializerInterface|null $serializer - * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( From 8bac8b032bdd09ca5e849a2bdb3503f0111e99e8 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 4 Nov 2016 17:08:15 -0500 Subject: [PATCH 1669/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding class and __constructor descriptions --- .../framework/Magento/TestFramework/Interception/PluginList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php b/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php index c696e362841a2..18cdc66cb3f2e 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php @@ -8,7 +8,7 @@ use Magento\Framework\Serialize\SerializerInterface; /** - * Plugin list configuration + * Provides plugin list configuration */ class PluginList extends \Magento\Framework\Interception\PluginList\PluginList { From 57b33ce6c83873e2da7492122f3470a5e6d7b2d3 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 4 Nov 2016 17:14:02 -0500 Subject: [PATCH 1670/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding class and __constructor descriptions --- dev/tests/integration/etc/install-config-mysql.php.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/etc/install-config-mysql.php.dist b/dev/tests/integration/etc/install-config-mysql.php.dist index 6fffcb22b5000..981d1bd073419 100644 --- a/dev/tests/integration/etc/install-config-mysql.php.dist +++ b/dev/tests/integration/etc/install-config-mysql.php.dist @@ -7,7 +7,7 @@ return [ 'db-host' => 'localhost', 'db-user' => 'root', - 'db-password' => '123123q', + 'db-password' => 'vagrant', 'db-name' => 'magento_integration_tests', 'db-prefix' => '', 'backend-frontname' => 'backend', From 287c7733ae368f040d6afe2d99279154911ede9f Mon Sep 17 00:00:00 2001 From: Joan He Date: Fri, 4 Nov 2016 17:16:25 -0500 Subject: [PATCH 1671/3232] MAGETWO-59764: Create serialize class in framework --- .../testsuite/Magento/Test/Legacy/_files/security/blacklist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php index 3c93d37deba52..42b8e68e78411 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php @@ -6,4 +6,5 @@ return [ 'Test/Unit', 'lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php', + 'lib/internal/Magento/Framework/Serialize/Serializer/Serialize.php', ]; From 2ee6dbfd3f5307734c626418e3ba7533db76ca36 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Fri, 4 Nov 2016 17:46:27 -0500 Subject: [PATCH 1672/3232] MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data Adding class and __constructor descriptions --- dev/tests/integration/etc/install-config-mysql.php.dist | 2 +- .../Magento/Framework/App/ResourceConnection/Config.php | 2 ++ lib/internal/Magento/Framework/Config/Data.php | 2 +- lib/internal/Magento/Framework/Config/Data/Scoped.php | 5 +++++ .../Framework/Interception/PluginList/PluginList.php | 9 +++++++-- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/etc/install-config-mysql.php.dist b/dev/tests/integration/etc/install-config-mysql.php.dist index 981d1bd073419..6fffcb22b5000 100644 --- a/dev/tests/integration/etc/install-config-mysql.php.dist +++ b/dev/tests/integration/etc/install-config-mysql.php.dist @@ -7,7 +7,7 @@ return [ 'db-host' => 'localhost', 'db-user' => 'root', - 'db-password' => 'vagrant', + 'db-password' => '123123q', 'db-name' => 'magento_integration_tests', 'db-prefix' => '', 'backend-frontname' => 'backend', diff --git a/lib/internal/Magento/Framework/App/ResourceConnection/Config.php b/lib/internal/Magento/Framework/App/ResourceConnection/Config.php index da0b4d3b033e4..79500c4b1073e 100644 --- a/lib/internal/Magento/Framework/App/ResourceConnection/Config.php +++ b/lib/internal/Magento/Framework/App/ResourceConnection/Config.php @@ -21,6 +21,8 @@ class Config extends \Magento\Framework\Config\Data\Scoped implements ConfigInte protected $_connectionNames = []; /** + * Constructor + * * @param Config\Reader $reader * @param \Magento\Framework\Config\ScopeInterface $configScope * @param \Magento\Framework\Config\CacheInterface $cache diff --git a/lib/internal/Magento/Framework/Config/Data.php b/lib/internal/Magento/Framework/Config/Data.php index 57b6769d3e559..1169abafccd8f 100644 --- a/lib/internal/Magento/Framework/Config/Data.php +++ b/lib/internal/Magento/Framework/Config/Data.php @@ -68,7 +68,7 @@ class Data implements \Magento\Framework\Config\DataInterface /** * @var SerializerInterface */ - protected $serializer; + private $serializer; /** * Constructor diff --git a/lib/internal/Magento/Framework/Config/Data/Scoped.php b/lib/internal/Magento/Framework/Config/Data/Scoped.php index 02379834c5e78..f9c151e867b89 100644 --- a/lib/internal/Magento/Framework/Config/Data/Scoped.php +++ b/lib/internal/Magento/Framework/Config/Data/Scoped.php @@ -55,6 +55,11 @@ class Scoped extends \Magento\Framework\Config\Data */ protected $_loadedScopes = []; + /** + * @var SerializerInterface + */ + private $serializer; + /** * Constructor * diff --git a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php index dc3ddea2c6fa8..eacd4e8493237 100644 --- a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php +++ b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php @@ -82,6 +82,11 @@ class PluginList extends Scoped implements InterceptionPluginList */ private $logger; + /** + * @var SerializerInterface + */ + private $serializer; + /** * Constructor * @@ -111,8 +116,8 @@ public function __construct( $cacheId = 'plugins', SerializerInterface $serializer = null ) { - $serializer = $serializer ?: $objectManager->get(Serialize::class); - parent::__construct($reader, $configScope, $cache, $cacheId, $serializer); + $this->serializer = $serializer ?: $objectManager->get(Serialize::class); + parent::__construct($reader, $configScope, $cache, $cacheId, $this->serializer); $this->_omConfig = $omConfig; $this->_relations = $relations; $this->_definitions = $definitions; From 3b6a8968441197574f29a3875cadaf8869b38994 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Mon, 7 Nov 2016 08:39:45 +0200 Subject: [PATCH 1673/3232] MAGETWO-59626: Error saving configurable product after disabling child products --- .../Product/Edit/Section/BlockGallery.php | 18 ++++++---- .../Block/Adminhtml/Product/ProductForm.xml | 7 +--- ...CanUpdate.php => AssertCanSaveProduct.php} | 11 +++--- .../Test/Fixture/CatalogProductSimple.xml | 4 +-- .../Catalog/Test/Fixture/Product/Image.php | 35 ++++++++++++++++--- .../Product/CreateSimpleProductEntityTest.xml | 5 ++- 6 files changed, 53 insertions(+), 27 deletions(-) rename dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/{AssertProductCanUpdate.php => AssertCanSaveProduct.php} (80%) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php index bc1a0ebc4ce15..5a7ee7970eab6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php @@ -10,8 +10,16 @@ use Magento\Mtf\Client\Locator; use Magento\Ui\Test\Block\Adminhtml\Section; +/** + * Class for product gallery block + */ class BlockGallery extends Section { + /** + * @var string + */ + private $imageLoader = '.image.image-placeholder .file-row'; + /** * Upload product images * @@ -22,12 +30,10 @@ class BlockGallery extends Section */ public function setFieldsData(array $data, SimpleElement $element = null) { - if (isset($data['image'])) { - foreach ($data['image']['value'] as $imageData) { - $uploadElement = $this->_rootElement->find('[name="image"]', Locator::SELECTOR_CSS, 'upload'); - $uploadElement->setValue($imageData['file']); - $this->waitForElementNotVisible('.image.image-placeholder .file-row'); - } + foreach ($data['image']['value'] as $imageData) { + $uploadElement = $element->find('[name="image"]', Locator::SELECTOR_CSS, 'upload'); + $uploadElement->setValue($imageData['file']); + $this->waitForElementNotVisible($this->imageLoader); } return $this; } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml index b4f2d99385cf3..3b66164ebe658 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml @@ -143,7 +143,7 @@ - \Magento\Ui\Test\Block\Adminhtml\Section + \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\BlockGallery [data-index='block_gallery'] css selector @@ -223,9 +223,4 @@ [data-index="related"] css selector - - \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\BlockGallery - [data-index="block_gallery"] - css selector - diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCanSaveProduct.php similarity index 80% rename from dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php rename to dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCanSaveProduct.php index 24f1f9d7714cc..6f0dcd095207e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductCanUpdate.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCanSaveProduct.php @@ -7,12 +7,12 @@ namespace Magento\Catalog\Test\Constraint; /** - * Class AssertProductCanUpdate + * Assert that can save already exist product */ -class AssertProductCanUpdate extends \Magento\Mtf\Constraint\AbstractConstraint +class AssertCanSaveProduct extends \Magento\Mtf\Constraint\AbstractConstraint { /** - * Assert that product with image can update without errors. + * Assert that can save already exist product * * @param \Magento\Mtf\Fixture\FixtureInterface $product * @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit $catalogProductEdit @@ -29,7 +29,8 @@ public function processAssert( $catalogProductEdit->getFormPageActions()->save(); \PHPUnit_Framework_Assert::assertNotEmpty( - $catalogProductEdit->getMessagesBlock()->getSuccessMessage() + $catalogProductEdit->getMessagesBlock()->getSuccessMessage(), + 'Cant save existing product.' ); } @@ -40,6 +41,6 @@ public function processAssert( */ public function toString() { - return 'Product with image was updated without errors.'; + return 'Product was saved without errors.'; } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml index a4ca27a0c9e7c..e8ceb1d088924 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml @@ -36,8 +36,8 @@ - - + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php index 0136c3431fe3c..ad72a6db4f4ce 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/Image.php @@ -15,21 +15,46 @@ class Image extends DataSource { /** - * Image constructor. + * Fixture Factory instance. + * + * @var FixtureFactory + */ + private $fixtureFactory; + + /** + * Fixture data. + * + * @var array + */ + private $fixtureData; + + /** * @param FixtureFactory $fixtureFactory * @param array $params * @param array $data - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct(FixtureFactory $fixtureFactory, array $params, $data = []) { - foreach ($data as $key => &$imageData) { + $this->fixtureFactory = $fixtureFactory; + $this->params = $params; + $this->fixtureData = $data; + } + + /** + * {@inheritdoc} + * @throws \Exception + */ + public function getData($key = null) + { + foreach ($this->fixtureData as &$imageData) { if (isset($imageData['file']) && file_exists(MTF_TESTS_PATH . $imageData['file'])) { $imageData['file'] = MTF_TESTS_PATH . $imageData['file']; } else { - unset($data[$key]); + throw new \Exception("Image '{$imageData['file']}'' not found on the server."); } } - $this->data = $data; + $this->data = $this->fixtureData; + + return parent::getData($key); } } 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 5e0a61a9c0426..9690f409011cf 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 @@ -500,8 +500,7 @@ - - Create product with image and try to save it again + Magento/Catalog/Test/_files/test1.png Magento/Catalog/Test/_files/test2.png simple-product-%isolation% @@ -512,7 +511,7 @@ severity:S1 100 - + From 057033509ec076e7a9c96bee39c8eae53d116aa7 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Mon, 7 Nov 2016 09:17:31 +0200 Subject: [PATCH 1674/3232] MAGETWO-59626: Error saving configurable product after disabling child products --- .../Product/Edit/Section/BlockGallery.php | 15 ++++++++++++--- .../Test/Constraint/AssertCanSaveProduct.php | 8 ++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php index 5a7ee7970eab6..bc0d0b87f24bb 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/BlockGallery.php @@ -11,17 +11,26 @@ use Magento\Ui\Test\Block\Adminhtml\Section; /** - * Class for product gallery block + * Class for product gallery block. */ class BlockGallery extends Section { /** + * Selector for image loader container. + * * @var string */ private $imageLoader = '.image.image-placeholder .file-row'; /** - * Upload product images + * Selector for image upload input. + * + * @var string + */ + private $imageUploadInput = '[name="image"]'; + + /** + * Upload product images. * * @param array $data * @param SimpleElement|null $element @@ -31,7 +40,7 @@ class BlockGallery extends Section public function setFieldsData(array $data, SimpleElement $element = null) { foreach ($data['image']['value'] as $imageData) { - $uploadElement = $element->find('[name="image"]', Locator::SELECTOR_CSS, 'upload'); + $uploadElement = $element->find($this->imageUploadInput, Locator::SELECTOR_CSS, 'upload'); $uploadElement->setValue($imageData['file']); $this->waitForElementNotVisible($this->imageLoader); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCanSaveProduct.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCanSaveProduct.php index 6f0dcd095207e..04e1c034b3db7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCanSaveProduct.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCanSaveProduct.php @@ -7,12 +7,12 @@ namespace Magento\Catalog\Test\Constraint; /** - * Assert that can save already exist product + * Assert that can save already exist product. */ class AssertCanSaveProduct extends \Magento\Mtf\Constraint\AbstractConstraint { /** - * Assert that can save already exist product + * Assert that can save already existing product. * * @param \Magento\Mtf\Fixture\FixtureInterface $product * @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit $catalogProductEdit @@ -30,12 +30,12 @@ public function processAssert( \PHPUnit_Framework_Assert::assertNotEmpty( $catalogProductEdit->getMessagesBlock()->getSuccessMessage(), - 'Cant save existing product.' + 'Can\'t save existing product.' ); } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ From d33d5c0ec78823ea4c7b8ffbb91322eafc5c7ac6 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Mon, 7 Nov 2016 09:45:54 +0200 Subject: [PATCH 1675/3232] MAGETWO-59739: [FT] Magento\Checkout\Test\TestCase\OnePageCheckoutTest fails randomly on CI --- .../app/Magento/Checkout/Test/Block/Onepage/Payment.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php index 82693052680aa..ce8f5a4cbfd99 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php @@ -8,7 +8,6 @@ use Magento\Mtf\Block\Block; use Magento\Mtf\Fixture\InjectableFixture; -use Magento\Payment\Test\Fixture\CreditCard; /** * Checkout payment block. @@ -90,7 +89,12 @@ public function selectPaymentMethod(array $payment, InjectableFixture $creditCar } catch (\Exception $exception) { throw new \Exception('Such payment method is absent.'); } - $this->waitForElementVisible($paymentSelector); + $browser = $this->browser; + $browser->waitUntil( + function () use ($browser, $paymentSelector) { + return $browser->find($paymentSelector); + } + ); $paymentRadioButton = $this->_rootElement->find($paymentSelector); if ($paymentRadioButton->isVisible()) { $paymentRadioButton->click(); From fdbad2e0cccf10413d49a1e02fea2e80be6ab0f4 Mon Sep 17 00:00:00 2001 From: Olexandr Lysenko Date: Mon, 7 Nov 2016 10:48:59 +0200 Subject: [PATCH 1676/3232] MAGETWO-60397 [GITHUB] Fix incorrect table name during catalog product indexing #7256 --- .../Product/Flat/FlatTableBuilderTest.php | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php index 83b6a7ac8eb48..d90261f068f50 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php @@ -122,11 +122,7 @@ public function testBuild() $eavCustomValueField = $eavCustomField . $valueFieldSuffix; $this->flatIndexerMock->expects($this->once())->method('getAttributes')->willReturn([]); $this->flatIndexerMock->expects($this->exactly(3))->method('getFlatColumns') - ->willReturnOnConsecutiveCalls( - [], - [$eavCustomValueField => []], - [$eavCustomValueField => []] - ); + ->willReturnOnConsecutiveCalls([], [$eavCustomValueField => []], [$eavCustomValueField => []]); $this->flatIndexerMock->expects($this->once())->method('getFlatIndexes')->willReturn([]); $statusAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class) ->disableOriginalConstructor() @@ -137,9 +133,7 @@ public function testBuild() $this->flatIndexerMock->expects($this->once())->method('getTablesStructure') ->willReturn( [ - 'catalog_product_entity' => [ - $linkField => $statusAttributeMock - ], + 'catalog_product_entity' => [$linkField => $statusAttributeMock], 'catalog_product_entity_int' => [ $linkField => $statusAttributeMock, $eavCustomField => $eavCustomAttributeMock @@ -147,14 +141,8 @@ public function testBuild() ] ); $this->flatIndexerMock->expects($this->atLeastOnce())->method('getTable') - ->withConsecutive( - [$tableName], - ['catalog_product_website'] - ) - ->willReturnOnConsecutiveCalls( - $tableName, - 'catalog_product_website' - ); + ->withConsecutive([$tableName], ['catalog_product_website']) + ->willReturnOnConsecutiveCalls($tableName, 'catalog_product_website'); $this->flatIndexerMock->expects($this->once())->method('getAttribute') ->with('status') ->willReturn($statusAttributeMock); From ab11bcc1077a101cd0ffb945396f2ee9b67b8b9b Mon Sep 17 00:00:00 2001 From: Oleksandr Radchenko Date: Mon, 7 Nov 2016 11:04:26 +0200 Subject: [PATCH 1677/3232] MAGETWO-59074: Creditmemo return to stock only one unit of configurable product --- .../Test/Unit/Observer/RefundOrderInventoryObserverTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesInventory/Test/Unit/Observer/RefundOrderInventoryObserverTest.php b/app/code/Magento/SalesInventory/Test/Unit/Observer/RefundOrderInventoryObserverTest.php index 8bcd178bdded5..4e553493d07f6 100644 --- a/app/code/Magento/SalesInventory/Test/Unit/Observer/RefundOrderInventoryObserverTest.php +++ b/app/code/Magento/SalesInventory/Test/Unit/Observer/RefundOrderInventoryObserverTest.php @@ -68,7 +68,7 @@ class RefundOrderInventoryObserverTest extends \PHPUnit_Framework_TestCase /** * @var OrderInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $orderMock; + private $orderMock; protected function setUp() { From daf307fc6f714eeb5e444bf2e6c6250618b23e29 Mon Sep 17 00:00:00 2001 From: Oleksandr Radchenko Date: Mon, 7 Nov 2016 11:38:25 +0200 Subject: [PATCH 1678/3232] MAGETWO-59074: Creditmemo return to stock only one unit of configurable product --- .../Observer/RefundOrderInventoryObserver.php | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php b/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php index 1d856c612a795..6560fa1bc2afa 100644 --- a/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php +++ b/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php @@ -22,22 +22,22 @@ class RefundOrderInventoryObserver implements ObserverInterface /** * @var StockConfigurationInterface */ - protected $stockConfiguration; + private $stockConfiguration; /** * @var StockManagementInterface */ - protected $stockManagement; + private $stockManagement; /** * @var \Magento\CatalogInventory\Model\Indexer\Stock\Processor */ - protected $stockIndexerProcessor; + private $stockIndexerProcessor; /** * @var \Magento\Catalog\Model\Indexer\Product\Price\Processor */ - protected $priceIndexer; + private $priceIndexer; /** * @var \Magento\SalesInventory\Model\Order\ReturnProcessor @@ -59,12 +59,14 @@ public function __construct( StockConfigurationInterface $stockConfiguration, StockManagementInterface $stockManagement, \Magento\CatalogInventory\Model\Indexer\Stock\Processor $stockIndexerProcessor, - \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer + \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer, + \Magento\Framework\App\ObjectManager $returnProcessor ) { $this->stockConfiguration = $stockConfiguration; $this->stockManagement = $stockManagement; $this->stockIndexerProcessor = $stockIndexerProcessor; $this->priceIndexer = $priceIndexer; + $this->returnProcessor = $returnProcessor; } /** @@ -84,7 +86,7 @@ public function execute(EventObserver $observer) $returnToStockItems[] = $item->getOrderItemId(); } } - $this->getReturnProcessor()->execute( + $this->returnProcessor->execute( $creditmemo, $order, $returnToStockItems, @@ -107,18 +109,4 @@ private function getOrderRepository() } return $this->orderRepository; } - - /** - * Get OrderRepository - * - * @return ReturnProcessor - * @deprecated - */ - private function getReturnProcessor() - { - if (!$this->returnProcessor) { - $this->returnProcessor = \Magento\Framework\App\ObjectManager::getInstance()->get(ReturnProcessor::class); - } - return $this->returnProcessor; - } } From 38ecb6e3f05780e8ba412ce5a27b8e521d4a51dd Mon Sep 17 00:00:00 2001 From: Oleksandr Radchenko Date: Mon, 7 Nov 2016 11:56:03 +0200 Subject: [PATCH 1679/3232] MAGETWO-59074: Creditmemo return to stock only one unit of configurable product --- .../SalesInventory/Observer/RefundOrderInventoryObserver.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php b/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php index 6560fa1bc2afa..86b2cd081d666 100644 --- a/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php +++ b/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php @@ -50,10 +50,12 @@ class RefundOrderInventoryObserver implements ObserverInterface private $orderRepository; /** + * RefundOrderInventoryObserver constructor. * @param StockConfigurationInterface $stockConfiguration * @param StockManagementInterface $stockManagement * @param \Magento\CatalogInventory\Model\Indexer\Stock\Processor $stockIndexerProcessor * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer + * @param \Magento\Framework\App\ObjectManager $returnProcessor */ public function __construct( StockConfigurationInterface $stockConfiguration, From 5be6aa52d3d25dccdb50f44b2087dc4b5547ac25 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Mon, 7 Nov 2016 12:01:43 +0200 Subject: [PATCH 1680/3232] MAGETWO-59626: Error saving configurable product after disabling child products --- .../AssertProductHasImageInGrid.php | 45 +++++++++++++++++++ .../Product/CreateSimpleProductEntityTest.xml | 1 + 2 files changed, 46 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php new file mode 100644 index 0000000000000..7a21e7498962d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php @@ -0,0 +1,45 @@ + $product->getSku()]; + $productGrid->open(); + $productGrid->getProductGrid()->search($filter); + $src = $productGrid->getProductGrid()->getBaseImageSource(); + \PHPUnit_Framework_Assert::assertTrue( + strpos($src, '/placeholder/') === false, + 'Product image is not present in product grid when it should be' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Product image is displayed in product grid.'; + } +} \ No newline at end of file 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 b26c94e627cdc..9f4a5e4bb71fe 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 @@ -520,6 +520,7 @@ severity:S1 100 + From 0ade71c5c78cdb284ae630901f6ac4f662ab4d9a Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Mon, 7 Nov 2016 12:10:31 +0200 Subject: [PATCH 1681/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60467: Simple product name not displayed as options on product page --- .../Block/Catalog/Product/View/Type/Bundle.php | 8 ++++---- app/code/Magento/Bundle/Model/Product/Type.php | 17 +---------------- .../ResourceModel/Selection/Collection.php | 17 +++-------------- .../Bundle/Pricing/Adjustment/Calculator.php | 8 ++++++-- .../Catalog/Product/View/Type/BundleTest.php | 6 +++--- .../Bundle/Test/Unit/Model/Product/TypeTest.php | 2 +- .../{Collection.php => CollectionProcessor.php} | 5 ++++- .../Model/ResourceModel/AddCatalogRulePrice.php | 6 +++--- 8 files changed, 25 insertions(+), 44 deletions(-) rename app/code/Magento/CatalogRule/Model/ResourceModel/Product/{Collection.php => CollectionProcessor.php} (97%) diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index b413dde5c244c..9fb752be81a6c 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -49,7 +49,7 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView private $selectedOptions = []; /** - * @var \Magento\CatalogRule\Model\ResourceModel\Product\Collection + * @var \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor */ private $catalogRuleProcessor; @@ -84,13 +84,13 @@ public function __construct( /** * @deprecated - * @return \Magento\CatalogRule\Model\ResourceModel\Product\Collection + * @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor */ private function getCatalogRuleProcessor() { if ($this->catalogRuleProcessor === null) { $this->catalogRuleProcessor = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\CatalogRule\Model\ResourceModel\Product\Collection::class); + ->get(\Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor::class); } return $this->catalogRuleProcessor; @@ -114,7 +114,7 @@ public function getOptions($stripSelection = false) $optionCollection = $typeInstance->getOptionsCollection($product); - $selectionCollection = clone $typeInstance->getSelectionsCollection( + $selectionCollection = $typeInstance->getSelectionsCollection( $typeInstance->getOptionsIds($product), $product ); diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index 31789442ce63b..4cfdf27fd0e6a 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -43,6 +43,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * Cache key for Selections Collection * * @var string + * @deprecated */ protected $_keySelectionsCollection = '_cache_instance_selections_collection'; @@ -449,22 +450,6 @@ public function getOptionsCollection($product) * @return \Magento\Bundle\Model\ResourceModel\Selection\Collection */ public function getSelectionsCollection($optionIds, $product) - { - $keyOptionIds = is_array($optionIds) ? implode('_', $optionIds) : ''; - $key = $this->_keySelectionsCollection . $keyOptionIds; - if (!$product->hasData($key)) { - $product->setData($key, $this->buildSelectionCollection($optionIds, $product)); - } - - return $product->getData($key); - } - - /** - * @param array $optionIds - * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Bundle\Model\ResourceModel\Selection\Collection - */ - private function buildSelectionCollection($optionIds, $product) { $storeId = $product->getStoreId(); $selectionsCollection = $this->_bundleCollection->create() diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index d1bbc8e7bbd40..4b64cb90c3118 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -27,7 +27,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection private $itemPrototype = null; /** - * @var \Magento\CatalogRule\Model\ResourceModel\Product\Collection + * @var \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor */ private $catalogRuleProcessor = null; @@ -241,27 +241,16 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) } /** - * @return \Magento\CatalogRule\Model\ResourceModel\Product\Collection + * @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor * @deprecated */ private function getCatalogRuleProcessor() { if (null === $this->catalogRuleProcessor) { $this->catalogRuleProcessor = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\CatalogRule\Model\ResourceModel\Product\Collection::class); + ->get(\Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor::class); } return $this->catalogRuleProcessor; } - - /** - * Clear collection data after clone - * @return void - */ - public function __clone() - { - parent::__clone(); - $this->removeAttributeToSelect(); - $this->clear(); - } } diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index b466f4600632a..7821c7f569be5 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -205,15 +205,19 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR if ($this->canSkipOption($option, $canSkipRequiredOptions)) { continue; } + /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ $typeInstance = $bundleProduct->getTypeInstance(); - $selectionsCollection = clone $typeInstance->getSelectionsCollection( + $selectionsCollection = $typeInstance->getSelectionsCollection( [(int)$option->getId()], $bundleProduct ); + $selectionsCollection->removeAttributeToSelect(); $selectionsCollection->addQuantityFilter(); if ($option->isMultiSelection() && !$searchMin) { + $selectionsCollection->addPriceData(); + foreach ($selectionsCollection as $selection) { $priceList[] = $this->selectionFactory->create( $bundleProduct, @@ -284,7 +288,7 @@ protected function hasRequiredOption($bundleProduct) { /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ $typeInstance = $bundleProduct->getTypeInstance(); - $collection = clone $typeInstance->getOptionsCollection($bundleProduct); + $collection = $typeInstance->getOptionsCollection($bundleProduct); return $collection->addFilter(\Magento\Bundle\Model\Option::KEY_REQUIRED, 1)->getSize() > 0; } diff --git a/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php b/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php index 72cb634127404..a0cad837e8657 100644 --- a/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php @@ -91,9 +91,9 @@ protected function setUp() ] ); - $ruleProcessor = $this->getMockBuilder(\Magento\CatalogRule\Model\ResourceModel\Product\Collection::class) - ->disableOriginalConstructor() - ->getMock(); + $ruleProcessor = $this->getMockBuilder( + \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor::class + )->disableOriginalConstructor()->getMock(); $objectHelper->setBackwardCompatibleProperty( $this->bundleBlock, 'catalogRuleProcessor', diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php index 004e717f15680..fa18a9cb015f1 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php @@ -117,7 +117,7 @@ protected function setUp() ->getMock(); $this->catalogRuleProcessor = $this->getMockBuilder( - \Magento\CatalogRule\Model\ResourceModel\Product\Collection::class + \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor::class ) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/CatalogRule/Model/ResourceModel/Product/Collection.php b/app/code/Magento/CatalogRule/Model/ResourceModel/Product/CollectionProcessor.php similarity index 97% rename from app/code/Magento/CatalogRule/Model/ResourceModel/Product/Collection.php rename to app/code/Magento/CatalogRule/Model/ResourceModel/Product/CollectionProcessor.php index 69dcfa59495e4..686fc3de62368 100644 --- a/app/code/Magento/CatalogRule/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/CatalogRule/Model/ResourceModel/Product/CollectionProcessor.php @@ -9,7 +9,10 @@ use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection; use Magento\CatalogRule\Pricing\Price\CatalogRulePrice; -class Collection +/** + * Add catalog rule prices to collection + */ +class CollectionProcessor { /** * @var \Magento\Store\Model\StoreManagerInterface diff --git a/app/code/Magento/CatalogRuleConfigurable/Plugin/ConfigurableProduct/Model/ResourceModel/AddCatalogRulePrice.php b/app/code/Magento/CatalogRuleConfigurable/Plugin/ConfigurableProduct/Model/ResourceModel/AddCatalogRulePrice.php index 788e43bd873a1..c7f97f770c3fb 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Plugin/ConfigurableProduct/Model/ResourceModel/AddCatalogRulePrice.php +++ b/app/code/Magento/CatalogRuleConfigurable/Plugin/ConfigurableProduct/Model/ResourceModel/AddCatalogRulePrice.php @@ -12,15 +12,15 @@ class AddCatalogRulePrice { /** - * @var \Magento\CatalogRule\Model\ResourceModel\Product\CollectionFactory + * @var \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessorFactory */ private $catalogRuleCollectionFactory; /** - * @param \Magento\CatalogRule\Model\ResourceModel\Product\CollectionFactory $catalogRuleCollectionFactory + * @param \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessorFactory $catalogRuleCollectionFactory */ public function __construct( - \Magento\CatalogRule\Model\ResourceModel\Product\CollectionFactory $catalogRuleCollectionFactory + \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessorFactory $catalogRuleCollectionFactory ) { $this->catalogRuleCollectionFactory = $catalogRuleCollectionFactory; } From 67a4d7ad5c91570cf10fe182f6d52d1bdb8672c0 Mon Sep 17 00:00:00 2001 From: Oleksandr Radchenko Date: Mon, 7 Nov 2016 14:22:23 +0200 Subject: [PATCH 1682/3232] MAGETWO-59074: Creditmemo return to stock only one unit of configurable product --- .../Observer/RefundOrderInventoryObserver.php | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php b/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php index 86b2cd081d666..acdebcf976a2e 100644 --- a/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php +++ b/app/code/Magento/SalesInventory/Observer/RefundOrderInventoryObserver.php @@ -55,20 +55,23 @@ class RefundOrderInventoryObserver implements ObserverInterface * @param StockManagementInterface $stockManagement * @param \Magento\CatalogInventory\Model\Indexer\Stock\Processor $stockIndexerProcessor * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer - * @param \Magento\Framework\App\ObjectManager $returnProcessor + * @param ReturnProcessor $returnProcessor + * @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository */ public function __construct( StockConfigurationInterface $stockConfiguration, StockManagementInterface $stockManagement, \Magento\CatalogInventory\Model\Indexer\Stock\Processor $stockIndexerProcessor, \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer, - \Magento\Framework\App\ObjectManager $returnProcessor + \Magento\SalesInventory\Model\Order\ReturnProcessor $returnProcessor, + \Magento\Sales\Api\OrderRepositoryInterface $orderRepository ) { $this->stockConfiguration = $stockConfiguration; $this->stockManagement = $stockManagement; $this->stockIndexerProcessor = $stockIndexerProcessor; $this->priceIndexer = $priceIndexer; $this->returnProcessor = $returnProcessor; + $this->orderRepository = $orderRepository; } /** @@ -81,7 +84,7 @@ public function execute(EventObserver $observer) { /* @var $creditmemo \Magento\Sales\Model\Order\Creditmemo */ $creditmemo = $observer->getEvent()->getCreditmemo(); - $order = $this->getOrderRepository()->get($creditmemo->getOrderId()); + $order = $this->orderRepository->get($creditmemo->getOrderId()); $returnToStockItems = []; foreach ($creditmemo->getItems() as $item) { if ($item->getBackToStock()) { @@ -95,20 +98,4 @@ public function execute(EventObserver $observer) $this->stockConfiguration->isAutoReturnEnabled() ); } - - /** - * Get OrderRepository - * - * @return OrderRepository - * @deprecated - */ - private function getOrderRepository() - { - if (!$this->orderRepository) { - $this->orderRepository = \Magento\Framework\App\ObjectManager::getInstance() - ->get(OrderRepository::class); - - } - return $this->orderRepository; - } } From 3ebf94ff6e476b530336d04a345d0df298b52ad1 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Mon, 7 Nov 2016 14:59:33 +0200 Subject: [PATCH 1683/3232] MAGETWO-59626: Error saving configurable product after disabling child products --- .../Catalog/Test/Constraint/AssertProductHasImageInGrid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php index 7a21e7498962d..fed3b36c08d66 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductHasImageInGrid.php @@ -42,4 +42,4 @@ public function toString() { return 'Product image is displayed in product grid.'; } -} \ No newline at end of file +} From 9b5e2b9caa699c9c8babedc03b22970c3f009aae Mon Sep 17 00:00:00 2001 From: Andrii Dimov Date: Mon, 7 Nov 2016 17:41:37 +0200 Subject: [PATCH 1684/3232] MAGETWO-59215: Optimize composer.json autoload --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index adcb47fc507d0..7840f84720b6c 100644 --- a/composer.json +++ b/composer.json @@ -249,4 +249,4 @@ }, "minimum-stability": "alpha", "prefer-stable": true -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index ac04d3c52262a..7b3c6ccc9928d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "0a4e3eece0328aec9aa46e797a1d0269", + "hash": "8c0f23eee8426e8aeba5a897f6f2ccbd", "content-hash": "600aca1692cf3fe5c2ea1cbf66de09ab", "packages": [ { From 279afd99c64457fef88a08a3b7a7292bceaad920 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Mon, 7 Nov 2016 17:45:05 +0200 Subject: [PATCH 1685/3232] MAGETWO-54263: [FT] OnlineRefundTest and CloseOrderTest is failed by syntax error in Magento\Tax\Test\Handler\Curl\RemoveTaxRule.php --- .../tests/app/Magento/Tax/Test/Handler/Curl/RemoveTaxRule.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/Curl/RemoveTaxRule.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/Curl/RemoveTaxRule.php index 31ca2396f0782..3e69145b42b34 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/Curl/RemoveTaxRule.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/Curl/RemoveTaxRule.php @@ -39,9 +39,9 @@ class RemoveTaxRule extends Curl public function persist(FixtureInterface $fixture = null) { $this->taxRuleGridUrl = $_ENV['app_backend_url'] . 'tax/rule/index/'; - $curl = $this->_getCurl($this->taxRuleGridUrl); + $curl = $this->getCurl($this->taxRuleGridUrl); $response = $curl->read(); - $this->_removeTaxRules($response); + $this->removeTaxRules($response); $curl->close(); return $response; } From 7a78408fa0f4f623cd7235992ea5fbecbca733bc Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko Date: Mon, 7 Nov 2016 18:20:51 +0200 Subject: [PATCH 1686/3232] MAGETWO-60453: DeleteSavedCreditCardTest fails on bamboo - added alternative Visa --- .../app/Magento/Payment/Test/Repository/CreditCard.xml | 9 ++++++++- .../Vault/Test/TestCase/DeleteSavedCreditCardTest.xml | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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 index b43173f568261..8e742ab30ba96 100644 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml @@ -14,8 +14,15 @@ 123 + + 4012888888881881 + 02 - February + 2021 + 123 + + - 371449635398431 + 378282246310005 02 - February 2021 1234 diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.xml b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.xml index ac69bfb9f47e4..2cafc815fed1d 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.xml +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestCase/DeleteSavedCreditCardTest.xml @@ -26,7 +26,7 @@ payflowpro credit_card - amex_default + visa_alt @@ -43,7 +43,7 @@ payflowpro credit_card - amex_default + visa_alt payflowpro_cc_vault From 398675248272dd58f7361517e633c30faee6fa84 Mon Sep 17 00:00:00 2001 From: Elena Marchenko Date: Mon, 7 Nov 2016 19:11:50 +0200 Subject: [PATCH 1687/3232] MAGETWO-60591: Update Zephyr tickets id for automated functional tests --- .../Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml | 2 +- .../app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml index ad4d5cc06e92e..6e46c7eeab394 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml @@ -7,7 +7,7 @@ --> - + Reorder from Admin with saved within Braintree credit card for Guest Customer catalogProductSimple::product_10_dollar default diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml index b1da43e473bc5..ad937cf472de7 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ReorderUsingVaultTest.xml @@ -7,7 +7,7 @@ --> - + Reorder from Admin with saved within PayPal Payflow Pro credit card for Guest Customer catalogProductSimple::product_10_dollar default From e7b9f52032639d3cd81ff8caede8ae54209689c0 Mon Sep 17 00:00:00 2001 From: Vitaliy Goncharenko Date: Tue, 1 Nov 2016 18:48:53 +0200 Subject: [PATCH 1688/3232] MAGETWO-53583: "Use Default" checkbox is checked again after saving empty fields (description, name, etc) - fixed integration build --- .../Eav/Model/Entity/Attribute/AbstractAttribute.php | 9 +++++++-- .../Eav/Model/ResourceModel/UpdateHandlerTest.php | 7 +------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index ba6e670ee9642..59a8e7ae2bb5e 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -22,6 +22,11 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens { const TYPE_STATIC = 'static'; + /** + * Const for empty string value. + */ + const EMPTY_STRING = ''; + /** * Attribute name * @@ -621,7 +626,7 @@ public function isValueEmpty($value) return (is_array($value) && count($value) == 0) || $value === null || ($value === false && $this->getBackend()->getType() != 'int') - || ($value === '' && $this->isInEmptyStringTypes()); + || ($value === self::EMPTY_STRING && $this->isInEmptyStringTypes()); } /** @@ -632,7 +637,7 @@ public function isValueEmpty($value) */ public function isAllowedEmptyTextValue($value) { - return $this->isInEmptyStringTypes() && $value === ''; + return $this->isInEmptyStringTypes() && $value === self::EMPTY_STRING; } /** diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php index eb30a7d0168c6..1d5daf1e6aadf 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ResourceModel/UpdateHandlerTest.php @@ -11,12 +11,11 @@ /** * @magentoAppArea adminhtml * @magentoAppIsolation enabled + * @magentoDbIsolation enabled */ class UpdateHandlerTest extends \PHPUnit_Framework_TestCase { /** - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled * @covers \Magento\Eav\Model\ResourceModel\UpdateHandler::execute * @magentoDataFixture Magento/Catalog/_files/product_simple.php * @dataProvider getAllStoresDataProvider @@ -51,8 +50,6 @@ public function testExecuteProcessForAllStores($code, $snapshotValue, $newValue, } /** - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled * @covers \Magento\Eav\Model\ResourceModel\UpdateHandlerTest::execute * @magentoDataFixture Magento/Catalog/_files/product_simple.php * @magentoDataFixture Magento/Store/_files/second_store.php @@ -95,8 +92,6 @@ public function testExecuteProcessForCustomStore($code, $snapshotValue, $newValu } /** - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled * @covers \Magento\Eav\Model\ResourceModel\UpdateHandlerTest::execute * @magentoDataFixture Magento/Catalog/_files/product_simple.php * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php From 82964c2500e425d77f8dcca019861fa72e2e5248 Mon Sep 17 00:00:00 2001 From: Ruslan Kostiv Date: Mon, 7 Nov 2016 19:46:45 +0200 Subject: [PATCH 1689/3232] MAGETWO-33564: [GitHub] Database Schema: Incorrect Unique Indexes #1002 --- .../CatalogInventory/Setup/UpgradeSchema.php | 78 ++++++++++++++++--- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/CatalogInventory/Setup/UpgradeSchema.php b/app/code/Magento/CatalogInventory/Setup/UpgradeSchema.php index f582e2ff9391b..8fd3d264ee67d 100644 --- a/app/code/Magento/CatalogInventory/Setup/UpgradeSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/UpgradeSchema.php @@ -9,6 +9,7 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; +use Magento\CatalogInventory\Model\Stock\Item as StockItem; class UpgradeSchema implements UpgradeSchemaInterface { @@ -40,30 +41,83 @@ private function upgradeProductCompositeKey(SchemaSetupInterface $setup) $oldCompositeKeyColumns = ['product_id', 'website_id']; $newCompositeKeyColumns = ['product_id', 'stock_id']; + $foreignKeys = $this->getForeignKeys($setup, $oldCompositeKeyColumns); + // drop foreign keys + $this->dropForeignKeys($setup, $foreignKeys); + $oldIndexName = $setup->getIdxName( - \Magento\CatalogInventory\Model\Stock\Item::ENTITY, + $setup->getTable(StockItem::ENTITY), $oldCompositeKeyColumns, \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ); $newIndexName = $setup->getIdxName( - \Magento\CatalogInventory\Model\Stock\Item::ENTITY, + $setup->getTable(StockItem::ENTITY), $newCompositeKeyColumns, \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ); // Drop a key based on the following columns: "product_id","website_id" - $setup->getConnection()->dropIndex( - $setup->getTable(\Magento\CatalogInventory\Model\Stock\Item::ENTITY), - $oldIndexName - ); + $setup->getConnection()->dropIndex($setup->getTable(StockItem::ENTITY), $oldIndexName); // Create a key based on the following columns: "product_id","stock_id" - $setup->getConnection()->addIndex( - \Magento\CatalogInventory\Model\Stock\Item::ENTITY, - $newIndexName, - $newCompositeKeyColumns, - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ); + $setup->getConnection() + ->addIndex( + $setup->getTable(StockItem::ENTITY), + $newIndexName, + $newCompositeKeyColumns, + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ); + // restore deleted foreign keys + $this->createForeignKeys($setup, $foreignKeys); + } + + /** + * @param SchemaSetupInterface $setup + * @param array $keys + * @return void + */ + private function dropForeignKeys(SchemaSetupInterface $setup, array $keys) + { + foreach ($keys as $key) { + $setup->getConnection()->dropForeignKey($key['TABLE_NAME'], $key['FK_NAME']); + } + } + + /** + * @param SchemaSetupInterface $setup + * @param array $keys + * @return void + */ + private function createForeignKeys(SchemaSetupInterface $setup, array $keys) + { + foreach ($keys as $key) { + $setup->getConnection()->addForeignKey( + $key['FK_NAME'], + $key['TABLE_NAME'], + $key['COLUMN_NAME'], + $key['REF_TABLE_NAME'], + $key['REF_COLUMN_NAME'], + $key['ON_DELETE'] + ); + } + } + + /** + * @param SchemaSetupInterface $setup + * @param array $compositeKeys + * @return array + */ + private function getForeignKeys(SchemaSetupInterface $setup, array $compositeKeys) + { + $foreignKeys = []; + $allForeignKeys = $setup->getConnection()->getForeignKeys($setup->getTable(StockItem::ENTITY)); + foreach ($allForeignKeys as $key) { + if (in_array($key['COLUMN_NAME'], $compositeKeys)) { + $foreignKeys[] = $key; + } + } + + return $foreignKeys; } } From 982731a1e6db3644531a16994ed02a706b17d8ca Mon Sep 17 00:00:00 2001 From: Serhii Dzhepa Date: Tue, 8 Nov 2016 11:20:05 +0200 Subject: [PATCH 1690/3232] MAGETWO-59308: Design theme dropdown does not display all themes in Widgets --- .../Block/Adminhtml/Widget/WidgetGrid.php | 4 ++ ...tWithDifferentThemesArePresentedInGrid.php | 63 +++++++++++++++++++ .../Magento/Widget/Test/Repository/Widget.xml | 14 +++++ .../AbstractCreateWidgetEntityTest.php | 12 +++- .../Test/TestCase/CreateWidgetEntityTest.php | 18 ++++-- .../Test/TestCase/CreateWidgetEntityTest.xml | 11 ++++ .../tests/app/Magento/Widget/Test/etc/di.xml | 5 ++ 7 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetWithDifferentThemesArePresentedInGrid.php diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php index 50a5657a47830..3906631741beb 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php @@ -36,5 +36,9 @@ class WidgetGrid extends AbstractGrid 'title' => [ 'selector' => 'input[name="title"]', ], + 'theme_id' => [ + 'selector' => 'select[name="theme_id"]', + 'input' => 'select', + ], ]; } diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetWithDifferentThemesArePresentedInGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetWithDifferentThemesArePresentedInGrid.php new file mode 100644 index 0000000000000..445357bd5f914 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetWithDifferentThemesArePresentedInGrid.php @@ -0,0 +1,63 @@ +open(); + $widgetGrid = $widgetInstanceIndex->getWidgetGrid(); + + foreach ($additionalWidgets as $widget) { + $filter = [ + 'title' => $widget->getTitle(), + 'theme_id' => $widget->getThemeId(), + ]; + $widgetGrid->search($filter); + $expectedData[] = $filter; + $actualData[] = $widgetGrid->getRowsData(array_keys($filter))[0]; + } + + \PHPUnit_Framework_Assert::assertEquals( + $expectedData, + $actualData, + 'Not all expected widgets are present in grid.' + ); + } + + /** + * Returns a string representation of the object + * + * @return string + */ + public function toString() + { + return 'Widgets with different themes are present in widget grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget.xml index dc39ed7fa1259..81c6ea28f56c9 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget.xml @@ -25,5 +25,19 @@ cmsPageLink + + Recently Viewed Products + Title_%isolation% + Magento Blank + + all_store_views + + + for_viewed_products + + + recentlyViewedProducts + + diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php index 235361aee8b7e..c5f920a6c893b 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php @@ -6,6 +6,7 @@ namespace Magento\Widget\Test\TestCase; +use Magento\Mtf\Fixture\FixtureFactory; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceEdit; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceIndex; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceNew; @@ -53,6 +54,11 @@ abstract class AbstractCreateWidgetEntityTest extends Injectable */ protected $cache; + /** + * @var FixtureFactory + */ + protected $fixtureFactory; + /** * Injection data. * @@ -61,20 +67,22 @@ abstract class AbstractCreateWidgetEntityTest extends Injectable * @param WidgetInstanceEdit $widgetInstanceEdit * @param CmsIndex $cmsIndex * @param Cache $cache - * @return void + * @param FixtureFactory $fixtureFactory */ public function __inject( WidgetInstanceIndex $widgetInstanceIndex, WidgetInstanceNew $widgetInstanceNew, WidgetInstanceEdit $widgetInstanceEdit, CmsIndex $cmsIndex, - Cache $cache + Cache $cache, + FixtureFactory $fixtureFactory ) { $this->widgetInstanceIndex = $widgetInstanceIndex; $this->widgetInstanceNew = $widgetInstanceNew; $this->widgetInstanceEdit = $widgetInstanceEdit; $this->cmsIndex = $cmsIndex; $this->cache = $cache; + $this->fixtureFactory = $fixtureFactory; } /** diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php index 6358ac8821f26..a61bc7f060a01 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php @@ -25,8 +25,7 @@ class CreateWidgetEntityTest extends AbstractCreateWidgetEntityTest { /* tags */ const MVP = 'yes'; - const TEST_TYPE = 'extended_acceptance_test'; - const SEVERITY = 'S1'; + const SEVERITY = 'S3'; /* end tags */ /** @@ -40,20 +39,29 @@ class CreateWidgetEntityTest extends AbstractCreateWidgetEntityTest * Create for New Widget. * * @param Widget $widget + * @param array $additionalWidgets * @param array $caches [optional] - * @return void + * @return array */ - public function test(Widget $widget, array $caches = []) + public function test(Widget $widget, array $additionalWidgets = [], array $caches = []) { // Preconditions $this->caches = $caches; $this->adjustCacheSettings(); - + // Steps $this->widgetInstanceIndex->open(); $this->widgetInstanceIndex->getPageActionsBlock()->addNew(); $this->widgetInstanceNew->getWidgetForm()->fill($widget); $this->widgetInstanceEdit->getPageActionsBlock()->save(); + + foreach ($additionalWidgets as $key => $additionalWidget) { + $additionalWidget = $this->fixtureFactory->createByCode('widget', ['dataset' => $additionalWidget]); + $additionalWidget->persist(); + $additionalWidgets[$key] = $additionalWidget; + } + + return ['additionalWidgets' => $additionalWidgets]; } /** diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml index 225759df91f17..15610625f3125 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml @@ -118,5 +118,16 @@ + + severity:S3 + Recently Viewed Products + Magento Blank + Title_%isolation% + all_store_views + for_viewed_products + recentlyViewedProducts + simple_widget + + diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml index 122a9659cf2b6..6fba66a3db338 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml @@ -66,4 +66,9 @@ S1 + + + S3 + + From 43904dbf9370cc939779b410deb0232f48332eb7 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Tue, 8 Nov 2016 12:42:53 +0200 Subject: [PATCH 1691/3232] MAGETWO-60625: [FT] AddProductsToCartBySkuFromCustomerAccountTest doesn't work --- .../Fixture/ConfigurableProduct/ConfigurableAttributesData.php | 3 +++ 1 file changed, 3 insertions(+) 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 65f80eb714463..a816a9bab2cf7 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 @@ -275,6 +275,9 @@ protected function prepareVariationsMatrix(array $data) // generate matrix foreach ($this->attributesData as $attributeKey => $attribute) { $variationsMatrix = $this->addVariationMatrix($variationsMatrix, $attribute, $attributeKey); + if (!isset($data['matrix'])) { + $data['matrix'] = $variationsMatrix; + } } foreach ($data['matrix'] as $key => $value) { From ea9eb2b295c4858c903069c118caf60c73f42e59 Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Tue, 8 Nov 2016 12:51:30 +0200 Subject: [PATCH 1692/3232] MAGETWO-46636: Nginx doesn't redirect to setup page when using port --- lib/internal/Magento/Framework/App/Http.php | 3 +-- lib/internal/Magento/Framework/App/SetupInfo.php | 3 +++ .../Magento/Framework/App/Test/Unit/SetupInfoTest.php | 7 +++++++ .../Magento/Framework/App/Test/Unit/_files/pub/index.php | 5 +++++ .../Magento/Framework/App/Test/Unit/_files/setup/index.php | 5 +++++ 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 lib/internal/Magento/Framework/App/Test/Unit/_files/pub/index.php create mode 100644 lib/internal/Magento/Framework/App/Test/Unit/_files/setup/index.php diff --git a/lib/internal/Magento/Framework/App/Http.php b/lib/internal/Magento/Framework/App/Http.php index b98998c55a401..e3de37bfc01f9 100644 --- a/lib/internal/Magento/Framework/App/Http.php +++ b/lib/internal/Magento/Framework/App/Http.php @@ -241,8 +241,7 @@ private function redirectToSetup(Bootstrap $bootstrap, \Exception $exception) . "because the Magento setup directory cannot be accessed. \n" . 'You can install Magento using either the command line or you must restore access ' . 'to the following directory: ' . $setupInfo->getDir($projectRoot) . "\n"; - $newMessage .= 'If you are using the sample nginx configuration, please go to ' - . $this->_request->getScheme(). '://' . $this->_request->getHttpHost() . $setupInfo->getUrl(); + throw new \Exception($newMessage, 0, $exception); } } diff --git a/lib/internal/Magento/Framework/App/SetupInfo.php b/lib/internal/Magento/Framework/App/SetupInfo.php index b52daaac333e8..4288d832dcb60 100644 --- a/lib/internal/Magento/Framework/App/SetupInfo.php +++ b/lib/internal/Magento/Framework/App/SetupInfo.php @@ -147,6 +147,9 @@ public function isAvailable() { $setupDir = $this->getDir($this->projectRoot); $isSubDir = false !== strpos($setupDir . '/', $this->docRoot . '/'); + // Setup is not accessible from pub folder MAGETWO-52799 + $setupDir = str_replace('/pub/', '/', $setupDir); + return $isSubDir && realpath($setupDir); } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php b/lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php index 99ca759490f14..61f0a34d8a0d7 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php @@ -193,6 +193,13 @@ public function isAvailableDataProvider() ], true ], + 'root within doc root + pub, existent sub-directory' => [ + [ + 'DOCUMENT_ROOT' => __DIR__ . '/_files/pub/', + 'SCRIPT_FILENAME' => __DIR__ . '/_files/pub/index.php', + ], + true + ], ]; } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/_files/pub/index.php b/lib/internal/Magento/Framework/App/Test/Unit/_files/pub/index.php new file mode 100644 index 0000000000000..2a0cd37c68d37 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/_files/pub/index.php @@ -0,0 +1,5 @@ + Date: Tue, 8 Nov 2016 12:54:09 +0200 Subject: [PATCH 1693/3232] MAGETWO-59586: Excessive loaders for order with virtual product - Load card_validation for all payment methods except free; --- .../templates/order/create/data.phtml | 6 ++++++ .../view/adminhtml/web/order/create/scripts.js | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) 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 9eabd2ec4fcaf..4d2352e742edb 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 @@ -61,6 +61,12 @@
    + getChildBlock('card_validation')): ?> +
    + getChildHtml('card_validation') ?> +
    + + getChildHtml('gift_options') ?>
    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 000a2b5577dcd..8d2fdfe0398d2 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 @@ -352,6 +352,11 @@ define([ }); jQuery('#edit_form').trigger('changePaymentMethod', [method]); this.setPaymentMethod(method); + if (method !== 'free') { + var data = {}; + data['order[payment_method]'] = method; + this.loadArea(['card_validation'], true, data); + } }, setPaymentMethod : function(method){ @@ -388,6 +393,7 @@ define([ field.bindChange = true; field.paymentContainer = form; field.method = method; + field.observe('change', this.changePaymentData.bind(this)) } },this); } @@ -395,6 +401,18 @@ define([ } }, + changePaymentData : function(event){ + var elem = Event.element(event); + if(elem && elem.method){ + var data = this.getPaymentData(elem.method); + if (data) { + this.loadArea(['card_validation'], true, data); + } else { + return; + } + } + }, + getPaymentData : function(currentMethod){ if (typeof(currentMethod) == 'undefined') { if (this.paymentMethod) { From 9d37303a35ceb1b5ed380eaf9f531e7d2f351037 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Tue, 8 Nov 2016 13:21:24 +0200 Subject: [PATCH 1694/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60467: Simple product name not displayed as options on product page --- .../Bundle/Pricing/Adjustment/Calculator.php | 25 +++-- .../Test/Unit/Model/Product/TypeTest.php | 104 ++++++------------ .../Pricing/Adjustment/CalculatorTest.php | 69 ++++++++---- 3 files changed, 93 insertions(+), 105 deletions(-) diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index 7821c7f569be5..6d1d172fc654e 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -209,7 +209,7 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ $typeInstance = $bundleProduct->getTypeInstance(); $selectionsCollection = $typeInstance->getSelectionsCollection( - [(int)$option->getId()], + [(int)$option->getOptionId()], $bundleProduct ); $selectionsCollection->removeAttributeToSelect(); @@ -239,16 +239,18 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR } $selection = $selectionsCollection->getFirstItem(); - $priceList[] = $this->selectionFactory->create( - $bundleProduct, - $selection, - $selection->getSelectionQty(), - [ - 'useRegularPrice' => $useRegularPrice, - ] - ); - } + if (!$selection->isEmpty()) { + $priceList[] = $this->selectionFactory->create( + $bundleProduct, + $selection, + $selection->getSelectionQty(), + [ + 'useRegularPrice' => $useRegularPrice, + ] + ); + } + } } if ($shouldFindMinOption) { @@ -257,10 +259,11 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR foreach ($priceList as $price) { $minPriceTmp = $price->getAmount()->getValue() * $price->getQuantity(); if (!$minPrice || $minPriceTmp < $minPrice) { + $minPrice = $minPriceTmp; $priceSelection = $price; } } - $priceList = [$priceSelection]; + $priceList = $priceSelection ? [$priceSelection] : []; } return $priceList; diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php index fa18a9cb015f1..2be68359909ef 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php @@ -208,20 +208,6 @@ public function testPrepareForCartAdvancedWithoutOptions() $product->expects($this->any()) ->method('getTypeInstance') ->willReturn($productType); - $product->expects($this->any()) - ->method('getData') - ->willReturnCallback( - function ($key) use ($optionCollection, $selectionCollection) { - $resultValue = null; - switch ($key) { - case '_cache_instance_options_collection': - $resultValue = $optionCollection; - break; - } - - return $resultValue; - } - ); $optionCollection->expects($this->any()) ->method('appendSelections') ->willReturn([$option]); @@ -2136,7 +2122,6 @@ public function testIsSalableWithRequiredOptionsTrue() 'is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, 'status' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, - '_cache_instance_selections_collection10_20_30' => $selectionCollectionMock ] ); @@ -2177,7 +2162,6 @@ public function testIsSalableWithEmptySelectionsCollection() 'is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, 'status' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, - '_cache_instance_selections_collection1' => $selectionCollectionMock ] ); @@ -2225,7 +2209,6 @@ public function nottestIsSalableWithRequiredOptionsOutOfStock() 'is_salable' => true, '_cache_instance_options_collection' => $optionCollectionMock, 'status' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, - '_cache_instance_selections_collection10_20' => $selectionCollectionMock ] ); @@ -2427,38 +2410,29 @@ public function testGetSelectionsCollection() ] ) ->getMock(); - $selectionCollection = $this->getMockBuilder(\Magento\Bundle\Model\ResourceModel\Selection\Collection::class) - ->disableOriginalConstructor() - ->setMethods( - [ - 'addAttributeToSelect', - 'setFlag', - 'setPositionOrder', - 'addStoreFilter', - 'setStoreId', - 'addFilterByRequiredOptions', - 'setOptionIdsFilter', - 'joinPrices', - 'addPriceData', - 'addTierPriceData' - ] - ) - ->getMock(); $store = $this->getMockBuilder(\Magento\Store\Model\Store::class) ->disableOriginalConstructor() ->setMethods(['getWebsiteId']) ->getMock(); - $product->expects($this->once()) - ->method('hasData') - ->with('_cache_instance_selections_collection1_2_3') - ->willReturn(false); $product->expects($this->once())->method('getStoreId')->willReturn('store_id'); - $product->expects($this->at(2)) - ->method('getData') - ->with('_cache_instance_store_filter') - ->willReturn($selectionCollection); + $selectionCollection = $this->getSelectionCollection(); $this->bundleCollection->expects($this->once())->method('create')->willReturn($selectionCollection); + $this->storeManager->expects($this->once())->method('getStore')->willReturn($store); + $store->expects($this->once())->method('getWebsiteId')->willReturn('website_id'); + $selectionCollection->expects($this->any())->method('joinPrices')->with('website_id')->willReturnSelf(); + + $this->assertEquals($selectionCollection, $this->model->getSelectionsCollection($optionIds, $product)); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getSelectionCollection() + { + $selectionCollection = $this->getMockBuilder(\Magento\Bundle\Model\ResourceModel\Selection\Collection::class) + ->disableOriginalConstructor() + ->getMock(); $selectionCollection->expects($this->any())->method('addAttributeToSelect')->willReturnSelf(); $selectionCollection->expects($this->any())->method('setFlag')->willReturnSelf(); $selectionCollection->expects($this->any())->method('setPositionOrder')->willReturnSelf(); @@ -2469,19 +2443,7 @@ public function testGetSelectionsCollection() $selectionCollection->expects($this->any())->method('addPriceData')->willReturnSelf(); $selectionCollection->expects($this->any())->method('addTierPriceData')->willReturnSelf(); - $this->storeManager->expects($this->once())->method('getStore')->willReturn($store); - $store->expects($this->once())->method('getWebsiteId')->willReturn('website_id'); - $selectionCollection->expects($this->any())->method('joinPrices')->with('website_id')->willReturnSelf(); - $product->expects($this->once()) - ->method('setData') - ->with('_cache_instance_selections_collection1_2_3', $selectionCollection) - ->willReturnSelf(); - $product->expects($this->at(4)) - ->method('getData') - ->with('_cache_instance_selections_collection1_2_3') - ->willReturn($selectionCollection); - - $this->assertEquals($selectionCollection, $this->model->getSelectionsCollection($optionIds, $product)); + return $selectionCollection; } public function testProcessBuyRequest() @@ -2515,7 +2477,10 @@ public function testGetProductsToPurchaseByReqGroups() ->disableOriginalConstructor() ->setMethods(['getId', 'getRequired']) ->getMock(); - $selectionCollection = $this->getMockBuilder(\Magento\Bundle\Model\ResourceModel\Selection\Collection::class) + $selectionCollection = $this->getSelectionCollection(); + $this->bundleCollection->expects($this->once())->method('create')->willReturn($selectionCollection); + + $selectionItem = $this->getMockBuilder(\Magento\Framework\DataObject::class) ->disableOriginalConstructor() ->getMock(); @@ -2526,13 +2491,13 @@ public function testGetProductsToPurchaseByReqGroups() ->willReturn($dbResourceMock); $dbResourceMock->expects($this->once())->method('getItems')->willReturn([$item]); $item->expects($this->once())->method('getId')->willReturn('itemId'); - $product->expects($this->at(3)) - ->method('getData') - ->with('_cache_instance_selections_collectionitemId') - ->willReturn([$selectionCollection]); $item->expects($this->once())->method('getRequired')->willReturn(true); - $this->assertEquals([[$selectionCollection]], $this->model->getProductsToPurchaseByReqGroups($product)); + $selectionCollection + ->expects($this->any()) + ->method('getIterator') + ->willReturn(new \ArrayIterator([$selectionItem])); + $this->assertEquals([[$selectionItem]], $this->model->getProductsToPurchaseByReqGroups($product)); } public function testGetSearchableData() @@ -2565,14 +2530,17 @@ public function testHasOptions() ->disableOriginalConstructor() ->setMethods(['getAllIds']) ->getMock(); - $selectionCollection = $this->getMockBuilder(\Magento\Bundle\Model\ResourceModel\Selection\Collection::class) - ->disableOriginalConstructor() - ->getMock(); + $selectionCollection = $this->getSelectionCollection(); + $selectionCollection + ->expects($this->any()) + ->method('count') + ->willReturn(1); + $this->bundleCollection->expects($this->once())->method('create')->willReturn($selectionCollection); - $product->expects($this->once())->method('getStoreId')->willReturn('storeId'); + $product->expects($this->any())->method('getStoreId')->willReturn(0); $product->expects($this->once()) ->method('setData') - ->with('_cache_instance_store_filter', 'storeId') + ->with('_cache_instance_store_filter', 0) ->willReturnSelf(); $product->expects($this->any())->method('hasData')->willReturn(true); $product->expects($this->at(3)) @@ -2580,10 +2548,6 @@ public function testHasOptions() ->with('_cache_instance_options_collection') ->willReturn($optionCollection); $optionCollection->expects($this->once())->method('getAllIds')->willReturn(['ids']); - $product->expects($this->at(5)) - ->method('getData') - ->with('_cache_instance_selections_collectionids') - ->willReturn([$selectionCollection]); $this->assertTrue($this->model->hasOptions($product)); } diff --git a/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php b/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php index 2d1ac8adce5f2..87e1446b499ce 100644 --- a/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php @@ -10,7 +10,6 @@ use Magento\Bundle\Model\ResourceModel\Selection\Collection; use \Magento\Bundle\Pricing\Adjustment\Calculator; - use Magento\Bundle\Model\Product\Price as ProductPrice; use Magento\Bundle\Pricing\Price; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -139,6 +138,7 @@ public function testEmptySelectionPriceList() */ public function testGetterAmount($amountForBundle, $optionList, $expectedResult) { + $searchMin = $expectedResult['isMinAmount']; $this->baseCalculator->expects($this->atLeastOnce())->method('getAmount') ->with($this->baseAmount, $this->saleableItem) ->will($this->returnValue($this->createAmountMock($amountForBundle))); @@ -147,39 +147,55 @@ public function testGetterAmount($amountForBundle, $optionList, $expectedResult) foreach ($optionList as $optionData) { $options[] = $this->createOptionMock($optionData); } + $typeInstance = $this->getMockBuilder(\Magento\Bundle\Model\Product\Type::class) ->disableOriginalConstructor() ->getMock(); - $this->saleableItem->expects($this->any())->method('getTypeInstance')->willReturn($typeInstance); + $this->saleableItem->expects($this->atLeastOnce())->method('getTypeInstance')->willReturn($typeInstance); $optionsCollection = $this->getMockBuilder(\Magento\Bundle\Model\ResourceModel\Option\Collection::class) ->disableOriginalConstructor() ->getMock(); $optionsCollection->expects($this->atLeastOnce())->method('getIterator') ->willReturn(new \ArrayIterator($options)); - $optionsCollection->expects($this->atLeastOnce())->method('addFilter') - ->willReturnSelf(); - $optionsCollection->expects($this->atLeastOnce())->method('getSize') - ->willReturn(count($options)); + $typeInstance->expects($this->atLeastOnce())->method('getOptionsCollection')->willReturn($optionsCollection); + + + if ($searchMin) { + $optionsCollection->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); + $optionsCollection->expects($this->atLeastOnce())->method('getSize')->willReturn(0); + $optionsCollection->expects($this->atLeastOnce())->method('getSize')->willReturn(count($options)); + } - foreach ($options as $option) { + $optionSelections = []; + foreach ($options as $index => $option) { $selectionsCollection = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); - $selectionsCollection->expects($this->any())->method('getIterator') - ->willReturn(new \ArrayIterator($option->getSelections())); - $selectionsCollection->expects($this->atLeastOnce())->method('getFirstItem') - ->willReturn($option->getSelections()[0]); - $typeInstance->expects($this->atLeastOnce())->method('getSelectionsCollection') - ->willReturn($selectionsCollection); + if ($option->isMultiSelection()) { + $selectionsCollection->expects($this->any()) + ->method('getIterator') + ->willReturn(new \ArrayIterator($option->getSelections())); + $selectionsCollection->expects($this->any()) + ->method('getItems') + ->willReturn($option->getSelections()); + } else { + $selectionsCollection->expects($this->atLeastOnce()) + ->method('getFirstItem') + ->willReturn(isset($option->getSelections()[0]) ? $option->getSelections()[0] : false); + } + $optionSelections[$option->getOptionId()] = $selectionsCollection; } - $typeInstance->expects($this->atLeastOnce())->method('getOptionsCollection')->willReturn($optionsCollection); + $typeInstance->expects($this->any())->method('getSelectionsCollection') + ->willReturnCallback( + function ($optionId) use ($optionSelections) { + return $optionSelections[array_pop($optionId)]; + } + ); $price = $this->getMock(\Magento\Bundle\Pricing\Price\BundleOptionPrice::class, [], [], '', false); - $price->expects($this->atLeastOnce())->method('getOptions')->will($this->returnValue($options)); - $this->priceMocks[Price\BundleOptionPrice::PRICE_CODE] = $price; // Price type of saleable items @@ -191,7 +207,7 @@ public function testGetterAmount($amountForBundle, $optionList, $expectedResult) $this->amountFactory->expects($this->atLeastOnce())->method('create') ->with($expectedResult['fullAmount'], $expectedResult['adjustments']); - if ($expectedResult['isMinAmount']) { + if ($searchMin) { $this->model->getAmount($this->baseAmount, $this->saleableItem); } else { $this->model->getMaxAmount($this->baseAmount, $this->saleableItem); @@ -255,6 +271,11 @@ protected function createOptionMock($optionData) foreach ($optionData['selections'] as $selectionData) { $selections[] = $this->createSelectionMock($selectionData); } + if (!$selections) { + $emptyProduct = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)->disableOriginalConstructor()->getMock(); + $emptyProduct->expects($this->any())->method('isEmpty')->willReturn(true); + $selections = [$emptyProduct]; + } foreach ($optionData['data'] as $key => $value) { $option->setData($key, $value); } @@ -320,6 +341,13 @@ protected function getCaseWithMinAmount() 'required' => '1', ], 'selections' => [ + 'third product selection with the lowest price' => [ + 'data' => ['price' => 50.], + 'amount' => [ + 'adjustmentsAmounts' => ['tax' => 8, 'weee' => 10], + 'amount' => 8, + ], + ], 'first product selection' => [ 'data' => ['price' => 70.], 'amount' => [ @@ -334,13 +362,6 @@ protected function getCaseWithMinAmount() 'amount' => 28, ], ], - 'third product selection with the lowest price' => [ - 'data' => ['price' => 50.], - 'amount' => [ - 'adjustmentsAmounts' => ['tax' => 8, 'weee' => 10], - 'amount' => 8, - ], - ], ] ], ], From f4533dec11fb9cd6c62d1bb78f16ba24b434aaae Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 8 Nov 2016 13:23:41 +0200 Subject: [PATCH 1695/3232] MAGETWO-60575: Implement Functional Test for Bundle Options on Catalog Profuct Page --- .../Block/Catalog/Product/CustomizedPrice.php | 34 ++++++ .../Test/Block/Catalog/Product/View.php | 54 +++++++++- .../AssertBundleItemsSummaryOnProductPage.php | 101 ++++++++++++++++++ .../Bundle/Test/Repository/BundleProduct.xml | 28 +++++ .../BundleProduct/BundleSelections.xml | 49 +++++++++ .../Repository/BundleProduct/CheckoutData.xml | 14 +++ .../Test/TestCase/BundleOptionsSummary.php | 34 ++++++ .../Test/TestCase/BundleOptionsSummary.xml | 17 +++ .../tests/app/Magento/Bundle/Test/etc/di.xml | 14 +++ 9 files changed, 343 insertions(+), 2 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.php create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.xml create mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/etc/di.xml diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php new file mode 100644 index 0000000000000..f82bc0b83e59c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php @@ -0,0 +1,34 @@ + [ + 'selector' => '.price', + ] + ]; + + /** + * This method returns the price represented by the block. + * + * @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/Bundle/Test/Block/Catalog/Product/View.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php index db349d16a86c6..b4a9afa71fe78 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php @@ -7,10 +7,8 @@ namespace Magento\Bundle\Test\Block\Catalog\Product; use Magento\Bundle\Test\Block\Catalog\Product\View\Type\Bundle; -use Magento\Bundle\Test\Fixture\BundleProduct; use Magento\Mtf\Client\Locator; use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Mtf\Fixture\InjectableFixture; /** * Class View @@ -46,6 +44,20 @@ class View extends \Magento\Catalog\Test\Block\Product\View */ protected $newsletterFormSelector = '#newsletter-validate-detail[novalidate="novalidate"]'; + /** + * Selector for Bundle Summary section. + * + * @var string + */ + protected $bundleSummarySelector = '#bundle-summary > .bundle li div div'; + + /** + * Selector for Customized Bundle price block. + * + * @var string + */ + protected $customizedBundlePriceSelector = '.bundle-info'; + /** * Get bundle options block. * @@ -59,6 +71,19 @@ public function getBundleBlock() ); } + /** + * Get Bundle customized Price block. + * + * @return \Magento\Bundle\Test\Block\Catalog\Product\CustomizedPrice + */ + public function getCustomizedPriceBlock() + { + return $this->blockFactory->create( + \Magento\Bundle\Test\Block\Catalog\Product\CustomizedPrice::class, + ['element' => $this->_rootElement->find($this->customizedBundlePriceSelector)] + ); + } + /** * Click "Customize and add to cart button". * @@ -114,4 +139,29 @@ public function fillOptions(FixtureInterface $product) } $this->getBundleBlock()->fillBundleOptions($bundleCheckoutData); } + + /** + * Fill in the custom option data. + * + * @param array $optionsData + * @return void + */ + public function fillOptionsWithCustomData(array $optionsData = []) + { + if (!$this->getBundleBlock()->isVisible()) { + $this->clickCustomize(); + } + + $this->getBundleBlock()->fillBundleOptions($optionsData); + } + + /** + * Get Bundle Summary row items. + * + * @return \Magento\Mtf\Client\ElementInterface[] + */ + public function getBundleSummary() + { + return $this->_rootElement->getElements($this->bundleSummarySelector, Locator::SELECTOR_CSS); + } } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php new file mode 100644 index 0000000000000..36895dd2548a5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php @@ -0,0 +1,101 @@ +open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $bundleOptions = $product->getData()['bundle_selections']['bundle_options']; + $optionsBlock = $catalogProductView->getBundleViewBlock(); + $customizedPriceBlock = $optionsBlock->getCustomizedPriceBlock(); + foreach ($bundleOptions as $bundleOption) { + foreach ($bundleOption['assigned_products'] as $assignedProduct) { + $optionsBlock->fillOptionsWithCustomData([ + [ + 'title' => $bundleOption['title'], + 'type' => $bundleOption['type'], + 'value' => [ + 'name' => $assignedProduct['search_data']['name'] + ] + ] + ]); + $assignedProductPrice = (double)$assignedProduct['data']['selection_price_value']; + $assignedProductQty = (double)$assignedProduct['data']['selection_qty']; + + foreach ($optionsBlock->getBundleSummary() as $bundleSummaryItem) { + $bundleSummaryItemText = $bundleSummaryItem->getText(); + if (strpos($bundleSummaryItemText, $assignedProduct['search_data']['name']) !== false) { + $optionData = $this->getBundleOptionData($bundleSummaryItemText); + $optionData['price'] = (double)$customizedPriceBlock->getFinalPrice(); + $actualResult[] = $optionData; + } + } + + $expectedResult[] = [ + 'qty' => $assignedProduct['data']['selection_qty'], + 'name' => $assignedProduct['search_data']['name'], + 'price' => $assignedProductQty * $assignedProductPrice + (double)$product->getPrice() + ]; + } + } + + \PHPUnit_Framework_Assert::assertEquals( + $expectedResult, + $actualResult, + 'Bundle Summary Section does not contain correct bundle options data.' + ); + } + + /** + * Extract Bundle summary item Qty and Name from row text. + * + * @param string $rowItem + * @return array + */ + private function getBundleOptionData($rowItem) + { + // Row item must be displayed like "1 x Simple Product". + $rowItem = explode(' x ', $rowItem); + return [ + 'qty' => $rowItem[0], + 'name' => $rowItem[1] + ]; + } + + /** + * Return Text if displayed on frontend equals with fixture. + * + * @return string + */ + public function toString() + { + return 'Bundle options are displayed correctly in the summary section.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct.xml index 6a507a7a99b43..25c9e26932588 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct.xml @@ -184,6 +184,34 @@ bundle_required_two_fixed_options + + + Bundle fixed product %isolation% + bundle-fixed-product-%isolation% + sku_bundle_fixed_product_%isolation% + No + No + + 100 + + + taxable_goods + + 1 + No + + + default + + + Separately + + required_three_fixed_options_with_qty + + + bundle_required_three_fixed_options_with_qty + + Bundle fixed product %isolation% diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml index 7131aab3cffcb..584ecc0d3d0ec 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml @@ -605,6 +605,55 @@ + + + + Drop-down Option + Drop-down + Yes + + + + %product_name% + + + 10.00 + Fixed + 1 + + + + + %product_name% + + + 20.00 + Fixed + 2 + + + + + %product_name% + + + 30.00 + Fixed + 3 + + + + + + + + catalogProductSimple::simple + catalogProductSimple::product_15_dollar + catalogProductSimple::product_40_dollar + + + + diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/CheckoutData.xml index 3e7550b9d784e..ea88e8566a7e6 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/CheckoutData.xml @@ -357,5 +357,19 @@ + + + + + + Drop-down Option + Drop-down + + Test simple product + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.php new file mode 100644 index 0000000000000..1069a09a354a5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.php @@ -0,0 +1,34 @@ +persist(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.xml new file mode 100644 index 0000000000000..d4deff192dc05 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.xml @@ -0,0 +1,17 @@ + + + + + + S2 + Bundle Option with Three Drop-Down selections with qty + fixed_with_required_options_and_qty + + + + diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/di.xml new file mode 100644 index 0000000000000..402dcca44c948 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/di.xml @@ -0,0 +1,14 @@ + + + + + + S2 + + + From f5b5b786a8eb1ddfcb4a07b6244e24af94fbbf92 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 8 Nov 2016 15:59:23 +0200 Subject: [PATCH 1696/3232] MAGETWO-60575: Implement Functional Test for Bundle Options on Catalog Profuct Page --- .../{BundleOptionsSummary.php => BundleOptionsSummaryTest.php} | 0 .../{BundleOptionsSummary.xml => BundleOptionsSummaryTest.xml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/{BundleOptionsSummary.php => BundleOptionsSummaryTest.php} (100%) rename dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/{BundleOptionsSummary.xml => BundleOptionsSummaryTest.xml} (100%) diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummaryTest.php similarity index 100% rename from dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.php rename to dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummaryTest.php diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummaryTest.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummary.xml rename to dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleOptionsSummaryTest.xml From f558a10721db696ca2b067149c115534c1aa0476 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 8 Nov 2016 16:26:50 +0200 Subject: [PATCH 1697/3232] MAGETWO-60647: [PR] Delivery of bug fixes for Sample Data and Import/Export --- .../Model/Import/Product/Validator/Media.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php index e05c7bd9ebaf1..3067aa3c2b2eb 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php @@ -24,14 +24,6 @@ class Media extends AbstractImportValidator implements RowValidatorInterface /** @var array */ protected $mediaAttributes = ['image', 'small_image', 'thumbnail']; - /** - * {@inheritdoc} - */ - public function init($context) - { - return parent::init($context); - } - /** * @param string $string * @return bool From 0a0da3e01e08902e1374bc20b1add5aee98f6cf1 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 8 Nov 2016 17:37:38 +0200 Subject: [PATCH 1698/3232] MAGETWO-60575: Implement Functional Test for Bundle Options on Catalog Profuct Page --- .../tests/app/Magento/Bundle/Test/etc/di.xml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/etc/di.xml diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/di.xml deleted file mode 100644 index 402dcca44c948..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/etc/di.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - S2 - - - From 5f827773fe6379811b764adfa8ff847bf9e4d6f8 Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Tue, 8 Nov 2016 17:48:33 +0200 Subject: [PATCH 1699/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60467: Simple product name not displayed as options on product page --- .../ResourceModel/Selection/Collection.php | 4 ++-- .../Bundle/Pricing/Adjustment/Calculator.php | 16 +++++++------- .../Pricing/Price/BundleSelectionFactory.php | 10 ++------- .../Price/BundleSelectionFactoryTest.php | 22 ------------------- .../Framework/Pricing/Price/AbstractPrice.php | 2 +- 5 files changed, 13 insertions(+), 41 deletions(-) diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index 4b64cb90c3118..d255dfc462015 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -177,7 +177,7 @@ public function addQuantityFilter() */ public function getNewEmptyItem() { - if ($this->itemPrototype == null) { + if (null === $this->itemPrototype) { $this->itemPrototype = parent::getNewEmptyItem(); } return clone $this->itemPrototype; @@ -200,7 +200,7 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) $minimalPriceExpression = 'minimal_price'; } else { $this->getCatalogRuleProcessor()->addPriceData($this, 'selection.product_id'); - $minimalPriceExpression = 'LEAST(minimal_price, IFNULL(catalog_rule_price, 99999999))'; + $minimalPriceExpression = 'LEAST(minimal_price, IFNULL(catalog_rule_price, minimal_price))'; } $orderByValue = new \Zend_Db_Expr( '(' . diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index 6d1d172fc654e..26174e3b29ad2 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -9,7 +9,6 @@ use Magento\Bundle\Model\Product\Price; use Magento\Bundle\Pricing\Price\BundleSelectionFactory; use Magento\Catalog\Model\Product; -use Magento\Framework\App\ObjectManager; use Magento\Framework\Pricing\Adjustment\Calculator as CalculatorBase; use Magento\Framework\Pricing\Amount\AmountFactory; use Magento\Framework\Pricing\SaleableInterface; @@ -199,15 +198,16 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR } $canSkipRequiredOptions = $searchMin && !$shouldFindMinOption; + /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ + $typeInstance = $bundleProduct->getTypeInstance(); $priceList = []; + foreach ($this->getBundleOptions($bundleProduct) as $option) { /** @var \Magento\Bundle\Model\Option $option */ if ($this->canSkipOption($option, $canSkipRequiredOptions)) { continue; } - /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ - $typeInstance = $bundleProduct->getTypeInstance(); $selectionsCollection = $typeInstance->getSelectionsCollection( [(int)$option->getOptionId()], $bundleProduct @@ -215,7 +215,7 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR $selectionsCollection->removeAttributeToSelect(); $selectionsCollection->addQuantityFilter(); - if ($option->isMultiSelection() && !$searchMin) { + if (!$searchMin && $option->isMultiSelection()) { $selectionsCollection->addPriceData(); foreach ($selectionsCollection as $selection) { @@ -278,7 +278,7 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR */ protected function canSkipOption($option, $canSkipRequiredOption) { - return ($canSkipRequiredOption && !$option->getRequired()); + return $canSkipRequiredOption && !$option->getRequired(); } /** @@ -289,9 +289,9 @@ protected function canSkipOption($option, $canSkipRequiredOption) */ protected function hasRequiredOption($bundleProduct) { - /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ - $typeInstance = $bundleProduct->getTypeInstance(); - $collection = $typeInstance->getOptionsCollection($bundleProduct); + $collection = clone $this->getBundleOptions($bundleProduct); + $collection->clear(); + return $collection->addFilter(\Magento\Bundle\Model\Option::KEY_REQUIRED, 1)->getSize() > 0; } diff --git a/app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php b/app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php index 6a7a2329f3799..051a89943c855 100644 --- a/app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php +++ b/app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php @@ -42,7 +42,6 @@ public function __construct(\Magento\Framework\ObjectManagerInterface $objectMan * @param Product $selection * @param float $quantity * @param array $arguments - * @throws \InvalidArgumentException * @return BundleSelectionPrice */ public function create( @@ -54,12 +53,7 @@ public function create( $arguments['bundleProduct'] = $bundleProduct; $arguments['saleableItem'] = $selection; $arguments['quantity'] = $quantity ? floatval($quantity) : 1.; - $selectionPrice = $this->objectManager->create(self::SELECTION_CLASS_DEFAULT, $arguments); - if (!$selectionPrice instanceof BundleSelectionPrice) { - throw new \InvalidArgumentException( - get_class($selectionPrice) . ' doesn\'t extend BundleSelectionPrice' - ); - } - return $selectionPrice; + + return $this->objectManager->create(self::SELECTION_CLASS_DEFAULT, $arguments); } } diff --git a/app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionFactoryTest.php b/app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionFactoryTest.php index 3a0b0a22080fa..1831154043d8b 100644 --- a/app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionFactoryTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionFactoryTest.php @@ -66,26 +66,4 @@ public function testCreate() ->create($this->bundleMock, $this->selectionMock, 2., ['test' => 'some value']) ); } - - /** - * @expectedException \InvalidArgumentException - */ - public function testCreateException() - { - $this->objectManagerMock->expects($this->once()) - ->method('create') - ->with( - $this->equalTo(BundleSelectionFactory::SELECTION_CLASS_DEFAULT), - $this->equalTo( - [ - 'test' => 'some value', - 'bundleProduct' => $this->bundleMock, - 'saleableItem' => $this->selectionMock, - 'quantity' => 2., - ] - ) - ) - ->will($this->returnValue(new \stdClass())); - $this->bundleSelectionFactory->create($this->bundleMock, $this->selectionMock, 2., ['test' => 'some value']); - } } diff --git a/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php b/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php index 701cabfa358f0..6f157f578ffa5 100644 --- a/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php +++ b/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php @@ -23,7 +23,7 @@ abstract class AbstractPrice implements PriceInterface const PRICE_CODE = 'abstract_price'; /** - * @var AmountInterface + * @var AmountInterface[] */ protected $amount; From bdb32d739ad7a5a2f8a204cb511591966a020ca0 Mon Sep 17 00:00:00 2001 From: sdzhepa Date: Tue, 8 Nov 2016 17:55:19 +0200 Subject: [PATCH 1700/3232] MAGETWO-59308: Design theme dropdown does not display all themes in Widgets - fix-rewrite test after CR --- .../Block/Adminhtml/Widget/WidgetGrid.php | 27 ++++++++ .../AssertThemeFilterValuesOnWidgetGrid.php | 48 ++++++++++++++ .../Test/Constraint/AssertWidgetInGrid.php | 11 ++-- ...tWithDifferentThemesArePresentedInGrid.php | 63 ------------------- .../Test/Constraint/AssertWidgetsInGrid.php | 48 ++++++++++++++ .../Widget/Test/Handler/Widget/Curl.php | 1 + .../Magento/Widget/Test/Repository/Widget.xml | 3 +- .../AbstractCreateWidgetEntityTest.php | 12 +--- .../Test/TestCase/CreateWidgetEntityTest.php | 16 ++--- .../Test/TestCase/CreateWidgetEntityTest.xml | 11 ---- .../Test/TestCase/CreateWidgetsEntityTest.php | 57 +++++++++++++++++ .../Test/TestCase/CreateWidgetsEntityTest.xml | 18 ++++++ .../tests/app/Magento/Widget/Test/etc/di.xml | 7 ++- 13 files changed, 220 insertions(+), 102 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertThemeFilterValuesOnWidgetGrid.php delete mode 100644 dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetWithDifferentThemesArePresentedInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetsInGrid.php create mode 100644 dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetsEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetsEntityTest.xml diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php index 3906631741beb..2a03872f4be6b 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php @@ -7,12 +7,20 @@ namespace Magento\Widget\Test\Block\Adminhtml\Widget; use Magento\Backend\Test\Block\Widget\Grid as AbstractGrid; +use Magento\Mtf\Client\Locator; /** * Widget grid on the Widget Instance Index page. */ class WidgetGrid extends AbstractGrid { + /** + * Selector for not empty options at select element. + * + * @var string + */ + private $notEmptyOptionsSelector = 'option:not([value=""])'; + /** * Locator value for link in action column. * @@ -41,4 +49,23 @@ class WidgetGrid extends AbstractGrid 'input' => 'select', ], ]; + + /** + * Returns values of theme_id filter. + * + * @return array + */ + public function getThemeIdValues() + { + $values = []; + $themeFilter = $this->filters['theme_id']; + $strategy = empty($themeFilter['strategy']) ? Locator::SELECTOR_CSS : $themeFilter['strategy']; + $element = $this->_rootElement->find($themeFilter['selector'], $strategy, $themeFilter['input']); + $options = $element->getElements($this->notEmptyOptionsSelector); + foreach ($options as $option) { + $values[] = $option->getText(); + } + + return $values; + } } diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertThemeFilterValuesOnWidgetGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertThemeFilterValuesOnWidgetGrid.php new file mode 100644 index 0000000000000..31ebfd87c252b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertThemeFilterValuesOnWidgetGrid.php @@ -0,0 +1,48 @@ +getThemeId(); + } + $widgetInstanceIndex->open(); + $actualValues = $widgetInstanceIndex->getWidgetGrid()->getThemeIdValues(); + \PHPUnit_Framework_Assert::assertEmpty( + array_diff($expectedValues, $actualValues), + 'Widget grid theme filter doesn\'t contain all possible values from created widgets.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Widget grid theme filter contains all possible values from created widgets.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetInGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetInGrid.php index 5382d544a94b9..2cc675f79fbd3 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetInGrid.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetInGrid.php @@ -11,7 +11,7 @@ use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertWidgetInGrid + * Assert widget is present in widget grid. */ class AssertWidgetInGrid extends AbstractConstraint { @@ -20,7 +20,10 @@ class AssertWidgetInGrid extends AbstractConstraint /* end tags */ /** - * Assert widget availability in widget grid + * Assert widget availability in widget grid. + * Verifying such fields as: + * - title + * - theme_id * * @param Widget $widget * @param WidgetInstanceIndex $widgetInstanceIndex @@ -28,7 +31,7 @@ class AssertWidgetInGrid extends AbstractConstraint */ public function processAssert(Widget $widget, WidgetInstanceIndex $widgetInstanceIndex) { - $filter = ['title' => $widget->getTitle()]; + $filter = ['title' => $widget->getTitle(), 'theme_id' => $widget->getThemeId()]; $widgetInstanceIndex->open(); \PHPUnit_Framework_Assert::assertTrue( $widgetInstanceIndex->getWidgetGrid()->isRowVisible($filter), @@ -37,7 +40,7 @@ public function processAssert(Widget $widget, WidgetInstanceIndex $widgetInstanc } /** - * 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/Widget/Test/Constraint/AssertWidgetWithDifferentThemesArePresentedInGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetWithDifferentThemesArePresentedInGrid.php deleted file mode 100644 index 445357bd5f914..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetWithDifferentThemesArePresentedInGrid.php +++ /dev/null @@ -1,63 +0,0 @@ -open(); - $widgetGrid = $widgetInstanceIndex->getWidgetGrid(); - - foreach ($additionalWidgets as $widget) { - $filter = [ - 'title' => $widget->getTitle(), - 'theme_id' => $widget->getThemeId(), - ]; - $widgetGrid->search($filter); - $expectedData[] = $filter; - $actualData[] = $widgetGrid->getRowsData(array_keys($filter))[0]; - } - - \PHPUnit_Framework_Assert::assertEquals( - $expectedData, - $actualData, - 'Not all expected widgets are present in grid.' - ); - } - - /** - * Returns a string representation of the object - * - * @return string - */ - public function toString() - { - return 'Widgets with different themes are present in widget grid.'; - } -} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetsInGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetsInGrid.php new file mode 100644 index 0000000000000..bc61b3ef66f51 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetsInGrid.php @@ -0,0 +1,48 @@ +processAssert($widget, $widgetInstanceIndex); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Widgets are present in widget grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Handler/Widget/Curl.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Handler/Widget/Curl.php index 4c9e61cdb873d..54520d0786a52 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Handler/Widget/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Handler/Widget/Curl.php @@ -27,6 +27,7 @@ class Curl extends AbstractCurl protected $mappingData = [ 'code' => [ 'CMS Page Link' => 'cms_page_link', + 'Recently Viewed Products' => 'recently_viewed', ], 'block' => [ 'Main Content Area' => 'content', diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget.xml index 81c6ea28f56c9..4a8972bfd8dbb 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget.xml @@ -25,7 +25,8 @@ cmsPageLink - + + Recently Viewed Products Title_%isolation% Magento Blank diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php index c5f920a6c893b..235361aee8b7e 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php @@ -6,7 +6,6 @@ namespace Magento\Widget\Test\TestCase; -use Magento\Mtf\Fixture\FixtureFactory; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceEdit; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceIndex; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceNew; @@ -54,11 +53,6 @@ abstract class AbstractCreateWidgetEntityTest extends Injectable */ protected $cache; - /** - * @var FixtureFactory - */ - protected $fixtureFactory; - /** * Injection data. * @@ -67,22 +61,20 @@ abstract class AbstractCreateWidgetEntityTest extends Injectable * @param WidgetInstanceEdit $widgetInstanceEdit * @param CmsIndex $cmsIndex * @param Cache $cache - * @param FixtureFactory $fixtureFactory + * @return void */ public function __inject( WidgetInstanceIndex $widgetInstanceIndex, WidgetInstanceNew $widgetInstanceNew, WidgetInstanceEdit $widgetInstanceEdit, CmsIndex $cmsIndex, - Cache $cache, - FixtureFactory $fixtureFactory + Cache $cache ) { $this->widgetInstanceIndex = $widgetInstanceIndex; $this->widgetInstanceNew = $widgetInstanceNew; $this->widgetInstanceEdit = $widgetInstanceEdit; $this->cmsIndex = $cmsIndex; $this->cache = $cache; - $this->fixtureFactory = $fixtureFactory; } /** diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php index a61bc7f060a01..cc02293ff8fdd 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php @@ -25,7 +25,8 @@ class CreateWidgetEntityTest extends AbstractCreateWidgetEntityTest { /* tags */ const MVP = 'yes'; - const SEVERITY = 'S3'; + const TEST_TYPE = 'extended_acceptance_test'; + const SEVERITY = 'S1'; /* end tags */ /** @@ -39,11 +40,10 @@ class CreateWidgetEntityTest extends AbstractCreateWidgetEntityTest * Create for New Widget. * * @param Widget $widget - * @param array $additionalWidgets * @param array $caches [optional] - * @return array + * @return void */ - public function test(Widget $widget, array $additionalWidgets = [], array $caches = []) + public function test(Widget $widget, array $caches = []) { // Preconditions $this->caches = $caches; @@ -54,14 +54,6 @@ public function test(Widget $widget, array $additionalWidgets = [], array $cache $this->widgetInstanceIndex->getPageActionsBlock()->addNew(); $this->widgetInstanceNew->getWidgetForm()->fill($widget); $this->widgetInstanceEdit->getPageActionsBlock()->save(); - - foreach ($additionalWidgets as $key => $additionalWidget) { - $additionalWidget = $this->fixtureFactory->createByCode('widget', ['dataset' => $additionalWidget]); - $additionalWidget->persist(); - $additionalWidgets[$key] = $additionalWidget; - } - - return ['additionalWidgets' => $additionalWidgets]; } /** diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml index 15610625f3125..225759df91f17 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml @@ -118,16 +118,5 @@ - - severity:S3 - Recently Viewed Products - Magento Blank - Title_%isolation% - all_store_views - for_viewed_products - recentlyViewedProducts - simple_widget - - diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetsEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetsEntityTest.php new file mode 100644 index 0000000000000..5269c315f78fc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetsEntityTest.php @@ -0,0 +1,57 @@ +createByCode('widget', ['dataset' => $widget]); + $widget->persist(); + $widgetInstances[] = $widget; + } + + return ['widgets' => $widgetInstances]; + } + + /** + * Delete all widgets. + * + * @return void + */ + public function tearDown() + { + $this->objectManager->create(\Magento\Widget\Test\TestStep\DeleteAllWidgetsStep::class)->run(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetsEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetsEntityTest.xml new file mode 100644 index 0000000000000..484ea26cf5253 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetsEntityTest.xml @@ -0,0 +1,18 @@ + + + + + + severity:S3 + default + recently_viewed_products_on_blank_theme + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml index 6fba66a3db338..c1595838b4f63 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/etc/di.xml @@ -66,7 +66,12 @@ S1 - + + + S3 + + + S3 From c3a96574dfcf9569c372b2f478d6987d9642200f Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Tue, 8 Nov 2016 18:00:12 +0200 Subject: [PATCH 1701/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60467: Simple product name not displayed as options on product page --- .../Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php b/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php index 87e1446b499ce..736190cd63b54 100644 --- a/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Pricing/Adjustment/CalculatorTest.php @@ -168,7 +168,7 @@ public function testGetterAmount($amountForBundle, $optionList, $expectedResult) } $optionSelections = []; - foreach ($options as $index => $option) { + foreach ($options as $option) { $selectionsCollection = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); From a3a12064d234e951fe735d6d585c457b3ad39b05 Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov Date: Tue, 8 Nov 2016 17:53:09 +0200 Subject: [PATCH 1702/3232] MAGETWO-59003: Js file version regenerated in browser on every page reload in develop mode --- .../App/View/Deployment/VersionTest.php | 1 - .../Deployment/Version/Storage/FileTest.php | 45 +++---------------- .../Test/Unit/View/Deployment/VersionTest.php | 4 +- .../Framework/App/View/Deployment/Version.php | 3 +- 4 files changed, 9 insertions(+), 44 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php index 351c509fe27f1..5a313c318f9e9 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php @@ -84,7 +84,6 @@ public function testGetValueInProductionModeWithoutVersion() $this->getVersionModel(State::MODE_PRODUCTION)->getValue(); } - public function testGetValueInDeveloperMode() { $this->assertFalse($this->directoryWrite->isExist($this->fileName)); diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php index 3981511ad4701..e7206bf556607 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/Version/Storage/FileTest.php @@ -34,48 +34,15 @@ protected function setUp() public function testLoad() { - $this->directory - ->expects($this->once()) - ->method('readFile') + $this->directory->expects($this->once()) + ->method('isReadable') ->with('fixture_file.txt') - ->will($this->returnValue('123')); - $this->assertEquals('123', $this->object->load()); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Exception to be propagated - */ - public function testLoadExceptionPropagation() - { - $this->directory - ->expects($this->once()) + ->willReturn(true); + $this->directory->expects($this->once()) ->method('readFile') ->with('fixture_file.txt') - ->will($this->throwException(new \Exception('Exception to be propagated'))); - $this->object->load(); - } - - /** - * @expectedException \UnexpectedValueException - * @expectedExceptionMessage Unable to retrieve deployment version of static files from the file system - */ - public function testLoadExceptionWrapping() - { - $filesystemException = new \Magento\Framework\Exception\FileSystemException( - new \Magento\Framework\Phrase('File does not exist') - ); - $this->directory - ->expects($this->once()) - ->method('readFile') - ->with('fixture_file.txt') - ->will($this->throwException($filesystemException)); - try { - $this->object->load(); - } catch (\Exception $e) { - $this->assertSame($filesystemException, $e->getPrevious(), 'Wrapping of original exception is expected'); - throw $e; - } + ->willReturn('123'); + $this->assertEquals('123', $this->object->load()); } public function testSave() diff --git a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php index 6f2fec559221a..8d804102f7a56 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/View/Deployment/VersionTest.php @@ -6,7 +6,6 @@ namespace Magento\Framework\App\Test\Unit\View\Deployment; use Magento\Framework\App\View\Deployment\Version; -use Magento\Framework\Exception\FileSystemException; /** * Class VersionTest @@ -70,7 +69,8 @@ public function getValueFromStorageDataProvider() ]; } - public function testGetValueInNonProductionMode() { + public function testGetValueInNonProductionMode() + { $version = 123123123123; $this->versionStorageMock->expects($this->once()) ->method('load') diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version.php b/lib/internal/Magento/Framework/App/View/Deployment/Version.php index 64f7ed1d5e18a..73d4a0c926cea 100644 --- a/lib/internal/Magento/Framework/App/View/Deployment/Version.php +++ b/lib/internal/Magento/Framework/App/View/Deployment/Version.php @@ -7,7 +7,6 @@ namespace Magento\Framework\App\View\Deployment; use Psr\Log\LoggerInterface; -use Magento\Framework\Exception\FileSystemException; /** * Deployment version of static files @@ -72,7 +71,7 @@ protected function readValue($appMode) if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) { $this->getLogger()->critical('Can not load static content version.'); throw new \UnexpectedValueException( - __('Unable to retrieve deployment version of static files from the file system.') + "Unable to retrieve deployment version of static files from the file system." ); } $result = $this->generateVersion(); From ee8dba2b3173eb1444fc360ede78b6568805e32b Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Tue, 8 Nov 2016 19:23:34 +0200 Subject: [PATCH 1703/3232] MAGETWO-56072: [Performance] Image resize mechanism does not generate images of all necessary sizes --- app/code/Magento/Catalog/Model/Product/Image.php | 5 +---- .../Magento/Catalog/Test/Unit/Model/Product/ImageTest.php | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 34b145ac113f4..769faa682f422 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -468,9 +468,6 @@ protected function _rgbToString($rgbArray) public function setBaseFile($file) { $this->_isBaseFilePlaceholder = false; - if ($file == 'no_selection') { - return $this; - } $this->imageAsset = $this->getViewAssetImageFactory()->create( [ @@ -478,7 +475,7 @@ public function setBaseFile($file) 'filePath' => $file, ] ); - if (!$this->_fileExists($this->imageAsset->getSourceFile()) + if ($file == 'no_selection' || !$this->_fileExists($this->imageAsset->getSourceFile()) || !$this->_checkMemory($this->imageAsset->getSourceFile()) ) { $this->_isBaseFilePlaceholder = true; diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php index e4cae1d88eb99..8ee875dad17b1 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php @@ -254,8 +254,10 @@ public function testSetGetBaseFile() public function testSetBaseNoSelectionFile() { + $this->viewAssetPlaceholderFactory->expects($this->once())->method('create')->willReturn($this->imageAsset); + $this->imageAsset->expects($this->any())->method('getSourceFile')->willReturn('Default Placeholder Path'); $this->image->setBaseFile('no_selection'); - $this->assertNull($this->image->getBaseFile()); + $this->assertEquals('Default Placeholder Path', $this->image->getBaseFile()); } public function testSetGetImageProcessor() @@ -373,6 +375,7 @@ public function testGetUrl() public function testGetUrlNoSelection() { + $this->viewAssetPlaceholderFactory->expects($this->once())->method('create')->willReturn($this->imageAsset); $this->imageAsset->expects($this->any())->method('getUrl')->will($this->returnValue('Default Placeholder URL')); $this->image->setBaseFile('no_selection'); $this->assertEquals('Default Placeholder URL', $this->image->getUrl()); From 644968634ab923ddbbf927ef9eeca338661e36a9 Mon Sep 17 00:00:00 2001 From: Vitaliy Goncharenko Date: Tue, 8 Nov 2016 19:35:24 +0200 Subject: [PATCH 1704/3232] MAGETWO-60283: Prices of configurable product are incorrectly recalculated when display currency is changed --- .../Magento/Catalog/Block/Product/View.php | 1 + .../Block/Product/View/Type/Configurable.php | 12 +++ ...AssertCurrencyRateAppliedOnProductPage.php | 76 +++++++++++++++++++ .../Test/TestCase/CreateCurrencyRateTest.xml | 28 +++++++ ...AssertCurrencyRateAppliedOnProductPage.php | 14 +++- .../Directory/Test/Repository/ConfigData.xml | 1 + .../Test/TestCase/CreateCurrencyRateTest.php | 30 ++++++-- .../Test/TestCase/CreateCurrencyRateTest.xml | 6 +- 8 files changed, 155 insertions(+), 13 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php create mode 100644 dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateCurrencyRateTest.xml diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index b100ac3643dc1..964a444a0aef8 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -28,6 +28,7 @@ class View extends AbstractProduct implements \Magento\Framework\DataObject\Iden /** * @var \Magento\Framework\Pricing\PriceCurrencyInterface + * @deprecated */ protected $priceCurrency; diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index 1cc1cceefb399..51c68145b24cf 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -92,6 +92,18 @@ public function __construct( ); } + /** + * Get cache key informative items. + * + * @return array + */ + public function getCacheKeyInfo() + { + $parentData = parent::getCacheKeyInfo(); + $parentData[] = $this->priceCurrency->getCurrencySymbol(); + return $parentData; + } + /** * Get allowed attributes * diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php new file mode 100644 index 0000000000000..fdbdcc0180e4d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php @@ -0,0 +1,76 @@ +open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $this->assertPrice($view, $basePrice); + + $view->getViewBlock()->configure($product); + $this->assertPrice($view, $configuredPrices['custom_currency']); + + $cmsIndex->getCurrencyBlock()->switchCurrency($baseCurrency); + $view->getViewBlock()->configure($product); + $this->assertPrice($view, $configuredPrices['base_currency']); + } + + /** + * Assert price. + * + * @param CatalogProductView $view + * @param string $price + * @param string $currency [optional] + */ + public function assertPrice(CatalogProductView $view, $price, $currency = '') { + \PHPUnit_Framework_Assert::assertEquals( + $price, + $view->getViewBlock()->getPriceBlock()->getPrice($currency), + 'Wrong price is displayed on Product page.' + ); + } + + /** + * Returns a string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Currency rate has been applied correctly on Configurable Product page."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateCurrencyRateTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateCurrencyRateTest.xml new file mode 100644 index 0000000000000..6ba7729120ae9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateCurrencyRateTest.xml @@ -0,0 +1,28 @@ + + + + + + USD + UAH + 2.000 + currency_symbols_uah + configurableProduct::default + config_base_currency_us_display_currency_uah + USD + ₴80.00 + + ₴80.00 + $40.00 + + test_type:acceptance_test + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php b/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php index aee8b2e53c6f4..d8a2438e00c16 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php @@ -31,10 +31,20 @@ public function processAssert( $basePrice ) { $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $this->assertPrice($view, $basePrice); + } + /** + * Assert price. + * + * @param CatalogProductView $view + * @param string $price + * @param string $currency [optional] + */ + public function assertPrice(CatalogProductView $view, $price, $currency = '') { \PHPUnit_Framework_Assert::assertEquals( - $basePrice, - $view->getViewBlock()->getPriceBlock()->getPrice(''), + $price, + $view->getViewBlock()->getPriceBlock()->getPrice($currency), 'Wrong price is displayed on Product page.' ); } 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 index e1ae1dc1ebfb5..7046437a0f4e2 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/Repository/ConfigData.xml @@ -13,6 +13,7 @@ 1 UAH + USD diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php index 07daaff5d366f..df9cdc93a50cd 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.php @@ -6,11 +6,12 @@ namespace Magento\Directory\Test\TestCase; +use Magento\Catalog\Test\TestStep\CreateProductsStep; use Magento\Config\Test\Fixture\ConfigData; use Magento\Mtf\TestCase\Injectable; use Magento\Directory\Test\Fixture\CurrencyRate; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\CurrencySymbol\Test\Page\Adminhtml\SystemCurrencyIndex; +use Magento\Mtf\TestStep\TestStepFactory; /** * Preconditions: @@ -41,29 +42,40 @@ class CreateCurrencyRateTest extends Injectable */ protected $currencyIndexPage; + /** + * Test step factory. + * + * @var TestStepFactory + */ + private $stepFactory; + /** * Inject data. * * @param SystemCurrencyIndex $currencyIndexPage - * @return void + * @param TestStepFactory $stepFactory */ - public function __inject(SystemCurrencyIndex $currencyIndexPage) + public function __inject(SystemCurrencyIndex $currencyIndexPage, TestStepFactory $stepFactory) { $this->currencyIndexPage = $currencyIndexPage; + $this->stepFactory = $stepFactory; } /** * Create currency rate test. * * @param CurrencyRate $currencyRate - * @param CatalogProductSimple $product - * @param $config - * @return void + * @param ConfigData $config + * @param string $product + * @param array $productData [optional] + * @return array */ - public function test(CurrencyRate $currencyRate, CatalogProductSimple $product, ConfigData $config) + public function test(CurrencyRate $currencyRate, ConfigData $config, $product, array $productData = []) { // Preconditions: - $product->persist(); + $product = $this->stepFactory + ->create(CreateProductsStep::class, ['products' => [$product], 'data' => $productData]) + ->run()['products'][0]; $config->persist(); // Steps: @@ -71,6 +83,8 @@ public function test(CurrencyRate $currencyRate, CatalogProductSimple $product, $this->currencyIndexPage->getCurrencyRateForm()->clickImportButton(); $this->currencyIndexPage->getCurrencyRateForm()->fill($currencyRate); $this->currencyIndexPage->getFormPageActions()->save(); + + return ['product' => $product]; } /** diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml index 083bcd5e4b0f1..e984cad9ca327 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/TestCase/CreateCurrencyRateTest.xml @@ -13,7 +13,7 @@ EUR 0.8 currency_symbols_eur - simple_10_dollar + catalogProductSimple::simple_10_dollar config_currency_symbols_usd_and_eur $10.00 €8.00 @@ -25,8 +25,8 @@ UAH 2.000 currency_symbols_uah - simple_10_dollar - not_required_text_option + catalogProductSimple::simple_10_dollar + not_required_text_option config_base_currency_us_display_currency_uah ₴20.00 test_type:acceptance_test From 9be4f2a0fa330db47c6c13a4fc52293e3bc9c0b8 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 8 Nov 2016 14:24:27 -0600 Subject: [PATCH 1705/3232] MAGETWO-60539: Remove object data in \Magento\Indexer\Model\Config\Data Moving translation from configuration to presentation layer --- .../Widget/Grid/Column/Renderer/Text.php | 68 ++++++++++++------- .../layout/adminhtml_cache_block.xml | 2 + .../layout/indexer_indexer_list_grid.xml | 2 + .../Framework/Indexer/Config/Converter.php | 5 +- 4 files changed, 52 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php index 1427cec7604e8..8004ca4134154 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php @@ -3,14 +3,13 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ +namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; + +use Magento\Framework\DataObject; /** * Backend grid item renderer - * - * @author Magento Core Team */ -namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; - class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** @@ -21,30 +20,53 @@ class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe protected $_variablePattern = '/\\$([a-z0-9_]+)/i'; /** - * Renders grid column + * Get value for the cel * - * @param \Magento\Framework\DataObject $row - * @return mixed + * @param DataObject $row + * @return string */ public function _getValue(\Magento\Framework\DataObject $row) { - $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null; - $defaultValue = $this->getColumn()->getDefault(); - if ($format === null) { - // If no format and it column not filtered specified return data as is. - $data = parent::_getValue($row); - $string = $data === null ? $defaultValue : $data; - return $this->escapeHtml($string); - } elseif (preg_match_all($this->_variablePattern, $format, $matches)) { - // Parsing of format string - $formattedString = $format; - foreach ($matches[0] as $matchIndex => $match) { - $value = $row->getData($matches[1][$matchIndex]); - $formattedString = str_replace($match, $value, $formattedString); + if ($this->getColumn()->getFormat() === null) { + return $this->getSimpleValue($row); + } + return $this->getFormattedValue($row); + } + + /** + * Get simple value + * + * @param DataObject $row + * @return string + */ + private function getSimpleValue($row) + { + $data = parent::_getValue($row); + $value = null === $data ? $this->getColumn()->getDefault() : $data; + if (true === $this->getColumn()->getTranslate()) { + $value = __($value); + } + return $this->escapeHtml($value); + } + + /** + * Replace placeholders in the string with values + * + * @param DataObject $row + * @return string + */ + private function getFormattedValue($row) + { + $value = $this->getColumn()->getFormat() ?: null; + if (true === $this->getColumn()->getTranslate()) { + $value = __($value); + } + if (preg_match_all($this->_variablePattern, $value, $matches)) { + foreach ($matches[0] as $index => $match) { + $replacement = $row->getData($matches[1][$index]); + $value = str_replace($match, $replacement, $value); } - return $formattedString; - } else { - return $this->escapeHtml($format); } + return $this->escapeHtml($value); } } diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml index 3e61fec077c6e..decc26f331c82 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml @@ -48,6 +48,7 @@ 180 left 0 + true @@ -57,6 +58,7 @@ text left 0 + true diff --git a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml index 6def568e9cbbd..63ef028238393 100644 --- a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml +++ b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml @@ -46,6 +46,7 @@ title 0 indexer-title + true @@ -54,6 +55,7 @@ description 0 indexer-description + true diff --git a/lib/internal/Magento/Framework/Indexer/Config/Converter.php b/lib/internal/Magento/Framework/Indexer/Config/Converter.php index b8b17b185a1f2..0112b4d9a4de3 100644 --- a/lib/internal/Magento/Framework/Indexer/Config/Converter.php +++ b/lib/internal/Magento/Framework/Indexer/Config/Converter.php @@ -72,10 +72,10 @@ protected function convertChild(\DOMElement $childNode, $data) $data['fieldsets'] = isset($data['fieldsets']) ? $data['fieldsets'] : []; switch ($childNode->nodeName) { case 'title': - $data['title'] = $this->getTranslatedNodeValue($childNode); + $data['title'] = $childNode->nodeValue; break; case 'description': - $data['description'] = $this->getTranslatedNodeValue($childNode); + $data['description'] = $childNode->nodeValue; break; case 'saveHandler': $data['saveHandler'] = $this->getAttributeValue($childNode, 'class'); @@ -207,6 +207,7 @@ protected function convertField(\DOMElement $node, $data) * * @param \DOMNode $node * @return string + * @deprecated */ protected function getTranslatedNodeValue(\DOMNode $node) { From 92700b445fcc0c0d6a428530cad953ad66feca8c Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Tue, 8 Nov 2016 14:27:07 -0600 Subject: [PATCH 1706/3232] MAGETWO-60539: Remove object data in \Magento\Indexer\Model\Config\Data Moving translation from configuration to presentation layer --- .../Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php index 8004ca4134154..010ee2d15c812 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php @@ -27,7 +27,7 @@ class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe */ public function _getValue(\Magento\Framework\DataObject $row) { - if ($this->getColumn()->getFormat() === null) { + if (null === $this->getColumn()->getFormat()) { return $this->getSimpleValue($row); } return $this->getFormattedValue($row); From 426c830d9435654c3e7eb67d07f6b356fd14e36f Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy Date: Tue, 8 Nov 2016 23:14:35 +0200 Subject: [PATCH 1707/3232] MAGETWO-59586: Excessive loaders for order with virtual product - Remove switchPaymentMethod call from template; --- .../templates/order/create/billing/method/form.phtml | 4 +--- .../Sales/view/adminhtml/web/order/create/scripts.js | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) 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 6d09c4d760189..4a9af33449b61 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 @@ -40,9 +40,7 @@
    - \ No newline at end of file + diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml index 0f221a393f5eb..ebe8f4570b02f 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml @@ -17,7 +17,13 @@
    - +
    diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml index d83b552b05cd4..21fafe4d37f1b 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml @@ -96,7 +96,6 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima size="4" title="escapeHtml(__('Qty')); ?>" class="input-text qty" - maxlength="12" data-validate="{required:true,'validate-greater-than-zero':true}" data-role="cart-item-qty"/>
    diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html index 89789996e5248..8796152eb6031 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html @@ -79,8 +79,7 @@ }, value: qty" type="number" size="4" - class="item-qty cart-item-qty" - maxlength="12"/> + class="item-qty cart-item-qty">
    -
    \ No newline at end of file +
    From 664258fd3e411b2ddc643922364b0a489c358d40 Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Fri, 11 Nov 2016 11:21:46 +0200 Subject: [PATCH 1754/3232] MAGETWO-48516: Most of category fields don't have Use Default Value option in Store/StoreView scope on the redesigned category page --- app/code/Magento/Catalog/Model/Category/DataProvider.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index 5fb96ce57a27b..2877507d4b67f 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -169,6 +169,9 @@ public function __construct( parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); } + /** + * @inheritdoc + */ public function getMeta() { $meta = parent::getMeta(); From 223ac523d6783f3b71d7374560322ae52173a8ad Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Fri, 11 Nov 2016 12:52:40 +0200 Subject: [PATCH 1755/3232] MAGETWO-48516: Most of category fields don't have Use Default Value option in Store/StoreView scope on the redesigned category page --- .../Catalog/Model/Category/DataProvider.php | 1 - .../Magento/Framework/Stdlib/ArrayManager.php | 16 ++++----- .../Stdlib/Test/Unit/ArrayManagerTest.php | 36 +++++++++++++++++-- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index 2877507d4b67f..2a8ab2c4de320 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -216,7 +216,6 @@ private function addUseDefaultValueCheckbox(Category $category, array $meta) ) ] ); - } return $meta; diff --git a/lib/internal/Magento/Framework/Stdlib/ArrayManager.php b/lib/internal/Magento/Framework/Stdlib/ArrayManager.php index c7224fa24e51b..edce214cc3091 100644 --- a/lib/internal/Magento/Framework/Stdlib/ArrayManager.php +++ b/lib/internal/Magento/Framework/Stdlib/ArrayManager.php @@ -30,7 +30,7 @@ class ArrayManager /** * Check if node exists * - * @param string $path + * @param array|string $path * @param array $data * @param string $delimiter * @return bool @@ -43,7 +43,7 @@ public function exists($path, array $data, $delimiter = self::DEFAULT_PATH_DELIM /** * Retrieve node * - * @param string $path + * @param array|string $path * @param array $data * @param null $defaultValue * @param string $delimiter @@ -57,7 +57,7 @@ public function get($path, array $data, $defaultValue = null, $delimiter = self: /** * Set value into node and return modified data * - * @param string $path + * @param array|string $path * @param array $data * @param mixed $value * @param string $delimiter @@ -75,7 +75,7 @@ public function set($path, array $data, $value, $delimiter = self::DEFAULT_PATH_ /** * Set value into existing node and return modified data * - * @param string $path + * @param array|string $path * @param array $data * @param mixed $value * @param string $delimiter @@ -93,7 +93,7 @@ public function replace($path, array $data, $value, $delimiter = self::DEFAULT_P /** * Move value from one location to another * - * @param string $path + * @param array|string $path * @param string $targetPath * @param array $data * @param bool $overwrite @@ -120,7 +120,7 @@ public function move($path, $targetPath, array $data, $overwrite = false, $delim /** * Merge value with node and return modified data * - * @param string $path + * @param array|string $path * @param array $data * @param array $value * @param string $delimiter @@ -141,7 +141,7 @@ public function merge($path, array $data, array $value, $delimiter = self::DEFAU /** * Populate nested array if possible and needed * - * @param string $path + * @param array|string $path * @param array $data * @param string $delimiter * @return array @@ -156,7 +156,7 @@ public function populate($path, array $data, $delimiter = self::DEFAULT_PATH_DEL /** * Remove node and return modified data * - * @param string $path + * @param array|string $path * @param array $data * @param string $delimiter * @return array diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/ArrayManagerTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/ArrayManagerTest.php index 4d469236e64bb..9ba8dbcf78985 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/ArrayManagerTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/ArrayManagerTest.php @@ -139,6 +139,12 @@ public function setDataProvider() 'data' => ['existing' => ['path' => 1]], 'value' => 'valuable data', 'result' => ['existing' => ['path' => 1], 'new' => ['path' => [2 => 'valuable data']]] + ], + 3 => [ + 'path' => ['new', 'path/2'], + 'data' => ['existing' => ['path' => 1]], + 'value' => 'valuable data', + 'result' => ['existing' => ['path' => 1], 'new' => ['path' => [2 => 'valuable data']]] ] ]; } @@ -178,6 +184,12 @@ public function setReplaceProvider() 'data' => ['existing' => ['path' => 1]], 'value' => 'valuable data', 'result' => ['existing' => ['path' => 1]] + ], + 3 => [ + 'path' => ['new', 'path', '2'], + 'data' => ['existing' => ['path' => 1]], + 'value' => 'valuable data', + 'result' => ['existing' => ['path' => 1]] ] ]; } @@ -228,6 +240,13 @@ public function moveDataProvider() 'data' => ['valid' => ['path' => 'value'], 'target' => ['path' => 'exists']], 'overwrite' => true, 'result' => ['valid' => [], 'target' => ['path' => 'value']] + ], + 4 => [ + 'path' => ['valid', 'path'], + 'targetPath' => 'target/path', + 'data' => ['valid' => ['path' => 'value'], 'target' => ['path' => 'exists']], + 'overwrite' => true, + 'result' => ['valid' => [], 'target' => ['path' => 'value']] ] ]; } @@ -267,7 +286,13 @@ public function mergeDataProvider() 'data' => [], 'value' => [true], 'result' => [] - ] + ], + 3 => [ + 'path' => ['0', 'path/1'], + 'data' => [['path' => [false, ['value' => false]]]], + 'value' => ['value' => true, 'new_value' => false], + 'result' => [['path' => [false, ['value' => true, 'new_value' => false]]]] + ], ]; } @@ -337,7 +362,12 @@ public function removeDataProvider() 'path' => 'invalid', 'data' => [true], 'result' => [true] - ] + ], + 3 => [ + 'path' => ['simple'], + 'data' => ['simple' => true, 'complex' => false], + 'result' => ['complex' => false] + ], ]; } @@ -550,7 +580,7 @@ public function slicePathDataProvider() 'offset' => -6, 'length' => 3, 'result' => 'path/0/goes' - ] + ], ]; } From 5c2bc87099009f12ae6d6fa5d03698fe201de62b Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Fri, 11 Nov 2016 12:54:18 +0200 Subject: [PATCH 1756/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -move deploy static command --- .../Magento/Config/App/Config/Type/System.php | 19 ++++++++++-- .../Test/Unit/App/Config/Type/SystemTest.php | 28 ++++++++++++++--- .../Eav/Model/Entity/AttributeCache.php | 27 +++++++++++++++-- .../Magento/Store/App/Config/Type/Scopes.php | 14 +++++++-- .../Test/Unit/App/Config/Type/ScopesTest.php | 24 +++++++++++++-- .../Theme/Model/Theme/ThemeProvider.php | 30 ++++++++++++++++--- .../Magento/User/Model/ResourceModel/User.php | 23 ++++++++++++++ 7 files changed, 148 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Config/App/Config/Type/System.php b/app/code/Magento/Config/App/Config/Type/System.php index a8b98d3824b5e..4a3c6da837915 100644 --- a/app/code/Magento/Config/App/Config/Type/System.php +++ b/app/code/Magento/Config/App/Config/Type/System.php @@ -10,6 +10,8 @@ use Magento\Framework\App\Config\Spi\PostProcessorInterface; use Magento\Framework\Cache\FrontendInterface; use Magento\Framework\DataObject; +use Magento\Framework\Serialize\Serializer\Serialize; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Store\Model\Config\Processor\Fallback; /** @@ -53,6 +55,11 @@ class System implements ConfigTypeInterface */ private $fallback; + /** + * @var Serialize + */ + private $serializer; + /** * System constructor. * @param ConfigSourceInterface $source @@ -60,12 +67,14 @@ class System implements ConfigTypeInterface * @param Fallback $fallback * @param FrontendInterface $cache * @param int $cachingNestedLevel + * @param Serialize $serializer */ public function __construct( ConfigSourceInterface $source, PostProcessorInterface $postProcessor, Fallback $fallback, FrontendInterface $cache, + Serialize $serializer, $cachingNestedLevel = 1 ) { $this->source = $source; @@ -73,6 +82,7 @@ public function __construct( $this->cache = $cache; $this->cachingNestedLevel = $cachingNestedLevel; $this->fallback = $fallback; + $this->serializer = $serializer; } /** @@ -88,11 +98,16 @@ public function get($path = '') if (!$data) { $data = $this->fallback->process($this->source->get()); $this->data = new DataObject($data); + //Placeholder processing need system config - so we need to save intermediate result $data = $this->postProcessor->process($data); $this->data = new DataObject($data); - $this->cache->save(serialize($this->data), self::CONFIG_TYPE, [self::CACHE_TAG]); + $this->cache->save( + $this->serializer->serialize($this->data->getData()), + self::CONFIG_TYPE, + [self::CACHE_TAG] + ); } else { - $this->data = unserialize($data); + $this->data = new DataObject($this->serializer->unserialize($data)); } } diff --git a/app/code/Magento/Config/Test/Unit/App/Config/Type/SystemTest.php b/app/code/Magento/Config/Test/Unit/App/Config/Type/SystemTest.php index 276082ae8a19c..be541228bf6d8 100644 --- a/app/code/Magento/Config/Test/Unit/App/Config/Type/SystemTest.php +++ b/app/code/Magento/Config/Test/Unit/App/Config/Type/SystemTest.php @@ -8,8 +8,9 @@ use Magento\Config\App\Config\Type\System; use Magento\Framework\App\Config\ConfigSourceInterface; use Magento\Framework\App\Config\Spi\PostProcessorInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Cache\FrontendInterface; -use Magento\Framework\DataObject; +use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Store\Model\Config\Processor\Fallback; /** @@ -43,6 +44,11 @@ class SystemTest extends \PHPUnit_Framework_TestCase */ private $configType; + /** + * @var Serialize|\PHPUnit_Framework_MockObject_MockObject + */ + private $serializer; + public function setUp() { $this->source = $this->getMockBuilder(ConfigSourceInterface::class) @@ -54,11 +60,15 @@ public function setUp() ->getMock(); $this->cache = $this->getMockBuilder(FrontendInterface::class) ->getMockForAbstractClass(); + $this->serializer = $this->getMockBuilder(Serialize::class) + ->disableOriginalConstructor() + ->getMock(); $this->configType = new System( $this->source, $this->postProcessor, $this->fallback, - $this->cache + $this->cache, + $this->serializer ); } @@ -79,12 +89,22 @@ public function testGet($isCached) ] ] ]; + $this->cache->expects($this->once()) ->method('load') ->with(System::CONFIG_TYPE) - ->willReturn($isCached ? serialize(new DataObject($data)) : null); + ->willReturn($isCached ? $data : null); + + if ($isCached) { + $this->serializer->expects($this->once()) + ->method('unserialize') + ->willReturn($data); + } if (!$isCached) { + $this->serializer->expects($this->once()) + ->method('serialize') + ->willReturn(serialize($data)); $this->source->expects($this->once()) ->method('get') ->willReturn($data); @@ -99,7 +119,7 @@ public function testGet($isCached) $this->cache->expects($this->once()) ->method('save') ->with( - serialize(new DataObject($data)), + serialize($data), System::CONFIG_TYPE, [System::CACHE_TAG] ); diff --git a/app/code/Magento/Eav/Model/Entity/AttributeCache.php b/app/code/Magento/Eav/Model/Entity/AttributeCache.php index 60727aa654e1c..2aca4aa589683 100644 --- a/app/code/Magento/Eav/Model/Entity/AttributeCache.php +++ b/app/code/Magento/Eav/Model/Entity/AttributeCache.php @@ -9,6 +9,9 @@ use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Framework\App\CacheInterface; use Magento\Framework\App\Cache\StateInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\Serializer\Serialize; +use Magento\Framework\Serialize\SerializerInterface; /** * Class AttributeCache @@ -43,6 +46,11 @@ class AttributeCache */ private $unsupportedTypes; + /** + * @var SerializerInterface + */ + private $serializer; + /** * AttributeCache constructor. * @param CacheInterface $cache @@ -89,7 +97,7 @@ public function getAttributes($entityType, $suffix = '') $cacheKey = self::ATTRIBUTES_CACHE_PREFIX . $entityType . $suffix; $attributesData = $this->cache->load($cacheKey); if ($attributesData) { - $attributes = unserialize($attributesData); + $attributes = $this->getSerializer()->unserialize($attributesData); $this->attributeInstances[$entityType . $suffix] = $attributes; return $attributes; } @@ -113,7 +121,7 @@ public function saveAttributes($entityType, $attributes, $suffix = '') $this->attributeInstances[$entityType . $suffix] = $attributes; if ($this->isAttributeCacheEnabled()) { $cacheKey = self::ATTRIBUTES_CACHE_PREFIX . $entityType . $suffix; - $attributesData = serialize($attributes); + $attributesData = $this->getSerializer()->serialize($attributes); $this->cache->save( $attributesData, $cacheKey, @@ -145,4 +153,19 @@ public function clear() } return true; } + + /** + * Retrieve handler which allows serialize/deserialize data + * + * @deprecated + * @return SerializerInterface + */ + private function getSerializer() + { + if (!$this->serializer) { + $this->serializer = ObjectManager::getInstance()->get(Serialize::class); + } + + return $this->serializer; + } } diff --git a/app/code/Magento/Store/App/Config/Type/Scopes.php b/app/code/Magento/Store/App/Config/Type/Scopes.php index f66e172bc638e..dbe939aac1be4 100644 --- a/app/code/Magento/Store/App/Config/Type/Scopes.php +++ b/app/code/Magento/Store/App/Config/Type/Scopes.php @@ -9,6 +9,8 @@ use Magento\Framework\App\Config\ConfigSourceInterface; use Magento\Framework\Cache\FrontendInterface; use Magento\Framework\DataObject; +use Magento\Framework\Serialize\Serializer\Serialize; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Store\Model\Group; use Magento\Store\Model\Store; use Magento\Store\Model\Website; @@ -42,20 +44,28 @@ class Scopes implements ConfigTypeInterface */ private $cachingNestedLevel; + /** + * @var Serialize + */ + private $serializer; + /** * System constructor. * @param ConfigSourceInterface $source * @param FrontendInterface $cache * @param int $cachingNestedLevel + * @param SerializerInterface $serializer */ public function __construct( ConfigSourceInterface $source, FrontendInterface $cache, + Serialize $serializer, $cachingNestedLevel = 1 ) { $this->source = $source; $this->cache = $cache; $this->cachingNestedLevel = $cachingNestedLevel; + $this->serializer = $serializer; } /** @@ -69,12 +79,12 @@ public function get($path = '') if (!$data) { $this->data = new DataObject($this->source->get()); $this->cache->save( - serialize($this->data), + $this->serializer->serialize($this->data->getData()), self::CONFIG_TYPE, [Group::CACHE_TAG, Store::CACHE_TAG, Website::CACHE_TAG] ); } else { - $this->data = unserialize($data); + $this->data = new DataObject($this->serializer->unserialize($data)); } } diff --git a/app/code/Magento/Store/Test/Unit/App/Config/Type/ScopesTest.php b/app/code/Magento/Store/Test/Unit/App/Config/Type/ScopesTest.php index 12e85d8631031..94efcc7db8cc7 100644 --- a/app/code/Magento/Store/Test/Unit/App/Config/Type/ScopesTest.php +++ b/app/code/Magento/Store/Test/Unit/App/Config/Type/ScopesTest.php @@ -8,6 +8,7 @@ use Magento\Framework\App\Config\ConfigSourceInterface; use Magento\Framework\Cache\FrontendInterface; use Magento\Framework\DataObject; +use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Store\App\Config\Type\Scopes; use Magento\Store\Model\Group; use Magento\Store\Model\Store; @@ -30,14 +31,22 @@ class ScopesTest extends \PHPUnit_Framework_TestCase */ private $configType; + /** + * @var Serialize | \PHPUnit_Framework_MockObject_MockObject + */ + private $serializer; + public function setUp() { $this->source = $this->getMockBuilder(ConfigSourceInterface::class) ->getMockForAbstractClass(); $this->cache = $this->getMockBuilder(FrontendInterface::class) ->getMockForAbstractClass(); + $this->serializer = $this->getMockBuilder(Serialize::class) + ->disableOriginalConstructor() + ->getMock(); - $this->configType = new Scopes($this->source, $this->cache); + $this->configType = new Scopes($this->source, $this->cache, $this->serializer); } /** @@ -58,9 +67,18 @@ public function testGet($isCached) $this->cache->expects($this->once()) ->method('load') ->with(Scopes::CONFIG_TYPE) - ->willReturn($isCached ? serialize(new DataObject($data)) : false); + ->willReturn($isCached ? serialize($data) : false); + + if ($isCached) { + $this->serializer->expects($this->once()) + ->method('unserialize') + ->willReturn($data); + } if (!$isCached) { + $this->serializer->expects($this->once()) + ->method('serialize') + ->willReturn(serialize($data)); $this->source->expects($this->once()) ->method('get') ->with('') @@ -68,7 +86,7 @@ public function testGet($isCached) $this->cache->expects($this->once()) ->method('save') ->with( - serialize(new DataObject($data)), + serialize($data), Scopes::CONFIG_TYPE, [Group::CACHE_TAG, Store::CACHE_TAG, Website::CACHE_TAG] ); diff --git a/app/code/Magento/Theme/Model/Theme/ThemeProvider.php b/app/code/Magento/Theme/Model/Theme/ThemeProvider.php index 89d7bfc18d30c..68e675387f905 100644 --- a/app/code/Magento/Theme/Model/Theme/ThemeProvider.php +++ b/app/code/Magento/Theme/Model/Theme/ThemeProvider.php @@ -6,6 +6,8 @@ namespace Magento\Theme\Model\Theme; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\Serializer\Serialize; +use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\View\Design\Theme\ListInterface; use Magento\Framework\App\DeploymentConfig; @@ -44,6 +46,11 @@ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProvide */ private $deploymentConfig; + /** + * @var SerializerInterface + */ + private $serializer; + /** * ThemeProvider constructor. * @@ -77,13 +84,13 @@ public function getThemeByFullPath($fullPath) /** @var $themeCollection \Magento\Theme\Model\ResourceModel\Theme\Collection */ $theme = $this->cache->load('theme'. $fullPath); if ($theme) { - $this->themes[$fullPath] = unserialize($theme); + $this->themes[$fullPath] = $this->getSerializer()->unserialize($theme); return $this->themes[$fullPath]; } $themeCollection = $this->collectionFactory->create(); $item = $themeCollection->getThemeByFullPath($fullPath); if ($item->getId()) { - $themeData = serialize($item); + $themeData = $this->getSerializer()->serialize($item); $this->cache->save($themeData, 'theme' . $fullPath); $this->cache->save($themeData, 'theme-by-id-' . $item->getId()); $this->themes[$fullPath] = $item; @@ -115,14 +122,14 @@ public function getThemeById($themeId) } $theme = $this->cache->load('theme-by-id-' . $themeId); if ($theme) { - $this->themes[$themeId] = unserialize($theme); + $this->themes[$themeId] = $this->getSerializer()->unserialize($theme); return $this->themes[$themeId]; } /** @var $themeModel \Magento\Framework\View\Design\ThemeInterface */ $themeModel = $this->themeFactory->create(); $themeModel->load($themeId); if ($themeModel->getId()) { - $this->cache->save(serialize($themeModel), 'theme-by-id-' . $themeId); + $this->cache->save($this->getSerializer()->serialize($themeModel), 'theme-by-id-' . $themeId); $this->themes[$themeId] = $themeModel; } return $themeModel; @@ -151,4 +158,19 @@ private function getDeploymentConfig() } return $this->deploymentConfig; } + + /** + * Retrieve handler which allows serialize/deserialize data + * + * @deprecated + * @return SerializerInterface + */ + private function getSerializer() + { + if (!$this->serializer) { + $this->serializer = ObjectManager::getInstance()->get(Serialize::class); + } + + return $this->serializer; + } } diff --git a/app/code/Magento/User/Model/ResourceModel/User.php b/app/code/Magento/User/Model/ResourceModel/User.php index d3e228d443581..fee2a07b21c8a 100644 --- a/app/code/Magento/User/Model/ResourceModel/User.php +++ b/app/code/Magento/User/Model/ResourceModel/User.php @@ -9,6 +9,9 @@ use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; use Magento\Authorization\Model\Acl\Role\User as RoleUser; use Magento\Authorization\Model\UserContextInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\Serializer\Serialize; +use Magento\Framework\Serialize\SerializerInterface; use Magento\User\Model\User as ModelUser; /** @@ -34,6 +37,11 @@ class User extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb */ protected $dateTime; + /** + * @var SerializerInterface + */ + private $serializer; + /** * Construct * @@ -617,4 +625,19 @@ public function getLatestPassword($userId) [':user_id' => $userId] ); } + + /** + * Retrieve handler which allows serialize/deserialize data + * + * @deprecated + * @return SerializerInterface + */ + private function getSerializer() + { + if (!$this->serializer) { + $this->serializer = ObjectManager::getInstance()->get(Serialize::class); + } + + return $this->serializer; + } } From bb56c2bb60d194319169abcf0e25d23093ed0ef6 Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 14:10:40 +0300 Subject: [PATCH 1757/3232] MTO-37: [Variation] Checkout as Guest if Billing address != Shipping address - Functional test implemented. --- .../Checkout/Test/TestCase/OnePageCheckoutTest.xml | 3 ++- .../app/Magento/Customer/Test/Repository/Address.xml | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml index 797255d4e374a..500b7946a0aac 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml @@ -168,12 +168,13 @@ - + stable:no catalogProductSimple::simple_with_tier_price_and_order_qty_3 default guest UK_address + UK_address_2_without_email Flat Rate Fixed diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index 70191dc828af7..63bdf75c86015 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -189,6 +189,18 @@ 555-55-555-55 + + Billy + Holiday + Magento %isolation% + Liverpool + 99 Henry St + SE1 7RW + United Kingdom + Liverpool + 555-55-555-55 + + Jane Doe From cc90e726691e9415a4676722e5a3e17cfc21ff29 Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 14:20:05 +0300 Subject: [PATCH 1758/3232] MTO-78: [Variation] Customer is redirected to checkout on login if guest is disabled - Functional test implemented. --- .../Checkout/Test/Repository/ConfigData.xml | 43 +++++++++++++++++++ .../Test/TestCase/OnePageCheckoutTest.php | 2 +- .../Test/TestCase/OnePageCheckoutTest.xml | 28 ++++++++++++ .../TestStep/SelectCheckoutMethodStep.php | 39 ++++++++++++++++- .../Block/Account/AuthenticationPopup.php | 17 ++++++++ .../Test/TestStep/CreateCustomerStep.php | 4 +- .../TestCase/CreateSalesRuleEntityTest.xml | 26 +++++++++++ 7 files changed, 155 insertions(+), 4 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Repository/ConfigData.xml diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Repository/ConfigData.xml new file mode 100644 index 0000000000000..f1d9108ec3fc4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Repository/ConfigData.xml @@ -0,0 +1,43 @@ + + + + + + + checkout + 1 + No + 0 + + + + + checkout + 1 + Yes + 1 + + + + + customer + 1 + No + 0 + + + + + customer + 1 + Yes + 1 + + + + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php index 58d0c23f2274f..25922102e1269 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php @@ -33,7 +33,7 @@ * 14. Perform assertions. * * @group One_Page_Checkout - * @ZephyrId MAGETWO-27485, MAGETWO-12412, MAGETWO-12429 + * @ZephyrId MAGETWO-27485, MAGETWO-12412, MAGETWO-12429, MAGETWO-49917, MAGETWO-27485 * @ZephyrId MAGETWO-12444, MAGETWO-12848, MAGETWO-12849, MAGETWO-12850 */ class OnePageCheckoutTest extends Scenario diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml index 797255d4e374a..22b6c462efe83 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml @@ -7,6 +7,34 @@ --> + + catalogProductSimple::default + johndoe_with_addresses + login + + 565.00 + + Flat Rate + Fixed + checkmo + checkmo, disable_guest_checkout, disable_customer_redirect_after_logging + + + + MAGETWO-59816: Redirect works improperly in a browser incognito mode + catalogProductSimple::default + register_customer + register_before_checkout + + 565.00 + + Flat Rate + Fixed + US_address_1_without_email + checkmo + checkmo, disable_guest_checkout, disable_customer_redirect_after_logging, enable_https_frontend_only + + catalogProductVirtual::default downloadableProduct::with_two_separately_links diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php index 444b98adb7f83..c63a52b7ed67e 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php @@ -8,6 +8,7 @@ use Magento\Mtf\TestStep\TestStepInterface; use Magento\Customer\Test\Fixture\Customer; +use Magento\Customer\Test\Page\CustomerAccountCreate; use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep; @@ -51,9 +52,17 @@ class SelectCheckoutMethodStep implements TestStepInterface */ private $clickProceedToCheckoutStep; + /** + * Customer account create page instance. + * + * @var CustomerAccountCreate + */ + private $customerAccountCreatePage; + /** * @constructor * @param CheckoutOnepage $checkoutOnepage + * @param CustomerAccountCreate $customerAccountCreatePage * @param Customer $customer * @param LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend * @param ClickProceedToCheckoutStep $clickProceedToCheckoutStep @@ -61,12 +70,14 @@ class SelectCheckoutMethodStep implements TestStepInterface */ public function __construct( CheckoutOnepage $checkoutOnepage, + CustomerAccountCreate $customerAccountCreatePage, Customer $customer, LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend, ClickProceedToCheckoutStep $clickProceedToCheckoutStep, $checkoutMethod ) { $this->checkoutOnepage = $checkoutOnepage; + $this->customerAccountCreatePage = $customerAccountCreatePage; $this->customer = $customer; $this->logoutCustomerOnFrontend = $logoutCustomerOnFrontend; $this->clickProceedToCheckoutStep = $clickProceedToCheckoutStep; @@ -80,7 +91,18 @@ public function __construct( */ public function run() { - if ($this->checkoutMethod === 'login') { + $this->processLogin(); + $this->processRegister(); + } + + /** + * Process login action. + * + * @return void + */ + private function processLogin() + { + if ($this->checkoutMethod == 'login') { if ($this->checkoutOnepage->getAuthenticationPopupBlock()->isVisible()) { $this->checkoutOnepage->getAuthenticationPopupBlock()->loginCustomer($this->customer); $this->clickProceedToCheckoutStep->run(); @@ -90,6 +112,19 @@ public function run() } } + /** + * Process customer register action. + * + * @return void + */ + private function processRegister() + { + if ($this->checkoutMethod === 'register_before_checkout') { + $this->checkoutOnepage->getAuthenticationPopupBlock()->createAccount(); + $this->customerAccountCreatePage->getRegisterForm()->registerCustomer($this->customer); + } + } + /** * Logout customer on fronted. * @@ -97,7 +132,7 @@ public function run() */ public function cleanup() { - if ($this->checkoutMethod === 'login') { + if ($this->checkoutMethod === 'login' || $this->checkoutMethod === 'register_before_checkout') { $this->logoutCustomerOnFrontend->run(); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php index c4fcfd569490a..64e358c904f35 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php @@ -27,6 +27,23 @@ class AuthenticationPopup extends Form */ private $loadingMask = '.loading-mask'; + /** + * 'Create an Account' button. + * + * @var string + */ + protected $createAccountButton = '.action.action-register.primary'; + + /** + * Click 'Create an Account' button. + * + * @return void + */ + public function createAccount() + { + $this->_rootElement->find($this->createAccountButton)->click(); + } + /** * Login customer on authentication popup. * diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/CreateCustomerStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/CreateCustomerStep.php index f3be4e8b89cfd..4beb9207f4f29 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/CreateCustomerStep.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/CreateCustomerStep.php @@ -46,7 +46,9 @@ public function __construct(LogoutCustomerOnFrontendStep $logout, Customer $cust { $this->logoutCustomerOnFrontend = $logout; $this->customer = $customer; - if ($checkoutMethod === 'register' || $checkoutMethod === 'guest') { + if ($checkoutMethod === 'register' + || $checkoutMethod === 'guest' + || $checkoutMethod === 'register_before_checkout') { $this->persistCustomer = false; } } diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml index d0ad41011004a..de4e7aeb1e298 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml @@ -399,5 +399,31 @@ + + Cart Price Rule1 %isolation% + Cart Price Rule Description %isolation% + Yes + Main Website + NOT LOGGED IN + No Coupon + Percent of product price discount + [Subtotal|greater than|0] + 50 + No + For matching items only + Sales Cart Rule labels + 100.00 + 50.00 + 50.00 + United States + California + 95814 + Flat Rate + simple_for_salesrule_1 + 1 + + + + From 64cc549065d8d652f6a15dd9217ce0c1d645f35f Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 14:25:05 +0300 Subject: [PATCH 1759/3232] MTO-88: Use layered navigation to filter products - Functional test implemented. --- .../Test/Repository/CatalogProductSimple.xml | 135 ++++++++++++++++++ .../Test/Repository/ConfigData.xml | 58 ++++++++ .../Test/TestCase/FilterProductListTest.php | 2 +- .../Test/TestCase/FilterProductListTest.xml | 62 ++++++++ 4 files changed, 256 insertions(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index e1cbc1a1d8ba2..64fb14b505bf3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -98,6 +98,87 @@ simple-product-%isolation% + + + default + + product_1_dollar %isolation% + sku_product_1_dollar_%isolation% + This item has weight + 1 + + 1000 + In Stock + + + 1 + + + taxable_goods + + + + default + + + Catalog, Search + product-1-dollar-%isolation% + + + + + default + + product_5_dollar %isolation% + sku_product_5_dollar_%isolation% + This item has weight + 1 + + 1000 + In Stock + + + 5 + + + taxable_goods + + + + default + + + Catalog, Search + product-5-dollar-%isolation% + + + + + default + + product_9_99_dollar %isolation% + sku_product_9_99_dollar_%isolation% + This item has weight + 1 + + 1000 + In Stock + + + 9.99 + + + taxable_goods + + + + default + + + Catalog, Search + product-9-99-dollar-%isolation% + + default @@ -128,6 +209,33 @@ + + + default + + product_15_dollar %isolation% + sku_product_15_dollar_%isolation% + This item has weight + 1 + + 1000 + In Stock + + + 15 + + + taxable_goods + + + + default + + + Catalog, Search + product-15-dollar-%isolation% + + default @@ -155,6 +263,33 @@ product-20-dollar-%isolation% + + + default + + product_21_dollar %isolation% + sku_product_21_dollar_%isolation% + This item has weight + 1 + + 1000 + In Stock + + + 21 + + + taxable_goods + + + + default + + + Catalog, Search + product-21-dollar-%isolation% + + Simple Product %isolation% sku_simple_product_%isolation% diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/Repository/ConfigData.xml index f6450b86c511a..08d4506b3c054 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/Repository/ConfigData.xml @@ -29,6 +29,40 @@ 10 + + + default + 0 + 1 + + + default + 0 + auto + + + + + default + 0 + 1 + + + default + 0 + improved + + + default + 0 + 0 + + + default + 0 + 3 + + default @@ -41,5 +75,29 @@ auto + + + default + 0 + 1 + + + default + 0 + auto + + + + + default + 0 + 1 + + + default + 0 + auto + + diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php index 543880aea1273..c42686f62591b 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php @@ -21,7 +21,7 @@ * 3. Perform all assertions. * * @group Layered_Navigation - * @ZephyrId MAGETWO-12419 + * @ZephyrId MAGETWO-12419, MAGETWO-30617, MAGETWO-30700, MAGETWO-30702, MAGETWO-30703 */ class FilterProductListTest extends Injectable { diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml index 8a9388df40c9f..0737dfd0d7ad6 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml @@ -10,6 +10,7 @@ test_type:acceptance_test, test_type:extended_acceptance_test layered_navigation_manual_range_10 + Yes default_anchor_subcategory catalogProductSimple::product_20_dollar, configurableProduct::filterable_two_options_with_zero_price @@ -31,5 +32,66 @@ + + test_type:acceptance_test, test_type:extended_acceptance_test + layered_navigation_automatic_equalize_price_range + Yes + default_anchor_subcategory + + catalogProductSimple::product_1_dollar, catalogProductSimple::product_5_dollar, catalogProductSimple::product_9_99_dollar, catalogProductSimple::product_10_dollar, catalogProductSimple::product_15_dollar, catalogProductSimple::product_21_dollar + + + + + Price + `^.+0\.00 - .+9\.99 3$`m + product_0, product_1, product_2 + + + + + Price + `^.+10\.00 - .+19\.99 2$`m + product_3, product_4 + + + + + Price + `^.+20\.00 and above 1$`m + product_5 + + + + + + + + test_type:acceptance_test, test_type:extended_acceptance_test + layered_navigation_automatic_equalize_product_counts + Yes + default_anchor_subcategory + + catalogProductSimple::product_1_dollar, catalogProductSimple::product_5_dollar, catalogProductSimple::product_9_99_dollar, catalogProductSimple::product_10_dollar, catalogProductSimple::product_15_dollar, catalogProductSimple::product_21_dollar + + + + + Price + `^.+0\.00 - .+9\.99 3$`m + product_0, product_1, product_2 + + + + + Price + `^.+10\.00 and above 3$`m + product_3, product_4, product_5 + + + + + + From 2263d5c9de4e459d864b9623eb02c3f93b7b331f Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Fri, 11 Nov 2016 13:39:05 +0200 Subject: [PATCH 1760/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -move deploy static command --- .../Eav/Model/Entity/AttributeCache.php | 26 ++-------------- .../Theme/Model/Theme/ThemeProvider.php | 30 +++---------------- .../Magento/User/Model/ResourceModel/User.php | 23 -------------- 3 files changed, 6 insertions(+), 73 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/AttributeCache.php b/app/code/Magento/Eav/Model/Entity/AttributeCache.php index 2aca4aa589683..f4f52e154cdd1 100644 --- a/app/code/Magento/Eav/Model/Entity/AttributeCache.php +++ b/app/code/Magento/Eav/Model/Entity/AttributeCache.php @@ -9,8 +9,6 @@ use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Framework\App\CacheInterface; use Magento\Framework\App\Cache\StateInterface; -use Magento\Framework\App\ObjectManager; -use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Framework\Serialize\SerializerInterface; /** @@ -46,11 +44,6 @@ class AttributeCache */ private $unsupportedTypes; - /** - * @var SerializerInterface - */ - private $serializer; - /** * AttributeCache constructor. * @param CacheInterface $cache @@ -97,7 +90,7 @@ public function getAttributes($entityType, $suffix = '') $cacheKey = self::ATTRIBUTES_CACHE_PREFIX . $entityType . $suffix; $attributesData = $this->cache->load($cacheKey); if ($attributesData) { - $attributes = $this->getSerializer()->unserialize($attributesData); + $attributes = unserialize($attributesData); $this->attributeInstances[$entityType . $suffix] = $attributes; return $attributes; } @@ -121,7 +114,7 @@ public function saveAttributes($entityType, $attributes, $suffix = '') $this->attributeInstances[$entityType . $suffix] = $attributes; if ($this->isAttributeCacheEnabled()) { $cacheKey = self::ATTRIBUTES_CACHE_PREFIX . $entityType . $suffix; - $attributesData = $this->getSerializer()->serialize($attributes); + $attributesData = serialize($attributes); $this->cache->save( $attributesData, $cacheKey, @@ -153,19 +146,4 @@ public function clear() } return true; } - - /** - * Retrieve handler which allows serialize/deserialize data - * - * @deprecated - * @return SerializerInterface - */ - private function getSerializer() - { - if (!$this->serializer) { - $this->serializer = ObjectManager::getInstance()->get(Serialize::class); - } - - return $this->serializer; - } } diff --git a/app/code/Magento/Theme/Model/Theme/ThemeProvider.php b/app/code/Magento/Theme/Model/Theme/ThemeProvider.php index 68e675387f905..89d7bfc18d30c 100644 --- a/app/code/Magento/Theme/Model/Theme/ThemeProvider.php +++ b/app/code/Magento/Theme/Model/Theme/ThemeProvider.php @@ -6,8 +6,6 @@ namespace Magento\Theme\Model\Theme; use Magento\Framework\App\ObjectManager; -use Magento\Framework\Serialize\Serializer\Serialize; -use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\View\Design\Theme\ListInterface; use Magento\Framework\App\DeploymentConfig; @@ -46,11 +44,6 @@ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProvide */ private $deploymentConfig; - /** - * @var SerializerInterface - */ - private $serializer; - /** * ThemeProvider constructor. * @@ -84,13 +77,13 @@ public function getThemeByFullPath($fullPath) /** @var $themeCollection \Magento\Theme\Model\ResourceModel\Theme\Collection */ $theme = $this->cache->load('theme'. $fullPath); if ($theme) { - $this->themes[$fullPath] = $this->getSerializer()->unserialize($theme); + $this->themes[$fullPath] = unserialize($theme); return $this->themes[$fullPath]; } $themeCollection = $this->collectionFactory->create(); $item = $themeCollection->getThemeByFullPath($fullPath); if ($item->getId()) { - $themeData = $this->getSerializer()->serialize($item); + $themeData = serialize($item); $this->cache->save($themeData, 'theme' . $fullPath); $this->cache->save($themeData, 'theme-by-id-' . $item->getId()); $this->themes[$fullPath] = $item; @@ -122,14 +115,14 @@ public function getThemeById($themeId) } $theme = $this->cache->load('theme-by-id-' . $themeId); if ($theme) { - $this->themes[$themeId] = $this->getSerializer()->unserialize($theme); + $this->themes[$themeId] = unserialize($theme); return $this->themes[$themeId]; } /** @var $themeModel \Magento\Framework\View\Design\ThemeInterface */ $themeModel = $this->themeFactory->create(); $themeModel->load($themeId); if ($themeModel->getId()) { - $this->cache->save($this->getSerializer()->serialize($themeModel), 'theme-by-id-' . $themeId); + $this->cache->save(serialize($themeModel), 'theme-by-id-' . $themeId); $this->themes[$themeId] = $themeModel; } return $themeModel; @@ -158,19 +151,4 @@ private function getDeploymentConfig() } return $this->deploymentConfig; } - - /** - * Retrieve handler which allows serialize/deserialize data - * - * @deprecated - * @return SerializerInterface - */ - private function getSerializer() - { - if (!$this->serializer) { - $this->serializer = ObjectManager::getInstance()->get(Serialize::class); - } - - return $this->serializer; - } } diff --git a/app/code/Magento/User/Model/ResourceModel/User.php b/app/code/Magento/User/Model/ResourceModel/User.php index fee2a07b21c8a..d3e228d443581 100644 --- a/app/code/Magento/User/Model/ResourceModel/User.php +++ b/app/code/Magento/User/Model/ResourceModel/User.php @@ -9,9 +9,6 @@ use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; use Magento\Authorization\Model\Acl\Role\User as RoleUser; use Magento\Authorization\Model\UserContextInterface; -use Magento\Framework\App\ObjectManager; -use Magento\Framework\Serialize\Serializer\Serialize; -use Magento\Framework\Serialize\SerializerInterface; use Magento\User\Model\User as ModelUser; /** @@ -37,11 +34,6 @@ class User extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb */ protected $dateTime; - /** - * @var SerializerInterface - */ - private $serializer; - /** * Construct * @@ -625,19 +617,4 @@ public function getLatestPassword($userId) [':user_id' => $userId] ); } - - /** - * Retrieve handler which allows serialize/deserialize data - * - * @deprecated - * @return SerializerInterface - */ - private function getSerializer() - { - if (!$this->serializer) { - $this->serializer = ObjectManager::getInstance()->get(Serialize::class); - } - - return $this->serializer; - } } From 16084cdfe464e49d7e81b58cf0cdd52752d773bc Mon Sep 17 00:00:00 2001 From: Andrei Malets Date: Fri, 11 Nov 2016 14:43:44 +0300 Subject: [PATCH 1761/3232] MTO-77: [Test] Checkout with Persistent Shopping Cart - Implemented test for checkout with Persistent Shopping Cart --- .../Test/Block/Onepage/Shipping/Method.php | 4 +- .../AssertCustomerIsRedirectedToCheckout.php | 42 ++++ .../Persistent/Test/Repository/ConfigData.xml | 40 ++++ .../CheckoutWthPersistentShoppingCartTest.php | 179 ++++++++++++++++++ .../CheckoutWthPersistentShoppingCartTest.xml | 17 ++ 5 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Persistent/Test/Constraint/AssertCustomerIsRedirectedToCheckout.php create mode 100644 dev/tests/functional/tests/app/Magento/Persistent/Test/Repository/ConfigData.xml create mode 100644 dev/tests/functional/tests/app/Magento/Persistent/Test/TestCase/CheckoutWthPersistentShoppingCartTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Persistent/Test/TestCase/CheckoutWthPersistentShoppingCartTest.xml diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php index d038ca0599d75..cce29d23f63b1 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/Method.php @@ -10,12 +10,12 @@ use Magento\Mtf\Client\Locator; /** - * One page checkout status shipping method block + * One page checkout status shipping method block. */ class Method extends Block { /** - * Shipping method selector + * Shipping method selector. * * @var string */ diff --git a/dev/tests/functional/tests/app/Magento/Persistent/Test/Constraint/AssertCustomerIsRedirectedToCheckout.php b/dev/tests/functional/tests/app/Magento/Persistent/Test/Constraint/AssertCustomerIsRedirectedToCheckout.php new file mode 100644 index 0000000000000..779740551527f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Persistent/Test/Constraint/AssertCustomerIsRedirectedToCheckout.php @@ -0,0 +1,42 @@ +open(); + \PHPUnit_Framework_Assert::assertTrue( + !$checkoutOnepage->getMessagesBlock()->isVisible() + && $checkoutOnepage->getShippingMethodBlock()->isVisible(), + 'Checkout first step is not available.' + ); + } + + /** + * Returns string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return 'Checkout first step is available.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Persistent/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Persistent/Test/Repository/ConfigData.xml new file mode 100644 index 0000000000000..5494453986157 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Persistent/Test/Repository/ConfigData.xml @@ -0,0 +1,40 @@ + + + + + + + persistent + 1 + Yes + 1 + + + persistent + 1 + No + 0 + + + + + + persistent + 1 + No + 0 + + + persistent + 1 + Yes + 1 + + + + diff --git a/dev/tests/functional/tests/app/Magento/Persistent/Test/TestCase/CheckoutWthPersistentShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Persistent/Test/TestCase/CheckoutWthPersistentShoppingCartTest.php new file mode 100644 index 0000000000000..0447738d51c33 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Persistent/Test/TestCase/CheckoutWthPersistentShoppingCartTest.php @@ -0,0 +1,179 @@ +customerAccountCreate = $customerAccountCreate; + $this->cmsIndex = $cmsIndex; + $this->logoutCustomerOnFrontendStep = $logoutCustomerOnFrontendStep; + $this->browser = $browser; + $this->catalogProductView = $catalogProductView; + $this->checkoutCart = $checkoutCart; + $this->stepFactory = $stepFactory; + } + + /** + * Prepare data. + * + * @param CatalogProductSimple $product + * @return array + */ + public function __prepare(CatalogProductSimple $product) + { + $product->persist(); + + return ['product' => $product]; + } + + /** + * Create Customer account on Storefront. + * + * @param string $configData + * @param CatalogProductSimple $product + * @param Customer $customer + * @return void + */ + public function test($configData, CatalogProductSimple $product, Customer $customer) + { + $this->configData = $configData; + $this->stepFactory->create( + \Magento\Config\Test\TestStep\SetupConfigurationStep::class, + ['configData' => $configData] + )->run(); + + // Steps + $this->cmsIndex->open(); + $this->cmsIndex->getLinksBlock()->openLink('Create an Account'); + $this->customerAccountCreate->getRegisterForm()->registerCustomer($customer); + + // Ensure that shopping cart is empty + $this->checkoutCart->open()->getCartBlock()->clearShoppingCart(); + + $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $this->catalogProductView->getViewBlock()->addToCart($product); + $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); + $this->logoutCustomerOnFrontendStep->run(); + } + + /** + * Clean data after running test. + * + * @return void + */ + public function tearDown() + { + $this->stepFactory->create( + \Magento\Config\Test\TestStep\SetupConfigurationStep::class, + ['configData' => $this->configData, 'rollback' => true] + )->run(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Persistent/Test/TestCase/CheckoutWthPersistentShoppingCartTest.xml b/dev/tests/functional/tests/app/Magento/Persistent/Test/TestCase/CheckoutWthPersistentShoppingCartTest.xml new file mode 100644 index 0000000000000..c9ef252fddf98 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Persistent/Test/TestCase/CheckoutWthPersistentShoppingCartTest.xml @@ -0,0 +1,17 @@ + + + + + + MAGETWO-59976: Customer can't open Product on Storefront if Persistent Cart is enabled + register_customer + clearpersistence_on_signout + + + + From d3019a689ede47b91ea33935e175e7f28e00ab96 Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 14:45:24 +0300 Subject: [PATCH 1762/3232] MTO-91: [Test] Url rewrites in catalog categories after changing url key for store view and moving category - Functional test implemented. --- .../Adminhtml/Category/Edit/CategoryForm.xml | 4 + .../Adminhtml/Category/Edit/PageActions.php | 39 +++++++ .../Test/Block/Adminhtml/Category/Tree.php | 27 +++++ .../Magento/Catalog/Test/Fixture/Category.xml | 1 + .../Magento/Theme/Test/Block/Html/Topmenu.php | 20 ++++ .../Magento/Ui/Test/Block/Adminhtml/Modal.php | 26 +++++ .../AssertCategoryUrlWithCustomStoreView.php | 62 +++++++++++ .../Test/TestCase/CategoryUrlRewriteTest.php | 100 ++++++++++++++++++ .../Test/TestCase/CategoryUrlRewriteTest.xml | 21 ++++ 9 files changed, 300 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertCategoryUrlWithCustomStoreView.php create mode 100644 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php create mode 100644 dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.xml diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml index dff1a9fd71d86..411833f033356 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.xml @@ -90,6 +90,10 @@ input input[name='url_key'] + + checkbox + input[name='use_default[url_key]'] + input input[name='meta_title'] diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php index 27e15044df11d..808da58c7dd49 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php @@ -7,12 +7,18 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit; use Magento\Backend\Test\Block\FormPageActions; +use Magento\Mtf\Client\Locator; /** * Category page actions. */ class PageActions extends FormPageActions { + /** + * Top page element to implement a scrolling in case of floating blocks overlay. + */ + const TOP_ELEMENT_TO_SCROLL = '.page-title'; + /** * Locator for "OK" button in warning block * @@ -20,6 +26,20 @@ class PageActions extends FormPageActions */ protected $warningBlock = '.ui-widget-content .ui-dialog-buttonset button:first-child'; + /** + * Change Store View selector. + * + * @var string + */ + protected $storeChangeButton = '#store-change-button'; + + /** + * Selector for confirm. + * + * @var string + */ + protected $confirmModal = '.confirm._show[data-role=modal]'; + /** * Click on "Save" button * @@ -33,4 +53,23 @@ public function save() $warningBlock->click(); } } + + /** + * Select Store View. + * + * @param string $name + * @return void + */ + public function selectStoreView($name) + { + $this->browser->find(self::TOP_ELEMENT_TO_SCROLL)->click(); + $this->_rootElement->find($this->storeChangeButton)->click(); + $this->waitForElementVisible($name, Locator::SELECTOR_LINK_TEXT); + $this->_rootElement->find($name, Locator::SELECTOR_LINK_TEXT)->click(); + $element = $this->browser->find($this->confirmModal); + /** @var \Magento\Ui\Test\Block\Adminhtml\Modal $modal */ + $modal = $this->blockFactory->create(\Magento\Ui\Test\Block\Adminhtml\Modal::class, ['element' => $element]); + $modal->acceptAlert(); + $this->waitForElementVisible($this->storeChangeButton); + } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php index 15a624c4b734f..447e131989808 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php @@ -60,6 +60,13 @@ class Tree extends Block */ protected $header = 'header'; + /** + * Xpath locator for category in tree. + * + * @var string + */ + protected $categoryInTree = '//*[@class="x-tree-node-ct"]/li/div/a/span[contains(text(), "%s")]/..'; + /** * Get backend abstract block. * @@ -153,6 +160,26 @@ public function isCategoryVisible(Category $category) ->isElementVisible($categoryPath); } + /** + * Assign child category to the parent. + * + * @param string $parentCategoryName + * @param string $childCategoryName + * + * @return void + */ + public function assignCategory($parentCategoryName, $childCategoryName) + { + $this->_rootElement->find(sprintf($this->categoryInTree, $childCategoryName), Locator::SELECTOR_XPATH)->click(); + $this->getTemplateBlock()->waitLoader(); + $targetElement = $this->_rootElement->find( + sprintf($this->categoryInTree, $parentCategoryName), + Locator::SELECTOR_XPATH + ); + $this->_rootElement->find(sprintf($this->categoryInTree, $childCategoryName), Locator::SELECTOR_XPATH) + ->dragAndDrop($targetElement); + } + /** * Expand all categories tree. * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml index b9ba495535e82..ed6f9568c2441 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml @@ -41,6 +41,7 @@ + diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Topmenu.php b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Topmenu.php index cc2826c6d840e..8d11cfea1295f 100644 --- a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Topmenu.php +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Topmenu.php @@ -63,6 +63,26 @@ function () use ($category) { $category[0]->click(); } + /** + * Hover on category from top menu by name. + * + * @param string $categoryName + * @return void + */ + public function hoverCategoryByName($categoryName) + { + $rootElement = $this->_rootElement; + $category = $this->waitLoadTopMenu($categoryName); + if ($category[1]) { + $rootElement->waitUntil( + function () use ($category) { + return $category[0]->isVisible() ? true : null; + } + ); + } + $category[0]->hover(); + } + /** * Check is visible category in top menu by name * diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php index e703369856834..a57616d4d4d0b 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/Modal.php @@ -41,6 +41,13 @@ class Modal extends Block */ protected $inputFieldSelector = '[data-role="promptField"]'; + /** + * Locator value for accept warning button. + * + * @var string + */ + protected $acceptWarningSelector = '.action-primary'; + /** * Modal overlay selector. * @@ -48,6 +55,13 @@ class Modal extends Block */ protected $modalOverlay = '.modals-overlay'; + /** + * Selector for spinner element. + * + * @var string + */ + protected $loadingMask = '[data-role="loader"]'; + /** * Press OK on an alert, confirm, prompt a dialog. * @@ -59,6 +73,18 @@ public function acceptAlert() $this->_rootElement->find($this->acceptButtonSelector)->click(); } + /** + * Press OK on a warning popup. + * + * @return void + */ + public function acceptWarning() + { + $this->waitModalAnimationFinished(); + $this->_rootElement->find($this->acceptWarningSelector)->click(); + $this->waitForElementNotVisible($this->loadingMask); + } + /** * Press Cancel on an alert, confirm, prompt a dialog. * diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertCategoryUrlWithCustomStoreView.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertCategoryUrlWithCustomStoreView.php new file mode 100644 index 0000000000000..d0baabcbb3aef --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertCategoryUrlWithCustomStoreView.php @@ -0,0 +1,62 @@ +open(); + $cmsIndex->getStoreSwitcherBlock()->selectStoreView($storeView->getName()); + $cmsIndex->getTopmenu()->hoverCategoryByName($parentCategory->getName()); + $cmsIndex->getTopmenu()->selectCategoryByName( + $childCategory->getName() + ); + $actualUrl = strtolower($parentCategory->getUrlKey() . '/' . $categoryUpdates->getUrlKey()); + $result = (bool)strpos($browser->getUrl(), $actualUrl); + + \PHPUnit_Framework_Assert::assertTrue( + $result, + "Category URL is not correct." + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Category URL is correct.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php new file mode 100644 index 0000000000000..a17732ad1535c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php @@ -0,0 +1,100 @@ + Categories. + * 3. On the categories editing page change store view to created additional view. + * 4. Change URL key for category "first-test" from default to "first-test-2". Save. + * 5. Change store view to "All store views". + * 6. Move category "first-test" inside "second-test". + * 7. Perform all assertions. + * + * @ZephyrId MAGETWO-45385 + */ +class CategoryUrlRewriteTest extends Injectable +{ + /** + * CatalogCategoryIndex page. + * + * @var CatalogCategoryIndex + */ + private $catalogCategoryIndex; + + /** + * CatalogCategoryEdit page. + * + * @var CatalogCategoryEdit + */ + private $catalogCategoryEdit; + + /** + * Inject page end prepare default category. + * + * @param CatalogCategoryIndex $catalogCategoryIndex + * @param CatalogCategoryEdit $catalogCategoryEdit + * @return array + */ + public function __inject( + CatalogCategoryIndex $catalogCategoryIndex, + CatalogCategoryEdit $catalogCategoryEdit + ) { + $this->catalogCategoryIndex = $catalogCategoryIndex; + $this->catalogCategoryEdit = $catalogCategoryEdit; + } + + /** + * Runs test. + * + * @param Store $storeView + * @param Category $childCategory + * @param Category $parentCategory + * @param Category $categoryUpdates + * @return array + */ + public function test(Store $storeView, Category $childCategory, Category $parentCategory, Category $categoryUpdates) + { + //Preconditions: + $storeView->persist(); + $parentCategory->persist(); + $childCategory->persist(); + + // Steps: + $this->catalogCategoryIndex->open(); + $this->catalogCategoryIndex->getTreeCategories()->selectCategory($childCategory); + $this->catalogCategoryEdit->getFormPageActions()->selectStoreView($storeView->getName()); + $this->catalogCategoryEdit->getEditForm()->fill($categoryUpdates); + $this->catalogCategoryEdit->getFormPageActions()->save(); + $this->catalogCategoryIndex->getTreeCategories()->assignCategory( + $parentCategory->getName(), + $childCategory->getName() + ); + $this->catalogCategoryEdit->getModalBlock()->acceptWarning(); + + return [ + 'storeView' => $storeView, + 'childCategory' => $childCategory, + 'parentCategory' => $parentCategory + ]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.xml new file mode 100644 index 0000000000000..d39650944a203 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.xml @@ -0,0 +1,21 @@ + + + + + + custom + default + catalogProductSimple::default + default + catalogProductSimple::default + No + UrlKey%isolation% + + + + From 09045d5158bc2f893b558457d53ed8dadf9009c7 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Fri, 11 Nov 2016 13:53:30 +0200 Subject: [PATCH 1763/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -move deploy static command --- .../App/Test/Unit/DeploymentConfig/WriterTest.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php index 1154e16f892c8..02d3ade243b83 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php @@ -135,17 +135,6 @@ public function testSaveConfigOverride() ConfigFilePool::APP_CONFIG => 'config.php' ]; - $testSetExisting = [ - ConfigFilePool::APP_CONFIG => [ - 'foo' => 'bar', - 'key' => 'value', - 'baz' => [ - 'test' => 'value', - 'test1' => 'value1' - ] - ], - ]; - $testSetUpdate = [ ConfigFilePool::APP_CONFIG => [ 'baz' => [ From ce1115fa3ecb8c2419cfc9e7b535d060dbb6381d Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 14:53:58 +0300 Subject: [PATCH 1764/3232] MTO-61: Checkout as Customer using default address. - Functional test implemented. --- .../Test/TestCase/OnePageCheckoutTest.xml | 21 +++++++++++++++++++ .../Customer/Test/Repository/Address.xml | 11 ++++++++++ 2 files changed, 32 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml index 797255d4e374a..8353530ace381 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml @@ -205,5 +205,26 @@ checkmo + + catalogProductSimple::default + customer_UK_US_addresses + login + + 0 + + + 0 + + + 565.00 + + Flat Rate + Fixed + checkmo + checkmo_specificcountry_gb + + + + diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index 70191dc828af7..d981d086946b0 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -227,5 +227,16 @@ Berlin 333-33-333-33 + + + John + Doe%isolation% + John.Doe%isolation%@example.com + 123123^q + 123123^q + + UK_address_default_billing, US_address_default_shipping + + From 718f708039f97385c1fab2f5b0afe48f80220438 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Fri, 11 Nov 2016 13:55:36 +0200 Subject: [PATCH 1765/3232] MAGETWO-56396: "Go Today" button in filter type date doesn`t apply value --- lib/web/mage/calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/calendar.js b/lib/web/mage/calendar.js index 984274575aa3a..5893b95f4bd38 100644 --- a/lib/web/mage/calendar.js +++ b/lib/web/mage/calendar.js @@ -552,7 +552,7 @@ //Set date/time according to timezone offset $(el).datepicker('setTimezoneDate') // To ensure that user can re-select date field without clicking outside it first. - .blur(); + .blur().trigger('change'); }; return { From 07592c09b8ca1032118693841b24f513df3ba7d6 Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 14:56:58 +0300 Subject: [PATCH 1766/3232] MTO-12: Place order with simple product with custom options on backend - Functional test implemented. --- .../Magento/Sales/Test/TestCase/CreateOrderBackendTest.php | 2 +- .../Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php index 284a09f42332f..218d10ad4bb1c 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php @@ -28,7 +28,7 @@ * 12. Perform all assertions. * * @group Order_Management - * @ZephyrId MAGETWO-28696 + * @ZephyrId MAGETWO-28696, MAGETWO-17063 */ class CreateOrderBackendTest extends Scenario { diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml index bd592e9d71aaa..2fb8f91d6d997 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml @@ -7,16 +7,16 @@ --> - + Create order with simple product for registered US customer using Fixed shipping method and Cash on Delivery payment method - catalogProductSimple::default + catalogProductSimple::with_one_custom_option default US_address_1_without_email No Flat Rate Fixed - 565.00 + 425.00 cashondelivery Pending From 2b25fca005b55de09e04fd9c5cb8be93ca41464e Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Fri, 11 Nov 2016 14:04:45 +0200 Subject: [PATCH 1767/3232] MAGETWO-60630: Wrong dependency version for magento/module-catalog --- app/code/Magento/SalesInventory/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesInventory/composer.json b/app/code/Magento/SalesInventory/composer.json index d7f9075cdd310..fa06db402a286 100644 --- a/app/code/Magento/SalesInventory/composer.json +++ b/app/code/Magento/SalesInventory/composer.json @@ -6,7 +6,7 @@ "magento/module-catalog-inventory": "100.2.*", "magento/module-sales": "100.2.*", "magento/module-store": "100.2.*", - "magento/module-catalog": "101.2.*", + "magento/module-catalog": "101.1.*", "magento/framework": "100.2.*" }, "type": "magento2-module", From 344fd5214f74046b070e4409daa563b744ce858e Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 15:14:49 +0300 Subject: [PATCH 1768/3232] MTO-53: [Variation] Update product qty in mini shopping cart - Functional test implemented. --- .../CatalogProductSimple/CheckoutData.xml | 8 ++ .../Checkout/Test/Block/Cart/Sidebar.php | 17 +++ ...CustomerIsRedirectedToCheckoutFromCart.php | 115 ++++++++++++++++++ .../AssertProductDataInMiniShoppingCart.php | 4 +- ...eProductFromMiniShoppingCartEntityTest.php | 36 +++++- ...eProductFromMiniShoppingCartEntityTest.xml | 18 ++- 6 files changed, 186 insertions(+), 12 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertCustomerIsRedirectedToCheckoutFromCart.php diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml index 53ec00f56b1e8..4c060a14b7e59 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml @@ -101,6 +101,14 @@ + + 2 + + 560 + 560 + + + 2 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 cbda80aa712f0..231589bfdab77 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 @@ -36,6 +36,13 @@ class Sidebar extends Block */ protected $braintreePaypalCheckoutButton = './/button[contains(@id, "braintree-paypal-mini-cart")]'; + /** + * Locator value for "Proceed to Checkout" button. + * + * @var string + */ + private $proceedToCheckoutButton = '#top-cart-btn-checkout'; + /** * Minicart items quantity * @@ -116,6 +123,16 @@ public function clickBraintreePaypalButton() ->click(); } + /** + * Click "Proceed to Checkout" button. + * + * @return void + */ + public function clickProceedToCheckoutButton() + { + $this->_rootElement->find($this->proceedToCheckoutButton)->click(); + } + /** * Wait counter qty visibility. * diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertCustomerIsRedirectedToCheckoutFromCart.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertCustomerIsRedirectedToCheckoutFromCart.php new file mode 100644 index 0000000000000..61fcf0f5adf8a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertCustomerIsRedirectedToCheckoutFromCart.php @@ -0,0 +1,115 @@ +stepFactory = $stepFactory; + + $miniShoppingCart = $cmsIndex->getCartSidebarBlock(); + $miniShoppingCart->openMiniCart(); + $miniShoppingCart->clickProceedToCheckoutButton(); + + \PHPUnit_Framework_Assert::assertTrue( + !$checkoutOnepage->getMessagesBlock()->isVisible() + && $checkoutOnepage->getShippingMethodBlock()->isVisible(), + 'Checkout first step is not available.' + ); + + if (isset($checkoutData['shippingAddress'])) { + $this->getOrder($checkoutData); + } + + //Assert that Order Grand Total is correct on order page in backend. + $assertOrderGrandTotal->processAssert($salesOrderView, $orderIndex, $this->orderId, $prices); + } + + /** + * Get Order. + * + * @param array $checkoutData + * @return void + */ + protected function getOrder(array $checkoutData) + { + $this->stepFactory->create( + \Magento\Checkout\Test\TestStep\FillShippingAddressStep::class, + ['shippingAddress' => $checkoutData['shippingAddress']] + )->run(); + $this->objectManager->create( + \Magento\Checkout\Test\TestStep\FillShippingMethodStep::class, + ['shipping' => $checkoutData['shipping']] + )->run(); + $this->objectManager->create( + \Magento\Checkout\Test\TestStep\SelectPaymentMethodStep::class, + ['payment' => $checkoutData['payment']] + )->run(); + $this->orderId = $this->objectManager->create( + \Magento\Checkout\Test\TestStep\PlaceOrderStep::class + )->run()['orderId']; + } + + /** + * Returns string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return 'Checkout first step is available.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertProductDataInMiniShoppingCart.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertProductDataInMiniShoppingCart.php index 2b10754d9b47b..3e78cfb076acb 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertProductDataInMiniShoppingCart.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertProductDataInMiniShoppingCart.php @@ -14,12 +14,12 @@ use Magento\Mtf\Fixture\FixtureInterface; /** - * Assert that product price and qty in mini shopping cart equal to expected price from data set. + * Assert that product price and qty in mini shopping cart are equal to expected price from data set. */ class AssertProductDataInMiniShoppingCart extends AbstractAssertForm { /** - * Assert that product price and qty in mini shopping cart are equal to expected price from data set. + * Assert that product price and qty in mini shopping cart equal to expected price from data set. * * @param CmsIndex $cmsIndex * @param Cart $cart diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php index 62d773a6637bf..0bfe42f7fe78c 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php @@ -11,6 +11,7 @@ use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\TestCase\Injectable; +use Magento\Customer\Test\Fixture\Customer; /** * Preconditions: @@ -76,14 +77,28 @@ public function __inject( /** * Update product from mini shopping cart. - * * @param array $originalProduct * @param array $checkoutData + * @param boolean $useMiniCartToEditQty + * @param array $shippingAddress + * @param array $shipping + * @param array $payment + * @param Customer $customer * @return array */ - public function test(array $originalProduct, array $checkoutData) - { + public function test( + array $originalProduct, + array $checkoutData, + $useMiniCartToEditQty = false, + $shippingAddress = null, + $shipping = null, + $payment = null, + Customer $customer = null + ) { // Preconditions: + if ($customer !== null) { + $customer->persist(); + } $product = $this->createProduct($originalProduct); $this->addToCart($product); @@ -93,16 +108,25 @@ public function test(array $originalProduct, array $checkoutData) $newProduct = $this->createProduct([explode('::', $originalProduct[0])[0]], [$productData]); $miniShoppingCart = $this->cmsIndex->getCartSidebarBlock(); $miniShoppingCart->openMiniCart(); - $miniShoppingCart->getCartItem($newProduct)->clickEditItem(); - $this->catalogProductView->getViewBlock()->addToCart($newProduct); + if ($useMiniCartToEditQty) { + $miniShoppingCart->getCartItem($newProduct)->editQty($newProduct->getCheckoutData()); + } else { + $miniShoppingCart->getCartItem($newProduct)->clickEditItem(); + $this->catalogProductView->getViewBlock()->addToCart($newProduct); + } // Prepare data for asserts: $cart['data']['items'] = ['products' => [$newProduct]]; $deletedCart['data']['items'] = ['products' => [$product]]; return [ 'deletedCart' => $this->fixtureFactory->createByCode('cart', $deletedCart), - 'cart' => $this->fixtureFactory->createByCode('cart', $cart) + 'cart' => $this->fixtureFactory->createByCode('cart', $cart), + 'checkoutData' => [ + 'shippingAddress' => $shippingAddress, + 'shipping' => $shipping, + 'payment' => $payment + ] ]; } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml index 5f9b069ab85ca..cd500a935485c 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml @@ -7,12 +7,22 @@ --> - - test_type:extended_acceptance_test, to_maintain:yes - catalogProductSimple::with_two_custom_option - simple_update_mini_shopping_cart + + test_type:extended_acceptance_test + catalogProductSimple::default + simple_order_qty_2 + true + + 1130 + + customer_US + Flat Rate + Fixed + UK_address + free + test_type:extended_acceptance_test, to_maintain:yes From fd3eded1c302c832ca8ddf2ad66601a152f11343 Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 15:22:05 +0300 Subject: [PATCH 1769/3232] MTO-75: [Variation] Add verification for url rewrite after creating a category - Functional test implemented. --- .../Category/CreateCategoryEntityTest.xml | 2 ++ .../AssertUrlRewriteCategoryInGrid.php | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) 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 fa81264dd2d4b..665a7ecf3831a 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 @@ -86,7 +86,9 @@ Yes 01/10/2014 12/31/2024 + request_path + diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCategoryInGrid.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCategoryInGrid.php index b94e716ceac64..3630bd697b859 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCategoryInGrid.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCategoryInGrid.php @@ -7,8 +7,8 @@ namespace Magento\UrlRewrite\Test\Constraint; use Magento\Catalog\Test\Fixture\Category; -use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex; /** * Class AssertUrlRewriteCategoryInGrid @@ -17,16 +17,20 @@ class AssertUrlRewriteCategoryInGrid extends AbstractConstraint { /** - * Assert that url rewrite category in grid + * Assert that url rewrite category in grid. * * @param Category $category * @param UrlRewriteIndex $urlRewriteIndex + * @param string $filterByPath * @return void */ - public function processAssert(Category $category, UrlRewriteIndex $urlRewriteIndex) - { + public function processAssert( + Category $category, + UrlRewriteIndex $urlRewriteIndex, + $filterByPath = 'target_path' + ) { $urlRewriteIndex->open(); - $filter = ['target_path' => strtolower($category->getUrlKey())]; + $filter = [$filterByPath => strtolower($category->getUrlKey())]; \PHPUnit_Framework_Assert::assertTrue( $urlRewriteIndex->getUrlRedirectGrid()->isRowVisible($filter, true, false), 'URL Rewrite with request path "' . $category->getUrlKey() . '" is absent in grid.' @@ -34,7 +38,7 @@ public function processAssert(Category $category, UrlRewriteIndex $urlRewriteInd } /** - * URL rewrite category present in grid + * URL rewrite category present in grid. * * @return string */ From bc068059710e9254a5b163e4e8ea061dace2cbb8 Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 15:27:56 +0300 Subject: [PATCH 1770/3232] MTO-5: [Variation] Add variation to a Create Sales Rule test to check free shipping - Functional test implemented. --- .../Checkout/Test/Block/Cart/Shipping.php | 21 ++++++++------- .../TestCase/CreateSalesRuleEntityTest.xml | 26 +++++++++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php index 483d6fa28636a..a10d28f5e70e3 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php @@ -86,16 +86,17 @@ public function openEstimateShippingAndTax() */ public function selectShippingMethod(array $shipping) { - $selector = sprintf($this->shippingMethod, $shipping['shipping_service'], $shipping['shipping_method']); - if (!$this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->isVisible()) { - $this->openEstimateShippingAndTax(); - } - - $element = $this->_rootElement->find($selector, Locator::SELECTOR_XPATH); - if (!$element->isDisabled()) { - $element->click(); - } else { - throw new \Exception("Unable to set value to field '$selector' as it's disabled."); + if (isset($shipping['shipping_service']) && isset($shipping['shipping_method'])) { + $selector = sprintf($this->shippingMethod, $shipping['shipping_service'], $shipping['shipping_method']); + if (!$this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->isVisible()) { + $this->openEstimateShippingAndTax(); + } + $element = $this->_rootElement->find($selector, Locator::SELECTOR_XPATH); + if (!$element->isDisabled()) { + $element->click(); + } else { + throw new \Exception("Unable to set value to field '$selector' as it's disabled."); + } } } diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml index d0ad41011004a..b5e7f3037915a 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml @@ -399,5 +399,31 @@ + + Cart Price Rule1 %isolation% + Cart Price Rule Description %isolation% + Yes + Main Website + NOT LOGGED IN + No Coupon + Percent of product price discount + [Subtotal|greater than|0] + 50 + No + For matching items only + Sales Cart Rule labels + 100.00 + 50.00 + 50.00 + United States + California + 95814 + simple_for_salesrule_1 + 1 + + + + test_type:current + From 9085dc94655aba8941df3ae74d4dc843379601c6 Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Fri, 11 Nov 2016 15:34:30 +0300 Subject: [PATCH 1771/3232] MTO-60: [Constraint] Verify that address was used for checkout is saved as default for Customer without addresses - Functional test implemented. --- .../Test/TestCase/OnePageCheckoutTest.php | 2 +- .../Test/TestCase/OnePageCheckoutTest.xml | 7 ++- .../TestStep/FillBillingInformationStep.php | 7 ++- .../Test/TestStep/FillShippingAddressStep.php | 5 +- ...tomerDefaultAddressFrontendAddressBook.php | 46 ++++++++++++++----- .../Customer/Test/Repository/Address.xml | 12 +++++ .../UpdateCustomerFrontendEntityTest.php | 6 ++- 7 files changed, 66 insertions(+), 19 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php index 58d0c23f2274f..64c5ca9a2ed8b 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php @@ -33,7 +33,7 @@ * 14. Perform assertions. * * @group One_Page_Checkout - * @ZephyrId MAGETWO-27485, MAGETWO-12412, MAGETWO-12429 + * @ZephyrId MAGETWO-27485, MAGETWO-12412, MAGETWO-12429, MAGETWO-42598, MAGETWO-42599 * @ZephyrId MAGETWO-12444, MAGETWO-12848, MAGETWO-12849, MAGETWO-12850 */ class OnePageCheckoutTest extends Scenario diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml index 797255d4e374a..cd739eedd0fd3 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml @@ -172,8 +172,9 @@ stable:no catalogProductSimple::simple_with_tier_price_and_order_qty_3 default - guest - UK_address + login + UK_address_without_email + UK_address_2_without_email Flat Rate Fixed @@ -183,6 +184,7 @@ banktransfer_specificcountry_gb + @@ -203,6 +205,7 @@ checkmo checkmo + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php index a7d432fa38b2a..3d5cbbfc988d8 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php @@ -6,10 +6,10 @@ namespace Magento\Checkout\Test\TestStep; +use Magento\Checkout\Test\Constraint\AssertBillingAddressSameAsShippingCheckbox; use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Customer\Test\Fixture\Address; use Magento\Mtf\TestStep\TestStepInterface; -use Magento\Checkout\Test\Constraint\AssertBillingAddressSameAsShippingCheckbox; /** * Fill billing information. @@ -76,7 +76,7 @@ public function __construct( /** * Fill billing address. * - * @return void + * @return array */ public function run() { @@ -91,5 +91,8 @@ public function run() } $selectedPaymentMethod->getBillingBlock()->fillBilling($this->billingAddress); } + return [ + 'billingAddress' => $this->billingAddress + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php index 5150eb9964ba3..ffd8686190125 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php @@ -45,12 +45,15 @@ public function __construct( /** * Fill shipping address. * - * @return void + * @return array */ public function run() { if ($this->shippingAddress) { $this->checkoutOnepage->getShippingBlock()->fill($this->shippingAddress); } + return [ + 'shippingAddress' => $this->shippingAddress + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerDefaultAddressFrontendAddressBook.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerDefaultAddressFrontendAddressBook.php index a95a0ba98e3bf..6ede7c49a070d 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerDefaultAddressFrontendAddressBook.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerDefaultAddressFrontendAddressBook.php @@ -6,9 +6,10 @@ namespace Magento\Customer\Test\Constraint; +use Magento\Customer\Test\Block\Address\Renderer; use Magento\Customer\Test\Fixture\Address; -use Magento\Customer\Test\Page\CustomerAccountIndex; use Magento\Customer\Test\Page\CustomerAccountAddress; +use Magento\Customer\Test\Page\CustomerAccountIndex; use Magento\Mtf\Constraint\AbstractConstraint; /** @@ -20,25 +21,32 @@ class AssertCustomerDefaultAddressFrontendAddressBook extends AbstractConstraint * Asserts that Default Billing Address and Default Shipping Address equal to data from fixture. * * @param CustomerAccountIndex $customerAccountIndex - * @param CustomerAccountAddress $customerAccountAddress - * @param Address $address + * @param CustomerAccountAddress $customerAddress + * @param Address|null $shippingAddress + * @param Address|null $billingAddress * @return void */ public function processAssert( CustomerAccountIndex $customerAccountIndex, - CustomerAccountAddress $customerAccountAddress, - Address $address + CustomerAccountAddress $customerAddress, + Address $shippingAddress, + Address $billingAddress = null ) { + $customerAccountIndex->open(); $customerAccountIndex->getAccountMenuBlock()->openMenuItem('Address Book'); - $addressRenderer = $this->objectManager->create( - \Magento\Customer\Test\Block\Address\Renderer::class, - ['address' => $address, 'type' => 'html'] - ); - $addressToVerify = $addressRenderer->render(); + + $shippingAddressRendered = $this->createAddressRenderer($shippingAddress)->render(); + $validated = + $shippingAddressRendered == $customerAddress->getDefaultAddressBlock()->getDefaultShippingAddress(); + + if (null !== $billingAddress) { + $billingAddressRendered = $customerAddress->getDefaultAddressBlock()->getDefaultBillingAddress(); + $validated = + $validated && ($billingAddressRendered == $this->createAddressRenderer($billingAddress)->render()); + } \PHPUnit_Framework_Assert::assertTrue( - $addressToVerify == $customerAccountAddress->getDefaultAddressBlock()->getDefaultBillingAddress() - && $addressToVerify == $customerAccountAddress->getDefaultAddressBlock()->getDefaultShippingAddress(), + $validated, 'Customer default address on address book tab is not matching the fixture.' ); } @@ -52,4 +60,18 @@ public function toString() { return 'Default billing and shipping address form is correct.'; } + + /** + * Instantiate Renderer object. + * + * @param Address $address + * @return Renderer + */ + private function createAddressRenderer(Address $address) + { + return $this->objectManager->create( + Renderer::class, + ['address' => $address, 'type' => 'html'] + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index 70191dc828af7..63bdf75c86015 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -189,6 +189,18 @@ 555-55-555-55 + + Billy + Holiday + Magento %isolation% + Liverpool + 99 Henry St + SE1 7RW + United Kingdom + Liverpool + 555-55-555-55 + + Jane Doe 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 34338371d45af..b3d41a911af41 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 @@ -156,6 +156,10 @@ public function test( $this->customerAddressEdit->getEditForm()->fill($address); $this->customerAddressEdit->getEditForm()->saveAddress(); - return ['customer' => $this->prepareCustomer($customer, $initialCustomer)]; + return [ + 'customer' => $this->prepareCustomer($customer, $initialCustomer), + 'shippingAddress' => $address, + 'billingAddress' => $address + ]; } } From dc376e6d46f636c8b1a0b7b24d4fc3933d3f5492 Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 15:59:20 +0300 Subject: [PATCH 1772/3232] MTO-62: [Variation] Login during checkout using "Sign In" link - Functional test implemented. --- .../Test/Block/Onepage/CustomAddress.php | 51 +++++++++ .../Checkout/Test/Block/Onepage/Shipping.php | 102 ++++++++++++++++++ .../Checkout/Test/Page/CheckoutOnepage.xml | 3 + .../Test/TestCase/OnePageCheckoutTest.php | 1 + .../Test/TestCase/OnePageCheckoutTest.xml | 87 +++++++++++++++ .../TestStep/FillBillingInformationStep.php | 55 +++++++++- .../Test/TestStep/FillShippingAddressStep.php | 77 ++++++++++++- .../TestStep/SelectCheckoutMethodStep.php | 36 ++++++- .../Block/Account/AuthenticationPopup.php | 2 +- .../Block/Account/AuthenticationWrapper.php | 32 ++++++ .../Block/Account/AuthenticationWrapper.xml | 17 +++ .../Customer/Test/Block/Address/Renderer.php | 10 ++ .../Customer/Test/Handler/Customer/Curl.php | 3 +- .../Customer/Test/Handler/Customer/Webapi.php | 3 +- .../Customer/Test/Repository/Address.xml | 13 +++ .../Customer/Test/Repository/Customer.xml | 11 ++ .../Block/Adminhtml/Order/View/Addresses.php | 77 +++++++++++++ .../Test/Constraint/AssertOrderAddresses.php | 62 +++++++++++ .../Test/Page/Adminhtml/SalesOrderView.xml | 1 + 19 files changed, 630 insertions(+), 13 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/CustomAddress.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationWrapper.php create mode 100644 dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationWrapper.xml create mode 100644 dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Addresses.php create mode 100644 dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderAddresses.php diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/CustomAddress.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/CustomAddress.php new file mode 100644 index 0000000000000..6905aacd40189 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/CustomAddress.php @@ -0,0 +1,51 @@ +_rootElement->find($this->updateButtonSelector)->click(); + } + + /** + * Set address value from dropdown. + * + * @param string $value + * @return void + */ + public function selectAddress($value) + { + $this->_rootElement->find($this->select, Locator::SELECTOR_CSS, 'select')->setValue($value); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php index f2530c016b714..6c97bb79b2b57 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php @@ -36,6 +36,39 @@ class Shipping extends Form */ private $addressModalBlock = '//*[@id="opc-new-shipping-address"]/../..'; + /** + * @var string + */ + private $selectedAddress = '.shipping-address-item.selected-item'; + + /** + * New address button selector. + * + * @var string + */ + private $newAddressButton = '.action-show-popup'; + + /** + * Locator for address select button. + * + * @var string + */ + private $addressSelectButton = '.action-select-shipping-item'; + + /** + * Locator for shipping address select block. + * + * @var string + */ + private $shippingAddressBlock = '.shipping-address-item'; + + /** + * Locator for shipping address select block. + * + * @var string + */ + private $selectedShippingAddressBlock = '.selected-item'; + /** * Click on "New Address" button. * @@ -47,6 +80,16 @@ public function clickOnNewAddressButton() $this->_rootElement->find($this->newAddressButton)->click(); } + /** + * 'Ship here' button click. + * + * @return void + */ + public function clickShipHere() + { + $this->_rootElement->find($this->shipHereButton, Locator::SELECTOR_XPATH)->click(); + } + /** * Get Address Modal Block. * @@ -69,4 +112,63 @@ public function getRequiredFields() { return $this->_rootElement->getElements("div .field._required"); } + + /** + * @return array + */ + public function getSelectedAddress() + { + return $this->_rootElement->find($this->selectedAddress, Locator::SELECTOR_CSS)->getText(); + } + + /** + * Select address. + * + * @param string $address + * @return void + */ + public function selectAddress($address) + { + $addresses = $this->_rootElement->getElements($this->shippingAddressBlock); + foreach ($addresses as $addressBlock) { + if (strpos($addressBlock->getText(), $address) === 0 && !$this->isAddressSelected($address)) { + $addressBlock->find($this->addressSelectButton)->click(); + break; + } + } + } + + /** + * Check if address selected. + * + * @param string $address + * @return bool + */ + public function isAddressSelected($address) + { + $text = $this->_rootElement->find($this->shippingAddressBlock . $this->selectedShippingAddressBlock)->getText(); + + return $text == $address; + } + + /** + * Checks if new address button is visible. + * + * @return bool + */ + public function isNewAddressButtonVisible() + { + $button = $this->_rootElement->find($this->newAddressButton); + return $button->isVisible(); + } + + /** + * Clicks new address button. + * + * @return void + */ + public function clickNewAddressButton() + { + $this->_rootElement->find($this->newAddressButton)->click(); + } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml index f8dcf95b0c16d..11d4579414a04 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml @@ -8,12 +8,15 @@ + + + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php index 58d0c23f2274f..8d6184dcf19df 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php @@ -35,6 +35,7 @@ * @group One_Page_Checkout * @ZephyrId MAGETWO-27485, MAGETWO-12412, MAGETWO-12429 * @ZephyrId MAGETWO-12444, MAGETWO-12848, MAGETWO-12849, MAGETWO-12850 + * @ZephyrId MAGETWO-42547 */ class OnePageCheckoutTest extends Scenario { diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml index 797255d4e374a..785877b7f8af0 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml @@ -7,6 +7,34 @@ --> + + catalogProductSimple::default + johndoe_with_addresses + login + + 565.00 + + Flat Rate + Fixed + checkmo + checkmo, disable_guest_checkout, disable_customer_redirect_after_logging + + + + MAGETWO-59816: Redirect works improperly in a browser incognito mode + catalogProductSimple::default + register_customer + register_before_checkout + + 565.00 + + Flat Rate + Fixed + US_address_1_without_email + checkmo + checkmo, disable_guest_checkout, disable_customer_redirect_after_logging, enable_https_frontend_only + + catalogProductVirtual::default downloadableProduct::with_two_separately_links @@ -205,5 +233,64 @@ checkmo + + catalogProductSimple::default + customer_UK_US_addresses + sign_in + + 1 + + + 1 + + + 565.00 + + Flat Rate + Fixed + checkmo + checkmo + + + + + catalogProductSimple::default + customer_US_DE_UK + login + + 1 + + + 2 + + + 565.00 + + Flat Rate + Fixed + checkmo + checkmo + + + + + + catalogProductSimple::default + johndoe_with_addresses + sign_in + + 565.00 + + UK_address_without_email + Flat Rate + Fixed + Yes + US_address_1_without_email + checkmo + checkmo + + + + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php index a7d432fa38b2a..720965212ad38 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillBillingInformationStep.php @@ -10,6 +10,8 @@ use Magento\Customer\Test\Fixture\Address; use Magento\Mtf\TestStep\TestStepInterface; use Magento\Checkout\Test\Constraint\AssertBillingAddressSameAsShippingCheckbox; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Mtf\ObjectManager; /** * Fill billing information. @@ -37,6 +39,13 @@ class FillBillingInformationStep implements TestStepInterface */ protected $shippingAddress; + /** + * Customer fixture. + * + * @var Customer + */ + protected $customer; + /** * "Same as Shipping" checkbox value assertion. * @@ -51,45 +60,85 @@ class FillBillingInformationStep implements TestStepInterface */ protected $billingCheckboxState; + /** + * Customer shipping address data for select. + * + * @var array + */ + private $billingAddressCustomer; + + /** + * Object manager instance. + * + * @var ObjectManager $objectManager + */ + protected $objectManager; + /** * @constructor * @param CheckoutOnepage $checkoutOnepage * @param AssertBillingAddressSameAsShippingCheckbox $assertBillingAddressCheckbox + * @param Customer $customer + * @param ObjectManager $objectManager * @param Address $billingAddress * @param Address $shippingAddress * @param string $billingCheckboxState + * @param array|null $billingAddressCustomer */ public function __construct( CheckoutOnepage $checkoutOnepage, AssertBillingAddressSameAsShippingCheckbox $assertBillingAddressCheckbox, + Customer $customer, + ObjectManager $objectManager, Address $billingAddress = null, Address $shippingAddress = null, - $billingCheckboxState = null + $billingCheckboxState = null, + $billingAddressCustomer = null ) { $this->checkoutOnepage = $checkoutOnepage; $this->billingAddress = $billingAddress; $this->shippingAddress = $shippingAddress; $this->assertBillingAddressCheckbox = $assertBillingAddressCheckbox; + $this->customer = $customer; + $this->objectManager = $objectManager; $this->billingCheckboxState = $billingCheckboxState; + $this->billingAddressCustomer = $billingAddressCustomer; } /** * Fill billing address. * - * @return void + * @return array */ public function run() { + $billingAddress = null; if ($this->billingCheckboxState) { $this->assertBillingAddressCheckbox->processAssert($this->checkoutOnepage, $this->billingCheckboxState); } - if ($this->billingAddress) { $selectedPaymentMethod = $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock(); if ($this->shippingAddress) { $selectedPaymentMethod->getBillingBlock()->unsetSameAsShippingCheckboxValue(); } $selectedPaymentMethod->getBillingBlock()->fillBilling($this->billingAddress); + $billingAddress = $this->billingAddress; + } + if (isset($this->billingAddressCustomer['added'])) { + $addressIndex = $this->billingAddressCustomer['added']; + $billingAddress = $this->customer->getDataFieldConfig('address')['source']->getAddresses()[$addressIndex]; + $address = $this->objectManager->create( + \Magento\Customer\Test\Block\Address\Renderer::class, + ['address' => $billingAddress, 'type' => 'html_for_select_element'] + )->render(); + $selectedPaymentMethod = $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock(); + $selectedPaymentMethod->getBillingBlock()->unsetSameAsShippingCheckboxValue(); + $this->checkoutOnepage->getCustomAddressBlock()->selectAddress($address); + $selectedPaymentMethod->getBillingBlock()->clickUpdate(); } + + return [ + 'billingAddress' => $billingAddress + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php index 5150eb9964ba3..6ea0a5c7b2b39 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php @@ -8,7 +8,10 @@ use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Customer\Test\Fixture\Address; +use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestStep\TestStepInterface; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Mtf\ObjectManager; /** * Fill shipping address step. @@ -20,37 +23,101 @@ class FillShippingAddressStep implements TestStepInterface * * @var CheckoutOnepage */ - protected $checkoutOnepage; + private $checkoutOnepage; /** * Address fixture. * * @var Address */ - protected $shippingAddress; + private $shippingAddress; + + /** + * Customer fixture. + * + * @var Customer + */ + private $customer; + + /** + * Customer shipping address data for select. + * + * @var array + */ + private $shippingAddressCustomer; + + /** + * Object manager instance. + * + * @var ObjectManager + */ + private $objectManager; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + private $fixtureFactory; /** * @constructor * @param CheckoutOnepage $checkoutOnepage - * @param Address $shippingAddress + * @param Customer $customer + * @param ObjectManager $objectManager + * @param FixtureFactory $fixtureFactory + * @param Address|null $shippingAddress + * @param array|null $shippingAddressCustomer */ public function __construct( CheckoutOnepage $checkoutOnepage, - Address $shippingAddress = null + Customer $customer, + ObjectManager $objectManager, + FixtureFactory $fixtureFactory, + Address $shippingAddress = null, + $shippingAddressCustomer = null ) { $this->checkoutOnepage = $checkoutOnepage; + $this->customer = $customer; + $this->objectManager = $objectManager; + $this->fixtureFactory = $fixtureFactory; $this->shippingAddress = $shippingAddress; + $this->shippingAddressCustomer = $shippingAddressCustomer; } /** * Fill shipping address. * - * @return void + * @return array */ public function run() { + $shippingAddress = null; if ($this->shippingAddress) { $this->checkoutOnepage->getShippingBlock()->fill($this->shippingAddress); + $shippingAddress = $this->shippingAddress; + } + if (isset($this->shippingAddressCustomer['new'])) { + $shippingAddress = $this->fixtureFactory->create( + 'address', + ['dataset' => $this->shippingAddressCustomer['new']] + ); + $this->checkoutOnepage->getShippingBlock()->clickNewAddressButton(); + $this->checkoutOnepage->getShippingAddressPopupBlock()->fill($shippingAddress)->clickSaveAddressButton(); } + if (isset($this->shippingAddressCustomer['added'])) { + $addressIndex = $this->shippingAddressCustomer['added']; + $shippingAddress = $this->customer->getDataFieldConfig('address')['source']->getAddresses()[$addressIndex]; + $address = $this->objectManager->create( + \Magento\Customer\Test\Block\Address\Renderer::class, + ['address' => $shippingAddress, 'type' => 'html_without_company'] + )->render(); + $shippingBlock = $this->checkoutOnepage->getShippingBlock(); + $shippingBlock->selectAddress($address); + } + + return [ + 'shippingAddress' => $shippingAddress, + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php index 444b98adb7f83..8c99d5053bade 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php @@ -8,6 +8,7 @@ use Magento\Mtf\TestStep\TestStepInterface; use Magento\Customer\Test\Fixture\Customer; +use Magento\Customer\Test\Page\CustomerAccountCreate; use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep; @@ -51,9 +52,17 @@ class SelectCheckoutMethodStep implements TestStepInterface */ private $clickProceedToCheckoutStep; + /** + * Customer account create page instance. + * + * @var CustomerAccountCreate + */ + private $customerAccountCreatePage; + /** * @constructor * @param CheckoutOnepage $checkoutOnepage + * @param CustomerAccountCreate $customerAccountCreatePage * @param Customer $customer * @param LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend * @param ClickProceedToCheckoutStep $clickProceedToCheckoutStep @@ -61,12 +70,14 @@ class SelectCheckoutMethodStep implements TestStepInterface */ public function __construct( CheckoutOnepage $checkoutOnepage, + CustomerAccountCreate $customerAccountCreatePage, Customer $customer, LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend, ClickProceedToCheckoutStep $clickProceedToCheckoutStep, $checkoutMethod ) { $this->checkoutOnepage = $checkoutOnepage; + $this->customerAccountCreatePage = $customerAccountCreatePage; $this->customer = $customer; $this->logoutCustomerOnFrontend = $logoutCustomerOnFrontend; $this->clickProceedToCheckoutStep = $clickProceedToCheckoutStep; @@ -88,16 +99,37 @@ public function run() $this->checkoutOnepage->getLoginBlock()->loginCustomer($this->customer); } } + + if ($this->checkoutMethod === 'sign_in') { + $this->checkoutOnepage->getAuthenticationWrapperBlock()->signInLinkClick(); + $this->checkoutOnepage->getAuthenticationWrapperBlock()->loginCustomer($this->customer); + } } /** - * Logout customer on fronted. + * Process customer register action. + * + * @return void + */ + private function processRegister() + { + if ($this->checkoutMethod === 'register_before_checkout') { + $this->checkoutOnepage->getAuthenticationPopupBlock()->createAccount(); + $this->customerAccountCreatePage->getRegisterForm()->registerCustomer($this->customer); + } + } + + /** + * Logout customer on frontend. * * @return void */ public function cleanup() { - if ($this->checkoutMethod === 'login') { + if ($this->checkoutMethod === 'login' + || $this->checkoutMethod === 'sign_in' + || $this->checkoutMethod === 'register_before_checkout' + ) { $this->logoutCustomerOnFrontend->run(); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php index c4fcfd569490a..5fd03a1814910 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationPopup.php @@ -18,7 +18,7 @@ class AuthenticationPopup extends Form * * @var string */ - private $login = '[name="send"]'; + private $login = '.action.action-login.secondary'; /** * Selector for loading mask element. diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationWrapper.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationWrapper.php new file mode 100644 index 0000000000000..56e7cf257f15c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationWrapper.php @@ -0,0 +1,32 @@ +_rootElement->find($this->signInLink)->click(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationWrapper.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationWrapper.xml new file mode 100644 index 0000000000000..1bcb31c45dc39 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AuthenticationWrapper.xml @@ -0,0 +1,17 @@ + + + + + + [id='login-email'] + + + [id='login-password'] + + + diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php index 832c376e64357..7b4d18eac2d5a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php @@ -54,6 +54,16 @@ protected function getPattern() . "{{depend}}\nF: {{fax}}{{/depend}}{{depend}}\nVAT: {{vat_id}}{{/depend}}"; break; case "oneline": + case "html_without_company": + $outputPattern = "{{depend}}{{prefix}} {{/depend}}{{firstname}} {{depend}}{{middlename}} {{/depend}}" + . "{{lastname}}{{depend}} {{suffix}}{{/depend}}\n{{/depend}}{{street}}\n" + . "{{city}}, {{{$region}}} {{postcode}}\n{{country_id}}\n{{depend}}{{telephone}}{{/depend}}"; + break; + case "html_for_select_element": + $outputPattern = "{{depend}}{{prefix}} {{/depend}}{{firstname}} {{depend}}{{middlename}} {{/depend}}" + . "{{lastname}}{{depend}} {{suffix}}{{/depend}}, {{/depend}}{{street}}, " + . "{{city}}, {{{$region}}} {{postcode}}, {{country_id}}"; + break; default: $outputPattern = "{{depend}}{{prefix}} {{/depend}}{{firstname}} {{depend}}{{middlename}} {{/depend}}" . "{{lastname}}{{depend}} {{suffix}}{{/depend}}, {{street}}, " diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php index ddb20b29e063a..f880983074576 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php @@ -32,7 +32,8 @@ class Curl extends AbstractCurl implements CustomerInterface protected $mappingData = [ 'country_id' => [ 'United States' => 'US', - 'United Kingdom' => 'GB' + 'United Kingdom' => 'GB', + 'Germany' => 'DE' ], 'gender' => [ 'Male' => 1, diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php index 8873e71610de0..aa63bfa50f052 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php @@ -33,7 +33,8 @@ class Webapi extends AbstractWebapi implements CustomerInterface ], 'country_id' => [ 'United States' => 'US', - 'United Kingdom' => 'GB' + 'United Kingdom' => 'GB', + 'Germany' => 'DE' ], 'region_id' => [ 'California' => 12, diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index 70191dc828af7..1e326364d1f76 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -189,6 +189,18 @@ 555-55-555-55 + + Billy + Holiday + Magento %isolation% + Liverpool + 99 Henry St + SE1 7RW + United Kingdom + Liverpool + 555-55-555-55 + + Jane Doe @@ -219,6 +231,7 @@ Jan Jansen + JaneDoe_%isolation%@example.com Magento %isolation% Berlin Augsburger Strabe 41 diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml index 0892fac420357..f0e3c5a898b99 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml @@ -186,5 +186,16 @@ UK_address_with_VAT + + + John + Doe%isolation% + John.Doe%isolation%@example.com + 123123^q + 123123^q + + UK_address_default_billing, US_address_default_shipping + + diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Addresses.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Addresses.php new file mode 100644 index 0000000000000..6d92327ef92d4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Addresses.php @@ -0,0 +1,77 @@ +_rootElement->find($this->billingAddress)->getText(); + } + + /** + * Get customer's shipping address from the data inside block. + * + * @return string + */ + public function getCustomerShippingAddress() + { + return $this->_rootElement->find($this->shippingAddress)->getText(); + } + + /** + * Checks if new address button is visible. + * + * @return bool + */ + public function isNewAddressButtonVisible() + { + $button = $this->_rootElement->find($this->newAddressButton); + return $button->isVisible(); + } + + /** + * Clicks new address button. + * + * @return void + */ + public function clickNewAddressButton() + { + $this->_rootElement->find($this->newAddressButton)->click(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderAddresses.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderAddresses.php new file mode 100644 index 0000000000000..6964153ca3df6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderAddresses.php @@ -0,0 +1,62 @@ +objectManager->create( + \Magento\Customer\Test\Block\Address\Renderer::class, + ['address' => $shippingAddress, 'type' => 'html'] + )->render(); + + $selectedBillingAddress = $this->objectManager->create( + \Magento\Customer\Test\Block\Address\Renderer::class, + ['address' => $billingAddress, 'type' => 'html'] + )->render(); + + $salesOrderView->open(['order_id' => $orderId]); + $orderBillingAddress = $salesOrderView->getAddressesBlock()->getCustomerBillingAddress(); + $orderShippingAddress = $salesOrderView->getAddressesBlock()->getCustomerShippingAddress(); + + \PHPUnit_Framework_Assert::assertTrue( + $selectedBillingAddress == $orderBillingAddress && $selectedShippingAddress == $orderShippingAddress, + 'Billing and shipping addresses from the address book and from the order page are not the same.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Billing and shipping addresses from the address book and from the order page are the same.'; + } +} 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 674b42732d2cd..39c228e63f2c6 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 @@ -17,5 +17,6 @@ + From 47482bf7b31219bf516fb5b2452f0238138043a6 Mon Sep 17 00:00:00 2001 From: Siarhei Andreyeu Date: Fri, 11 Nov 2016 16:07:29 +0300 Subject: [PATCH 1773/3232] MTO-18: [Variation] Add variation to check catalog price rule with simple product with custom options - Functional test implemented. --- .../Test/Repository/CatalogProductSimple.xml | 96 +++++++++++++++++++ .../CatalogProductSimple/CheckoutData.xml | 42 ++++++++ .../Test/Repository/Product/CustomOptions.xml | 24 +++++ .../TestCase/ApplyCatalogPriceRulesTest.php | 57 ++++++----- .../TestCase/ApplyCatalogPriceRulesTest.xml | 45 +++++++-- 5 files changed, 234 insertions(+), 30 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index e1cbc1a1d8ba2..f73e35f409510 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -1263,5 +1263,101 @@ + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + + 56.78 + + This item has weight + 1 + + 1 + In Stock + + + + default + + + simple-product-%isolation% + + default_subcategory + + + percent_and_fixed_radio_options + + + simple_order_qty_1_price_56 + + + + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + + 56.78 + + This item has weight + 1 + + 1 + In Stock + + + + default + + + simple-product-%isolation% + + default_subcategory + + + percent_and_fixed_radio_options + + + with_fixed_custom_option + + + + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + + 56.78 + + This item has weight + 1 + + 1 + In Stock + + + + default + + + simple-product-%isolation% + + default_subcategory + + + percent_and_fixed_radio_options + + + with_percent_custom_option + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml index 53ec00f56b1e8..9f769798ec53d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml @@ -148,5 +148,47 @@ 3 + + + 1 + + 49.40 + 49.40 + + + + + + + + attribute_key_0 + option_key_0 + + + + 1 + + 61.74 + 1 + 61.74 + + + + + + + + attribute_key_0 + option_key_1 + + + + 1 + + 53.85 + 1 + 53.85 + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml index 3252f0178e241..ae9c2238c9e00 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml @@ -358,5 +358,29 @@ + + + + custom menu + No + Select/Radio Buttons + + + 12.34 bucks + 12.34 + Fixed + sku_radio_buttons_row_1 + 0 + + + 9 Percent + 9 + Percent + sku_radio_buttons_row_2 + 0 + + + + diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php index 4a4c6a25321c8..68972e5bb766d 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php @@ -11,6 +11,8 @@ use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Util\Command\Cli\Cron; use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleEdit; +use Magento\Mtf\TestStep\TestStepFactory; +use Magento\Mtf\Fixture\FixtureInterface; /** * Preconditions: @@ -37,57 +39,66 @@ class ApplyCatalogPriceRulesTest extends AbstractCatalogRuleEntityTest * Apply catalog price rules. * * @param array $catalogRules - * @param CatalogProductSimple $product * @param CatalogRuleEdit $catalogRuleEdit + * @param TestStepFactory $stepFactory * @param Cron $cron * @param bool $isCronEnabled * @param Customer $customer - * @return array + * @param array $products + * @return FixtureInterface[] */ public function test( array $catalogRules, - CatalogProductSimple $product, CatalogRuleEdit $catalogRuleEdit, + TestStepFactory $stepFactory, Cron $cron, $isCronEnabled = false, - Customer $customer = null + Customer $customer = null, + array $products = null ) { - $product->persist(); - - foreach ($catalogRules as $catalogPriceRule) { - $catalogPriceRule = $this->createCatalogPriceRule($catalogPriceRule, $product, $customer); + if ($customer !== null) { + $customer->persist(); + } - if ($isCronEnabled) { - $cron->run(); - $cron->run(); - } else { - $catalogRuleEdit->open(['id' => $catalogPriceRule->getId()]); - $this->catalogRuleNew->getFormPageActions()->saveAndApply(); + $products = $stepFactory->create( + \Magento\Catalog\Test\TestStep\CreateProductsStep::class, + ['products' => $products] + )->run()['products']; + + foreach ($catalogRules as $catalogRule) { + foreach ($products as $product) { + $catalogPriceRule = $this->createCatalogPriceRule($catalogRule, $product, $customer); + if ($isCronEnabled) { + $cron->run(); + $cron->run(); + } else { + $catalogRuleEdit->open(['id' => $catalogPriceRule->getId()]); + $this->catalogRuleNew->getFormPageActions()->saveAndApply(); + } } } - - return ['products' => [$product]]; + return ['products' => $products]; } /** * Prepare condition for catalog price rule. * - * @param CatalogProductSimple $productSimple + * @param FixtureInterface $product * @param array $catalogPriceRule * @return array */ - private function prepareCondition(CatalogProductSimple $productSimple, array $catalogPriceRule) + private function prepareCondition(FixtureInterface $product, array $catalogPriceRule) { $result = []; $conditionEntity = explode('|', trim($catalogPriceRule['data']['rule'], '[]'))[0]; switch ($conditionEntity) { case 'Category': - $result['%category_id%'] = $productSimple->getDataFieldConfig('category_ids')['source']->getIds()[0]; + $result['%category_id%'] = $product->getDataFieldConfig('category_ids')['source']->getIds()[0]; break; case 'Attribute': /** @var \Magento\Catalog\Test\Fixture\CatalogProductAttribute[] $attrs */ - $attributes = $productSimple->getDataFieldConfig('attribute_set_id')['source'] + $attributes = $product->getDataFieldConfig('attribute_set_id')['source'] ->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes(); $result['%attribute_id%'] = $attributes[0]->getAttributeCode(); @@ -110,7 +121,6 @@ private function prepareCondition(CatalogProductSimple $productSimple, array $ca */ private function applyCustomerGroup(array $catalogPriceRule, Customer $customer) { - $customer->persist(); /** @var \Magento\Customer\Test\Fixture\CustomerGroup $customerGroup */ $customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup(); $catalogPriceRule['data']['customer_group_ids']['option_0'] = $customerGroup->getCustomerGroupId(); @@ -121,20 +131,19 @@ private function applyCustomerGroup(array $catalogPriceRule, Customer $customer) /** * Create catalog price rule. * - * @param CatalogProductSimple $product * @param array $catalogPriceRule + * @param FixtureInterface $product * @param Customer $customer * @return CatalogRule */ private function createCatalogPriceRule( array $catalogPriceRule, - CatalogProductSimple $product, + FixtureInterface $product, Customer $customer = null ) { if (isset($catalogPriceRule['data']['rule'])) { $catalogPriceRule = $this->prepareCondition($product, $catalogPriceRule); } - if ($customer !== null) { $catalogPriceRule = $this->applyCustomerGroup($catalogPriceRule, $customer); } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml index c732ae1f2b877..00b02c61bd61c 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml @@ -11,7 +11,7 @@ test_type:extended_acceptance_test catalog_price_rule_priority_0 catalog_price_rule_priority_2 - simple_for_salesrule_2 + catalogProductSimple::simple_for_salesrule_2 15 20 35 @@ -26,7 +26,7 @@ catalog_price_rule_priority_0 catalog_price_rule_priority_1_stop_further_rules catalog_price_rule_priority_2 - simple_for_salesrule_2 + catalogProductSimple::simple_for_salesrule_2 20 25 30 @@ -40,7 +40,7 @@ active_catalog_price_rule_with_conditions active_catalog_rule - simple_for_salesrule_2 + catalogProductSimple::simple_for_salesrule_2 45 50 5 @@ -53,7 +53,7 @@ test_type:extended_acceptance_test - product_with_custom_color_attribute + catalogProductSimple::product_with_custom_color_attribute Catalog Price Rule %isolation% Active Main Website @@ -72,7 +72,7 @@ - MAGETWO-23036 + catalogProductSimple::MAGETWO-23036 rule_name%isolation% Active Main Website @@ -93,7 +93,7 @@ test_type:acceptance_test, test_type:extended_acceptance_test customer_with_new_customer_group - simple_10_dollar + catalogProductSimple::simple_10_dollar rule_name%isolation% Active Main Website @@ -113,5 +113,38 @@ + + catalogProductSimple::with_default_custom_option + catalogProductSimple::with_fixed_custom_option + catalogProductSimple::with_percent_custom_option + customer_US + CatalogPriceRule %isolation% + Active + Main Website + default + Apply as percentage of original + 13 + Yes + 164.99 + 179.99 + 7.38 + 8.04 + 7.38 + 49.40 + 53.85 + 61.74 + 49.40 + 61.74 + 53.85 + 56.78 + 61.98 + 69.12 + Flat Rate + Fixed + UK_address + free + + + From 305e916fe243b43c7fc366f59ae39aa94dfe9782 Mon Sep 17 00:00:00 2001 From: Vadim Zubovich Date: Mon, 24 Oct 2016 22:08:43 +0300 Subject: [PATCH 1774/3232] MTO-94: [Test] PCI password requirements for admin users while changing a password - Test implemented --- .../AssertUserPasswordChangedSuccessfully.php | 47 +++++++ ...ePasswordUserEntityPciRequirementsTest.php | 131 ++++++++++++++++++ ...ePasswordUserEntityPciRequirementsTest.xml | 19 +++ 3 files changed, 197 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserPasswordChangedSuccessfully.php create mode 100644 dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdatePasswordUserEntityPciRequirementsTest.php create mode 100644 dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdatePasswordUserEntityPciRequirementsTest.xml diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserPasswordChangedSuccessfully.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserPasswordChangedSuccessfully.php new file mode 100644 index 0000000000000..fec96f699ea65 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserPasswordChangedSuccessfully.php @@ -0,0 +1,47 @@ +getMessagesBlock()->getErrorMessage(); + \PHPUnit_Framework_Assert::assertEquals( + self::FAIL_MESSAGE, + $errorMessage, + 'Password update failed with error: "' . self::FAIL_MESSAGE . '"' + ); + } + + /** + * Returns success message if there is fail message. + * + * @return string + */ + public function toString() + { + return 'Password validation completed successfully.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdatePasswordUserEntityPciRequirementsTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdatePasswordUserEntityPciRequirementsTest.php new file mode 100644 index 0000000000000..df95519e5ffe4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdatePasswordUserEntityPciRequirementsTest.php @@ -0,0 +1,131 @@ + All Users + * 3. Click on admin record to open > Account Information page. + * 4. Update password providing a new password. + * 5. Save user + * 6. Repeat Steps 4-5 4 times with different passwords. + * 7. Update password providing an original password for the user. + * + * @ZephyrId MAGETWO-48104 + */ +class UpdatePasswordUserEntityPciRequirementsTest extends Injectable +{ + /** + * User edit page on backend. + * + * @var UserEdit + */ + protected $userEdit; + + /** + * Dashboard page on backend. + * + * @var Dashboard + */ + protected $dashboard; + + /** + * Authorization page on backend. + * + * @var AdminAuthLogin + */ + protected $adminAuth; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Setup necessary data for test. + * + * @param UserEdit $userEdit + * @param Dashboard $dashboard + * @param AdminAuthLogin $adminAuth + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __inject( + UserEdit $userEdit, + Dashboard $dashboard, + AdminAuthLogin $adminAuth, + FixtureFactory $fixtureFactory + ) { + $this->userEdit = $userEdit; + $this->dashboard = $dashboard; + $this->adminAuth = $adminAuth; + $this->fixtureFactory = $fixtureFactory; + } + + /** + * Run Test. + * + * @param User $user + * @param array $passwords + * @return void + */ + public function test( + User $user, + array $passwords + ) { + // Preconditions + $user->persist(); + $initialPassword = $user->getPassword(); + $currentPassword = $user->getPassword(); + $passwords[] = $initialPassword; + + // Steps + $this->adminAuth->open(); + $this->adminAuth->getLoginBlock()->fill($user); + $this->adminAuth->getLoginBlock()->submit(); + + foreach ($passwords as $password) { + $data = [ + 'password' => $password, + 'password_confirmation' => $password, + 'current_password' => $currentPassword, + + ]; + $updatedUser = $this->fixtureFactory->createByCode('user', ['data' => $data]); + + $this->userEdit->open(['user_id' => $user->getUserId()]); + $this->userEdit->getUserForm()->fill($updatedUser); + $this->userEdit->getPageActions()->save(); + $currentPassword = $password; + } + } + + /** + * Logout Admin User from account. + * + * @return void + */ + public function tearDown() + { + if ($this->dashboard->getAdminPanelHeader()->isVisible()) { + $this->dashboard->getAdminPanelHeader()->logOut(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdatePasswordUserEntityPciRequirementsTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdatePasswordUserEntityPciRequirementsTest.xml new file mode 100644 index 0000000000000..c2a24b0f102e2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdatePasswordUserEntityPciRequirementsTest.xml @@ -0,0 +1,19 @@ + + + + + + custom_admin_with_default_role + 123123^q0 + 123123^q1 + 123123^q2 + 123123^q3 + + + + From 29e6c2e4f4743512cc80c201942696fc78fded9f Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko Date: Fri, 11 Nov 2016 15:39:08 +0200 Subject: [PATCH 1775/3232] MAGETWO-60572: [GitHub] PayPal.js error on checkout downloadable product #7000 --- .../js/view/payment/method-renderer/paypal.js | 2 +- ...OnePageCheckoutWithBraintreePaypalTest.xml | 16 +++++++ .../TestStep/PlaceOrderWithPaypalStep.php | 38 ++++++++++++++++ .../Checkout/Test/Block/Onepage/Login.php | 12 ++++++ .../AssertBillingAddressAbsentInPayment.php | 43 +++++++++++++++++++ 5 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressAbsentInPayment.php diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js index 075a1fdaf1fc1..2d5e0b3a270b7 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js @@ -296,7 +296,7 @@ define([ getShippingAddress: function () { var address = quote.shippingAddress(); - if (address.postcode === null) { + if (_.isNull(address.postcode) || _.isUndefined(address.postcode)) { return {}; } diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.xml index 7e38e6f0303b6..7bc8fe883dc2d 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.xml @@ -50,5 +50,21 @@ + + catalogProductVirtual::product_50_dollar + default + guest + + 50.00 + + braintree_paypal + braintree, braintree_paypal, braintree_paypal_skip_order_review + Processing + test_type:3rd_party_test, severity:S2 + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php index 0ff7f164b0996..abc9915d65692 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php @@ -6,9 +6,11 @@ namespace Magento\Braintree\Test\TestStep; use Magento\Checkout\Test\Constraint\AssertGrandTotalOrderReview; +use Magento\Checkout\Test\Constraint\AssertBillingAddressAbsentInPayment; use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Checkout\Test\Page\CheckoutOnepageSuccess; use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\TestStep\TestStepInterface; /** @@ -26,6 +28,11 @@ class PlaceOrderWithPaypalStep implements TestStepInterface */ private $assertGrandTotalOrderReview; + /** + * @var AssertBillingAddressAbsentInPayment + */ + private $assertBillingAddressAbsentInPayment; + /** * @var CheckoutOnepageSuccess */ @@ -46,26 +53,50 @@ class PlaceOrderWithPaypalStep implements TestStepInterface */ private $products; + /** + * Customer fixture. + * + * @var Customer + */ + protected $customer; + + /** + * Checkout method. + * + * @var string + */ + protected $checkoutMethod; + /** * @param CheckoutOnepage $checkoutOnepage * @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview + * @param AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment * @param CheckoutOnepageSuccess $checkoutOnepageSuccess * @param FixtureFactory $fixtureFactory + * @param Customer $customer + * @param string $checkoutMethod * @param array $products * @param array $prices */ public function __construct( CheckoutOnepage $checkoutOnepage, AssertGrandTotalOrderReview $assertGrandTotalOrderReview, + AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment, CheckoutOnepageSuccess $checkoutOnepageSuccess, FixtureFactory $fixtureFactory, + Customer $customer = null, + $checkoutMethod, + array $products, array $prices = [] ) { $this->checkoutOnepage = $checkoutOnepage; $this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview; + $this->assertBillingAddressAbsentInPayment = $assertBillingAddressAbsentInPayment; $this->checkoutOnepageSuccess = $checkoutOnepageSuccess; $this->fixtureFactory = $fixtureFactory; + $this->customer = $customer; + $this->checkoutMethod = $checkoutMethod; $this->products = $products; $this->prices = $prices; } @@ -78,6 +109,13 @@ public function run() if (isset($this->prices['grandTotal'])) { $this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']); } + + $this->assertBillingAddressAbsentInPayment->processAssert($this->checkoutOnepage); + + if ($this->checkoutMethod === 'guest') { + $this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer); + } + $parentWindow = $this->checkoutOnepage->getPaymentBlock() ->getSelectedPaymentMethodBlock() ->clickPayWithPaypal(); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php index 789069299d22c..fe1eda337581a 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php @@ -90,6 +90,18 @@ public function loginCustomer(FixtureInterface $customer) $this->waitForElementNotVisible($this->loadingMask); } + /** + * Fill required fields for guest checkout. + * + * @param FixtureInterface $customer + * @return void + */ + public function fillGuestFields(FixtureInterface $customer) + { + $mapping = $this->dataMapping(); + $this->_rootElement->find($mapping['email']['selector'], $mapping['email']['strategy'])->setValue($customer->getEmail()); + } + /** * Click continue on checkout method block. * diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressAbsentInPayment.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressAbsentInPayment.php new file mode 100644 index 0000000000000..6b8e2d0307eba --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressAbsentInPayment.php @@ -0,0 +1,43 @@ +getPaymentBlock() + ->getSelectedPaymentMethodBlock() + ->getBillingBlock()->isVisible(), + 'Billing address is present in payment method' + ); + } + + /** + * Returns string representation of successful assertion + * + * @return string + */ + public function toString() + { + return 'Billing address is absent in payment method'; + } +} From 56787d6ec527283a351f8383f7f8e8e695edff3c Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Fri, 11 Nov 2016 15:56:25 +0200 Subject: [PATCH 1776/3232] MAGETWO-60243: Confusion on the order State Title and Code of "processing[Suspected Fraud]" --- .../Sales/Block/Status/Grid/Column/State.php | 3 +- app/code/Magento/Sales/Model/Order/Config.php | 18 ++++ .../Block/Status/Grid/Column/StateTest.php | 90 +++++++++++++++++++ .../Test/Unit/Model/Order/ConfigTest.php | 38 +++++++- 4 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php index cd049799e7b49..ae9ea20fd35fd 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php @@ -49,8 +49,9 @@ public function getFrameCallback() */ public function decorateState($value, $row, $column, $isExport) { + $status = $row->getStatus(); if ($value) { - $cell = $value . '[' . $this->_config->getStateLabel($value) . ']'; + $cell = $value . '[' . $this->_config->getStateLabelByStateAndStatus($value, $status) . ']'; } else { $cell = $value; } diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php index 8c6f2e55f55ac..535e2975ee13d 100644 --- a/app/code/Magento/Sales/Model/Order/Config.php +++ b/app/code/Magento/Sales/Model/Order/Config.php @@ -256,4 +256,22 @@ protected function _getStatuses($visibility) } return $this->statuses[(bool) $visibility]; } + + /** + * Retrieve label by state and status + * + * @param string $state + * @param string $status + * @return \Magento\Framework\Phrase|string + */ + public function getStateLabelByStateAndStatus($state, $status) + { + foreach ($this->_getCollection() as $item) { + if ($item->getData('state') == $state && $item->getData('status') == $status) { + $label = $item->getData('label'); + return __($label); + } + } + return $state; + } } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php b/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php new file mode 100644 index 0000000000000..cafc6ff031a0d --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php @@ -0,0 +1,90 @@ +orderStatusCollectionFactoryMock = $this->getMock( + \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory::class, + ['create'], + [], + '', + false, + false + ); + $this->configMock = $helper->getObject(\Magento\Sales\Model\Order\Config::class, + [ + 'orderStatusCollectionFactory' => $this->orderStatusCollectionFactoryMock + ] + ); + $this->stateColumn = $helper + ->getObject( + \Magento\Sales\Block\Status\Grid\Column\State::class, + [ + 'config' => $this->configMock, + ] + ); + } + + public function testDecorateState() + { + $rowMock = $this->getMock(\Magento\Sales\Model\Order\Status::class, [], [], '', false); + $rowMock->expects($this->any())->method('getStatus')->willReturn('fraud'); + $columnMock = $this->getMock(\Magento\Backend\Block\Widget\Grid\Column::class, [], [], '', false); + $statuses = [ + new \Magento\Framework\DataObject( + [ + 'status' => 'fraud', + 'state' => 'processing', + 'label' => 'Suspected Fraud', + ] + ), + new \Magento\Framework\DataObject( + [ + 'status' => 'processing', + 'state' => 'processing', + 'label' => 'Processing', + ] + ) + ]; + $collectionMock = $this->getMock( + \Magento\Sales\Model\ResourceModel\Order\Status\Collection::class, + ['create', 'joinStates'], + [], + '', + false, + false + ); + $this->orderStatusCollectionFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($collectionMock)); + $collectionMock->expects($this->once()) + ->method('joinStates') + ->will($this->returnValue($statuses)); + + $result = $this->stateColumn->decorateState('processing', $rowMock, $columnMock, false); + $this->assertSame('processing[processing]', $result); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php index 1f29235efaef2..7ee4f745cde8f 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php @@ -5,8 +5,6 @@ */ namespace Magento\Sales\Test\Unit\Model\Order; -use \Magento\Sales\Model\Order\Config; - /** * Class ConfigTest */ @@ -95,4 +93,40 @@ public function testGetInvisibleOnFrontStatuses() $result = $this->salesConfig->getInvisibleOnFrontStatuses(); $this->assertSame($expectedResult, $result); } + + public function testGetStateLabelByStateAndStatus() + { + $statuses = [ + new \Magento\Framework\DataObject( + [ + 'status' => 'fraud', + 'state' => 'processing', + 'label' => 'Suspected Fraud', + ] + ), + new \Magento\Framework\DataObject( + [ + 'status' => 'processing', + 'state' => 'processing', + 'label' => 'Processing', + ] + ) + ]; + $collectionMock = $this->getMock( + \Magento\Sales\Model\ResourceModel\Order\Status\Collection::class, + ['create', 'joinStates'], + [], + '', + false, + false + ); + $this->orderStatusCollectionFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($collectionMock)); + $collectionMock->expects($this->once()) + ->method('joinStates') + ->will($this->returnValue($statuses)); + $result = $this->salesConfig->getStateLabelByStateAndStatus('processing', 'fraud'); + $this->assertSame('Suspected Fraud', $result->getText()); + } } From d63bb1fe158dd4e54a2e4ce9de2aeb590bec579a Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko Date: Fri, 11 Nov 2016 16:14:27 +0200 Subject: [PATCH 1777/3232] MAGETWO-56989: Deployment process can't be executed on separate machine -move deploy static command --- .../Unit/Console/Command/DeployStaticContentCommandTest.php | 2 +- .../Setup}/Test/Unit/Console/Command/FunctionExistMock.php | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {app/code/Magento/Deploy => setup/src/Magento/Setup}/Test/Unit/Console/Command/DeployStaticContentCommandTest.php (99%) rename {app/code/Magento/Deploy => setup/src/Magento/Setup}/Test/Unit/Console/Command/FunctionExistMock.php (100%) diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/DeployStaticContentCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/DeployStaticContentCommandTest.php similarity index 99% rename from app/code/Magento/Deploy/Test/Unit/Console/Command/DeployStaticContentCommandTest.php rename to setup/src/Magento/Setup/Test/Unit/Console/Command/DeployStaticContentCommandTest.php index 6f6f564b5bd42..82777bb6b7aee 100644 --- a/app/code/Magento/Deploy/Test/Unit/Console/Command/DeployStaticContentCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/DeployStaticContentCommandTest.php @@ -3,7 +3,7 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Deploy\Test\Unit\Console\Command; +namespace Magento\Setup\Test\Unit\Console\Command; use Magento\Setup\Console\Command\DeployStaticContentCommand; use Symfony\Component\Console\Tester\CommandTester; diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/FunctionExistMock.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/FunctionExistMock.php similarity index 100% rename from app/code/Magento/Deploy/Test/Unit/Console/Command/FunctionExistMock.php rename to setup/src/Magento/Setup/Test/Unit/Console/Command/FunctionExistMock.php From 6815c97d30b57510a1e5472029869e13c1477769 Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko Date: Fri, 11 Nov 2016 16:16:51 +0200 Subject: [PATCH 1778/3232] MAGETWO-60572: [GitHub] PayPal.js error on checkout downloadable product #7000 --- .../Test/TestStep/PlaceOrderWithPaypalStep.php | 18 ++++++++++++++++-- .../AssertBillingAddressAbsentInPayment.php | 10 +++++----- .../tests/app/Magento/Checkout/Test/etc/di.xml | 5 +++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php index abc9915d65692..fc54b3ca5b656 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php @@ -67,6 +67,13 @@ class PlaceOrderWithPaypalStep implements TestStepInterface */ protected $checkoutMethod; + /** + * Shipping carrier and method. + * + * @var array + */ + protected $shipping; + /** * @param CheckoutOnepage $checkoutOnepage * @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview @@ -77,6 +84,8 @@ class PlaceOrderWithPaypalStep implements TestStepInterface * @param string $checkoutMethod * @param array $products * @param array $prices + * @param array $shipping + * */ public function __construct( CheckoutOnepage $checkoutOnepage, @@ -88,7 +97,9 @@ public function __construct( $checkoutMethod, array $products, - array $prices = [] + array $prices = [], + array $shipping = [] + ) { $this->checkoutOnepage = $checkoutOnepage; $this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview; @@ -99,6 +110,7 @@ public function __construct( $this->checkoutMethod = $checkoutMethod; $this->products = $products; $this->prices = $prices; + $this->shipping = $shipping; } /** @@ -112,7 +124,9 @@ public function run() $this->assertBillingAddressAbsentInPayment->processAssert($this->checkoutOnepage); - if ($this->checkoutMethod === 'guest') { + if ($this->checkoutMethod === 'guest' && + empty($this->shipping['shipping_method']) && + empty($this->shipping['shipping_service'])) { $this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer); } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressAbsentInPayment.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressAbsentInPayment.php index 6b8e2d0307eba..62fd88e98eed4 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressAbsentInPayment.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertBillingAddressAbsentInPayment.php @@ -10,15 +10,14 @@ use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertBillingAddressAbsentInShoppingCart - * Assert billing address is not present in selected payment method + * Assert billing address is not present in selected payment method. */ class AssertBillingAddressAbsentInPayment extends AbstractConstraint { /** - * Assert billing address is not present in selected payment method + * Assert billing address is not present in selected payment method. * - * @param CheckoutOnepage $checkoutOnepage, + * @param CheckoutOnepage $checkoutOnepage * @return void */ public function processAssert(CheckoutOnepage $checkoutOnepage) @@ -26,7 +25,8 @@ public function processAssert(CheckoutOnepage $checkoutOnepage) \PHPUnit_Framework_Assert::assertFalse( $checkoutOnepage->getPaymentBlock() ->getSelectedPaymentMethodBlock() - ->getBillingBlock()->isVisible(), + ->getBillingBlock() + ->isVisible(), 'Billing address is present in payment method' ); } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/di.xml index 6dc1b3b0c67ed..f8aed5f6cba6e 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/di.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/di.xml @@ -11,4 +11,9 @@ middle + + + S2 + + From ce7d097ecde2a25878deaafa38e836aa5086fc1a Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko Date: Fri, 11 Nov 2016 16:27:20 +0200 Subject: [PATCH 1779/3232] MAGETWO-60572: [GitHub] PayPal.js error on checkout downloadable product #7000 --- .../Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php index fc54b3ca5b656..cae85fea49c45 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php @@ -124,9 +124,7 @@ public function run() $this->assertBillingAddressAbsentInPayment->processAssert($this->checkoutOnepage); - if ($this->checkoutMethod === 'guest' && - empty($this->shipping['shipping_method']) && - empty($this->shipping['shipping_service'])) { + if ($this->checkoutMethod === 'guest' && empty($this->shipping)) { $this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer); } From f0b932f69447df6672cd103d4b2bd6e6a072967e Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 11 Nov 2016 17:01:35 +0200 Subject: [PATCH 1780/3232] MAGETWO-60575: Implement Functional Test for Bundle Options on Catalog Profuct Page - MAGETWO-55729 [Customer] Optimize performance for bundled products with lots of product options --- .../Block/Catalog/Product/CustomizedPrice.php | 34 ------------------- .../Test/Block/Catalog/Product/View.php | 13 ------- .../Block/Catalog/Product/View/Summary.php | 17 ++++++++++ .../AssertBundleItemsSummaryOnProductPage.php | 11 +++--- .../BundleProduct/BundleSelections.xml | 1 + 5 files changed, 24 insertions(+), 52 deletions(-) delete mode 100644 dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php deleted file mode 100644 index f82bc0b83e59c..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/CustomizedPrice.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'selector' => '.price', - ] - ]; - - /** - * This method returns the price represented by the block. - * - * @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/Bundle/Test/Block/Catalog/Product/View.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php index 327fea6b8c702..a688ffac5ac01 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php @@ -78,19 +78,6 @@ public function getBundleSummaryBlock() ); } - /** - * Get Bundle customized Price block. - * - * @return \Magento\Bundle\Test\Block\Catalog\Product\CustomizedPrice - */ - public function getCustomizedPriceBlock() - { - return $this->blockFactory->create( - \Magento\Bundle\Test\Block\Catalog\Product\CustomizedPrice::class, - ['element' => $this->_rootElement->find($this->customizedBundlePriceSelector)] - ); - } - /** * Click "Customize and add to cart button". * diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Summary.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Summary.php index 76a46bfe3088a..03c0aeadd85bb 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Summary.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Summary.php @@ -20,6 +20,13 @@ class Summary extends \Magento\Catalog\Test\Block\Product\View */ private $configuredPriceBlockSelector = '.price-configured_price'; + /** + * Summary items selector. + * + * @var string + */ + private $summaryItemsSelector = '.bundle li div div'; + /** * Get configured price block. * @@ -32,4 +39,14 @@ public function getConfiguredPriceBlock() ['element' => $this->_rootElement->find($this->configuredPriceBlockSelector)] ); } + + /** + * Get Bundle Summary row items. + * + * @return \Magento\Mtf\Client\ElementInterface[] + */ + public function getSummaryItems() + { + return $this->_rootElement->getElements($this->summaryItemsSelector); + } } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php index 36895dd2548a5..e60e08e3c9b9a 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsSummaryOnProductPage.php @@ -33,14 +33,15 @@ public function processAssert( $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $bundleOptions = $product->getData()['bundle_selections']['bundle_options']; - $optionsBlock = $catalogProductView->getBundleViewBlock(); - $customizedPriceBlock = $optionsBlock->getCustomizedPriceBlock(); + $bundleViewBlock = $catalogProductView->getBundleViewBlock(); + $configuredPriceBlock = $bundleViewBlock->getBundleSummaryBlock()->getConfiguredPriceBlock(); foreach ($bundleOptions as $bundleOption) { foreach ($bundleOption['assigned_products'] as $assignedProduct) { - $optionsBlock->fillOptionsWithCustomData([ + $bundleViewBlock->fillOptionsWithCustomData([ [ 'title' => $bundleOption['title'], 'type' => $bundleOption['type'], + 'frontend_type' => $bundleOption['type'], 'value' => [ 'name' => $assignedProduct['search_data']['name'] ] @@ -49,11 +50,11 @@ public function processAssert( $assignedProductPrice = (double)$assignedProduct['data']['selection_price_value']; $assignedProductQty = (double)$assignedProduct['data']['selection_qty']; - foreach ($optionsBlock->getBundleSummary() as $bundleSummaryItem) { + foreach ($bundleViewBlock->getBundleSummaryBlock()->getSummaryItems() as $bundleSummaryItem) { $bundleSummaryItemText = $bundleSummaryItem->getText(); if (strpos($bundleSummaryItemText, $assignedProduct['search_data']['name']) !== false) { $optionData = $this->getBundleOptionData($bundleSummaryItemText); - $optionData['price'] = (double)$customizedPriceBlock->getFinalPrice(); + $optionData['price'] = (double)$configuredPriceBlock->getPrice(); $actualResult[] = $optionData; } } diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml index 4a4bd5878ce6c..a297891ba085c 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml @@ -628,6 +628,7 @@ Drop-down Option Drop-down + Drop-down Yes From 61b2e446d2e5aed46a4b6231100e49534b371bf9 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Fri, 11 Nov 2016 17:03:57 +0200 Subject: [PATCH 1781/3232] MAGETWO-60817: [FT] Required argument $configData is missing in variation CreateCreditMemoEntityWithConfigurableTestVariation1 --- .../Test/TestCase/CreateCreditMemoEntityTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateCreditMemoEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateCreditMemoEntityTest.xml index dd92edc82b331..8a8195db638d5 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateCreditMemoEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateCreditMemoEntityTest.xml @@ -14,6 +14,7 @@ default configurableProduct::configurable_with_qty_1 full_refund + From 331b1e0b6bedc5391fa6a1f0950ccef957cee892 Mon Sep 17 00:00:00 2001 From: Vadim Zubovich Date: Fri, 11 Nov 2016 18:14:05 +0300 Subject: [PATCH 1782/3232] MTO-95: PRs stabilization - Fixed name conflict. --- .../Checkout/Test/Block/Onepage/Shipping.php | 27 +++---------------- .../Test/TestStep/FillShippingAddressStep.php | 2 +- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php index 6c97bb79b2b57..b5a161257c7b7 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php @@ -46,7 +46,7 @@ class Shipping extends Form * * @var string */ - private $newAddressButton = '.action-show-popup'; + private $popupSelector = '.action-show-popup'; /** * Locator for address select button. @@ -80,16 +80,6 @@ public function clickOnNewAddressButton() $this->_rootElement->find($this->newAddressButton)->click(); } - /** - * 'Ship here' button click. - * - * @return void - */ - public function clickShipHere() - { - $this->_rootElement->find($this->shipHereButton, Locator::SELECTOR_XPATH)->click(); - } - /** * Get Address Modal Block. * @@ -151,24 +141,13 @@ public function isAddressSelected($address) return $text == $address; } - /** - * Checks if new address button is visible. - * - * @return bool - */ - public function isNewAddressButtonVisible() - { - $button = $this->_rootElement->find($this->newAddressButton); - return $button->isVisible(); - } - /** * Clicks new address button. * * @return void */ - public function clickNewAddressButton() + public function clickPopupNewAddressButton() { - $this->_rootElement->find($this->newAddressButton)->click(); + $this->_rootElement->find($this->popupSelector)->click(); } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php index 6ea0a5c7b2b39..ce00cf446b3ad 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php @@ -102,7 +102,7 @@ public function run() 'address', ['dataset' => $this->shippingAddressCustomer['new']] ); - $this->checkoutOnepage->getShippingBlock()->clickNewAddressButton(); + $this->checkoutOnepage->getShippingBlock()->clickPopupNewAddressButton(); $this->checkoutOnepage->getShippingAddressPopupBlock()->fill($shippingAddress)->clickSaveAddressButton(); } if (isset($this->shippingAddressCustomer['added'])) { From dd78e93244833e574eeb1474df6d5668e7f19ead Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Fri, 11 Nov 2016 17:15:25 +0200 Subject: [PATCH 1783/3232] MAGETWO-48516: Most of category fields don't have Use Default Value option in Store/StoreView scope on the redesigned category page --- .../Catalog/Model/Category/DataProvider.php | 17 ++++++----------- .../adminhtml/ui_component/category_form.xml | 13 ------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index 2a8ab2c4de320..5646eec60700e 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -197,7 +197,12 @@ private function addUseDefaultValueCheckbox(Category $category, array $meta) && $category->getStoreId(); $attributePath = $this->getArrayManager()->findPath($attributeCode, $meta); - if (!$attributePath || !$canDisplayUseDefault) { + if ( + !$attributePath + || !$canDisplayUseDefault + || in_array($attributeCode, $this->elementsWithUseConfigSetting + ) + ) { continue; } @@ -494,15 +499,6 @@ public function getDefaultMetaData($result) $result['use_config.available_sort_by']['default'] = true; $result['use_config.default_sort_by']['default'] = true; $result['use_config.filter_price_range']['default'] = true; - if ($this->request->getParam('store') && $this->request->getParam('id')) { - $result['use_default.url_key']['checked'] = true; - $result['use_default.url_key']['default'] = true; - $result['use_default.url_key']['visible'] = true; - } else { - $result['use_default.url_key']['checked'] = false; - $result['use_default.url_key']['default'] = false; - $result['use_default.url_key']['visible'] = false; - } return $result; } @@ -542,7 +538,6 @@ protected function getFieldsMap() [ 'url_key', 'url_key_create_redirect', - 'use_default.url_key', 'url_key_group', 'meta_title', 'meta_keywords', diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml index 049ead82f31fa..4b99707b85f5c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml @@ -375,19 +375,6 @@ category URL Key 10 - - ${ $.provider }:data.use_default.url_key - - - - - - - - Use Default - boolean - checkbox - 20 From b5d49661ca52db5ec4a1fa26c85dc8452fbf17aa Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Fri, 11 Nov 2016 17:36:01 +0200 Subject: [PATCH 1784/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60826: Wrong Regular price for dynamic bundle --- .../ResourceModel/Selection/Collection.php | 2 +- .../Model/Product/BundlePriceAbstract.php | 6 +- .../DynamicBundlePriceCalculatorTest.php | 128 +++++- ...ndleWithCatalogPriceRuleCalculatorTest.php | 55 --- ...icBundleWithSpecialPriceCalculatorTest.php | 374 +++--------------- .../dynamic_bundle_product.php | 4 +- ...amic_bundle_product_with_special_price.php | 29 ++ ...le_product_with_special_price_rollback.php | 7 + 8 files changed, 214 insertions(+), 391 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price_rollback.php diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index d255dfc462015..e5c370fd5b688 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -197,7 +197,7 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false) if ($product->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC) { $this->addPriceData(); if ($useRegularPrice) { - $minimalPriceExpression = 'minimal_price'; + $minimalPriceExpression = 'price'; } else { $this->getCatalogRuleProcessor()->addPriceData($this, 'selection.product_id'); $minimalPriceExpression = 'LEAST(minimal_price, IFNULL(catalog_rule_price, minimal_price))'; diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php index e69de8d62ef53..a6f5653b276c0 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php @@ -38,7 +38,7 @@ abstract public function getTestCases(); /** * @param array $strategyModifiers * @param string $productSku - * @return \Magento\Catalog\Api\Data\ProductInterface + * @return void * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\StateException @@ -54,12 +54,12 @@ protected function prepareFixture($strategyModifiers, $productSku) $bundleProduct = call_user_func_array([$this, $modifier['modifierName']], $modifier['data']); } else { throw new \Magento\Framework\Exception\InputException( - sprintf('Modifier %s does not exists', $modifier['modifierName']) + __('Modifier %s does not exists', $modifier['modifierName']) ); } } - return $this->productRepository->save($bundleProduct); + $this->productRepository->save($bundleProduct); } /** diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php index 0206bfa38f041..b97fb29b2ba54 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php @@ -77,7 +77,7 @@ public function getTestCases() { return [ '#1 Testing price for dynamic bundle product with one simple' => [ - 'strategy' => $this->getProductWithOneSimple(), + 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // just price from simple1 'minimalPrice' => 10, @@ -87,7 +87,7 @@ public function getTestCases() ], '#2 Testing price for dynamic bundle product with three simples and different qty' => [ - 'strategy' => $this->getProductWithDifferentQty(), + 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // min price from simples 3*10 or 30 'minimalPrice' => 30, @@ -97,14 +97,34 @@ public function getTestCases() ], '#3 Testing price for dynamic bundle product with four simples and different price' => [ - 'strategy' => $this->getProductWithDifferentPrice(), + 'strategy' => $this->getBundleConfiguration3(), 'expectedResults' => [ // 10 'minimalPrice' => 10, // 10 + 20 + 30 'maximalPrice' => 60 ] - ] + ], + + '#4 Testing price for dynamic bundle with two non required options' => [ + 'strategy' => $this->getBundleConfiguration4(), + 'expectedResults' => [ + // 1 * 10 + 'minimalPrice' => 10, + // 3 * 20 + 1 * 10 + 3 * 20 + 'maximalPrice' => 130 + ] + ], + + '#5 Testing price for dynamic bundle with two required options' => [ + 'strategy' => $this->getBundleConfiguration5(), + 'expectedResults' => [ + // 1 * 10 + 1 * 10 + 'minimalPrice' => 20, + // 3 * 20 + 1 * 10 + 3 * 20 + 'maximalPrice' => 130 + ] + ], ]; } @@ -113,7 +133,7 @@ public function getTestCases() * * @return array */ - private function getProductWithOneSimple() + private function getBundleConfiguration1() { $optionsData = [ [ @@ -142,7 +162,7 @@ private function getProductWithOneSimple() * * @return array */ - private function getProductWithDifferentQty() + private function getBundleConfiguration2() { $optionsData = [ [ @@ -179,7 +199,7 @@ private function getProductWithDifferentQty() * * @return array */ - private function getProductWithDifferentPrice() + private function getBundleConfiguration3() { $optionsData = [ [ @@ -210,4 +230,98 @@ private function getProductWithDifferentPrice() ], ]; } + + /** + * Dynamic bundle with two non required options and special price + * @return array + */ + private function getBundleConfiguration4() + { + $optionsData = [ + [ + 'title' => 'Op1', + 'required' => false, + 'type' => 'radio', + 'links' => [ + [ + 'sku' => 'simple1', + 'qty' => 1, + ], + [ + 'sku' => 'simple2', + 'qty' => 3, + ], + ] + ], + [ + 'title' => 'Op2', + 'required' => false, + 'type' => 'checkbox', + 'links' => [ + [ + 'sku' => 'simple1', + 'qty' => 1, + ], + [ + 'sku' => 'simple2', + 'qty' => 3, + ], + ] + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } + + /** + * Dynamic bundle with two required options + * @return array + */ + private function getBundleConfiguration5() + { + $optionsData = [ + [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'radio', + 'links' => [ + [ + 'sku' => 'simple1', + 'qty' => 1, + ], + [ + 'sku' => 'simple2', + 'qty' => 3, + ], + ] + ], + [ + 'title' => 'Op2', + 'required' => true, + 'type' => 'checkbox', + 'links' => [ + [ + 'sku' => 'simple1', + 'qty' => 1, + ], + [ + 'sku' => 'simple2', + 'qty' => 3, + ], + ] + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + ]; + } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php index 80ad5e6a85786..5a85dfa3104bf 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithCatalogPriceRuleCalculatorTest.php @@ -59,17 +59,6 @@ public function getTestCases() ] ], - '#2 Testing price for dynamic bundle with one required option and special price' => [ - 'strategy' => $this->getBundleProductConfiguration2(), - 'expectedResults' => [ - // 0.5 * 10 * 0.9 - 'minimalPrice' => 4.5, - - // 0.5 * 10 * 0.9 - 'maximalPrice' => 4.5 - ] - ], - '#3 Testing price for dynamic bundle with one non required option' => [ 'strategy' => $this->getBundleProductConfiguration3(), 'expectedResults' => [ @@ -177,38 +166,6 @@ private function getBundleProductConfiguration1() ]; } - /** - * Dynamic bundle with one required option and special price - * @return array - */ - private function getBundleProductConfiguration2() - { - $optionsData = [ - [ - 'title' => 'Op1', - 'required' => true, - 'type' => 'checkbox', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - ], - ] - ] - ]; - - return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - ]; - } - /** * Dynamic bundle with one non required option * @return array @@ -473,16 +430,4 @@ private function getBundleProductConfiguration9() ], ]; } - - /** - * @param \Magento\Catalog\Model\Product $bundleProduct - * @param int $discount - * @return \Magento\Catalog\Model\Product - */ - protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) - { - $bundleProduct->setSpecialPrice($discount); - - return $bundleProduct; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php index 10a63007f654a..1001cf39c625d 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php @@ -7,7 +7,7 @@ namespace Magento\Bundle\Model\Product; /** - * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php + * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php * @magentoAppArea frontend */ class DynamicBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract @@ -38,6 +38,24 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(), 'Failed to check maximal price on product' ); + + if (isset($expectedResults['regularMinimalPrice'])) { + $priceCode = \Magento\Catalog\Pricing\Price\RegularPrice::PRICE_CODE; + $this->assertEquals( + $expectedResults['regularMinimalPrice'], + $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue(), + 'Failed to check minimal regular price on product' + ); + } + + if (isset($expectedResults['regularMaximalPrice'])) { + $priceCode = \Magento\Catalog\Pricing\Price\RegularPrice::PRICE_CODE; + $this->assertEquals( + $expectedResults['regularMaximalPrice'], + $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(), + 'Failed to check minimal regular price on product' + ); + } } /** @@ -48,10 +66,7 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec public function getTestCases() { return [ - ' - #1 Testing price for dynamic bundle - with one required option and special price - ' => [ + '#1 Testing price for dynamic bundle with one required option and special price' => [ 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 0.5 * 10 @@ -61,10 +76,7 @@ public function getTestCases() ] ], - ' - #2 Testing price for dynamic bundle - with one non required option and special price - ' => [ + '#2 Testing price for dynamic bundle with one non required option and special price' => [ 'strategy' => $this->getBundleConfiguration2(), 'expectedResults' => [ // 0.5 * 2 * 10 @@ -82,8 +94,8 @@ public function getTestCases() 'expectedResults' => [ // 0.5 * 1 * 10 'minimalPrice' => 5, - // 0.5 * (1 * 10 + 3 * 20) - 'maximalPrice' => 35 + // 0.5 * (1 * 10 + 3 * 30) + 'maximalPrice' => 50 ] ], @@ -93,93 +105,41 @@ public function getTestCases() ' => [ 'strategy' => $this->getBundleConfiguration4(), 'expectedResults' => [ - 'minimalPrice' => 9.99, - 'maximalPrice' => 21.97 + // 0.5 * (min (1 * 9.9, 2.5 * 4)) + 'minimalPrice' => 4.95, + // 0.5 * ( 1 * 9.9 + 2.5 * 4) + 'maximalPrice' => 9.95 ] ], - ' - #5 Testing price for dynamic bundle - with one required radio type option, two simples and special price - ' => [ + '#5 Testing price for dynamic bundle with one required option, one non required and special price' => [ 'strategy' => $this->getBundleConfiguration5(), 'expectedResults' => [ - // 0.5 * 1 * 10 - 'minimalPrice' => 5, - // 0.5 * 3 * 20 - 'maximalPrice' => 30 + // 0.5 * (3 * 2.5) + 'minimalPrice' => 3.75, + // 0.5 * (3 * 13 + 1 * 30 + 1 * 10) + 'maximalPrice' => 39.5, + // 1 * 10 + 'regularMinimalPrice' => '10', + // 3 * 20 + (30 * 1 + 13 * 3) + 'regularMaximalPrice' => '129', ] ], - ' - #6 Testing price for dynamic bundle - with two required options and special price - ' => [ + '#6 Testing price for dynamic bundle with one simple product with special price' => [ 'strategy' => $this->getBundleConfiguration6(), 'expectedResults' => [ - // 0.5 * (1 * 10 + 1 * 10) - 'minimalPrice' => 10, - // 0.5 * (3 * 20 + 1 * 10 + 3 * 20) - 'maximalPrice' => 65 - ] - ], - - ' - #7 Testing price for dynamic bundle - with one required option, one non required and special price - ' => [ - 'strategy' => $this->getBundleConfiguration7(), - 'expectedResults' => [ - // 0.5 * (1 * 10) - 'minimalPrice' => 5, - // 0.5 * (3 * 20 + 1 * 10 + 3 * 20) - 'maximalPrice' => 65 - ] - ], - - ' - #8 Testing price for dynamic bundle - with two non required options and special price - ' => [ - 'strategy' => $this->getBundleConfiguration8(), - 'expectedResults' => [ - // 0.5 * (1 * 10) - 'minimalPrice' => 5, - // 0.5 * (3 * 20 + 1 * 10 + 3 * 20) - 'maximalPrice' => 65 - ] - ], - - ' - #9 Testing price for dynamic bundle - with one simple product with special price - ' => [ - 'strategy' => $this->getBundleConfiguration9(), - 'expectedResults' => [ - // 1 * 3.5 - 'minimalPrice' => 3.5, - // 1 * 20 - 'maximalPrice' => 20 - ] - ], - - ' - #10 Testing price for dynamic bundle - with special price and with one simple product with special price - ' => [ - 'strategy' => $this->getBundleConfiguration10(), - 'expectedResults' => [ - // 0.5 * 1 * 3.5 - 'minimalPrice' => 1.75, - // 0.5 * 3 * 20 - 'maximalPrice' => 30 + // 0.5 * min(4 * 2.5, 1 * 9.9) + 'minimalPrice' => 4.95, + // 0.5 * max(4 * 2.5, 1 * 9.9) + 'maximalPrice' => 5 ] ], ]; } /** - * Dynamic bundle with one required option and special price + * Dynamic bundle with one required option * @return array */ private function getBundleConfiguration1() @@ -199,10 +159,6 @@ private function getBundleConfiguration1() ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -231,10 +187,6 @@ private function getBundleConfiguration2() ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -259,7 +211,7 @@ private function getBundleConfiguration3() 'qty' => 1, ], [ - 'sku' => 'simple2', + 'sku' => 'simple3', 'qty' => 3, ], ] @@ -267,10 +219,6 @@ private function getBundleConfiguration3() ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -291,26 +239,18 @@ private function getBundleConfiguration4() 'type' => 'checkbox', 'links' => [ [ - 'sku' => 'simple1', + 'sku' => 'simple5', 'qty' => 1, ], [ 'sku' => 'simple2', - 'qty' => 2, + 'qty' => 4, ], ] ] ]; return [ - [ - 'modifierName' => 'addSpecialPriceForSimple', - 'data' => ['simple1', 9.99] - ], - [ - 'modifierName' => 'addSpecialPriceForSimple', - 'data' => ['simple2', 5.99] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -319,46 +259,10 @@ private function getBundleConfiguration4() } /** - * Dynamic bundle with one required radio type option, two simples and special price + * Dynamic bundle with one required option, one non required and special price * @return array */ private function getBundleConfiguration5() - { - $optionsData = [ - [ - 'title' => 'Op1', - 'required' => true, - 'type' => 'radio', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - ], - [ - 'sku' => 'simple2', - 'qty' => 3, - ], - ] - ] - ]; - - return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - ]; - } - - /** - * Dynamic bundle with two required options and special price - * @return array - */ - private function getBundleConfiguration6() { $optionsData = [ [ @@ -378,66 +282,15 @@ private function getBundleConfiguration6() ], [ 'title' => 'Op2', - 'required' => true, - 'type' => 'checkbox', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - ], - [ - 'sku' => 'simple2', - 'qty' => 3, - ], - ] - ] - ]; - - return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - ]; - } - - /** - * Dynamic bundle with one required option, one non required and special price - * @return array - */ - private function getBundleConfiguration7() - { - $optionsData = [ - [ - 'title' => 'Op1', 'required' => false, - 'type' => 'radio', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - ], - [ - 'sku' => 'simple2', - 'qty' => 3, - ], - ] - ], - [ - 'title' => 'Op2', - 'required' => true, 'type' => 'checkbox', 'links' => [ [ - 'sku' => 'simple1', + 'sku' => 'simple3', 'qty' => 1, ], [ - 'sku' => 'simple2', + 'sku' => 'simple4', 'qty' => 3, ], ] @@ -445,10 +298,6 @@ private function getBundleConfiguration7() ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -456,62 +305,12 @@ private function getBundleConfiguration7() ]; } - /** - * Dynamic bundle with two non required options and special price - * @return array - */ - private function getBundleConfiguration8() - { - $optionsData = [ - [ - 'title' => 'Op1', - 'required' => false, - 'type' => 'radio', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - ], - [ - 'sku' => 'simple2', - 'qty' => 3, - ], - ] - ], - [ - 'title' => 'Op2', - 'required' => false, - 'type' => 'checkbox', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - ], - [ - 'sku' => 'simple2', - 'qty' => 3, - ], - ] - ] - ]; - - return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - ]; - } /** * Dynamic bundle with one simple product with special price * @return array */ - private function getBundleConfiguration9() + private function getBundleConfiguration6() { $optionsData = [ [ @@ -519,94 +318,23 @@ private function getBundleConfiguration9() 'required' => true, 'type' => 'radio', 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - ], [ 'sku' => 'simple2', - 'qty' => 1, + 'qty' => 4, ], - ] - ] - ]; - - return [ - [ - 'modifierName' => 'addSpecialPriceForSimple', - 'data' => ['simple1', 3.5] - ], - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - ]; - } - - /** - * Dynamic bundle with special price and with one simple product with special price - * @return array - */ - private function getBundleConfiguration10() - { - $optionsData = [ - [ - 'title' => 'Op1', - 'required' => true, - 'type' => 'radio', - 'links' => [ [ - 'sku' => 'simple1', + 'sku' => 'simple5', 'qty' => 1, ], - [ - 'sku' => 'simple2', - 'qty' => 3, - ], ] ] ]; return [ - [ - 'modifierName' => 'addSpecialPriceForSimple', - 'data' => ['simple1', 3.5] - ], - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] ], ]; } - - /** - * @param \Magento\Catalog\Model\Product $bundleProduct - * @param int $discount - * @return \Magento\Catalog\Model\Product - */ - protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) - { - $bundleProduct->setSpecialPrice($discount); - - return $bundleProduct; - } - - /** - * @param \Magento\Catalog\Model\Product $bundleProduct - * @param string $sku - * @param int $price - * @return \Magento\Catalog\Model\Product - */ - protected function addSpecialPriceForSimple(\Magento\Catalog\Model\Product $bundleProduct, $sku, $price) - { - $simple = $this->productRepository->get($sku, false, null, true); - $simple->setSpecialPrice($price); - $this->productRepository->save($simple); - - return $bundleProduct; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php index 9918cb0c743fb..e05a72fe17d43 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php @@ -15,12 +15,12 @@ ->setId(42) ->setAttributeSetId(4) ->setWebsiteIds([1]) - ->setName('Spherical Bundle Product in a Vacuum') + ->setName('Bundle Product') ->setSku('bundle_product') ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) - ->setPriceView(1) + ->setPriceView(0) ->setPriceType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC) ->setShipmentType(0); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php new file mode 100644 index 0000000000000..37f8295e43ca7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php @@ -0,0 +1,29 @@ +create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + +/** @var $product \Magento\Catalog\Model\Product */ +$productRepository + ->get('bundle_product') + ->setSpecialPrice(50) + ->save(); + +$productRepository->save($product); + +$productRepository + ->get('simple2') + ->setSpecialPrice(2.5) + ->save(); + +$productRepository + ->get('simple5') + ->setSpecialPrice(9.9) + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price_rollback.php new file mode 100644 index 0000000000000..50cb07079c24f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price_rollback.php @@ -0,0 +1,7 @@ + Date: Fri, 11 Nov 2016 17:56:06 +0200 Subject: [PATCH 1785/3232] MAGETWO-60613: [GitHub]Catalog Products List widget: Sku chooser grid not displayed when editing an existing condition for the attribute SKU #6985 --- .../Magento/CatalogWidget/Block/Product/Widget/Conditions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php b/app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php index d57db33131b9d..cb597a18b7de7 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php +++ b/app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php @@ -100,6 +100,7 @@ protected function _construct() public function render(AbstractElement $element) { $this->element = $element; + $this->rule->getConditions()->setJsFormObject($this->getHtmlId()); return $this->toHtml(); } From df98e6663cf96c9ca8f998dafe45b135d5e022b7 Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Fri, 11 Nov 2016 18:02:26 +0200 Subject: [PATCH 1786/3232] MAGETWO-60067: Advanced Pricing is very slow to import --- .../Model/Import/AdvancedPricing.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php index d751fdc75882d..53c4605a81913 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php +++ b/app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php @@ -542,19 +542,24 @@ protected function retrieveOldSkus() */ protected function processCountExistingPrices($prices, $table) { + $oldSkus = $this->retrieveOldSkus(); + $existProductIds = array_intersect_key($oldSkus, $prices); + if (!count($existProductIds)) { + return $this; + } + $tableName = $this->_resourceFactory->create()->getTable($table); $productEntityLinkField = $this->getProductEntityLinkField(); $existingPrices = $this->_connection->fetchAssoc( $this->_connection->select()->from( $tableName, ['value_id', $productEntityLinkField, 'all_groups', 'customer_group_id'] - ) + )->where($productEntityLinkField . ' IN (?)', $existProductIds) ); - $oldSkus = $this->retrieveOldSkus(); foreach ($existingPrices as $existingPrice) { - foreach ($oldSkus as $sku => $productId) { - if ($existingPrice[$productEntityLinkField] == $productId && isset($prices[$sku])) { - $this->incrementCounterUpdated($prices[$sku], $existingPrice); + foreach ($prices as $sku => $skuPrices) { + if (isset($oldSkus[$sku]) && $existingPrice[$productEntityLinkField] == $oldSkus[$sku]) { + $this->incrementCounterUpdated($skuPrices, $existingPrice); } } } From 9a4db6ba04359b7b603bad571fae65ffc2d3724e Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Fri, 11 Nov 2016 18:05:54 +0200 Subject: [PATCH 1787/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - MAGETWO-60826: Wrong Regular price for dynamic bundle --- ...icBundleWithSpecialPriceCalculatorTest.php | 2 +- .../FixedBundlePriceCalculatorTest.php | 117 ++++++- ...edBundleWithSpecialPriceCalculatorTest.php | 288 ++++-------------- ...amic_bundle_product_with_special_price.php | 2 - .../PriceCalculator/fixed_bundle_product.php | 4 +- ...ixed_bundle_product_with_special_price.php | 17 ++ ...le_product_with_special_price_rollback.php | 7 + 7 files changed, 200 insertions(+), 237 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php index 1001cf39c625d..63efce3945589 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php @@ -53,7 +53,7 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec $this->assertEquals( $expectedResults['regularMaximalPrice'], $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(), - 'Failed to check minimal regular price on product' + 'Failed to check maximal regular price on product' ); } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php index 28e4886fb16ef..31ceea07ee22d 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -116,7 +116,75 @@ public function getTestCases() // 110 + 30 'maximalPrice' => 140 ] - ] + ], + + ' + #5 Testing price for fixed bundle product + with fixed sub items, fixed options and without any discounts + ' => [ + 'strategy' => $this->getBundleConfiguration3( + LinkInterface::PRICE_TYPE_FIXED, + self::CUSTOM_OPTION_PRICE_TYPE_FIXED + ), + 'expectedResults' => [ + // 110 + 1 * 20 + 100 + 'minimalPrice' => 230, + + // 110 + 1 * 20 + 100 + 'maximalPrice' => 230 + ] + ], + + ' + #6 Testing price for fixed bundle product + with percent sub items, percent options and without any discounts + ' => [ + 'strategy' => $this->getBundleConfiguration3( + LinkInterface::PRICE_TYPE_PERCENT, + self::CUSTOM_OPTION_PRICE_TYPE_PERCENT + ), + 'expectedResults' => [ + // 110 + 110 * 0.2 + 110 * 1 + 'minimalPrice' => 242, + + // 110 + 110 * 0.2 + 110 * 1 + 'maximalPrice' => 242 + ] + ], + + ' + #7 Testing price for fixed bundle product + with fixed sub items, percent options and without any discounts + ' => [ + 'strategy' => $this->getBundleConfiguration3( + LinkInterface::PRICE_TYPE_FIXED, + self::CUSTOM_OPTION_PRICE_TYPE_PERCENT + ), + 'expectedResults' => [ + // 110 + 1 * 20 + 110 * 1 + 'minimalPrice' => 240, + + // 110 + 1 * 20 + 110 * 1 + 'maximalPrice' => 240 + ] + ], + + ' + #8 Testing price for fixed bundle product + with percent sub items, fixed options and without any discounts + ' => [ + 'strategy' => $this->getBundleConfiguration3( + LinkInterface::PRICE_TYPE_PERCENT, + self::CUSTOM_OPTION_PRICE_TYPE_FIXED + ), + 'expectedResults' => [ + // 110 + 110 * 0.2 + 100 + 'minimalPrice' => 232, + + // 110 + 110 * 0.2 + 100 + 'maximalPrice' => 232 + ] + ], ]; } @@ -275,4 +343,51 @@ private function getProductWithDifferentPrice() ], ]; } + + /** + * Fixed bundle product with required option, custom option and without any discounts + * @param $selectionsPriceType + * @param $customOptionsPriceType + * @return array + */ + private function getBundleConfiguration3($selectionsPriceType, $customOptionsPriceType) + { + $optionsData = [ + [ + 'title' => 'Op1', + 'required' => true, + 'type' => 'checkbox', + 'links' => [ + [ + 'sku' => 'simple1', + 'qty' => 1, + 'price' => 20, + 'price_type' => $selectionsPriceType + ], + ] + ], + ]; + + $customOptionsData = [ + [ + 'price_type' => $customOptionsPriceType, + 'title' => 'Test Field', + 'type' => 'field', + 'is_require' => 1, + 'price' => 100, + 'sku' => '1-text', + ] + ]; + + return [ + [ + 'modifierName' => 'addSimpleProduct', + 'data' => [$optionsData] + ], + [ + 'modifierName' => 'addCustomOption', + 'data' => [$customOptionsData] + ], + ]; + } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php index 55fe57d082639..183e5cc330438 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php @@ -9,7 +9,7 @@ use \Magento\Bundle\Api\Data\LinkInterface; /** - * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php + * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php * @magentoAppArea frontend */ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract @@ -52,23 +52,9 @@ public function getTestCases() return [ ' #1 Testing price for fixed bundle product - without any discounts, sub items and options - ' => [ - 'strategy' => $this->getBundleConfiguration1(), - 'expectedResults' => [ - // just product price - 'minimalPrice' => 110, - - // just product price - 'maximalPrice' => 110 - ] - ], - - ' - #2 Testing price for fixed bundle product with special price and without any sub items and options ' => [ - 'strategy' => $this->getBundleConfiguration2(), + 'strategy' => $this->getBundleConfiguration1(), 'expectedResults' => [ // 110 * 0.5 'minimalPrice' => 55, @@ -79,78 +65,10 @@ public function getTestCases() ], ' - #3 Testing price for fixed bundle product - with fixed sub items, fixed options and without any discounts - ' => [ - 'strategy' => $this->getBundleConfiguration3( - LinkInterface::PRICE_TYPE_FIXED, - self::CUSTOM_OPTION_PRICE_TYPE_FIXED - ), - 'expectedResults' => [ - // 110 + 1 * 20 + 100 - 'minimalPrice' => 230, - - // 110 + 1 * 20 + 100 - 'maximalPrice' => 230 - ] - ], - - ' - #4 Testing price for fixed bundle product - with percent sub items, percent options and without any discounts - ' => [ - 'strategy' => $this->getBundleConfiguration3( - LinkInterface::PRICE_TYPE_PERCENT, - self::CUSTOM_OPTION_PRICE_TYPE_PERCENT - ), - 'expectedResults' => [ - // 110 + 110 * 0.2 + 110 * 1 - 'minimalPrice' => 242, - - // 110 + 110 * 0.2 + 110 * 1 - 'maximalPrice' => 242 - ] - ], - - ' - #5 Testing price for fixed bundle product - with fixed sub items, percent options and without any discounts - ' => [ - 'strategy' => $this->getBundleConfiguration3( - LinkInterface::PRICE_TYPE_FIXED, - self::CUSTOM_OPTION_PRICE_TYPE_PERCENT - ), - 'expectedResults' => [ - // 110 + 1 * 20 + 110 * 1 - 'minimalPrice' => 240, - - // 110 + 1 * 20 + 110 * 1 - 'maximalPrice' => 240 - ] - ], - - ' - #6 Testing price for fixed bundle product - with percent sub items, fixed options and without any discounts - ' => [ - 'strategy' => $this->getBundleConfiguration3( - LinkInterface::PRICE_TYPE_PERCENT, - self::CUSTOM_OPTION_PRICE_TYPE_FIXED - ), - 'expectedResults' => [ - // 110 + 110 * 0.2 + 100 - 'minimalPrice' => 232, - - // 110 + 110 * 0.2 + 100 - 'maximalPrice' => 232 - ] - ], - - ' - #7 Testing price for fixed bundle product + #2 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration4( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -164,10 +82,10 @@ public function getTestCases() ], ' - #8 Testing price for fixed bundle product + #3 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration4( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -181,10 +99,10 @@ public function getTestCases() ], ' - #9 Testing price for fixed bundle product + #4 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration4( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -198,10 +116,10 @@ public function getTestCases() ], ' - #10 Testing price for fixed bundle product + #5 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration4( + 'strategy' => $this->getBundleConfiguration2( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -215,10 +133,10 @@ public function getTestCases() ], ' - #11 Testing price for fixed bundle product + #6 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration5( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -232,10 +150,10 @@ public function getTestCases() ], ' - #12 Testing price for fixed bundle product + #7 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration5( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -249,10 +167,10 @@ public function getTestCases() ], ' - #13 Testing price for fixed bundle product + #8 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration5( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -266,10 +184,10 @@ public function getTestCases() ], ' - #14 Testing price for fixed bundle product + #9 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration5( + 'strategy' => $this->getBundleConfiguration3( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -283,10 +201,10 @@ public function getTestCases() ], ' - #15 Testing price for fixed bundle product + #10 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration6( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -300,10 +218,10 @@ public function getTestCases() ], ' - #16 Testing price for fixed bundle product + #11 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration6( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -317,10 +235,10 @@ public function getTestCases() ], ' - #17 Testing price for fixed bundle product + #12 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration6( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -334,10 +252,10 @@ public function getTestCases() ], ' - #18 Testing price for fixed bundle product + #13 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration6( + 'strategy' => $this->getBundleConfiguration4( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -351,10 +269,10 @@ public function getTestCases() ], ' - #19 Testing price for fixed bundle product + #14 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration7( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -368,10 +286,10 @@ public function getTestCases() ], ' - #20 Testing price for fixed bundle product + #15 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration7( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -385,10 +303,10 @@ public function getTestCases() ], ' - #21 Testing price for fixed bundle product + #16 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration7( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -402,10 +320,10 @@ public function getTestCases() ], ' - #22 Testing price for fixed bundle product + #17 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration7( + 'strategy' => $this->getBundleConfiguration5( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -419,10 +337,10 @@ public function getTestCases() ], ' - #23 Testing price for fixed bundle product + #18 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration8( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -436,10 +354,10 @@ public function getTestCases() ], ' - #24 Testing price for fixed bundle product + #19 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration8( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -453,10 +371,10 @@ public function getTestCases() ], ' - #25 Testing price for fixed bundle product + #20 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration8( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -470,10 +388,10 @@ public function getTestCases() ], ' - #26 Testing price for fixed bundle product + #21 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration8( + 'strategy' => $this->getBundleConfiguration6( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -487,10 +405,10 @@ public function getTestCases() ], ' - #27 Testing price for fixed bundle product + #22 Testing price for fixed bundle product with special price, fixed sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration9( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -504,10 +422,10 @@ public function getTestCases() ], ' - #28 Testing price for fixed bundle product + #23 Testing price for fixed bundle product with special price, percent sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration9( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -521,10 +439,10 @@ public function getTestCases() ], ' - #29 Testing price for fixed bundle product + #24 Testing price for fixed bundle product with special price, fixed sub items and percent options ' => [ - 'strategy' => $this->getBundleConfiguration9( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_FIXED, self::CUSTOM_OPTION_PRICE_TYPE_PERCENT ), @@ -538,10 +456,10 @@ public function getTestCases() ], ' - #30 Testing price for fixed bundle product + #25 Testing price for fixed bundle product with special price, percent sub items and fixed options ' => [ - 'strategy' => $this->getBundleConfiguration9( + 'strategy' => $this->getBundleConfiguration7( LinkInterface::PRICE_TYPE_PERCENT, self::CUSTOM_OPTION_PRICE_TYPE_FIXED ), @@ -557,7 +475,7 @@ public function getTestCases() } /** - * Fixed bundle product without any discounts, sub items and options + * Fixed bundle product with special price and without any sub items and options * @return array */ private function getBundleConfiguration1() @@ -565,74 +483,13 @@ private function getBundleConfiguration1() return []; } - /** - * Fixed bundle product with special price and without any sub items and options - * @return array - */ - private function getBundleConfiguration2() - { - return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], - ]; - } - - /** - * Fixed bundle product with required option, custom option and without any discounts - * @param $selectionsPriceType - * @param $customOptionsPriceType - * @return array - */ - private function getBundleConfiguration3($selectionsPriceType, $customOptionsPriceType) - { - $optionsData = [ - [ - 'title' => 'Op1', - 'required' => true, - 'type' => 'checkbox', - 'links' => [ - [ - 'sku' => 'simple1', - 'qty' => 1, - 'price' => 20, - 'price_type' => $selectionsPriceType - ], - ] - ], - ]; - - $customOptionsData = [ - [ - 'price_type' => $customOptionsPriceType, - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'price' => 100, - 'sku' => '1-text', - ] - ]; - - return [ - [ - 'modifierName' => 'addSimpleProduct', - 'data' => [$optionsData] - ], - [ - 'modifierName' => 'addCustomOption', - 'data' => [$customOptionsData] - ], - ]; - } - /** * Fixed bundle product with required option, custom option and with special price * @param $selectionsPriceType * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration4( + private function getBundleConfiguration2( $selectionsPriceType, $customOptionsPriceType ) { @@ -664,10 +521,6 @@ private function getBundleConfiguration4( ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -685,7 +538,7 @@ private function getBundleConfiguration4( * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration5( + private function getBundleConfiguration3( $selectionsPriceType, $customOptionsPriceType ) { @@ -717,10 +570,6 @@ private function getBundleConfiguration5( ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -738,7 +587,7 @@ private function getBundleConfiguration5( * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration6( + private function getBundleConfiguration4( $selectionsPriceType, $customOptionsPriceType ) { @@ -776,10 +625,6 @@ private function getBundleConfiguration6( ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -797,7 +642,7 @@ private function getBundleConfiguration6( * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration7( + private function getBundleConfiguration5( $selectionsPriceType, $customOptionsPriceType ) { @@ -835,10 +680,6 @@ private function getBundleConfiguration7( ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -856,7 +697,7 @@ private function getBundleConfiguration7( * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration8( + private function getBundleConfiguration6( $selectionsPriceType, $customOptionsPriceType ) { @@ -894,10 +735,6 @@ private function getBundleConfiguration8( ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -915,7 +752,7 @@ private function getBundleConfiguration8( * @param $customOptionsPriceType * @return array */ - private function getBundleConfiguration9( + private function getBundleConfiguration7( $selectionsPriceType, $customOptionsPriceType ) { @@ -972,10 +809,6 @@ private function getBundleConfiguration9( ]; return [ - [ - 'modifierName' => 'addSpecialPrice', - 'data' => [50] - ], [ 'modifierName' => 'addSimpleProduct', 'data' => [$optionsData] @@ -986,11 +819,4 @@ private function getBundleConfiguration9( ], ]; } - - protected function addSpecialPrice(\Magento\Catalog\Model\Product $bundleProduct, $discount) - { - $bundleProduct->setSpecialPrice($discount); - - return $bundleProduct; - } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php index 37f8295e43ca7..4b29c72e16217 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php @@ -16,8 +16,6 @@ ->setSpecialPrice(50) ->save(); -$productRepository->save($product); - $productRepository ->get('simple2') ->setSpecialPrice(2.5) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php index a8f3974f6584e..68dcbbe1c0cf6 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php @@ -15,12 +15,12 @@ ->setId(42) ->setAttributeSetId(4) ->setWebsiteIds([1]) - ->setName('Spherical Bundle Product in a Vacuum') + ->setName('Bundle Product') ->setSku('bundle_product') ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) - ->setPriceView(1) + ->setPriceView(0) ->setPriceType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED) ->setPrice(110.0) ->setShipmentType(0); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php new file mode 100644 index 0000000000000..3d3e92f7ac625 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php @@ -0,0 +1,17 @@ +create(\Magento\Catalog\Api\ProductRepositoryInterface::class); + +/** @var $product \Magento\Catalog\Model\Product */ +$productRepository + ->get('bundle_product') + ->setSpecialPrice(50) + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price_rollback.php new file mode 100644 index 0000000000000..8a0059e120851 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price_rollback.php @@ -0,0 +1,7 @@ + Date: Fri, 28 Oct 2016 14:57:41 +0300 Subject: [PATCH 1788/3232] MTA-3790: Add variation with PayPal Payflow Pro method to One Page Checkout test --- .../Test/TestCase/OnePageCheckoutTest.xml | 4 - .../Test/TestCase/OnePageCheckoutTest.xml | 4 + .../Test/Block/Onepage/Payment/Method.php | 20 ----- .../Test/TestCase/OnePageCheckoutTest.xml | 32 ++++++++ .../Block/Onepage/Payment/Method/Vault.php | 67 ++++++++++++++++ .../Magento/Vault/Test/Block/VaultPayment.php | 31 -------- .../AssertSaveCreditCardOptionNotPresent.php | 40 ++++++++++ .../Vault/Test/Page/CheckoutOnepage.xml | 2 +- .../CheckSaveCreditCardOptionStep.php | 77 +++++++++++++++++++ .../Test/TestStep/SaveCreditCardStep.php | 2 +- .../app/Magento/Vault/Test/etc/testcase.xml | 3 + 11 files changed, 225 insertions(+), 57 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml create mode 100644 dev/tests/functional/tests/app/Magento/Vault/Test/Block/Onepage/Payment/Method/Vault.php delete mode 100644 dev/tests/functional/tests/app/Magento/Vault/Test/Block/VaultPayment.php create mode 100644 dev/tests/functional/tests/app/Magento/Vault/Test/Constraint/AssertSaveCreditCardOptionNotPresent.php create mode 100644 dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/CheckSaveCreditCardOptionStep.php diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml index d4cf5dab742aa..d629bcba9e174 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml @@ -22,10 +22,6 @@ visa_authorizenet authorizenet Processing - - No - Authorization - test_type:3rd_party_test, severity:S0 diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml index 1e9c539c8c0d3..920047e7037e1 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml @@ -23,6 +23,7 @@ braintree credit_card_braintree visa_braintree_3dsecure + false braintree, braintree_3d_secure_not_triggered_due_threshold Processing test_type:3rd_party_test, severity:S1 @@ -46,6 +47,7 @@ braintree credit_card_braintree visa_braintree_3dsecure + false braintree, braintree_3d_secure_uk Processing test_type:3rd_party_test, severity:S1 @@ -69,6 +71,7 @@ braintree credit_card_braintree visa_braintree + false braintree Processing test_type:extended_acceptance_test, test_type:3rd_party_test, severity:S0 @@ -96,6 +99,7 @@ braintree credit_card_braintree visa_braintree + false braintree, braintree_sale Processing test_type:3rd_party_test, severity:S0 diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method.php index 55351dbe5fd5e..64afdf5486068 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method.php @@ -35,13 +35,6 @@ class Method extends Block */ protected $billingAddressSelector = '.payment-method-billing-address'; - /** - * Save credit card check box. - * - * @var string - */ - protected $vaultCheckbox = '#%s_enable_vault'; - /** * PayPal load spinner. * @@ -137,17 +130,4 @@ public function getBillingBlock() ['element' => $element] ); } - - /** - * Save credit card. - * - * @param string $paymentMethod - * @param string $creditCardSave - * @return void - */ - public function saveCreditCard($paymentMethod, $creditCardSave) - { - $saveCard = sprintf($this->vaultCheckbox, $paymentMethod); - $this->_rootElement->find($saveCard, Locator::SELECTOR_CSS, 'checkbox')->setValue($creditCardSave); - } } diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml new file mode 100644 index 0000000000000..dfb1f96f1f15b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml @@ -0,0 +1,32 @@ + + + + + + catalogProductSimple::product_10_dollar + default + US_address_1 + us_ca_ny_rule + guest + Flat Rate + Fixed + payflowpro + + 15.83 + + credit_card + visa_default + false + payflowpro + test_type:3rd_party_test, severity:S0 + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/Block/Onepage/Payment/Method/Vault.php b/dev/tests/functional/tests/app/Magento/Vault/Test/Block/Onepage/Payment/Method/Vault.php new file mode 100644 index 0000000000000..75257b37a83c0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/Block/Onepage/Payment/Method/Vault.php @@ -0,0 +1,67 @@ +vaultCheckbox, $paymentMethod); + $this->_rootElement->find($saveCard, 'checkbox')->setValue($creditCardSave); + } + + /** + * Check if Save credit card check box is visible. + * + * @param string $paymentMethod + * @return bool + */ + public function isVaultVisible($paymentMethod) + { + $saveCard = sprintf($this->vaultCheckbox, $paymentMethod); + return $this->_rootElement->find($saveCard, 'checkbox')->isVisible(); + } + + /** + * Verify if saved credit card is present as a payment option. + * + * @param string $creditCard + * @return bool + */ + public function isSavedCreditCardPresent($creditCard) + { + $paymentLabelSelector = sprintf($this->creditCardSelector, $creditCard); + return $this->_rootElement->find($paymentLabelSelector, Locator::SELECTOR_XPATH)->isVisible(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/Block/VaultPayment.php b/dev/tests/functional/tests/app/Magento/Vault/Test/Block/VaultPayment.php deleted file mode 100644 index 2afa11baee329..0000000000000 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/Block/VaultPayment.php +++ /dev/null @@ -1,31 +0,0 @@ -creditCardSelector, $creditCard); - return $this->browser->find($paymentLabelSelector, Locator::SELECTOR_XPATH)->isVisible(); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/Constraint/AssertSaveCreditCardOptionNotPresent.php b/dev/tests/functional/tests/app/Magento/Vault/Test/Constraint/AssertSaveCreditCardOptionNotPresent.php new file mode 100644 index 0000000000000..dbe14c977c2d4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/Constraint/AssertSaveCreditCardOptionNotPresent.php @@ -0,0 +1,40 @@ +getVaultPaymentBlock()->isVaultVisible($payment), + 'Save for later use checkbox is present.' + ); + } + + /** + * Returns string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return 'Save for later use checkbox is not present in credit card form.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/Page/CheckoutOnepage.xml b/dev/tests/functional/tests/app/Magento/Vault/Test/Page/CheckoutOnepage.xml index 9568a88096186..fd1412e15649f 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/Page/CheckoutOnepage.xml +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/Page/CheckoutOnepage.xml @@ -7,6 +7,6 @@ --> - + diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/CheckSaveCreditCardOptionStep.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/CheckSaveCreditCardOptionStep.php new file mode 100644 index 0000000000000..168f7da10a58e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/CheckSaveCreditCardOptionStep.php @@ -0,0 +1,77 @@ +checkoutOnepage = $checkoutOnepage; + $this->assertSaveCreditCardOptionNotPresent = $assertSaveCreditCardOptionNotPresent; + $this->payment = $payment; + $this->isVaultEnabled = $isVaultEnabled; + } + + /** + * Run step that verifies if 'Save for later use' checkbox is not present in credit card form. + * + * @return void + */ + public function run() + { + if ($this->isVaultEnabled === false) { + $this->assertSaveCreditCardOptionNotPresent->processAssert( + $this->checkoutOnepage, + $this->payment['method'] + ); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/SaveCreditCardStep.php b/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/SaveCreditCardStep.php index 0f06f5f636bdc..63fe8c2401336 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/SaveCreditCardStep.php +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/TestStep/SaveCreditCardStep.php @@ -57,7 +57,7 @@ public function __construct( */ public function run() { - $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->saveCreditCard( + $this->checkoutOnepage->getVaultPaymentBlock()->saveCreditCard( $this->payment['method'], $this->creditCardSave ); diff --git a/dev/tests/functional/tests/app/Magento/Vault/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Vault/Test/etc/testcase.xml index cd34b96648208..6289a8392ee75 100644 --- a/dev/tests/functional/tests/app/Magento/Vault/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Vault/Test/etc/testcase.xml @@ -64,4 +64,7 @@ + + + From 846c193c2f1334d98654d20e483a0eef8e9173f0 Mon Sep 17 00:00:00 2001 From: Vadim Zubovich Date: Sun, 13 Nov 2016 17:15:20 +0300 Subject: [PATCH 1789/3232] MTO-95: PRs stabilization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Product form filling issue fixed - Wrong parsing sort options issue fixed - The creation new category  implemented (MAGETWO-58108) - Issue tag added (MAGETWO-60635) - "to_maintain:yes" tag removed (MAGETWO-60635) - Added suppress warning annotation to skip static test fail related with a coupling between objects --- .../Block/Adminhtml/Product/ProductForm.php | 34 ++++++++++++++++--- .../Block/Product/ProductList/TopToolbar.php | 5 ++- .../Category/CreateCategoryEntityTest.xml | 7 ++-- 3 files changed, 35 insertions(+), 11 deletions(-) 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 b6e95f5393e14..08d38f45c4ff9 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 @@ -14,9 +14,12 @@ use Magento\Mtf\Client\Locator; use Magento\Mtf\Fixture\FixtureInterface; use Magento\Ui\Test\Block\Adminhtml\DataGrid; +use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\ProductDetails\NewCategoryIds; /** * Product form on backend product page. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ProductForm extends FormSections { @@ -48,6 +51,13 @@ class ProductForm extends FormSections */ protected $attributeBlock = '[data-index="%s"]'; + /** + * NewCategoryIds block selector. + * + * @var string + */ + protected $newCategoryModalForm = '.product_form_product_form_create_category_modal'; + /** * Magento form loader. * @@ -70,8 +80,6 @@ class ProductForm extends FormSections * @param FixtureInterface|null $category * @return $this * @throws \Exception - * - * @SuppressWarnings(PHPMD.NPathComplexity) */ public function fill(FixtureInterface $product, SimpleElement $element = null, FixtureInterface $category = null) { @@ -88,9 +96,14 @@ public function fill(FixtureInterface $product, SimpleElement $element = null, F $this->callRender($typeId, 'fill', $renderArguments); } else { $sections = $this->getFixtureFieldsByContainers($product); - + $category = $product->hasData('category_ids') + ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $category; if ($category) { - $sections['product-details']['category_ids']['value'] = $category->getName(); + if ((int)$category->getId()) { + $sections['product-details']['category_ids']['value'] = $category->getName(); + } else { + $this->getNewCategoryModalForm()->addNewCategory($category); + } } $this->fillContainers($sections, $element); } @@ -193,6 +206,19 @@ public function getAttributeForm() ); } + /** + * Get New Category Modal Form. + * + * @return NewCategoryIds + */ + public function getNewCategoryModalForm() + { + return $this->blockFactory->create( + \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\ProductDetails\NewCategoryIds::class, + ['element' => $this->browser->find($this->newCategoryModalForm)] + ); + } + /** * Get attribute element. * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/TopToolbar.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/TopToolbar.php index 3d5e550560e85..f7529f1fcb61e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/TopToolbar.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/TopToolbar.php @@ -36,12 +36,11 @@ public function getSelectSortType() /** * Get all available method of sorting product * - * @return array|string + * @return array */ public function getSortType() { $content = $this->_rootElement->find($this->sorter)->getText(); - preg_match_all('/\w+\s?\w+/', $content, $matches); - return $matches[0]; + return explode("\n", $content); } } 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 665a7ecf3831a..238fddba3de42 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 @@ -16,7 +16,7 @@ - to_maintain:yes + MAGETWO-60635: [CE][Categories] Design update dates are incorrect after save Create root category with all fields addRootCategory Yes @@ -57,7 +57,7 @@ - to_maintain:yes + MAGETWO-60635: [CE][Categories] Design update dates are incorrect after save Create not anchor subcategory specifying all fields addSubcategory default_category @@ -94,7 +94,6 @@ - to_maintain:yes Create anchor subcategory with all fields addSubcategory default_category @@ -155,7 +154,7 @@ - test_type:extended_acceptance_test, to_maintain:yes + test_type:extended_acceptance_test Create category with three nesting addSubcategory two_nested_categories From 3733ba83716da18c6b10e174493f98aeb018f381 Mon Sep 17 00:00:00 2001 From: Vitali Kirychenka Date: Mon, 14 Nov 2016 11:24:58 +0300 Subject: [PATCH 1790/3232] MTO-55: [Test] Email validation for Guest on checkout flow - Test implemented --- .../Checkout/Test/Block/Onepage/Shipping.php | 61 +++++++++++++++++- .../AssertEmailErrorValidationMessage.php | 49 +++++++++++++++ .../Test/Constraint/AssertEmailToolTips.php | 62 +++++++++++++++++++ .../TestCase/ValidateEmailOnCheckoutTest.php | 62 +++++++++++++++++++ .../TestCase/ValidateEmailOnCheckoutTest.xml | 27 ++++++++ 5 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailErrorValidationMessage.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailToolTips.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.xml diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php index b5a161257c7b7..a20c44a229e5a 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php @@ -16,7 +16,7 @@ class Shipping extends Form { /** - * CSS Selector for "New Address" button + * CSS Selector for "New Address" button. * * @var string */ @@ -69,6 +69,65 @@ class Shipping extends Form */ private $selectedShippingAddressBlock = '.selected-item'; + /** + * Email instructions selector. + * + * @var string + */ + private $emailInstructions = '#customer-email-fieldset .note span'; + + /** + * Email tooltip button selector. + * + * @var string + */ + private $emailTooltipButton = '#customer-email-fieldset .field-tooltip-action'; + + /** + * Email tooltip content selector. + * + * @var string + */ + private $emailTooltipContent = '#customer-email-fieldset .field-tooltip-content'; + + /** + * Email error selector. + * + * @var string + */ + private $emailError = '#customer-email-error'; + + /** + * Get email error. + * + * @return string + */ + public function getEmailError() + { + return $this->_rootElement->find($this->emailError)->getText(); + } + + /** + * Get email tooltip. + * + * @return string + */ + public function getEmailTooltip() + { + $this->_rootElement->find($this->emailTooltipButton)->click(); + return $this->_rootElement->find($this->emailTooltipContent)->getText(); + } + + /** + * Get email instructions. + * + * @return string + */ + public function getEmailInstructions() + { + return $this->_rootElement->find($this->emailInstructions)->getText(); + } + /** * Click on "New Address" button. * diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailErrorValidationMessage.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailErrorValidationMessage.php new file mode 100644 index 0000000000000..b6085ac3faf56 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailErrorValidationMessage.php @@ -0,0 +1,49 @@ +emailValidationMessage, + $checkoutOnepage->getShippingBlock()->getEmailError(), + 'Email validation message is not correct.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Email validation message is correct.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailToolTips.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailToolTips.php new file mode 100644 index 0000000000000..8e645ead73690 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailToolTips.php @@ -0,0 +1,62 @@ +emailTooltip, + $checkoutOnepage->getShippingBlock()->getEmailTooltip(), + 'Email tooltip is not correct.' + ); + + \PHPUnit_Framework_Assert::assertEquals( + $this->emailInstructions, + $checkoutOnepage->getShippingBlock()->getEmailInstructions(), + 'Email instructions are not correct.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Email field tooltips are present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.php new file mode 100644 index 0000000000000..49cc4ad6d3ef4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.php @@ -0,0 +1,62 @@ +persist(); + + $cartPage->open(); + $cartPage->getCartBlock()->clearShoppingCart(); + + //Step + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $productView = $catalogProductView->getViewBlock(); + $productView->fillOptions($product); + $productView->setQty($product->getCheckoutData()['qty']); + $productView->clickAddToCart(); + $catalogProductView->getMessagesBlock()->waitSuccessMessage(); + + $checkoutOnepage->open(); + $checkoutOnepage->getShippingBlock()->fill($customer); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.xml new file mode 100644 index 0000000000000..2e32affe4fbca --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.xml @@ -0,0 +1,27 @@ + + + + + + johndoe + John + + + + + johndoe#example.com + John + + + + johndoe@example.c + John + + + + From 2d193d8a5bfc4801b4af57a1a1730445e733fe47 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Mon, 14 Nov 2016 10:57:21 +0200 Subject: [PATCH 1791/3232] MAGETWO-60165: Inability to Run the DI Compiler before setup --- .../Developer/Model/Logger/Handler/Debug.php | 21 +++++++-- .../Unit/Model/Logger/Handler/DebugTest.php | 44 +++++++++++++++++-- 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Developer/Model/Logger/Handler/Debug.php b/app/code/Magento/Developer/Model/Logger/Handler/Debug.php index e05f008f70aa8..e1997ed400b82 100644 --- a/app/code/Magento/Developer/Model/Logger/Handler/Debug.php +++ b/app/code/Magento/Developer/Model/Logger/Handler/Debug.php @@ -9,6 +9,7 @@ use Magento\Framework\App\State; use Magento\Framework\Filesystem\DriverInterface; use Magento\Store\Model\ScopeInterface; +use Magento\Framework\App\DeploymentConfig; /** * Class Debug @@ -25,22 +26,30 @@ class Debug extends \Magento\Framework\Logger\Handler\Debug */ private $scopeConfig; + /** + * @var DeploymentConfig + */ + private $deploymentConfig; + /** * @param DriverInterface $filesystem * @param State $state * @param ScopeConfigInterface $scopeConfig + * @param DeploymentConfig $deploymentConfig * @param string $filePath */ public function __construct( DriverInterface $filesystem, State $state, ScopeConfigInterface $scopeConfig, + DeploymentConfig $deploymentConfig, $filePath = null ) { parent::__construct($filesystem, $filePath); $this->state = $state; $this->scopeConfig = $scopeConfig; + $this->deploymentConfig = $deploymentConfig; } /** @@ -48,9 +57,13 @@ public function __construct( */ public function isHandling(array $record) { - return - parent::isHandling($record) - && $this->state->getMode() !== State::MODE_PRODUCTION - && $this->scopeConfig->getValue('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE); + if ($this->deploymentConfig->isAvailable()) { + return + parent::isHandling($record) + && $this->state->getMode() !== State::MODE_PRODUCTION + && $this->scopeConfig->getValue('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE); + } + + return parent::isHandling($record); } } \ No newline at end of file diff --git a/app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/DebugTest.php b/app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/DebugTest.php index 7eae4020e6768..5640f33cf13eb 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/DebugTest.php +++ b/app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/DebugTest.php @@ -13,6 +13,7 @@ use Magento\Store\Model\ScopeInterface; use Monolog\Formatter\FormatterInterface; use Monolog\Logger; +use Magento\Framework\App\DeploymentConfig; /** * Class DebugTest @@ -44,6 +45,11 @@ class DebugTest extends \PHPUnit_Framework_TestCase */ private $formatterMock; + /** + * @var DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject + */ + private $deploymentConfigMock; + protected function setUp() { $this->filesystemMock = $this->getMockBuilder(DriverInterface::class) @@ -55,6 +61,10 @@ protected function setUp() ->getMockForAbstractClass(); $this->formatterMock = $this->getMockBuilder(FormatterInterface::class) ->getMockForAbstractClass(); + $this->deploymentConfigMock = $this->getMockBuilder(DeploymentConfig::class) + ->disableOriginalConstructor() + ->disableOriginalClone() + ->getMock(); $this->formatterMock->expects($this->any()) ->method('format') @@ -64,12 +74,16 @@ protected function setUp() 'filesystem' => $this->filesystemMock, 'state' => $this->stateMock, 'scopeConfig' => $this->scopeConfigMock, + 'deploymentConfig' => $this->deploymentConfigMock ]); $this->model->setFormatter($this->formatterMock); } public function testHandle() { + $this->deploymentConfigMock->expects($this->once()) + ->method('isAvailable') + ->willReturn(true); $this->stateMock->expects($this->once()) ->method('getMode') ->willReturn(State::MODE_DEVELOPER); @@ -78,22 +92,28 @@ public function testHandle() ->with('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE, null) ->willReturn(true); - $this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]); + $this->assertTrue($this->model->isHandling(['formatted' => false, 'level' => Logger::DEBUG])); } public function testHandleDisabledByProduction() { + $this->deploymentConfigMock->expects($this->once()) + ->method('isAvailable') + ->willReturn(true); $this->stateMock->expects($this->once()) ->method('getMode') ->willReturn(State::MODE_PRODUCTION); $this->scopeConfigMock->expects($this->never()) ->method('getValue'); - $this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]); + $this->assertFalse($this->model->isHandling(['formatted' => false, 'level' => Logger::DEBUG])); } public function testHandleDisabledByConfig() { + $this->deploymentConfigMock->expects($this->once()) + ->method('isAvailable') + ->willReturn(true); $this->stateMock->expects($this->once()) ->method('getMode') ->willReturn(State::MODE_DEVELOPER); @@ -102,16 +122,32 @@ public function testHandleDisabledByConfig() ->with('dev/debug/debug_logging', ScopeInterface::SCOPE_STORE, null) ->willReturn(false); - $this->model->handle(['formatted' => false, 'level' => Logger::DEBUG]); + $this->assertFalse($this->model->isHandling(['formatted' => false, 'level' => Logger::DEBUG])); } public function testHandleDisabledByLevel() { + $this->deploymentConfigMock->expects($this->once()) + ->method('isAvailable') + ->willReturn(true); + $this->stateMock->expects($this->never()) + ->method('getMode'); + $this->scopeConfigMock->expects($this->never()) + ->method('getValue'); + + $this->assertFalse($this->model->isHandling(['formatted' => false, 'level' => Logger::API])); + } + + public function testDeploymentConfigIsNotAvailable() + { + $this->deploymentConfigMock->expects($this->once()) + ->method('isAvailable') + ->willReturn(false); $this->stateMock->expects($this->never()) ->method('getMode'); $this->scopeConfigMock->expects($this->never()) ->method('getValue'); - $this->model->handle(['formatted' => false, 'level' => Logger::API]); + $this->assertTrue($this->model->isHandling(['formatted' => false, 'level' => Logger::DEBUG])); } } From 378eb5f961b2b38da98e9c81fbc92c7e40eb159c Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Mon, 14 Nov 2016 11:08:15 +0200 Subject: [PATCH 1792/3232] MAGETWO-60165: Inability to Run the DI Compiler before setup --- app/code/Magento/Developer/Model/Logger/Handler/Debug.php | 2 +- .../Developer/Test/Unit/Model/Logger/Handler/DebugTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Developer/Model/Logger/Handler/Debug.php b/app/code/Magento/Developer/Model/Logger/Handler/Debug.php index e1997ed400b82..cdf2403fa40a8 100644 --- a/app/code/Magento/Developer/Model/Logger/Handler/Debug.php +++ b/app/code/Magento/Developer/Model/Logger/Handler/Debug.php @@ -66,4 +66,4 @@ public function isHandling(array $record) return parent::isHandling($record); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/DebugTest.php b/app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/DebugTest.php index 5640f33cf13eb..e539e6b1772b8 100644 --- a/app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/DebugTest.php +++ b/app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/DebugTest.php @@ -17,6 +17,7 @@ /** * Class DebugTest + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class DebugTest extends \PHPUnit_Framework_TestCase { From debfdaea5edfc86815a019ec5c477592b3a9c1a0 Mon Sep 17 00:00:00 2001 From: Vadim Zubovich Date: Mon, 14 Nov 2016 12:35:54 +0300 Subject: [PATCH 1793/3232] MTO-95: PRs stabilization - Added part of MTO-63 test - Added issue tag for MAGETWO-60470 --- .../Product/CreateSimpleProductEntityTest.xml | 1 + .../Block/Onepage/Payment/Method/Billing.php | 18 +++++++++++ .../Checkout/Test/Block/Onepage/Shipping.php | 11 +++++++ .../Test/Block/Onepage/ShippingPopup.php | 32 +++++++++++++++++++ .../Test/Block/Onepage/ShippingPopup.xml | 26 +++++++++++++++ .../Checkout/Test/Page/CheckoutOnepage.xml | 1 + .../Test/TestCase/OnePageCheckoutTest.php | 3 +- .../Test/TestStep/FillShippingAddressStep.php | 10 +++++- .../TestStep/SelectCheckoutMethodStep.php | 11 +++++-- .../Customer/Test/Repository/Address.xml | 2 +- .../Customer/Test/Repository/Customer.xml | 14 ++++++++ .../Block/Adminhtml/Order/View/Addresses.php | 10 +++--- .../TestCase/CreateSalesRuleEntityTest.xml | 1 - 13 files changed, 128 insertions(+), 12 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/ShippingPopup.php create mode 100644 dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/ShippingPopup.xml 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 9f4a5e4bb71fe..68e84930fcd05 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 @@ -317,6 +317,7 @@ + MAGETWO-60470: [Import Custom options] An error occurs on attempt to save the product with imported options Create product wit suite of custom options simple-product-%isolation% Simple Product %isolation% diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.php index 167767e518a48..d93c24f2641b0 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.php @@ -36,6 +36,20 @@ class Billing extends Form */ protected $sameAsShippingCheckbox = '[name="billing-address-same-as-shipping"]'; + /** + * New address select selector. + * + * @var string + */ + private $newAddressSelect = '[name="billing_address_id"]'; + + /** + * New address option value. + * + * @var string + */ + private $newAddressOption = 'New Address'; + /** * Fill billing address. * @@ -44,6 +58,10 @@ class Billing extends Form */ public function fillBilling(Address $billingAddress) { + $select = $this->_rootElement->find($this->newAddressSelect, Locator::SELECTOR_CSS, 'select'); + if ($select && $select->isVisible()) { + $select->setValue($this->newAddressOption); + } $this->fill($billingAddress); $this->clickUpdate(); $this->waitForElementNotVisible($this->waitElement); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php index b5a161257c7b7..fe844bc08b001 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php @@ -141,6 +141,17 @@ public function isAddressSelected($address) return $text == $address; } + /** + * Checks if new address button is visible. + * + * @return bool + */ + public function isPopupNewAddressButtonVisible() + { + $button = $this->_rootElement->find($this->popupSelector); + return $button->isVisible(); + } + /** * Clicks new address button. * diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/ShippingPopup.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/ShippingPopup.php new file mode 100644 index 0000000000000..fa6a8fa2a2861 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/ShippingPopup.php @@ -0,0 +1,32 @@ +browser->find($this->saveAddressButton)->click(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/ShippingPopup.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/ShippingPopup.xml new file mode 100644 index 0000000000000..13403b7926845 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/ShippingPopup.xml @@ -0,0 +1,26 @@ + + + + + + + + + input[name="street[0]"] + + + + select + + + select + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml index 11d4579414a04..0ab3bbb2c2cfc 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml @@ -12,6 +12,7 @@ + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php index 58f27dbb540c5..25922102e1269 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php @@ -33,9 +33,8 @@ * 14. Perform assertions. * * @group One_Page_Checkout - * @ZephyrId MAGETWO-27485, MAGETWO-12412, MAGETWO-12429, MAGETWO-42598 + * @ZephyrId MAGETWO-27485, MAGETWO-12412, MAGETWO-12429, MAGETWO-49917, MAGETWO-27485 * @ZephyrId MAGETWO-12444, MAGETWO-12848, MAGETWO-12849, MAGETWO-12850 - * @ZephyrId MAGETWO-42547, MAGETWO-42599, MAGETWO-49917, MAGETWO-27485 */ class OnePageCheckoutTest extends Scenario { diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php index ce00cf446b3ad..1c4e407fb8c24 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/FillShippingAddressStep.php @@ -94,7 +94,15 @@ public function run() { $shippingAddress = null; if ($this->shippingAddress) { - $this->checkoutOnepage->getShippingBlock()->fill($this->shippingAddress); + $shippingBlock = $this->checkoutOnepage->getShippingBlock(); + if ($shippingBlock->isPopupNewAddressButtonVisible()) { + $shippingBlock->clickPopupNewAddressButton(); + $this->checkoutOnepage->getShippingAddressPopupBlock() + ->fill($this->shippingAddress) + ->clickSaveAddressButton(); + } else { + $shippingBlock->fill($this->shippingAddress); + } $shippingAddress = $this->shippingAddress; } if (isset($this->shippingAddressCustomer['new'])) { diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php index c63a52b7ed67e..5cb5b83daadb9 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php @@ -110,6 +110,11 @@ private function processLogin() $this->checkoutOnepage->getLoginBlock()->loginCustomer($this->customer); } } + + if ($this->checkoutMethod === 'sign_in') { + $this->checkoutOnepage->getAuthenticationWrapperBlock()->signInLinkClick(); + $this->checkoutOnepage->getAuthenticationWrapperBlock()->loginCustomer($this->customer); + } } /** @@ -126,13 +131,15 @@ private function processRegister() } /** - * Logout customer on fronted. + * Logout customer on frontend. * * @return void */ public function cleanup() { - if ($this->checkoutMethod === 'login' || $this->checkoutMethod === 'register_before_checkout') { + if ($this->checkoutMethod === 'login' || + $this->checkoutMethod === 'sign_in' || + $this->checkoutMethod === 'register_before_checkout') { $this->logoutCustomerOnFrontend->run(); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index 41db01910b763..8baa7ce0d9310 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -237,7 +237,7 @@ Augsburger Strabe 41 10789 Germany - Berlin + Berlin 333-33-333-33 diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml index f0e3c5a898b99..3be7447c91dad 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml @@ -197,5 +197,19 @@ UK_address_default_billing, US_address_default_shipping + + + John + Doe%isolation% + + General + + JohnDoe_%isolation%@example.com + 123123^q + 123123^q + + US_address, DE_address, UK_address + + diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Addresses.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Addresses.php index 6d92327ef92d4..063f3f0d2a566 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Addresses.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Addresses.php @@ -9,7 +9,7 @@ use Magento\Mtf\Client\Locator; /** - * Block for information about adresses on order page. + * Block for information about addresses on order page. */ class Addresses extends Block { @@ -18,7 +18,7 @@ class Addresses extends Block * * @var string */ - protected $billingAddress = '.order-billing-address address'; + private $billingAddress = '.order-billing-address address'; /** * New address button selector. @@ -32,7 +32,7 @@ class Addresses extends Block * * @var string */ - protected $shippingAddress = '.order-shipping-address address'; + private $shippingAddress = '.order-shipping-address address'; /** * Get customer's billing address from the data inside block. @@ -41,7 +41,7 @@ class Addresses extends Block */ public function getCustomerBillingAddress() { - return $this->_rootElement->find($this->billingAddress)->getText(); + return $this->_rootElement->find($this->billingAddress, Locator::SELECTOR_CSS)->getText(); } /** @@ -51,7 +51,7 @@ public function getCustomerBillingAddress() */ public function getCustomerShippingAddress() { - return $this->_rootElement->find($this->shippingAddress)->getText(); + return $this->_rootElement->find($this->shippingAddress, Locator::SELECTOR_CSS)->getText(); } /** diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml index de4e7aeb1e298..141638e6b31b9 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml @@ -418,7 +418,6 @@ United States California 95814 - Flat Rate simple_for_salesrule_1 1 From 5ff806f2405b52924ac01fec28798bc7b6772e08 Mon Sep 17 00:00:00 2001 From: rliukshyn Date: Wed, 9 Nov 2016 20:04:36 +0200 Subject: [PATCH 1794/3232] MTA-3794: Add AssertTransactionStatus and refactor online credit memo step --- .../Magento/Braintree/Test/etc/testcase.xml | 4 +- .../Adminhtml/Order/View/Tab/Transactions.php | 2 +- .../Constraint/AssertTransactionStatus.php | 61 +++++++++++++++++++ .../TestStep/CreateOnlineCreditMemoStep.php} | 7 +-- .../Sales/Test/TestStep/SubmitOrderStep.php | 27 +++++++- 5 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertTransactionStatus.php rename dev/tests/functional/tests/app/Magento/{Braintree/Test/TestStep/CreateBraintreeCreditMemoStep.php => Sales/Test/TestStep/CreateOnlineCreditMemoStep.php} (93%) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml index 495f455c43a72..12aa92d35064d 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml @@ -106,8 +106,8 @@ - - + + diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Transactions.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Transactions.php index 80309405fcd05..64e449c805b28 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Transactions.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Transactions.php @@ -8,7 +8,7 @@ use Magento\Backend\Test\Block\Widget\Tab; use Magento\Mtf\Client\Locator; -use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Shipments\Grid; +use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Transactions\Grid; /** * Transactions tab. diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertTransactionStatus.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertTransactionStatus.php new file mode 100644 index 0000000000000..fb975ae4bd1c6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertTransactionStatus.php @@ -0,0 +1,61 @@ +open(); + $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); + $salesOrderView->getOrderForm()->openTab('transactions'); + $actualTransactions = $salesOrderView->getOrderForm()->getTab('transactions')->getGridBlock()->getIds(); + + foreach ($transactions as $transaction) { + foreach ($actualTransactions as $actualTransaction) { + if ($actualTransaction['transactionType'] === $transaction['transactionType']) { + \PHPUnit_Framework_Assert::assertEquals( + $transaction['statusIsClosed'], + $actualTransaction['statusIsClosed'], + 'The ' . $transaction['transactionType'] . ' transaction status is not closed.' + ); + break; + } + } + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Transactions status is closed.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/CreateBraintreeCreditMemoStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php similarity index 93% rename from dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/CreateBraintreeCreditMemoStep.php rename to dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php index 085fc142a3373..84491c1992e5d 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/CreateBraintreeCreditMemoStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php @@ -4,9 +4,8 @@ * See COPYING.txt for license details. */ -namespace Magento\Braintree\Test\TestStep; +namespace Magento\Sales\Test\TestStep; -use Magento\Mtf\ObjectManager; use Magento\Mtf\TestStep\TestStepInterface; use Magento\Sales\Test\Fixture\OrderInjectable; use Magento\Sales\Test\Page\Adminhtml\OrderCreditMemoNew; @@ -15,9 +14,9 @@ use Magento\Sales\Test\Page\Adminhtml\SalesOrderView; /** - * Create credit memo for order placed via Braintree credit card payment method. + * Create credit memo for order placed using online payment methods. */ -class CreateBraintreeCreditMemoStep implements TestStepInterface +class CreateOnlineCreditMemoStep implements TestStepInterface { /** * Orders Page. diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SubmitOrderStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SubmitOrderStep.php index fa37c94be3cdd..0a82770fab38b 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SubmitOrderStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SubmitOrderStep.php @@ -23,21 +23,42 @@ class SubmitOrderStep implements TestStepInterface * * @var OrderCreateIndex */ - protected $orderCreateIndex; + private $orderCreateIndex; /** * Sales order view. * * @var SalesOrderView */ - protected $salesOrderView; + private $salesOrderView; /** * Factory for fixtures. * * @var FixtureFactory */ - protected $fixtureFactory; + private $fixtureFactory; + + /** + * Customer fixture. + * + * @var Customer + */ + private $customer; + + /** + * Billing Address fixture. + * + * @var Address + */ + private $billingAddress; + + /** + * Products fixtures. + * + * @var array|\Magento\Mtf\Fixture\FixtureInterface[] + */ + private $products; /** * @constructor From 564f86973f49c188a754554d68f07d2d1f34c542 Mon Sep 17 00:00:00 2001 From: Vitali Kirychenka Date: Mon, 14 Nov 2016 12:50:30 +0300 Subject: [PATCH 1795/3232] MTO-55: [Test] Email validation for Guest on checkout flow - CR fixes --- .../AssertEmailErrorValidationMessage.php | 6 ++---- .../Test/Constraint/AssertEmailToolTips.php | 12 ++++-------- .../Test/TestCase/ValidateEmailOnCheckoutTest.php | 13 ++++++++++++- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailErrorValidationMessage.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailErrorValidationMessage.php index b6085ac3faf56..01941682c328c 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailErrorValidationMessage.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailErrorValidationMessage.php @@ -16,10 +16,8 @@ class AssertEmailErrorValidationMessage extends AbstractConstraint { /** * Email validation message. - * - * @var string */ - private $emailValidationMessage = 'Please enter a valid email address (Ex: johndoe@domain.com).'; + const EMAIL_VALIDATION_MESSAGE = 'Please enter a valid email address (Ex: johndoe@domain.com).'; /** * Assert that email validation message is correct. @@ -31,7 +29,7 @@ public function processAssert( CheckoutOnepage $checkoutOnepage ) { \PHPUnit_Framework_Assert::assertEquals( - $this->emailValidationMessage, + self::EMAIL_VALIDATION_MESSAGE, $checkoutOnepage->getShippingBlock()->getEmailError(), 'Email validation message is not correct.' ); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailToolTips.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailToolTips.php index 8e645ead73690..974d1ba290da8 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailToolTips.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEmailToolTips.php @@ -16,17 +16,13 @@ class AssertEmailToolTips extends AbstractConstraint { /** * Email tooltip message. - * - * @var string */ - private $emailTooltip = 'We\'ll send your order confirmation here.'; + const EMAIL_TOOLTIP = 'We\'ll send your order confirmation here.'; /** * Email instructions message. - * - * @var string */ - private $emailInstructions = 'You can create an account after checkout.'; + const EMAIL_INSTRUCTIONS = 'You can create an account after checkout.'; /** * Assert that email field tooltips are present. @@ -38,13 +34,13 @@ public function processAssert( CheckoutOnepage $checkoutOnepage ) { \PHPUnit_Framework_Assert::assertEquals( - $this->emailTooltip, + self::EMAIL_TOOLTIP, $checkoutOnepage->getShippingBlock()->getEmailTooltip(), 'Email tooltip is not correct.' ); \PHPUnit_Framework_Assert::assertEquals( - $this->emailInstructions, + self::EMAIL_INSTRUCTIONS, $checkoutOnepage->getShippingBlock()->getEmailInstructions(), 'Email instructions are not correct.' ); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.php index 49cc4ad6d3ef4..d2c341d1a68c1 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/ValidateEmailOnCheckoutTest.php @@ -34,6 +34,17 @@ class ValidateEmailOnCheckoutTest extends Injectable const MVP = 'yes'; /* end tags */ + /** + * Validate email on checkout. + * + * @param CatalogProductSimple $product + * @param CheckoutCart $cartPage + * @param CatalogProductView $catalogProductView + * @param BrowserInterface $browser + * @param CheckoutOnepage $checkoutOnepage + * @param Customer $customer + * @return void + */ public function test( CatalogProductSimple $product, CheckoutCart $cartPage, @@ -48,7 +59,7 @@ public function test( $cartPage->open(); $cartPage->getCartBlock()->clearShoppingCart(); - //Step + //Steps $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $productView = $catalogProductView->getViewBlock(); $productView->fillOptions($product); From ddda1c0469f6e21f8c179a164db609ce1e4d815e Mon Sep 17 00:00:00 2001 From: Michail Slabko Date: Mon, 14 Nov 2016 12:36:24 +0200 Subject: [PATCH 1796/3232] MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options - fix static --- .../Product/DynamicBundleWithSpecialPriceCalculatorTest.php | 1 - .../Bundle/Model/Product/FixedBundlePriceCalculatorTest.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php index 63efce3945589..f701c93789c16 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php @@ -305,7 +305,6 @@ private function getBundleConfiguration5() ]; } - /** * Dynamic bundle with one simple product with special price * @return array diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php index 31ceea07ee22d..07b455a0feeaf 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php @@ -74,6 +74,7 @@ public function testPriceForFixedBundleInWebsiteScope(array $strategyModifiers, /** * Test cases for current test * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function getTestCases() { From 113c5ba3bf4bcbd9904d8f420fe5ac5c318973c2 Mon Sep 17 00:00:00 2001 From: rliukshyn Date: Thu, 3 Nov 2016 21:23:57 +0200 Subject: [PATCH 1797/3232] MTA-3797: Create auto test to void authorization --- .../Test/Block/Adminhtml/Order/Actions.php | 27 +++++--- .../Test/Block/Adminhtml/Order/History.php | 18 ++++++ .../AssertOrderSuccessVoidedMessage.php | 54 ++++++++++++++++ .../AssertVoidInCommentsHistory.php | 57 +++++++++++++++++ .../Test/TestCase/VoidAuthorizationTest.php | 49 +++++++++++++++ .../Test/TestStep/VoidAuthorizationStep.php | 63 +++++++++++++++++++ .../app/Magento/Sales/Test/etc/testcase.xml | 16 +++++ 7 files changed, 274 insertions(+), 10 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderSuccessVoidedMessage.php create mode 100644 dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertVoidInCommentsHistory.php create mode 100644 dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/VoidAuthorizationTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/VoidAuthorizationStep.php diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php index 398553b2abd3c..beb4d2219a68b 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php @@ -178,10 +178,7 @@ public function edit() public function cancel() { $this->_rootElement->find($this->cancel)->click(); - $element = $this->browser->find($this->confirmModal); - /** @var \Magento\Ui\Test\Block\Adminhtml\Modal $modal */ - $modal = $this->blockFactory->create(\Magento\Ui\Test\Block\Adminhtml\Modal::class, ['element' => $element]); - $modal->acceptAlert(); + $this->acceptAlert(); } /** @@ -202,6 +199,7 @@ public function sendEmail() public function void() { $this->_rootElement->find($this->void)->click(); + $this->acceptAlert(); } /** @@ -266,27 +264,36 @@ public function isActionButtonVisible($buttonName) } /** - * Accept order + * Accept order. + * * @return void */ public function accept() { $acceptPayment = '#accept_payment'; $this->_rootElement->find($acceptPayment)->click(); - $element = $this->browser->find($this->confirmModal); - /** @var Modal $modal */ - $modal = $this->blockFactory->create(Modal::class, ['element' => $element]); - $modal->acceptAlert(); + $this->acceptAlert(); } /** - * Deny order + * Deny order. + * * @return void */ public function deny() { $denyPayment = '#deny_payment'; $this->_rootElement->find($denyPayment)->click(); + $this->acceptAlert(); + } + + /** + * Accept alert. + * + * @return void + */ + private function acceptAlert() + { $element = $this->browser->find($this->confirmModal); /** @var Modal $modal */ $modal = $this->blockFactory->create(Modal::class, ['element' => $element]); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/History.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/History.php index 740f8f03fe639..8ae8bbb31584e 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/History.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/History.php @@ -56,6 +56,13 @@ class History extends Block */ protected $refundedAmount = '//div[@class="note-list-comment"][contains(text(), "We refunded")]'; + /** + * Voided Amount. + * + * @var string + */ + protected $voidedAmount = '//div[@class="note-list-comment"][contains(text(), "Voided authorization")]'; + /** * Note list locator. * @@ -117,6 +124,17 @@ public function getRefundedAmount() return $result; } + /** + * Get the voided amount from the comments history. + * + * @return string + */ + public function getVoidedAmount() + { + $this->waitCommentsHistory(); + return $this->_rootElement->find($this->voidedAmount, Locator::SELECTOR_XPATH)->getText(); + } + /** * Gets the status which presented in comment * diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderSuccessVoidedMessage.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderSuccessVoidedMessage.php new file mode 100644 index 0000000000000..99afc944edb95 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderSuccessVoidedMessage.php @@ -0,0 +1,54 @@ +getMessagesBlock()->getSuccessMessage(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Text of voided order message assert. + * + * @return string + */ + public function toString() + { + return 'Order successful void message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertVoidInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertVoidInCommentsHistory.php new file mode 100644 index 0000000000000..bc3e90ee7f776 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertVoidInCommentsHistory.php @@ -0,0 +1,57 @@ +open(); + $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); + + \PHPUnit_Framework_Assert::assertContains( + self::VOIDED_AMOUNT . $prices['grandTotal'], + $salesOrderView->getOrderHistoryBlock()->getVoidedAmount(), + 'Incorrect voided amount value for the order #' . $orderId + ); + } + + /** + * Returns string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Message about voided amount is available in Comments History section."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/VoidAuthorizationTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/VoidAuthorizationTest.php new file mode 100644 index 0000000000000..27de6bdd5ea2c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/VoidAuthorizationTest.php @@ -0,0 +1,49 @@ +executeScenario(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/VoidAuthorizationStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/VoidAuthorizationStep.php new file mode 100644 index 0000000000000..6897233c7242c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/VoidAuthorizationStep.php @@ -0,0 +1,63 @@ +orderIndex = $orderIndex; + $this->order = $order; + $this->salesOrderView = $salesOrderView; + } + + /** + * Void authorization. + * + * @return void + */ + public function run() + { + $this->orderIndex->open(); + $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); + $this->salesOrderView->getPageActions()->void(); + } +} 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 eebdf2128dc70..030b0f4f32df0 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 @@ -35,6 +35,22 @@ + + + + + + + + + + + + + + + + From a4e17f83105d8a185a089027c794ba6be78556ef Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko Date: Mon, 14 Nov 2016 12:58:47 +0200 Subject: [PATCH 1798/3232] MAGETWO-60613: [GitHub]Catalog Products List widget: Sku chooser grid not displayed when editing an existing condition for the attribute SKU #6985 --- .../Block/Product/Widget/ConditionsTest.php | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php b/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php index 8d87c0ebf0d21..c744c50a30ccf 100644 --- a/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php +++ b/app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php @@ -175,4 +175,115 @@ public function testConstructWithParamsFromBlock() ] ); } + + /** + * @return void + */ + public function testRender() + { + $data = ['area' => 'backend']; + $abstractElementMock = $this->getMock( + \Magento\Framework\Data\Form\Element\AbstractElement::class, + ['getContainer'], + [], + '', + false + ); + $eventManagerMock = $this->getMock( + \Magento\Framework\Event\ManagerInterface::class, + [], + [], + '', + false + ); + $scopeConfigMock = $this->getMock( + \Magento\Framework\App\Config\ScopeConfigInterface::class, + [], + [], + '', + false + ); + $fieldsetMock = $this->getMock( + \Magento\Framework\Data\Form\Element\Fieldset::class, + [], + [], + '', + false + ); + $combineMock = $this->getMock( + \Magento\Rule\Model\Condition\Combine::class, + [], + [], + '', + false + ); + $resolverMock = $this->getMock( + \Magento\Framework\View\Element\Template\File\Resolver::class, + [], + [], + '', + false + ); + $filesystemMock = $this->getMock( + \Magento\Framework\Filesystem::class, + ['getDirectoryRead'], + [], + '', + false + ); + $validatorMock = $this->getMock( + \Magento\Framework\View\Element\Template\File\Validator::class, + [], + [], + '', + false + ); + $templateEnginePoolMock = $this->getMock( + \Magento\Framework\View\TemplateEnginePool::class, + [], + [], + '', + false + ); + $templateEngineMock = $this->getMock( + \Magento\Framework\View\TemplateEngineInterface::class, + [], + [], + '', + false + ); + $directoryReadMock = $this->getMock( + \Magento\Framework\Filesystem\Directory\ReadInterface::class, + [], + [], + '', + false + ); + + $this->ruleMock->expects($this->once())->method('getConditions')->willReturn($combineMock); + $combineMock->expects($this->once())->method('setJsFormObject')->willReturnSelf(); + $abstractElementMock->expects($this->any())->method('getContainer')->willReturn($fieldsetMock); + $filesystemMock->expects($this->once())->method('getDirectoryRead')->willReturn($directoryReadMock); + $validatorMock->expects($this->once())->method('isValid')->willReturn(true); + $this->contextMock->expects($this->once())->method('getEnginePool')->willReturn($templateEnginePoolMock); + $templateEnginePoolMock->expects($this->once())->method('get')->willReturn($templateEngineMock); + $templateEngineMock->expects($this->once())->method('render')->willReturn('html'); + + $this->widgetConditions = $this->objectManagerHelper->getObject( + Conditions::class, + [ + 'context' => $this->contextMock, + 'registry' => $this->registryMock, + 'rule' => $this->ruleMock, + '_eventManager' => $eventManagerMock, + '_filesystem' => $filesystemMock, + '_scopeConfig' => $scopeConfigMock, + 'validator' => $validatorMock, + 'resolver' => $resolverMock, + 'data' => $data + ] + ); + + $this->assertEquals($this->widgetConditions->render($abstractElementMock), 'html'); + } } From 1aef2aac19b922691fec88c4569815313de9a177 Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Mon, 14 Nov 2016 14:43:28 +0300 Subject: [PATCH 1799/3232] MTO-17: [Variation] Add variation to check catalog price rule for configurable product - Functional test implemented. --- .../Handler/CatalogProductSimple/Curl.php | 3 +- .../Test/Repository/CatalogAttributeSet.xml | 10 + .../Repository/CatalogProductAttribute.xml | 50 +++ .../Test/Repository/CatalogProductSimple.xml | 232 ++++++++++++++ .../CatalogProductSimple/CheckoutData.xml | 55 ++++ .../Test/Repository/Product/CustomOptions.xml | 93 ++++++ ...sertCatalogPriceRuleAppliedCatalogPage.php | 6 +- ...sertCatalogPriceRuleAppliedProductPage.php | 6 +- .../TestCase/ApplyCatalogPriceRulesTest.php | 70 ++-- .../TestCase/ApplyCatalogPriceRulesTest.xml | 52 ++- .../ConfigurableAttributesData.php | 1 - .../Test/Repository/ConfigurableProduct.xml | 302 ++++++++++++++++++ .../ConfigurableProduct/CheckoutData.xml | 200 ++++++++++++ .../ConfigurableAttributesData.xml | 113 +++++++ .../Repository/ConfigurableProduct/Price.xml | 8 + ...nfigurableProductCatalogPriceRulesTest.php | 48 +++ ...nfigurableProductCatalogPriceRulesTest.xml | 76 +++++ 17 files changed, 1295 insertions(+), 30 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php create mode 100644 dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php index 2ccb804b073f9..9267d041d6a18 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductSimple/Curl.php @@ -488,7 +488,6 @@ protected function prepareCustomOptionsData() if (!isset($this->fields['product']['custom_options'])) { return; } - $options = []; foreach ($this->fields['product']['custom_options'] as $key => $customOption) { $options[$key] = [ @@ -510,7 +509,7 @@ protected function prepareCustomOptionsData() } $this->fields['product']['options'] = $options; - $this->fields['affect_product_custom_options'] = 1; + $this->fields['product']['affect_product_custom_options'] = 1; unset($this->fields['product']['custom_options']); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogAttributeSet.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogAttributeSet.xml index a62bef0680a9e..a06e944982b1e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogAttributeSet.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogAttributeSet.xml @@ -38,5 +38,15 @@ color_for_promo_rules + + + Promo_attribute_set_with_sizes_%isolation% + + default + + + sizes_for_promo_rules + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml index e94af12754af5..8182177ed56db 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml @@ -204,5 +204,55 @@ + + + size_%isolation% + size_%isolation% + Dropdown + No + + + No + SIZE_S + SIZE_S + + + No + SIZE_M + SIZE_M + + + No + SIZE_L + SIZE_L + + + + + + size_%isolation% + size_%isolation% + Dropdown + Yes + No + + + Yes + SIZE_S_%isolation% + SIZE_S + + + No + SIZE_M_%isolation% + SIZE_M + + + No + SIZE_L_%isolation% + SIZE_L + Yes + + + diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index 997d0ab1d7f11..bcf6f7c510199 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -1368,6 +1368,238 @@ overnight-duffle + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + + 56.78 + + This item has weight + 1 + + 1 + In Stock + + + + default + + + simple-product-%isolation% + + default_subcategory + + + percent_and_fixed_radio_options + + + + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + + 56.78 + + This item has weight + 1 + + 1 + In Stock + + + + default + + + simple-product-%isolation% + + default_subcategory + + + percent_and_fixed_radio_options + + + with_fixed_custom_option + + + + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + + 100 + + This item has weight + 1 + + 1 + In Stock + + + + default + + + simple-product-%isolation% + + default_subcategory + + + text_and_two_custrom_options + + + text_and_two_custrom_options + + + + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + + 56.78 + + This item has weight + 1 + + 1 + In Stock + + + + default + + + simple-product-%isolation% + + default_subcategory + + + percent_and_fixed_radio_options + + + with_percent_custom_option + + + + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + This item has weight + 1 + + 25 + In Stock + + + 20.01 + + + taxable_goods + + + + default + + + Catalog, Search + simple-product-%isolation% + + simple_order_default + + + + + + default + + Simple Product %isolation% + sku_simple_product_%isolation% + This item has weight + 1 + + 25 + In Stock + + + 79.99 + + + taxable_goods + + + + default + + + Catalog, Search + simple-product-%isolation% + + simple_order_default + + + + + Simple product without category %isolation% + simple-product-%isolation% + simple_product_without_category_%isolation% + This item has weight + 1 + + default + + + 100 + + + + 100 + In Stock + + + + default + + + + + + Simple product without category %isolation% + simple-product-%isolation% + simple_product_without_category_%isolation% + This item has weight + 1 + + temp_attribute_set_id + + + 100 + + + + 100 + In Stock + + + + default + + + default diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml index 180da27ca2a09..08be8607a2aa5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple/CheckoutData.xml @@ -157,6 +157,61 @@ 3 + + + + + attribute_key_0 + option_key_0 + + + + 1 + + 560.78 + 1 + 560.78 + + + + + + + + attribute_key_0 + option_key_1 + + + + 1 + + 560.78 + 1 + 560.78 + + + + + + + + attribute_key_0 + Ok + + + attribute_key_1 + option_key_0 + + + + 1 + + 5 + 1 + 125 + + + 1 diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml index ae9c2238c9e00..b8db068b3cf22 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml @@ -382,5 +382,98 @@ + + + + 30 bucks + Yes + Text/Field + + + 30 + Fixed + sku_field_option_%isolation% + 1024 + + + + + custom menu + Yes + Select/Radio Buttons + + + 5 bucks + 5 + Fixed + sku_radio_buttons_row_1 + 0 + + + 10 bucks + 10 + Fixed + sku_radio_buttons_row_2 + 1 + + + + + + + + custom menu + No + Select/Radio Buttons + + + 12 bucks + 12 + Fixed + sku_radio_buttons_row_1 + 0 + + + 89 bucks + 89 + Fixed + sku_radio_buttons_row_2 + 0 + + + + + + + + custom option drop down %isolation% + Yes + Select/Drop-down + + + 12 bucks + 12 + Fixed + sku_radio_buttons_row_1 + 0 + + + 12 bucks + 12 + Fixed + sku_radio_buttons_row_1 + 0 + + + 12 bucks + 12 + Fixed + sku_radio_buttons_row_1 + 0 + + + + + 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 1a83f4258a4ce..73b09e78cbdf2 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php @@ -53,9 +53,11 @@ public function processAssert( $priceBlock->isVisible(), 'Price block is not displayed for product ' . $product->getName() ); - $actualPrice['regular'] = (float)$priceBlock->getOldPrice(); $actualPrice['special'] = (float)$priceBlock->getSpecialPrice(); - $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; + if ($productPrice[$key]['regular'] !== 'No') { + $actualPrice['regular'] = (float)$priceBlock->getOldPrice(); + $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; + } $diff = $this->verifyData($actualPrice, $productPrice[$key]); \PHPUnit_Framework_Assert::assertTrue( empty($diff), 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 653792417be5a..be71e19d0e52e 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php @@ -53,9 +53,11 @@ public function processAssert( $catalogProductViewPage->getViewBlock()->waitLoader(); $productPriceBlock = $catalogProductViewPage->getViewBlock()->getPriceBlock(); - $actualPrice['regular'] = $productPriceBlock->getOldPrice(); $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); - $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; + if ($productPrice[$key]['regular'] !== 'No') { + $actualPrice['regular'] = $productPriceBlock->getOldPrice(); + $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; + } $diff = $this->verifyData($actualPrice, $productPrice[$key]); \PHPUnit_Framework_Assert::assertTrue( empty($diff), diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php index 68972e5bb766d..ffc31f3a5a381 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php @@ -7,6 +7,7 @@ namespace Magento\CatalogRule\Test\TestCase; use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct; use Magento\CatalogRule\Test\Fixture\CatalogRule; use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Util\Command\Cli\Cron; @@ -35,6 +36,13 @@ class ApplyCatalogPriceRulesTest extends AbstractCatalogRuleEntityTest const MVP = 'yes'; /* end tags */ + /** + * Index number of promo product. + * + * @var int + */ + protected $promo; + /** * Apply catalog price rules. * @@ -45,6 +53,7 @@ class ApplyCatalogPriceRulesTest extends AbstractCatalogRuleEntityTest * @param bool $isCronEnabled * @param Customer $customer * @param array $products + * @param int $promo * @return FixtureInterface[] */ public function test( @@ -54,8 +63,10 @@ public function test( Cron $cron, $isCronEnabled = false, Customer $customer = null, - array $products = null + array $products = [], + $promo = 0 ) { + $this->promo = $promo; if ($customer !== null) { $customer->persist(); } @@ -87,29 +98,44 @@ public function test( * @param array $catalogPriceRule * @return array */ - private function prepareCondition(FixtureInterface $product, array $catalogPriceRule) + protected function prepareCondition(FixtureInterface $product, array $catalogPriceRule) { - $result = []; $conditionEntity = explode('|', trim($catalogPriceRule['data']['rule'], '[]'))[0]; - - switch ($conditionEntity) { - case 'Category': - $result['%category_id%'] = $product->getDataFieldConfig('category_ids')['source']->getIds()[0]; - break; - case 'Attribute': - /** @var \Magento\Catalog\Test\Fixture\CatalogProductAttribute[] $attrs */ - $attributes = $product->getDataFieldConfig('attribute_set_id')['source'] - ->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes(); - - $result['%attribute_id%'] = $attributes[0]->getAttributeCode(); - $result['%attribute_value%'] = $attributes[0]->getOptions()[0]['id']; - break; - } - foreach ($result as $key => $value) { - $catalogPriceRule['data']['rule'] = str_replace($key, $value, $catalogPriceRule['data']['rule']); + $actionName = 'get' . $conditionEntity; + if (method_exists(__CLASS__, $actionName)) { + $result = $this->$actionName($product); + foreach ($result as $key => $value) { + $catalogPriceRule['data']['rule'] = str_replace($key, $value, $catalogPriceRule['data']['rule']); + } + return $catalogPriceRule; } + } - return $catalogPriceRule; + /** + * Add category_id to catalog price rule. + * + * @param FixtureInterface $product + * @return array + */ + protected function getCategory(FixtureInterface $product) + { + $result['%category_id%'] = $product->getDataFieldConfig('category_ids')['source']->getIds()[0]; + return $result; + } + + /** + * Add attribute_id to catalog price rule. + * + * @param FixtureInterface $product + * @return array + */ + protected function getAttribute(FixtureInterface $product) + { + $attributes = $product->getDataFieldConfig('attribute_set_id')['source'] + ->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes(); + $result['%attribute_id%'] = $attributes[0]->getAttributeCode(); + $result['%attribute_value%'] = $attributes[0]->getOptions()[$this->promo]['id']; + return $result; } /** @@ -119,7 +145,7 @@ private function prepareCondition(FixtureInterface $product, array $catalogPrice * @param Customer $customer * @return array */ - private function applyCustomerGroup(array $catalogPriceRule, Customer $customer) + protected function applyCustomerGroup(array $catalogPriceRule, Customer $customer) { /** @var \Magento\Customer\Test\Fixture\CustomerGroup $customerGroup */ $customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup(); @@ -136,7 +162,7 @@ private function applyCustomerGroup(array $catalogPriceRule, Customer $customer) * @param Customer $customer * @return CatalogRule */ - private function createCatalogPriceRule( + protected function createCatalogPriceRule( array $catalogPriceRule, FixtureInterface $product, Customer $customer = null diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml index 00b02c61bd61c..ef66c59050289 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml @@ -1,7 +1,7 @@ @@ -114,6 +114,7 @@ + catalogProductSimple::no_custom_options catalogProductSimple::with_default_custom_option catalogProductSimple::with_fixed_custom_option catalogProductSimple::with_percent_custom_option @@ -146,5 +147,54 @@ + + configurableProduct::product_with_price_10 + catalogProductSimple::simple_10_dollar + NOT LOGGED IN + CatalogPriceRule %isolation% + Yes + Active + Main Website + Apply as percentage of original + 10 + 18 + 28 + 9 + 9 + No + 9 + 9 + 10 + 1 + customer_US + default + Flat Rate + Fixed + UK_address + checkmo + + + + + + catalogProductSimple::with_fixed_custom_option_price_100 + customer_US + CatalogPriceRule %isolation% + Active + Main Website + default + Apply as percentage of original + 10 + 125 + 130 + 90 + 100 + 10 + 125 + Flat Rate + Fixed + + + 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 65f80eb714463..0b0e3e1338fe0 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 @@ -129,7 +129,6 @@ protected function prepareAttributesData(array $data) foreach ($this->attributes as $attributeKey => $attribute) { $attributeData = $attribute->getData(); $options = []; - foreach ($attributeData['options'] as $key => $option) { $options['option_key_' . $key] = $option; } diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml index 32f1957d4173f..5e491f225ae94 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml @@ -39,6 +39,9 @@ configurable_default + + default_subcategory + @@ -497,5 +500,304 @@ price_40 + + + Test configurable product %isolation% + sku_test_configurable_product_%isolation% + + 10 + + 10 + This item has weight + 5 + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + two_options_with_assigned_product_special_price + + + In Stock + + + + default + + + + default + + + configurable_two_new_options_with_special_price + + + default_subcategory + + + + + Test configurable product %isolation% + sku_test_configurable_product_%isolation% + 49.99 + This item has weight + 5 + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + two_options_with_assigned_product_special_price_2 + + + In Stock + + + + default + + + + default + + + two_fixed_radio_options + + + product_1_and_option_1 + + + default_subcategory + + + + + Test configurable product %isolation% + sku_test_configurable_product_%isolation% + 10 + This item has weight + 5 + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + two_options_with_assigned_product_special_price_2 + + + In Stock + + + + default + + + + default + + + two_fixed_radio_options + + + product_1_and_option_2 + + + default_subcategory + + + + + Test configurable product %isolation% + sku_test_configurable_product_%isolation% + 10 + This item has weight + 5 + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + two_options_with_assigned_product_special_price_2 + + + In Stock + + + + default + + + + default + + + two_fixed_radio_options + + + product_2_and_option_1 + + + default_subcategory + + + + + Test configurable product %isolation% + sku_test_configurable_product_%isolation% + 10 + This item has weight + 5 + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + two_options_with_assigned_product_special_price_2 + + + In Stock + + + + default + + + + default + + + two_fixed_radio_options + + + product_2_and_option_2 + + + default_subcategory + + + + + Stellar Solar Jacket %isolation% + sku_test_configurable_product_%isolation% + This item has weight + 5 + + 75 + price_75 + + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + three_options_with_sizes_S_M_L + + + promo_attribute_set_with_sizes + + + In Stock + + + + default + + + + + configurable_the_first_option + + + default_subcategory + + + + + Stellar Solar Jacket %isolation% + sku_test_configurable_product_%isolation% + This item has weight + 5 + + 75 + price_75 + + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + three_options_with_sizes_S_M_L + + + promo_attribute_set_with_sizes + + + In Stock + + + + default + + + + configurable_the_second_option + + + default_subcategory + + + + + Stellar Solar Jacket %isolation% + sku_test_configurable_product_%isolation% + This item has weight + 5 + + 75 + price_75 + + Yes + Catalog, Search + + taxable_goods + + configurable-product-%isolation% + + three_options_with_sizes_S_M_L + + + promo_attribute_set_with_sizes + + + In Stock + + + + default + + + + configurable_the_third_option + + + default_subcategory + + diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml index bb9f7a4ae03b1..30294b3c877b5 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml @@ -185,6 +185,42 @@ + + + + + attribute_key_0 + option_key_0 + + + + 1 + + + + + + + attribute_key_0 + option_key_1 + + + + 1 + + + + + + + attribute_key_0 + option_key_2 + + + + 1 + + @@ -211,5 +247,169 @@ 11 + + + + + + attribute_key_0 + option_key_1 + + + + + 9 + 1 + 9 + + + + + + + + attribute_key_0 + option_key_0 + + + + + attribute_key_0 + option_key_0 + + + + + 9 + 1 + 9 + + + + + + + + attribute_key_0 + option_key_0 + + + + + attribute_key_0 + option_key_1 + + + + + 9 + 1 + 9 + + + + + + + + attribute_key_0 + option_key_1 + + + + + attribute_key_0 + option_key_0 + + + + + 9 + 1 + 9 + + + + + + + + attribute_key_0 + option_key_1 + + + + + attribute_key_0 + option_key_1 + + + + + 9 + 1 + 9 + + + + + + + + attribute_key_0 + option_key_1 + + + + + attribute_key_0 + option_key_1 + + + + + 1 + + + + + + + + attribute_key_0 + option_key_0 + + + + + attribute_key_0 + option_key_0 + + + + + 1 + + + + + + + + attribute_key_0 + option_key_0 + + + + + attribute_key_0 + option_key_1 + + + + + 1 + + diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml index cf9d73d3dcd2e..1f7d6be789a68 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml @@ -440,6 +440,42 @@ + + + + + + option_key_1_%isolation% + 79.99 + Yes + + + option_key_2_%isolation% + 20.01 + Yes + + + + + + catalogProductAttribute::attribute_type_dropdown_two_options + + + catalogProductSimple::product_79_99 + catalogProductSimple::product_20_01 + + + + 10 + 1 + + + 20 + 1 + + + + @@ -677,5 +713,82 @@ + + + + + + + SIZE_S + 75 + Yes + + + SIZE_M + 75 + Yes + + + SIZE_L + 75 + Yes + + + + + + catalogProductAttribute::sizes_for_promo_rules + + + + 10 + 1 + + + 20 + 1 + + + 20 + 1 + + + + + + + + + + option_key_1_%isolation% + 79.99 + Yes + + + option_key_2_%isolation% + 20.01 + Yes + + + + + + catalogProductAttribute::attrebutes_temp + + + catalogProductSimple::product_temp_1 + catalogProductSimple::product_temp_2 + + + + 10 + 1 + + + 20 + 1 + + + diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/Price.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/Price.xml index 1b6282b9432c3..2704871a561d1 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/Price.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/Price.xml @@ -14,9 +14,17 @@ 40 40 + + 10 + 10 + 11 + + 75 + 75 + 9 diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php new file mode 100644 index 0000000000000..13d1568c90d53 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php @@ -0,0 +1,48 @@ +getDataFieldConfig('configurable_attributes_data')['source'] + ->getAttributesData()['attribute_key_0']; + $result['%attribute_id%'] = $attributes['attribute_code']; + $result['%attribute_value%'] = $attributes['options']['option_key_' . $this->promo]['id']; + return $result; + } +} diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml new file mode 100644 index 0000000000000..719fb10303ed8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml @@ -0,0 +1,76 @@ + + + + + + configurableProduct::Stellar_Solar_Jacket_SIZE_S + configurableProduct::Stellar_Solar_Jacket_SIZE_M + configurableProduct::Stellar_Solar_Jacket_SIZE_L + 2 + Catalog Price Rule %isolation% + Active + Main Website + NOT LOGGED IN + [Attribute|%attribute_id%|is|%attribute_value%] + Apply as fixed amount + 0.55 + 224.45 + 239.45 + 74.45 + 75 + No + 74.45 + 75 + No + 74.45 + 74.45 + No + Flat Rate + Fixed + UK_address + checkmo + + + + + configurableProduct::first_product_with_custom_option_1 + configurableProduct::first_product_with_custom_option_2 + configurableProduct::second_product_with_custom_option_1 + configurableProduct::second_product_with_custom_option_2 + customer_US + default + NOT LOGGED IN + CatalogPriceRule %isolation% + Active + Main Website + Apply as fixed amount + Yes + 5 + 382 + 402 + 15.01 + 86.99 + No + 15.01 + 163.99 + No + 15.01 + 27.01 + No + 15.01 + 104.01 + No + Flat Rate + Fixed + UK_address + checkmo + + + + + From 43cb136f5faa0683ea794d1dffe60e8aa3f597a3 Mon Sep 17 00:00:00 2001 From: Vitali Kirychenka Date: Mon, 14 Nov 2016 15:22:19 +0300 Subject: [PATCH 1800/3232] MTO-44: [Variation] Create disabled store view - Variation implemented --- .../AssertStoreDisabledErrorSaveMessage.php | 46 +++++++++++++++++++ .../Test/TestCase/CreateStoreEntityTest.xml | 7 +++ 2 files changed, 53 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreDisabledErrorSaveMessage.php diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreDisabledErrorSaveMessage.php b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreDisabledErrorSaveMessage.php new file mode 100644 index 0000000000000..ed74a913b247e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Constraint/AssertStoreDisabledErrorSaveMessage.php @@ -0,0 +1,46 @@ +getMessagesBlock()->getErrorMessage(), + 'Wrong error message is displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store View disabled error create message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml index 26d9aa9beba0a..c3c1afacfb075 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml @@ -50,5 +50,12 @@ + + custom_new_group + store_name_%isolation% + storecode_%isolation% + Disabled + + From f2afc3b817461cdce626901e9f2a72ee382d2c44 Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Mon, 14 Nov 2016 15:19:11 +0200 Subject: [PATCH 1801/3232] MAGETWO-48516: Most of category fields don't have Use Default Value option in Store/StoreView scope on the redesigned category page --- app/code/Magento/Catalog/Model/Category/DataProvider.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index 5646eec60700e..a2935d502d856 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -200,8 +200,7 @@ private function addUseDefaultValueCheckbox(Category $category, array $meta) if ( !$attributePath || !$canDisplayUseDefault - || in_array($attributeCode, $this->elementsWithUseConfigSetting - ) + || in_array($attributeCode, $this->elementsWithUseConfigSetting) ) { continue; } From 4aa3ccfddf0b722ee3a448cd14a70a9449855863 Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko Date: Mon, 14 Nov 2016 15:30:00 +0200 Subject: [PATCH 1802/3232] MAGETWO-60572: [GitHub] PayPal.js error on checkout downloadable product #7000 - static tests fix --- .../TestStep/PlaceOrderWithPaypalStep.php | 40 +------------------ .../Checkout/Test/Block/Onepage/Login.php | 3 +- .../TestStep/SelectCheckoutMethodStep.php | 16 +++++++- 3 files changed, 18 insertions(+), 41 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php index cae85fea49c45..d61e2fff6337a 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php @@ -10,7 +10,6 @@ use Magento\Checkout\Test\Page\CheckoutOnepage; use Magento\Checkout\Test\Page\CheckoutOnepageSuccess; use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\TestStep\TestStepInterface; /** @@ -53,39 +52,14 @@ class PlaceOrderWithPaypalStep implements TestStepInterface */ private $products; - /** - * Customer fixture. - * - * @var Customer - */ - protected $customer; - - /** - * Checkout method. - * - * @var string - */ - protected $checkoutMethod; - - /** - * Shipping carrier and method. - * - * @var array - */ - protected $shipping; - /** * @param CheckoutOnepage $checkoutOnepage * @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview * @param AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment * @param CheckoutOnepageSuccess $checkoutOnepageSuccess * @param FixtureFactory $fixtureFactory - * @param Customer $customer - * @param string $checkoutMethod * @param array $products * @param array $prices - * @param array $shipping - * */ public function __construct( CheckoutOnepage $checkoutOnepage, @@ -93,24 +67,16 @@ public function __construct( AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment, CheckoutOnepageSuccess $checkoutOnepageSuccess, FixtureFactory $fixtureFactory, - Customer $customer = null, - $checkoutMethod, - array $products, - array $prices = [], - array $shipping = [] - + array $prices = [] ) { $this->checkoutOnepage = $checkoutOnepage; $this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview; $this->assertBillingAddressAbsentInPayment = $assertBillingAddressAbsentInPayment; $this->checkoutOnepageSuccess = $checkoutOnepageSuccess; $this->fixtureFactory = $fixtureFactory; - $this->customer = $customer; - $this->checkoutMethod = $checkoutMethod; $this->products = $products; $this->prices = $prices; - $this->shipping = $shipping; } /** @@ -124,10 +90,6 @@ public function run() $this->assertBillingAddressAbsentInPayment->processAssert($this->checkoutOnepage); - if ($this->checkoutMethod === 'guest' && empty($this->shipping)) { - $this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer); - } - $parentWindow = $this->checkoutOnepage->getPaymentBlock() ->getSelectedPaymentMethodBlock() ->clickPayWithPaypal(); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php index fe1eda337581a..49b900e4eedce 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php @@ -99,7 +99,8 @@ public function loginCustomer(FixtureInterface $customer) public function fillGuestFields(FixtureInterface $customer) { $mapping = $this->dataMapping(); - $this->_rootElement->find($mapping['email']['selector'], $mapping['email']['strategy'])->setValue($customer->getEmail()); + $this->_rootElement->find($mapping['email']['selector'], $mapping['email']['strategy']) + ->setValue($customer->getEmail()); } /** diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php index 444b98adb7f83..eef5f2fbdd03a 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php @@ -51,6 +51,13 @@ class SelectCheckoutMethodStep implements TestStepInterface */ private $clickProceedToCheckoutStep; + /** + * Shipping carrier and method. + * + * @var array + */ + protected $shipping; + /** * @constructor * @param CheckoutOnepage $checkoutOnepage @@ -58,19 +65,22 @@ class SelectCheckoutMethodStep implements TestStepInterface * @param LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend * @param ClickProceedToCheckoutStep $clickProceedToCheckoutStep * @param string $checkoutMethod + * @param array $shipping */ public function __construct( CheckoutOnepage $checkoutOnepage, Customer $customer, LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend, ClickProceedToCheckoutStep $clickProceedToCheckoutStep, - $checkoutMethod + $checkoutMethod, + array $shipping = [] ) { $this->checkoutOnepage = $checkoutOnepage; $this->customer = $customer; $this->logoutCustomerOnFrontend = $logoutCustomerOnFrontend; $this->clickProceedToCheckoutStep = $clickProceedToCheckoutStep; $this->checkoutMethod = $checkoutMethod; + $this->shipping = $shipping; } /** @@ -87,6 +97,10 @@ public function run() } else { $this->checkoutOnepage->getLoginBlock()->loginCustomer($this->customer); } + } elseif ($this->checkoutMethod === 'guest') { + if (empty($this->shipping)) { + $this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer); + } } } From f0ece548b96fad7539f849b9dd0385175c67b67f Mon Sep 17 00:00:00 2001 From: Vitaliy Goncharenko Date: Mon, 14 Nov 2016 16:27:10 +0200 Subject: [PATCH 1803/3232] MAGETWO-60283: Prices of configurable product are incorrectly recalculated when display currency is changed - fixed static build --- .../Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php | 3 ++- .../Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php index fdbdcc0180e4d..6f3cfc48cdd55 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php @@ -56,7 +56,8 @@ public function processAssert( * @param string $price * @param string $currency [optional] */ - public function assertPrice(CatalogProductView $view, $price, $currency = '') { + public function assertPrice(CatalogProductView $view, $price, $currency = '') + { \PHPUnit_Framework_Assert::assertEquals( $price, $view->getViewBlock()->getPriceBlock()->getPrice($currency), diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php b/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php index d8a2438e00c16..4b8f3825df8ba 100644 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Directory/Test/Constraint/AssertCurrencyRateAppliedOnProductPage.php @@ -41,7 +41,8 @@ public function processAssert( * @param string $price * @param string $currency [optional] */ - public function assertPrice(CatalogProductView $view, $price, $currency = '') { + public function assertPrice(CatalogProductView $view, $price, $currency = '') + { \PHPUnit_Framework_Assert::assertEquals( $price, $view->getViewBlock()->getPriceBlock()->getPrice($currency), From 2ac106984df40571fef6bda7eca0202ab78b77fc Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Mon, 14 Nov 2016 17:58:34 +0300 Subject: [PATCH 1804/3232] MTO-17: [Variation] Add variation to check catalog price rule for configurable product - Fixed bugs. --- .../Magento/Catalog/Test/Repository/CatalogProductSimple.xml | 4 ++-- .../CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml | 1 - .../Test/Repository/ConfigurableProduct.xml | 3 --- .../ConfigurableProduct/ConfigurableAttributesData.xml | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index bcf6f7c510199..e9e098ec47ac0 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -1493,7 +1493,7 @@ - + default @@ -1523,7 +1523,7 @@ - + default diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml index ef66c59050289..536335740785e 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml @@ -114,7 +114,6 @@ - catalogProductSimple::no_custom_options catalogProductSimple::with_default_custom_option catalogProductSimple::with_fixed_custom_option catalogProductSimple::with_percent_custom_option diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml index 5e491f225ae94..579832dc3ea58 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml @@ -715,9 +715,6 @@ default - configurable_the_first_option diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml index 1f7d6be789a68..dbc9e0a8e7ff9 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/ConfigurableAttributesData.xml @@ -461,8 +461,8 @@ catalogProductAttribute::attribute_type_dropdown_two_options - catalogProductSimple::product_79_99 - catalogProductSimple::product_20_01 + catalogProductSimple::product_with_price_79_99 + catalogProductSimple::product_with_price_20_01 From fa750cfdf3a14bd64157fc37e7b2743349217f79 Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Mon, 14 Nov 2016 18:42:57 +0300 Subject: [PATCH 1805/3232] MTO-17: [Variation] Add variation to check catalog price rule for configurable product - Refactoring. --- .../ApplyConfigurableProductCatalogPriceRulesTest.php | 7 +++---- .../ApplyConfigurableProductCatalogPriceRulesTest.xml | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) rename dev/tests/functional/tests/app/Magento/{ConfigurableProduct => CatalogRuleConfigurable}/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php (91%) rename dev/tests/functional/tests/app/Magento/{ConfigurableProduct => CatalogRuleConfigurable}/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml (96%) diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php b/dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php similarity index 91% rename from dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php rename to dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php index 13d1568c90d53..5ba099e009d0a 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php @@ -4,10 +4,9 @@ * See COPYING.txt for license details. */ -namespace Magento\ConfigurableProduct\Test\TestCase; +namespace Magento\CatalogRuleConfigurable\Test\TestCase; use Magento\CatalogRule\Test\TestCase\ApplyCatalogPriceRulesTest; - use Magento\CatalogRule\Test\Fixture\CatalogRule; use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Util\Command\Cli\Cron; @@ -23,10 +22,10 @@ * * Steps: * 1. Apply all created rules. - * 2. Create simple product. + * 2. Create configurable product. * 3. Perform all assertions. * - * @group Catalog_Price_Rules + * @group Catalog_Rule_Configurable * @ZephyrId MAGETWO-24780 */ class ApplyConfigurableProductCatalogPriceRulesTest extends ApplyCatalogPriceRulesTest diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml similarity index 96% rename from dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml rename to dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml index 719fb10303ed8..5137f16ea3813 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.xml @@ -1,12 +1,12 @@ - + configurableProduct::Stellar_Solar_Jacket_SIZE_S configurableProduct::Stellar_Solar_Jacket_SIZE_M From 15fdb0ef0695b8a5cce1df324008f902746739e6 Mon Sep 17 00:00:00 2001 From: Oleh Posyniak Date: Mon, 14 Nov 2016 17:53:37 +0200 Subject: [PATCH 1806/3232] MAGETWO-48516: Most of category fields don't have Use Default Value option in Store/StoreView scope on the redesigned category page --- app/code/Magento/Catalog/Model/Category/DataProvider.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category/DataProvider.php b/app/code/Magento/Catalog/Model/Category/DataProvider.php index a2935d502d856..8aa7216a6b639 100644 --- a/app/code/Magento/Catalog/Model/Category/DataProvider.php +++ b/app/code/Magento/Catalog/Model/Category/DataProvider.php @@ -176,8 +176,13 @@ public function getMeta() { $meta = parent::getMeta(); $meta = $this->prepareMeta($meta); - $meta = $this->addUseDefaultValueCheckbox($this->getCurrentCategory(), $meta); - $meta = $this->resolveParentInheritance($this->getCurrentCategory(), $meta); + + $category = $this->getCurrentCategory(); + + if ($category) { + $meta = $this->addUseDefaultValueCheckbox($category, $meta); + $meta = $this->resolveParentInheritance($category, $meta); + } return $meta; } From a47090b2314da613036071cf2664744640e08125 Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Mon, 14 Nov 2016 19:37:34 +0300 Subject: [PATCH 1807/3232] MTO-17: [Variation] Add variation to check catalog price rule for configurable product - Refactoring, fixed bugs. --- .../Test/TestCase/ApplyCatalogPriceRulesTest.php | 6 ++++-- .../Test/TestCase/ApplyCatalogPriceRulesTest.xml | 4 ++-- ...plyConfigurableProductCatalogPriceRulesTest.php | 14 +++++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php index ffc31f3a5a381..79783c06cfb29 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.php @@ -7,7 +7,6 @@ namespace Magento\CatalogRule\Test\TestCase; use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct; use Magento\CatalogRule\Test\Fixture\CatalogRule; use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Util\Command\Cli\Cron; @@ -102,12 +101,15 @@ protected function prepareCondition(FixtureInterface $product, array $catalogPri { $conditionEntity = explode('|', trim($catalogPriceRule['data']['rule'], '[]'))[0]; $actionName = 'get' . $conditionEntity; - if (method_exists(__CLASS__, $actionName)) { + if (method_exists($this, $actionName)) { $result = $this->$actionName($product); foreach ($result as $key => $value) { $catalogPriceRule['data']['rule'] = str_replace($key, $value, $catalogPriceRule['data']['rule']); } return $catalogPriceRule; + } else { + $message = sprintf('Method "%s" does not exist in %s', $actionName, get_class($this)); + throw new \BadMethodCallException($message); } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml index 536335740785e..98fd364cbc34a 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplyCatalogPriceRulesTest.xml @@ -1,9 +1,9 @@ diff --git a/dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php b/dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php index 5ba099e009d0a..8a6d50d5dbcbc 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRuleConfigurable/Test/TestCase/ApplyConfigurableProductCatalogPriceRulesTest.php @@ -38,10 +38,14 @@ class ApplyConfigurableProductCatalogPriceRulesTest extends ApplyCatalogPriceRul */ protected function getAttribute(FixtureInterface $product) { - $attributes = $product->getDataFieldConfig('configurable_attributes_data')['source'] - ->getAttributesData()['attribute_key_0']; - $result['%attribute_id%'] = $attributes['attribute_code']; - $result['%attribute_value%'] = $attributes['options']['option_key_' . $this->promo]['id']; - return $result; + if ($product->hasData('configurable_attributes_data')) { + $attributes = $product->getDataFieldConfig('configurable_attributes_data')['source'] + ->getAttributesData()['attribute_key_0']; + $result['%attribute_id%'] = $attributes['attribute_code']; + $result['%attribute_value%'] = $attributes['options']['option_key_' . $this->promo]['id']; + return $result; + } else { + parent::getAttribute($product); + } } } From 050bd3ac8f5bdd33ffea0cc65f0f96c34abc6007 Mon Sep 17 00:00:00 2001 From: Ruslan Kostiv Date: Mon, 14 Nov 2016 18:49:37 +0200 Subject: [PATCH 1808/3232] MAGETWO-60962: New attribute is not visible when create new address --- .../frontend/web/template/billing-address/details.html | 7 ++++++- .../shipping-address/address-renderer/default.html | 7 ++++++- .../shipping-information/address-renderer/default.html | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html index da625c51d4b77..798be1f978f54 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html @@ -15,7 +15,12 @@
    - + + + + + +
    -
    \ No newline at end of file +
    diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal/vault.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal/vault.html index eef06f048cdc1..28cd3ebb2f2d1 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal/vault.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/paypal/vault.html @@ -1,6 +1,6 @@ @@ -44,4 +44,4 @@
    -
    \ No newline at end of file + diff --git a/app/code/Magento/Bundle/Api/Data/BundleOptionInterface.php b/app/code/Magento/Bundle/Api/Data/BundleOptionInterface.php index a10d131c000ce..5ef6c2971b18b 100644 --- a/app/code/Magento/Bundle/Api/Data/BundleOptionInterface.php +++ b/app/code/Magento/Bundle/Api/Data/BundleOptionInterface.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Bundle/etc/adminhtml/events.xml b/app/code/Magento/Bundle/etc/adminhtml/events.xml index 3e1de66c1fdd3..cd8af005694ea 100644 --- a/app/code/Magento/Bundle/etc/adminhtml/events.xml +++ b/app/code/Magento/Bundle/etc/adminhtml/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/adminhtml/routes.xml b/app/code/Magento/Bundle/etc/adminhtml/routes.xml index e140d1b6875a4..d2e7c9c3b20f9 100644 --- a/app/code/Magento/Bundle/etc/adminhtml/routes.xml +++ b/app/code/Magento/Bundle/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/catalog_attributes.xml b/app/code/Magento/Bundle/etc/catalog_attributes.xml index 832ba71237c0b..8c45aaab6c46f 100644 --- a/app/code/Magento/Bundle/etc/catalog_attributes.xml +++ b/app/code/Magento/Bundle/etc/catalog_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/config.xml b/app/code/Magento/Bundle/etc/config.xml index abaed7a879f2b..0016210cd149d 100644 --- a/app/code/Magento/Bundle/etc/config.xml +++ b/app/code/Magento/Bundle/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml index 3425b9323ed4d..6afd212e1b82b 100644 --- a/app/code/Magento/Bundle/etc/di.xml +++ b/app/code/Magento/Bundle/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/extension_attributes.xml b/app/code/Magento/Bundle/etc/extension_attributes.xml index 3819e892e6ff1..d23dfc71b39fc 100644 --- a/app/code/Magento/Bundle/etc/extension_attributes.xml +++ b/app/code/Magento/Bundle/etc/extension_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/frontend/di.xml b/app/code/Magento/Bundle/etc/frontend/di.xml index acaf67ac82e5e..084f681df7e03 100644 --- a/app/code/Magento/Bundle/etc/frontend/di.xml +++ b/app/code/Magento/Bundle/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/frontend/events.xml b/app/code/Magento/Bundle/etc/frontend/events.xml index ce21acda965de..d08cdb4bcc997 100644 --- a/app/code/Magento/Bundle/etc/frontend/events.xml +++ b/app/code/Magento/Bundle/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index 34a88d4447cc3..878af07761b42 100644 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/pdf.xml b/app/code/Magento/Bundle/etc/pdf.xml index 085e7946cb7d6..912aa1426efa1 100644 --- a/app/code/Magento/Bundle/etc/pdf.xml +++ b/app/code/Magento/Bundle/etc/pdf.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/product_types.xml b/app/code/Magento/Bundle/etc/product_types.xml index c3f909afbeabe..6168189a3b4e3 100644 --- a/app/code/Magento/Bundle/etc/product_types.xml +++ b/app/code/Magento/Bundle/etc/product_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/sales.xml b/app/code/Magento/Bundle/etc/sales.xml index 74e5647051dec..3094eb6bfecfa 100644 --- a/app/code/Magento/Bundle/etc/sales.xml +++ b/app/code/Magento/Bundle/etc/sales.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/webapi.xml b/app/code/Magento/Bundle/etc/webapi.xml index 6e31986be7b8f..69124309687a3 100644 --- a/app/code/Magento/Bundle/etc/webapi.xml +++ b/app/code/Magento/Bundle/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/webapi_rest/di.xml b/app/code/Magento/Bundle/etc/webapi_rest/di.xml index acaf67ac82e5e..084f681df7e03 100644 --- a/app/code/Magento/Bundle/etc/webapi_rest/di.xml +++ b/app/code/Magento/Bundle/etc/webapi_rest/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/etc/webapi_soap/di.xml b/app/code/Magento/Bundle/etc/webapi_soap/di.xml index acaf67ac82e5e..084f681df7e03 100644 --- a/app/code/Magento/Bundle/etc/webapi_soap/di.xml +++ b/app/code/Magento/Bundle/etc/webapi_soap/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/registration.php b/app/code/Magento/Bundle/registration.php index 48ae2414286eb..53f3657ae0519 100644 --- a/app/code/Magento/Bundle/registration.php +++ b/app/code/Magento/Bundle/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml index 34975692a948b..6b97971a0ee51 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/adminhtml_order_shipment_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_bundle.xml b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_bundle.xml index 14ab43a776bbb..d0fdb184355d7 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_bundle.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_bundle.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_new.xml index 251a2ddd68af6..a496ea7538923 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_view_type_bundle.xml b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_view_type_bundle.xml index 370ef3cf8afca..15374cb987d36 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_view_type_bundle.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/catalog_product_view_type_bundle.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml b/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml index b7a0c9d03e16e..7e37070109921 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/customer_index_wishlist.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_new.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_new.xml index f3962e20d4435..99fdab5a7e9f4 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_new.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml index f3962e20d4435..99fdab5a7e9f4 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_view.xml index 5f2c852416e04..323aba1d186e6 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_view.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_creditmemo_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_new.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_new.xml index 9b37d8286fdcb..b03ce7a9cb451 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_new.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_updateqty.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_updateqty.xml index 9b37d8286fdcb..b03ce7a9cb451 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_updateqty.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_updateqty.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_view.xml index 752031796631f..34c3470cf06a7 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_view.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_invoice_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_view.xml index 2c6a8fe93caa9..62f0305194fa9 100644 --- a/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_view.xml +++ b/app/code/Magento/Bundle/view/adminhtml/layout/sales_order_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml index 0dff5ef370825..84e87afd48180 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml index 8fddd0798f7b4..41923c4826432 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css b/app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css index 3503d6050e777..d5aed8a7d652e 100644 --- a/app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css +++ b/app/code/Magento/Bundle/view/adminhtml/web/css/bundle-product.css @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js index a4e47177bdf22..53b08e43614a0 100644 --- a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true jquery:true*/ diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js index 12dda7d3a148c..7f4a57cb530da 100644 --- a/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/bundle-type-handler.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true jquery:true expr:true*/ diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js index b7a05076ae268..9c2432bade43f 100644 --- a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-checkbox.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js index e9a924e1cffe6..6265394cf38e3 100644 --- a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js index b36d8003a399f..4bbd1b3e4da20 100644 --- a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js index 14dd426ed02aa..cee0489cc901a 100644 --- a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-input-type.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js index b5c1d61d41f20..d5be0a19b597d 100644 --- a/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js +++ b/app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Bundle/view/base/layout/catalog_product_prices.xml b/app/code/Magento/Bundle/view/base/layout/catalog_product_prices.xml index 92d76cdfaa580..5f7d22ba2650b 100644 --- a/app/code/Magento/Bundle/view/base/layout/catalog_product_prices.xml +++ b/app/code/Magento/Bundle/view/base/layout/catalog_product_prices.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml b/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml index 4c11b0ba1fe50..efd75677d3061 100644 --- a/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml index e31437ec63963..fedd29f952b02 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml index e7128e45ddc7b..adb1b2911983b 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml index c5d613183e640..9abf0a4018980 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml index 09a27341fd5da..ddede2340995b 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/default.xml b/app/code/Magento/Bundle/view/frontend/layout/default.xml index a54d4b652b685..cb14616af5980 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/default.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml index 4db5f73f55bc5..991011db9fa08 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml index 1dba5769c0207..0e32c9fd9e816 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml index 6e1b90abf4d4e..927214fbcc174 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml index 7846245018a74..7463caa738083 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml index 7896e92bd34f4..c94b4957d267b 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml index 850e546a93a5a..d07959385bd9f 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml index 317b142514b9d..fb26de5bc2fdd 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml index dc5fb238dfd77..8c328c87a5c65 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml index 450f18d863ab5..57e39795df7da 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml index c4741ad6119f5..510168ac55e8a 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml index e3c91f1da5c20..f46b6260f3bd8 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml index ce42a5466cf06..536953423a3f2 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Bundle/view/frontend/requirejs-config.js b/app/code/Magento/Bundle/view/frontend/requirejs-config.js index 9dd12524124a6..51ab4cab6bb2c 100644 --- a/app/code/Magento/Bundle/view/frontend/requirejs-config.js +++ b/app/code/Magento/Bundle/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -12,4 +12,4 @@ var config = { productSummary: 'Magento_Bundle/js/product-summary' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml index ddb483cf0220d..86cd52b6dc6fd 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/backbutton.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml index e72be96db1ab0..e3538ebd6caea 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/customize.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml index cb1de4e05e8a4..0fc7e6f9c8f06 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/BundleImportExport/etc/export.xml b/app/code/Magento/BundleImportExport/etc/export.xml index 04312d79f0260..c7fd951bfab53 100644 --- a/app/code/Magento/BundleImportExport/etc/export.xml +++ b/app/code/Magento/BundleImportExport/etc/export.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/BundleImportExport/etc/import.xml b/app/code/Magento/BundleImportExport/etc/import.xml index 2c23489002b1f..8daa5296a8c39 100644 --- a/app/code/Magento/BundleImportExport/etc/import.xml +++ b/app/code/Magento/BundleImportExport/etc/import.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/BundleImportExport/etc/module.xml b/app/code/Magento/BundleImportExport/etc/module.xml index d042b3bc7eb79..64f2c06b3c770 100644 --- a/app/code/Magento/BundleImportExport/etc/module.xml +++ b/app/code/Magento/BundleImportExport/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/BundleImportExport/registration.php b/app/code/Magento/BundleImportExport/registration.php index b417e7d20b79e..b4f80e749f130 100644 --- a/app/code/Magento/BundleImportExport/registration.php +++ b/app/code/Magento/BundleImportExport/registration.php @@ -1,6 +1,6 @@ @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/CacheInvalidate/etc/module.xml b/app/code/Magento/CacheInvalidate/etc/module.xml index 7cc9d59df5959..b3277477fb62d 100644 --- a/app/code/Magento/CacheInvalidate/etc/module.xml +++ b/app/code/Magento/CacheInvalidate/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CacheInvalidate/registration.php b/app/code/Magento/CacheInvalidate/registration.php index 21f5baf8f333c..00ddee3f6776b 100644 --- a/app/code/Magento/CacheInvalidate/registration.php +++ b/app/code/Magento/CacheInvalidate/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Captcha/etc/adminhtml/events.xml b/app/code/Magento/Captcha/etc/adminhtml/events.xml index 984e5e9e29f4e..7fcadbfd8f2ff 100644 --- a/app/code/Magento/Captcha/etc/adminhtml/events.xml +++ b/app/code/Magento/Captcha/etc/adminhtml/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/adminhtml/routes.xml b/app/code/Magento/Captcha/etc/adminhtml/routes.xml index e06b87beef772..6b6b6717c489a 100644 --- a/app/code/Magento/Captcha/etc/adminhtml/routes.xml +++ b/app/code/Magento/Captcha/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/adminhtml/system.xml b/app/code/Magento/Captcha/etc/adminhtml/system.xml index dc4c737597cce..88f0ae27f91c7 100644 --- a/app/code/Magento/Captcha/etc/adminhtml/system.xml +++ b/app/code/Magento/Captcha/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/config.xml b/app/code/Magento/Captcha/etc/config.xml index a068485910a77..d969626d73144 100644 --- a/app/code/Magento/Captcha/etc/config.xml +++ b/app/code/Magento/Captcha/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/crontab.xml b/app/code/Magento/Captcha/etc/crontab.xml index 846a15cbdbec6..d3d6e30e1a03a 100644 --- a/app/code/Magento/Captcha/etc/crontab.xml +++ b/app/code/Magento/Captcha/etc/crontab.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/crontab/di.xml b/app/code/Magento/Captcha/etc/crontab/di.xml index fd57ded2fb92b..f3086b469842b 100644 --- a/app/code/Magento/Captcha/etc/crontab/di.xml +++ b/app/code/Magento/Captcha/etc/crontab/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/di.xml b/app/code/Magento/Captcha/etc/di.xml index 0bb7660f27a6b..db624420ba647 100644 --- a/app/code/Magento/Captcha/etc/di.xml +++ b/app/code/Magento/Captcha/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/events.xml b/app/code/Magento/Captcha/etc/events.xml index 274058ec98e82..4223c4a2a3256 100644 --- a/app/code/Magento/Captcha/etc/events.xml +++ b/app/code/Magento/Captcha/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/frontend/di.xml b/app/code/Magento/Captcha/etc/frontend/di.xml index d15f8d5914998..209f9beb71a04 100644 --- a/app/code/Magento/Captcha/etc/frontend/di.xml +++ b/app/code/Magento/Captcha/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/frontend/events.xml b/app/code/Magento/Captcha/etc/frontend/events.xml index e1441f0311ee8..dfa0d1b428557 100644 --- a/app/code/Magento/Captcha/etc/frontend/events.xml +++ b/app/code/Magento/Captcha/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/etc/frontend/routes.xml b/app/code/Magento/Captcha/etc/frontend/routes.xml index 255f4551daf5d..d4bbe64821a91 100644 --- a/app/code/Magento/Captcha/etc/frontend/routes.xml +++ b/app/code/Magento/Captcha/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Captcha/etc/module.xml b/app/code/Magento/Captcha/etc/module.xml index 1703142e54133..698604928afb6 100644 --- a/app/code/Magento/Captcha/etc/module.xml +++ b/app/code/Magento/Captcha/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/registration.php b/app/code/Magento/Captcha/registration.php index a8fce947e6697..488ac412a8926 100644 --- a/app/code/Magento/Captcha/registration.php +++ b/app/code/Magento/Captcha/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Captcha/view/adminhtml/layout/adminhtml_auth_login.xml b/app/code/Magento/Captcha/view/adminhtml/layout/adminhtml_auth_login.xml index 3cb5ffbbf5ae3..8c093257f1790 100644 --- a/app/code/Magento/Captcha/view/adminhtml/layout/adminhtml_auth_login.xml +++ b/app/code/Magento/Captcha/view/adminhtml/layout/adminhtml_auth_login.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml b/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml index 1246f1f4f5df5..37d2ed6fe1238 100644 --- a/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml +++ b/app/code/Magento/Captcha/view/adminhtml/templates/default.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml b/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml index 9e31eea8aaeba..1460d8fac6974 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/contact_index_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml index 573af66d5bd31..cd72cc5857b83 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_edit.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_edit.xml index 875479c49954c..9700e88006f10 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_edit.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml index dc92c7c3548bc..1f25fa040b591 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml index bcabf0adccc26..3a24e44fd1afe 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/view/frontend/layout/default.xml b/app/code/Magento/Captcha/view/frontend/layout/default.xml index 9d6a234514855..43a770c54c0ca 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/default.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Captcha/view/frontend/requirejs-config.js b/app/code/Magento/Captcha/view/frontend/requirejs-config.js index 72f7d627b8707..ff1d9f1acc7b1 100644 --- a/app/code/Magento/Captcha/view/frontend/requirejs-config.js +++ b/app/code/Magento/Captcha/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -9,4 +9,4 @@ var config = { captcha: 'Magento_Captcha/captcha' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/Captcha/view/frontend/templates/default.phtml b/app/code/Magento/Captcha/view/frontend/templates/default.phtml index 92c008a0e186a..e028ea19fa8b4 100644 --- a/app/code/Magento/Captcha/view/frontend/templates/default.phtml +++ b/app/code/Magento/Captcha/view/frontend/templates/default.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/Api/AttributeSetFinderInterface.php b/app/code/Magento/Catalog/Api/AttributeSetFinderInterface.php index 4dabce697b30f..c7df36623ff83 100644 --- a/app/code/Magento/Catalog/Api/AttributeSetFinderInterface.php +++ b/app/code/Magento/Catalog/Api/AttributeSetFinderInterface.php @@ -1,7 +1,7 @@ - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Catalog\Model\Product\Attribute; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Management.php b/app/code/Magento/Catalog/Model/Product/Attribute/Management.php index fa9b2ddee3cfe..4529b61147402 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Management.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Management.php @@ -1,7 +1,7 @@ - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Catalog\Model\Product\Attribute; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php index 7e7234d1ebbf8..d3bd12f804a14 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php @@ -1,7 +1,7 @@ ['test_attribute'], 'group_two' => ['attribute_one', 'attribute_two']]; diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_merged.xml b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_merged.xml index 131fe397f2e6b..813e9d64af710 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_merged.xml +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_merged.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_one.xml b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_one.xml index 3e11d226e6af4..3fe4cc449c51d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_one.xml +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_one.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_two.xml b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_two.xml index 772a85eafe95e..718895e7117fb 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_two.xml +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/Config/_files/attributes_config_two.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/ConfigTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/ConfigTest.php index 358a5ed67e63d..64a26b7cd8664 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Attribute/ConfigTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Attribute/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/product_options_valid.xml b/app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/product_options_valid.xml index 093521a0b7a49..5f418c4b177ad 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/product_options_valid.xml +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/product_options_valid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index 8c08d0c63bc5e..a3f2372d48590 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types.xml b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types.xml index 525beaf93c6e9..dc5284d1e5405 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types.xml +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml index 96a8c06c1db2a..724203272620b 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/valid_product_types_merged.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/ConfigTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/ConfigTest.php index 852eb11c5cfb9..64b8b05b5755d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/ConfigTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/Test/Unit/Observer/MenuCategoryDataTest.php b/app/code/Magento/Catalog/Test/Unit/Observer/MenuCategoryDataTest.php index fde1c74bc5ae5..a935861a263e1 100644 --- a/app/code/Magento/Catalog/Test/Unit/Observer/MenuCategoryDataTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Observer/MenuCategoryDataTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/etc/adminhtml/di.xml b/app/code/Magento/Catalog/etc/adminhtml/di.xml index d6ecaa7c40391..fc59b5bbe6c19 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/di.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/adminhtml/events.xml b/app/code/Magento/Catalog/etc/adminhtml/events.xml index a77e1e741a4be..034204feff5c9 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/events.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/adminhtml/menu.xml b/app/code/Magento/Catalog/etc/adminhtml/menu.xml index d0f15c930e6d2..ee0d1ec5c4117 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/menu.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/adminhtml/routes.xml b/app/code/Magento/Catalog/etc/adminhtml/routes.xml index 8dac88c2a22cd..5deeddb3bb4bd 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/routes.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 85949a953fc53..c5a1b3686fbe5 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/catalog_attributes.xml b/app/code/Magento/Catalog/etc/catalog_attributes.xml index d822d36eabfee..650652aa94555 100644 --- a/app/code/Magento/Catalog/etc/catalog_attributes.xml +++ b/app/code/Magento/Catalog/etc/catalog_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/catalog_attributes.xsd b/app/code/Magento/Catalog/etc/catalog_attributes.xsd index 00384d783eff1..d95d5a17c258e 100644 --- a/app/code/Magento/Catalog/etc/catalog_attributes.xsd +++ b/app/code/Magento/Catalog/etc/catalog_attributes.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/config.xml b/app/code/Magento/Catalog/etc/config.xml index a86b005be2857..4a8a523e0d55c 100644 --- a/app/code/Magento/Catalog/etc/config.xml +++ b/app/code/Magento/Catalog/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/crontab.xml b/app/code/Magento/Catalog/etc/crontab.xml index 2288ed4ebd8a8..b3fd1d2f5615c 100644 --- a/app/code/Magento/Catalog/etc/crontab.xml +++ b/app/code/Magento/Catalog/etc/crontab.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 0142f7c2f2618..83f194bc9a2b5 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/eav_attributes.xml b/app/code/Magento/Catalog/etc/eav_attributes.xml index c480ea4dd2322..133849a28e048 100644 --- a/app/code/Magento/Catalog/etc/eav_attributes.xml +++ b/app/code/Magento/Catalog/etc/eav_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/events.xml b/app/code/Magento/Catalog/etc/events.xml index 544abf6b9e069..a495a47fe9da0 100644 --- a/app/code/Magento/Catalog/etc/events.xml +++ b/app/code/Magento/Catalog/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/extension_attributes.xml b/app/code/Magento/Catalog/etc/extension_attributes.xml index 509c3240bb6c8..3136b3df67274 100644 --- a/app/code/Magento/Catalog/etc/extension_attributes.xml +++ b/app/code/Magento/Catalog/etc/extension_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/frontend/di.xml b/app/code/Magento/Catalog/etc/frontend/di.xml index ac8c3693e8f30..ca1e1e244f49c 100644 --- a/app/code/Magento/Catalog/etc/frontend/di.xml +++ b/app/code/Magento/Catalog/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/frontend/events.xml b/app/code/Magento/Catalog/etc/frontend/events.xml index 5ef8c72468314..dd225750f73be 100644 --- a/app/code/Magento/Catalog/etc/frontend/events.xml +++ b/app/code/Magento/Catalog/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/frontend/page_types.xml b/app/code/Magento/Catalog/etc/frontend/page_types.xml index 2557d79a1a49b..8f929046afeef 100644 --- a/app/code/Magento/Catalog/etc/frontend/page_types.xml +++ b/app/code/Magento/Catalog/etc/frontend/page_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/frontend/routes.xml b/app/code/Magento/Catalog/etc/frontend/routes.xml index 5adaf604c51d5..d4d52559673d6 100644 --- a/app/code/Magento/Catalog/etc/frontend/routes.xml +++ b/app/code/Magento/Catalog/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Catalog/etc/frontend/sections.xml b/app/code/Magento/Catalog/etc/frontend/sections.xml index 7c36594283640..0bc9c63494b33 100644 --- a/app/code/Magento/Catalog/etc/frontend/sections.xml +++ b/app/code/Magento/Catalog/etc/frontend/sections.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/indexer.xml b/app/code/Magento/Catalog/etc/indexer.xml index 88e6da345c393..5c2ca91e525d9 100644 --- a/app/code/Magento/Catalog/etc/indexer.xml +++ b/app/code/Magento/Catalog/etc/indexer.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index 0c9e6bb356fe1..fc5225bc350fc 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/mview.xml b/app/code/Magento/Catalog/etc/mview.xml index d6614e837dde3..4600bb7fad370 100644 --- a/app/code/Magento/Catalog/etc/mview.xml +++ b/app/code/Magento/Catalog/etc/mview.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/product_options.xml b/app/code/Magento/Catalog/etc/product_options.xml index 48d62d0c2c0ad..43bf4865cb49e 100644 --- a/app/code/Magento/Catalog/etc/product_options.xml +++ b/app/code/Magento/Catalog/etc/product_options.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/product_options.xsd b/app/code/Magento/Catalog/etc/product_options.xsd index a6bcb74ac2894..18b5934c1410f 100644 --- a/app/code/Magento/Catalog/etc/product_options.xsd +++ b/app/code/Magento/Catalog/etc/product_options.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/product_options_merged.xsd b/app/code/Magento/Catalog/etc/product_options_merged.xsd index 2a5951c57787d..7b9e6fa2650ec 100644 --- a/app/code/Magento/Catalog/etc/product_options_merged.xsd +++ b/app/code/Magento/Catalog/etc/product_options_merged.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/product_types.xml b/app/code/Magento/Catalog/etc/product_types.xml index a1516fee38ed5..513f0905b13ce 100644 --- a/app/code/Magento/Catalog/etc/product_types.xml +++ b/app/code/Magento/Catalog/etc/product_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/product_types.xsd b/app/code/Magento/Catalog/etc/product_types.xsd index e0cb33802851e..06999fbeddc7a 100644 --- a/app/code/Magento/Catalog/etc/product_types.xsd +++ b/app/code/Magento/Catalog/etc/product_types.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/product_types_base.xsd b/app/code/Magento/Catalog/etc/product_types_base.xsd index 94d8b87d167e3..eddd7a6845488 100644 --- a/app/code/Magento/Catalog/etc/product_types_base.xsd +++ b/app/code/Magento/Catalog/etc/product_types_base.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/product_types_merged.xsd b/app/code/Magento/Catalog/etc/product_types_merged.xsd index 1a1a9bfd8214c..1b1d92c163989 100644 --- a/app/code/Magento/Catalog/etc/product_types_merged.xsd +++ b/app/code/Magento/Catalog/etc/product_types_merged.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/view.xml b/app/code/Magento/Catalog/etc/view.xml index 756888e3b688f..8c7500d9c1374 100644 --- a/app/code/Magento/Catalog/etc/view.xml +++ b/app/code/Magento/Catalog/etc/view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/webapi.xml b/app/code/Magento/Catalog/etc/webapi.xml index b53f11b1ff295..eb1167b64679d 100644 --- a/app/code/Magento/Catalog/etc/webapi.xml +++ b/app/code/Magento/Catalog/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/webapi_rest/di.xml b/app/code/Magento/Catalog/etc/webapi_rest/di.xml index 8606cd8de1136..67e74dfbfd44e 100644 --- a/app/code/Magento/Catalog/etc/webapi_rest/di.xml +++ b/app/code/Magento/Catalog/etc/webapi_rest/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/webapi_soap/di.xml b/app/code/Magento/Catalog/etc/webapi_soap/di.xml index 9d2f4abfa5b46..cb5273e4aeac5 100644 --- a/app/code/Magento/Catalog/etc/webapi_soap/di.xml +++ b/app/code/Magento/Catalog/etc/webapi_soap/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/etc/widget.xml b/app/code/Magento/Catalog/etc/widget.xml index e9907e5b17700..f54d4af816c09 100644 --- a/app/code/Magento/Catalog/etc/widget.xml +++ b/app/code/Magento/Catalog/etc/widget.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/registration.php b/app/code/Magento/Catalog/registration.php index 96b9df94d399e..fada27f08c173 100644 --- a/app/code/Magento/Catalog/registration.php +++ b/app/code/Magento/Catalog/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml index 2809386e4f94e..30add348f7d2b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml index a71dd55d3dfc0..ec97c79610237 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_add.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_add.xml index 5f376149e96bf..d9c70ae487903 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_add.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_add.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_create.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_create.xml index 0a8b4e2509cd0..02734a674189e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_create.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_create.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml index 1f975b4a701a3..799c50dfc4756 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml index be147a4270879..3a073f75eef12 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertspricegrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertspricegrid.xml index 39b7f82b2e78d..0cd56d138149e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertspricegrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertspricegrid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertsstockgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertsstockgrid.xml index 74e558c34cc79..d098da96d3e52 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertsstockgrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_alertsstockgrid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit.xml index ad6d9f5d4ef94..ddf02a7cdb9c2 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_form.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_form.xml index 59c5d5cff3158..8f4780d34b17d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml index 5049f5ac8e3f5..a19d29a98720e 100755 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_change_attribute_set.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_change_attribute_set.xml index 82007f774971f..422cf537c3081 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_change_attribute_set.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_change_attribute_set.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml index 6f95ce72a20bf..9c1280a2500df 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml index 808e95a885616..96c66485f2132 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_customoptions.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_customoptions.xml index 064463bd0d613..39781cc8adcf0 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_customoptions.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_customoptions.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml index d8b0ce7c957e0..3375f5b8233f5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_form.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_form.xml index bdcd5da65bbea..194c745e6a65a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grid.xml index 7343969a40ba4..e214ccad3dc21 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml index 7ee21e218051f..bad6a5d165535 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml index 0d6dae0c99a87..cb993bc892eac 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_options.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_options.xml index e52d7e7ec1a14..7d88ff2a04384 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_options.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_options.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_optionsimportgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_optionsimportgrid.xml index 699b6084c314a..7f6f62943bbea 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_optionsimportgrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_optionsimportgrid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml index e1f2eb0403580..6b688eeec2084 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml index 8d2fb11dc18c1..4a306dd725b91 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reload.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reload.xml index 82007f774971f..422cf537c3081 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reload.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reload.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml index 1dc0de6498cb1..bbbc1e21669e1 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_block.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml index d61a2c344d666..7caf391119166 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_index.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_index.xml index 23b859d526e10..b25eecbbc2502 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_index.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml index f7ec295f154a0..ce0b1521d82e6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml index 097649c8c0aa3..83c19659b5135 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js b/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js index d2e45cbfb42ee..848d1f1da908c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js +++ b/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -17,4 +17,4 @@ var config = { deps: [ 'Magento_Catalog/catalog/product' ] -}; \ No newline at end of file +}; diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml index b1f8197650fd9..eaeed5b12ebaf 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml index 536e840249b78..cf40ee6d78af6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/add.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml index 3b5748da54823..2cdb9f451a86f 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/toolbar/main.phtml @@ -1,6 +1,6 @@ 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 0a2fcb84c996c..767b54e0fdadf 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 @@ -1,6 +1,6 @@ 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 5d35a9e8be152..cb60254d4d8c7 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 @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml index 5ffacc462ac83..82d2111b986cd 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/crosssell_product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/crosssell_product_listing.xml index 965694d7f94c4..c562cf1096fa3 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/crosssell_product_listing.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/crosssell_product_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml index 9852ad74121c8..28522ca5c2ba2 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/new_category_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/new_category_form.xml index dbe6aa9eb7d91..a0307886770c6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/new_category_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/new_category_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml index 870304c881627..ab5ab6e288e13 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attributes_grid.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attributes_grid.xml index 4067cd062de6c..b4b625dbdac92 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attributes_grid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_attributes_grid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_custom_options_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_custom_options_listing.xml index 5c7292637129d..2b6db7050d0a9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_custom_options_listing.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_custom_options_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml index 2db3d337822b6..b99e01147c00d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml index ec88952af5033..f7475d0bb8168 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/related_product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/related_product_listing.xml index 25350158c5297..55863e0a21c0d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/related_product_listing.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/related_product_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/upsell_product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/upsell_product_listing.xml index fc03f128f4617..26703ba03c9a0 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/upsell_product_listing.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/upsell_product_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/apply-to-type-switcher.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/apply-to-type-switcher.js index 595638d8ca6ef..13543ade8f726 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/apply-to-type-switcher.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/apply-to-type-switcher.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js index 9c0d986c7e9f2..4ba2d110ffb34 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*global alert:true*/ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js index ad5f52095f36b..1da9c2c379c37 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/assign-products.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js index 28bc0734ef033..66eb039790f28 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** @@ -75,4 +75,4 @@ define([ categorySubmit(config.url, config.ajax); }); }; -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js index f64111a2f0ef8..9f413832537e2 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js index c2f16d82959d0..78f48b0bafabb 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js index 27fdd1b201885..11a1866284131 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ require([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js index c2aa604d11e7a..2af880f4d04c5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ 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 28bcd7011ab8f..0f45dda8043d0 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 @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js index 55a4599ce85e5..9de0ff75fa843 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/file-type-field.js b/app/code/Magento/Catalog/view/adminhtml/web/component/file-type-field.js index 491d765740b0b..bed32eb574695 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/component/file-type-field.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/file-type-field.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js b/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js index a2e05dcc1c69c..13a759e534735 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/select-type-grid.js b/app/code/Magento/Catalog/view/adminhtml/web/component/select-type-grid.js index ba5307da4cda1..57d35424268b8 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/component/select-type-grid.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/select-type-grid.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-container.js b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-container.js index 5105271769d71..b3ef035402c3e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-container.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-container.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-input.js b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-input.js index 694eb0163467c..d520758d456a5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-input.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-input.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-select.js b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-select.js index 555024e026a0b..6b61b5e49c97a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-select.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/static-type-select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/text-type-field.js b/app/code/Magento/Catalog/view/adminhtml/web/component/text-type-field.js index d09110f41d3cf..72d97b7aebcd9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/component/text-type-field.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/text-type-field.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/bundle-proxy-button.js b/app/code/Magento/Catalog/view/adminhtml/web/js/bundle-proxy-button.js index 60141a7138008..42543656f210b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/bundle-proxy-button.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/bundle-proxy-button.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js b/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js index 0cb4932a012f3..5453b760e2f31 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true jquery:true*/ @@ -94,4 +94,4 @@ define([ }); return $.mage.categoryTree; -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attribute-set-select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attribute-set-select.js index 3fa5d6a6790f3..baefa1ae2e4b5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attribute-set-select.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attribute-set-select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-fieldset.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-fieldset.js index 8b2d64353f72f..1e363ef2a1a0f 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-fieldset.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-fieldset.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-grid-paging.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-grid-paging.js index f698de4a5386f..641dfaf295150 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-grid-paging.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-grid-paging.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-insert-listing.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-insert-listing.js index 5d9234b76d544..10be9f2ffc907 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-insert-listing.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/attributes-insert-listing.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/checkbox.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/checkbox.js index 944ef4f7b4d5f..b371efca26f64 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/checkbox.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/checkbox.js @@ -1,4 +1,4 @@ -/* Copyright © 2016 Magento. All rights reserved. +/* Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-hide-select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-hide-select.js index fd36504b5a77c..4bf54406e3598 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-hide-select.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-hide-select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/input.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/input.js index 4dd196da99294..1961bc5fde625 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/input.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/input.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/select.js index ad6090cdd8e46..2dc21fc11cf55 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/select.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/strategy.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/strategy.js index 6a31b28df2c05..e8b276c171ca4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/strategy.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/strategy.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define(function () { diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/yesno.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/yesno.js index 3c40951499fff..7362acbe63eb2 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/yesno.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/disable-on-option/yesno.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js index 10e498ff47497..d15c7b48dc409 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-tier-price.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-tier-price.js index 6dc4c747a4451..c8b66f23abc83 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-tier-price.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-tier-price.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js index a0aec918ccda2..a616978f8d369 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/input-handle-required.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/input-handle-required.js index 9d2154656b005..c342e961fa9e2 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/input-handle-required.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/input-handle-required.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/messages.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/messages.js index 78956749be6a9..7e3696ba24bf8 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/messages.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/messages.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/multiselect-handle-required.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/multiselect-handle-required.js index 3e26f693456c4..b7146137c6bb3 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/multiselect-handle-required.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/multiselect-handle-required.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-form.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-form.js index 96d3f0accec5a..360349f8c61e5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-form.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-form.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-insert-form.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-insert-form.js index 4c646b1de8e2f..f3624de9cbd0f 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-insert-form.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-attribute-insert-form.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-category.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-category.js index 8037d1c6ac3f4..7a16067b37291 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-category.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/new-category.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/product-status.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/product-status.js index c02af7c6369b2..3e3c811584973 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/product-status.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/product-status.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-handle-required.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-handle-required.js index dc7b4dee30b1b..08ed325c82a78 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-handle-required.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-handle-required.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-to-checkbox.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-to-checkbox.js index 4232c54e7b617..281ef42a9e533 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-to-checkbox.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/select-to-checkbox.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/url-key-handle-changes.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/url-key-handle-changes.js index 2305a79fa7e73..b12f73c17125a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/url-key-handle-changes.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/url-key-handle-changes.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/date.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/date.js index 1f1aa3a4a5d4d..ecdb3a66006b7 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/date.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/date.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/fieldset.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/fieldset.js index 2ddd6566cb074..581153832d3a5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/fieldset.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/fieldset.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/input.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/input.js index 950ab4aa4eb34..bd832632f7513 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/input.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/input.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/select.js index c63e79316b3ec..05453dc19bff8 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/select.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/strategy.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/strategy.js index 7d1f0557108f5..2e59efeab1b58 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/strategy.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/strategy.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define(function () { diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/textarea.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/textarea.js index 0c0860e1b7102..7446174982a21 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/textarea.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/textarea.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/yesno.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/yesno.js index 5f64db1ee6dd2..9f8a9e43dacc5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/yesno.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/visible-on-option/yesno.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js index e4c65f543eddf..878e8e1429680 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js index 9de11667b9d56..0611c4fae9233 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true*/ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/edit-tree.js b/app/code/Magento/Catalog/view/adminhtml/web/js/edit-tree.js index 9d84efd42c7d9..7420595078071 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/edit-tree.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/edit-tree.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js index d809ecc74fa4b..1ecfddac7abb8 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/checkbox.js b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/checkbox.js index cffa4dff8952b..57d45551d180b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/checkbox.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/checkbox.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js index 688dc39692dac..84be3a4f8783b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js b/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js index 41c29880de8c9..e20d3f3e0c5b1 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true jquery:true*/ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index b366f61ba4994..75d768dae7bb6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js b/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js index eba8ef201eae2..2cfde92d6a762 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint jquery:true*/ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js b/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js index 176cc9bd5c80c..a2ae5b794f601 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/tier-price/percentage-processor.js b/app/code/Magento/Catalog/view/adminhtml/web/js/tier-price/percentage-processor.js index afc0bab3f7fa4..85d6f07763b50 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/tier-price/percentage-processor.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/tier-price/percentage-processor.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/tier-price/value-type-select.js b/app/code/Magento/Catalog/view/adminhtml/web/js/tier-price/value-type-select.js index 216a767d393d5..17e5037dc507a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/tier-price/value-type-select.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/tier-price/value-type-select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/utils/percentage-price-calculator.js b/app/code/Magento/Catalog/view/adminhtml/web/js/utils/percentage-price-calculator.js index b7c18d5332f56..9697cb6bf12cd 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/utils/percentage-price-calculator.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/utils/percentage-price-calculator.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/attributes/grid/paging.html b/app/code/Magento/Catalog/view/adminhtml/web/template/attributes/grid/paging.html index 6ad88dd64d9e3..bf03ffb1049e7 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/template/attributes/grid/paging.html +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/attributes/grid/paging.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/checkbox.html b/app/code/Magento/Catalog/view/adminhtml/web/template/checkbox.html index 9b737a457f3f5..7a2c8e42364df 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/template/checkbox.html +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/checkbox.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html index 13445314101b2..687420c9ef156 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html @@ -1,6 +1,6 @@ @@ -13,4 +13,4 @@ } "> - \ No newline at end of file + diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-service.html b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-service.html index 9b1a3936b9f43..ad83bc144615e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-service.html +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-service.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-type-service.html b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-type-service.html index 442d96b5ae4ba..3c3cbbde2ab39 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-type-service.html +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/helper/custom-option-type-service.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/input.html b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/input.html index 70b1b6033f7f6..560bc90ea6d19 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/input.html +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/form/element/input.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html b/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html index 3bc6e0a359c5e..22f7237c6cd4a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml b/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml index aeb647660af7c..b47a6a3e69d86 100644 --- a/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml +++ b/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/base/layout/default.xml b/app/code/Magento/Catalog/view/base/layout/default.xml index 25a23d2be7df4..776dbc4b646ef 100644 --- a/app/code/Magento/Catalog/view/base/layout/default.xml +++ b/app/code/Magento/Catalog/view/base/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/base/layout/empty.xml b/app/code/Magento/Catalog/view/base/layout/empty.xml index 25a23d2be7df4..776dbc4b646ef 100644 --- a/app/code/Magento/Catalog/view/base/layout/empty.xml +++ b/app/code/Magento/Catalog/view/base/layout/empty.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/base/templates/js/components.phtml b/app/code/Magento/Catalog/view/base/templates/js/components.phtml index e490a6aa04923..bdcb2e9bf7747 100644 --- a/app/code/Magento/Catalog/view/base/templates/js/components.phtml +++ b/app/code/Magento/Catalog/view/base/templates/js/components.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml index a72cbcf8e8981..01d82db69d2ce 100644 --- a/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml +++ b/app/code/Magento/Catalog/view/base/templates/product/price/default.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default.xml index a9cfdf8f834bd..d6788f3d4eed6 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default_without_children.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default_without_children.xml index 7509438df2553..e01b48cc71b11 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default_without_children.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_category_view_type_default_without_children.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_compare_index.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_compare_index.xml index 3e16064e57312..c6f02a8acb155 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_compare_index.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_compare_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_gallery.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_gallery.xml index 837d34157a600..7e39fd35d6cde 100755 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_gallery.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_gallery.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_opengraph.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_opengraph.xml index 6bb8a78949038..661ec52df3dcd 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_opengraph.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_opengraph.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml index 2f8feb52db5ff..6e17705f4c464 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_simple.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_simple.xml index bc1959a36cb72..6703d18deac37 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_simple.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_simple.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_virtual.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_virtual.xml index 6155df2f60653..dd93e8064e60c 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_virtual.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_virtual.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml index 2ad9ebb874ea2..ee16e638b64cb 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/layout/default.xml b/app/code/Magento/Catalog/view/frontend/layout/default.xml index ab424810401c9..f267c2a5ae634 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/default.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Catalog/view/frontend/requirejs-config.js b/app/code/Magento/Catalog/view/frontend/requirejs-config.js index 6c7a8d3a969ff..a26e53e9620fd 100644 --- a/app/code/Magento/Catalog/view/frontend/requirejs-config.js +++ b/app/code/Magento/Catalog/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml b/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml index 06d1fc56b6f4b..818456d2272f6 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/category/cms.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml index f78631f32a80a..c3280c563fe58 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index 578a58fb4d48d..bcbd2882e02c2 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper/bottom.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper/bottom.phtml index ccf717394717c..08642bc792586 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper/bottom.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/options/wrapper/bottom.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml index 0ba4ead7f5516..8c7376ea1cead 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/price_clone.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html b/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html index b9ffd3203087a..88886989b19aa 100644 --- a/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html +++ b/app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product.php b/app/code/Magento/CatalogImportExport/Model/Export/Product.php index fa70427296216..59bb01b7e3532 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogImportExport/etc/di.xml b/app/code/Magento/CatalogImportExport/etc/di.xml index 5b1c6b287eec6..dca2159fbdc66 100644 --- a/app/code/Magento/CatalogImportExport/etc/di.xml +++ b/app/code/Magento/CatalogImportExport/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogImportExport/etc/export.xml b/app/code/Magento/CatalogImportExport/etc/export.xml index 5902f03cfe7a9..824b7defdaee6 100644 --- a/app/code/Magento/CatalogImportExport/etc/export.xml +++ b/app/code/Magento/CatalogImportExport/etc/export.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogImportExport/etc/import.xml b/app/code/Magento/CatalogImportExport/etc/import.xml index a1ad8e411d024..e4ff1c2825654 100644 --- a/app/code/Magento/CatalogImportExport/etc/import.xml +++ b/app/code/Magento/CatalogImportExport/etc/import.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogImportExport/etc/module.xml b/app/code/Magento/CatalogImportExport/etc/module.xml index d4f27fb1f8ddc..c63a6dd52918f 100644 --- a/app/code/Magento/CatalogImportExport/etc/module.xml +++ b/app/code/Magento/CatalogImportExport/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogImportExport/registration.php b/app/code/Magento/CatalogImportExport/registration.php index 6be2ae769ceee..5b1c90ca644a6 100644 --- a/app/code/Magento/CatalogImportExport/registration.php +++ b/app/code/Magento/CatalogImportExport/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml index 1af3b65eeb412..9356f15cd7f86 100644 --- a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml +++ b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml index e32d794a9e0b2..c403bb3c627e1 100644 --- a/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/config.xml b/app/code/Magento/CatalogInventory/etc/config.xml index ba0a059168d56..b4da95f48293c 100644 --- a/app/code/Magento/CatalogInventory/etc/config.xml +++ b/app/code/Magento/CatalogInventory/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/di.xml b/app/code/Magento/CatalogInventory/etc/di.xml index e3ca5c01cedab..54f2e4dccf3d4 100644 --- a/app/code/Magento/CatalogInventory/etc/di.xml +++ b/app/code/Magento/CatalogInventory/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/events.xml b/app/code/Magento/CatalogInventory/etc/events.xml index d9db59b7a1766..1c5c11096957f 100644 --- a/app/code/Magento/CatalogInventory/etc/events.xml +++ b/app/code/Magento/CatalogInventory/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/extension_attributes.xml b/app/code/Magento/CatalogInventory/etc/extension_attributes.xml index 5be0207e10703..43495ebf2e644 100644 --- a/app/code/Magento/CatalogInventory/etc/extension_attributes.xml +++ b/app/code/Magento/CatalogInventory/etc/extension_attributes.xml @@ -1,7 +1,7 @@ @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/CatalogInventory/etc/frontend/di.xml b/app/code/Magento/CatalogInventory/etc/frontend/di.xml index 009d6b7a3f488..66591baa41660 100644 --- a/app/code/Magento/CatalogInventory/etc/frontend/di.xml +++ b/app/code/Magento/CatalogInventory/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/indexer.xml b/app/code/Magento/CatalogInventory/etc/indexer.xml index cb61128640800..e3fc5e845c4c3 100644 --- a/app/code/Magento/CatalogInventory/etc/indexer.xml +++ b/app/code/Magento/CatalogInventory/etc/indexer.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/module.xml b/app/code/Magento/CatalogInventory/etc/module.xml index 7aff70e225831..56cc38b7d0d30 100644 --- a/app/code/Magento/CatalogInventory/etc/module.xml +++ b/app/code/Magento/CatalogInventory/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/mview.xml b/app/code/Magento/CatalogInventory/etc/mview.xml index 5737fea21509a..58a051a3d0e1b 100644 --- a/app/code/Magento/CatalogInventory/etc/mview.xml +++ b/app/code/Magento/CatalogInventory/etc/mview.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/product_types.xml b/app/code/Magento/CatalogInventory/etc/product_types.xml index 57ae2a962d298..206a4969b3fd2 100644 --- a/app/code/Magento/CatalogInventory/etc/product_types.xml +++ b/app/code/Magento/CatalogInventory/etc/product_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/etc/webapi.xml b/app/code/Magento/CatalogInventory/etc/webapi.xml index ef2d2c89b3ff1..09753ed6d7ca0 100644 --- a/app/code/Magento/CatalogInventory/etc/webapi.xml +++ b/app/code/Magento/CatalogInventory/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/registration.php b/app/code/Magento/CatalogInventory/registration.php index f9ba272c2f47f..c39a8159f90b8 100644 --- a/app/code/Magento/CatalogInventory/registration.php +++ b/app/code/Magento/CatalogInventory/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml index 3d993257b8de1..51587e0732830 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml +++ b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js index f45d32d6482d6..3123784e64e71 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js +++ b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/qty-validator-changer.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js index d0dffe5da87f4..9bce6ced3141e 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js +++ b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-min-sale-qty.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js index dbcb852ad667c..877f2b44b4f9a 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js +++ b/app/code/Magento/CatalogInventory/view/adminhtml/web/js/components/use-config-settings.js @@ -1,9 +1,9 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view.xml index d2b7d7df1e2f0..e6e9e8b30988b 100644 --- a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_simple.xml b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_simple.xml index aa702435eb8fe..bfd59283750be 100644 --- a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_simple.xml +++ b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_simple.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_virtual.xml b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_virtual.xml index 001450481255b..c83b8b6fc47e7 100644 --- a/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_virtual.xml +++ b/app/code/Magento/CatalogInventory/view/frontend/layout/catalog_product_view_type_virtual.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml b/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml index 08ed9910200a6..544b82ccd06cf 100644 --- a/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml +++ b/app/code/Magento/CatalogInventory/view/frontend/templates/qtyincrements.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/di.xml b/app/code/Magento/CatalogRule/etc/adminhtml/di.xml index b6ca015d1fd9c..a993ed0ca485a 100644 --- a/app/code/Magento/CatalogRule/etc/adminhtml/di.xml +++ b/app/code/Magento/CatalogRule/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/events.xml b/app/code/Magento/CatalogRule/etc/adminhtml/events.xml index 96dcaba04e6e3..afab20010a4b2 100644 --- a/app/code/Magento/CatalogRule/etc/adminhtml/events.xml +++ b/app/code/Magento/CatalogRule/etc/adminhtml/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml b/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml index 62f4378ed8b0b..e47fa911f5a6e 100644 --- a/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml +++ b/app/code/Magento/CatalogRule/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml b/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml index df54097062f70..8eb519e847511 100644 --- a/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml +++ b/app/code/Magento/CatalogRule/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/crontab.xml b/app/code/Magento/CatalogRule/etc/crontab.xml index 67714c1bc437f..0f0102057447e 100644 --- a/app/code/Magento/CatalogRule/etc/crontab.xml +++ b/app/code/Magento/CatalogRule/etc/crontab.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/crontab/events.xml b/app/code/Magento/CatalogRule/etc/crontab/events.xml index d17a099982464..e82f4c8b1a393 100644 --- a/app/code/Magento/CatalogRule/etc/crontab/events.xml +++ b/app/code/Magento/CatalogRule/etc/crontab/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/di.xml b/app/code/Magento/CatalogRule/etc/di.xml index f0644755b308e..6783fd6d69bc2 100644 --- a/app/code/Magento/CatalogRule/etc/di.xml +++ b/app/code/Magento/CatalogRule/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/events.xml b/app/code/Magento/CatalogRule/etc/events.xml index 09fd7458fa799..54d4ba74370a9 100644 --- a/app/code/Magento/CatalogRule/etc/events.xml +++ b/app/code/Magento/CatalogRule/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/frontend/events.xml b/app/code/Magento/CatalogRule/etc/frontend/events.xml index b547bb645bb91..7ec1d35dfbe97 100644 --- a/app/code/Magento/CatalogRule/etc/frontend/events.xml +++ b/app/code/Magento/CatalogRule/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/indexer.xml b/app/code/Magento/CatalogRule/etc/indexer.xml index edfae35c07213..bae3bdf98efb7 100644 --- a/app/code/Magento/CatalogRule/etc/indexer.xml +++ b/app/code/Magento/CatalogRule/etc/indexer.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/module.xml b/app/code/Magento/CatalogRule/etc/module.xml index d7db233e1eb06..0a9c185d87512 100644 --- a/app/code/Magento/CatalogRule/etc/module.xml +++ b/app/code/Magento/CatalogRule/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/mview.xml b/app/code/Magento/CatalogRule/etc/mview.xml index 02f3761a0278e..58015fc69863c 100644 --- a/app/code/Magento/CatalogRule/etc/mview.xml +++ b/app/code/Magento/CatalogRule/etc/mview.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml b/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml index c2030340d5ce5..7ca6491d59d76 100644 --- a/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml +++ b/app/code/Magento/CatalogRule/etc/webapi_rest/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/webapi_rest/events.xml b/app/code/Magento/CatalogRule/etc/webapi_rest/events.xml index b547bb645bb91..7ec1d35dfbe97 100644 --- a/app/code/Magento/CatalogRule/etc/webapi_rest/events.xml +++ b/app/code/Magento/CatalogRule/etc/webapi_rest/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/etc/webapi_soap/events.xml b/app/code/Magento/CatalogRule/etc/webapi_soap/events.xml index b547bb645bb91..7ec1d35dfbe97 100644 --- a/app/code/Magento/CatalogRule/etc/webapi_soap/events.xml +++ b/app/code/Magento/CatalogRule/etc/webapi_soap/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/registration.php b/app/code/Magento/CatalogRule/registration.php index b7a9603532d5a..3322ca97134fa 100644 --- a/app/code/Magento/CatalogRule/registration.php +++ b/app/code/Magento/CatalogRule/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml index ef8a6e758bac1..62148084b47b8 100644 --- a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml +++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml index c92bb30955557..e781a870f1c5d 100644 --- a/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml +++ b/app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml index 77cf14b3782d8..0c13825d16798 100644 --- a/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml +++ b/app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php index 4bc4e1753281a..c4b8d5f275f68 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php +++ b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRuleConfigurable/etc/crontab/di.xml b/app/code/Magento/CatalogRuleConfigurable/etc/crontab/di.xml index 731447249dbe7..ef226c965c57b 100644 --- a/app/code/Magento/CatalogRuleConfigurable/etc/crontab/di.xml +++ b/app/code/Magento/CatalogRuleConfigurable/etc/crontab/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRuleConfigurable/etc/di.xml b/app/code/Magento/CatalogRuleConfigurable/etc/di.xml index 881988b4446af..8807b657f1c05 100644 --- a/app/code/Magento/CatalogRuleConfigurable/etc/di.xml +++ b/app/code/Magento/CatalogRuleConfigurable/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRuleConfigurable/etc/module.xml b/app/code/Magento/CatalogRuleConfigurable/etc/module.xml index 6e927ed7bc27f..c329a1fbe46ee 100644 --- a/app/code/Magento/CatalogRuleConfigurable/etc/module.xml +++ b/app/code/Magento/CatalogRuleConfigurable/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogRuleConfigurable/registration.php b/app/code/Magento/CatalogRuleConfigurable/registration.php index a16941628e0d6..578434d65237b 100644 --- a/app/code/Magento/CatalogRuleConfigurable/registration.php +++ b/app/code/Magento/CatalogRuleConfigurable/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml b/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml index 2402e81ba49ed..ab0ddab0a7cf6 100644 --- a/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/catalog_attributes.xml b/app/code/Magento/CatalogSearch/etc/catalog_attributes.xml index 1ff65f256b23c..c13caa8bbf2f0 100644 --- a/app/code/Magento/CatalogSearch/etc/catalog_attributes.xml +++ b/app/code/Magento/CatalogSearch/etc/catalog_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/config.xml b/app/code/Magento/CatalogSearch/etc/config.xml index f922751096c34..d9f709f501f2e 100644 --- a/app/code/Magento/CatalogSearch/etc/config.xml +++ b/app/code/Magento/CatalogSearch/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/di.xml b/app/code/Magento/CatalogSearch/etc/di.xml index 7116abf263b0d..dc104cc781617 100644 --- a/app/code/Magento/CatalogSearch/etc/di.xml +++ b/app/code/Magento/CatalogSearch/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/events.xml b/app/code/Magento/CatalogSearch/etc/events.xml index 45f6ea3159c78..68d32ad26fb7e 100644 --- a/app/code/Magento/CatalogSearch/etc/events.xml +++ b/app/code/Magento/CatalogSearch/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/frontend/di.xml b/app/code/Magento/CatalogSearch/etc/frontend/di.xml index a998918421ab6..69e8823e7bdef 100644 --- a/app/code/Magento/CatalogSearch/etc/frontend/di.xml +++ b/app/code/Magento/CatalogSearch/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml b/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml index 28a45d33805d8..7f05e212df860 100644 --- a/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml +++ b/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/frontend/routes.xml b/app/code/Magento/CatalogSearch/etc/frontend/routes.xml index 6ae08215debe1..e0bcffc439c25 100644 --- a/app/code/Magento/CatalogSearch/etc/frontend/routes.xml +++ b/app/code/Magento/CatalogSearch/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/CatalogSearch/etc/indexer.xml b/app/code/Magento/CatalogSearch/etc/indexer.xml index 3cb19891b83f6..796db4aecc118 100644 --- a/app/code/Magento/CatalogSearch/etc/indexer.xml +++ b/app/code/Magento/CatalogSearch/etc/indexer.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/module.xml b/app/code/Magento/CatalogSearch/etc/module.xml index 2296175b78820..53ee3fca13af2 100644 --- a/app/code/Magento/CatalogSearch/etc/module.xml +++ b/app/code/Magento/CatalogSearch/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/mview.xml b/app/code/Magento/CatalogSearch/etc/mview.xml index e064650d59b72..ef5d6b453aac3 100644 --- a/app/code/Magento/CatalogSearch/etc/mview.xml +++ b/app/code/Magento/CatalogSearch/etc/mview.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/etc/search_request.xml b/app/code/Magento/CatalogSearch/etc/search_request.xml index ccb0328b22aa6..84817ab37f36b 100644 --- a/app/code/Magento/CatalogSearch/etc/search_request.xml +++ b/app/code/Magento/CatalogSearch/etc/search_request.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/registration.php b/app/code/Magento/CatalogSearch/registration.php index 2f482e73ce30b..357bda4629222 100644 --- a/app/code/Magento/CatalogSearch/registration.php +++ b/app/code/Magento/CatalogSearch/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_index.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_index.xml index a64c73887944a..337ec41d8f92e 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_index.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_result.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_result.xml index 09e583f2f106b..56f652ec31af0 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_result.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_advanced_result.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_result_index.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_result_index.xml index 7f8e28626e5a7..fe4feb0bfaf0d 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_result_index.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/catalogsearch_result_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml b/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml index 930750c297a2c..566910b76d499 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml +++ b/app/code/Magento/CatalogSearch/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogSearch/view/frontend/requirejs-config.js b/app/code/Magento/CatalogSearch/view/frontend/requirejs-config.js index 57e2a7a930136..c2a3e552a7299 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/requirejs-config.js +++ b/app/code/Magento/CatalogSearch/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -9,4 +9,4 @@ var config = { catalogSearch: 'Magento_CatalogSearch/form-mini' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml index 988b697698657..ffa83a8717b2d 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml index 3f5eecc9eb7bb..a977b24d7c69b 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml index d8cf69dd8502a..8b5a72b18ff1b 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml b/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml index 06087fd701e2b..5d2dbcb0d90d6 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/catalog_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogUrlRewrite/etc/di.xml b/app/code/Magento/CatalogUrlRewrite/etc/di.xml index 9ea21bce36567..5a8974fc52da4 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/di.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml b/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml index 31f1d6424ff42..aaedd2e5bb1a7 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/eav_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogUrlRewrite/etc/events.xml b/app/code/Magento/CatalogUrlRewrite/etc/events.xml index 02c67bb500b66..60c8d1045d836 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/events.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogUrlRewrite/etc/module.xml b/app/code/Magento/CatalogUrlRewrite/etc/module.xml index 2082a0c426239..d2bfee12a6eda 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/module.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogUrlRewrite/registration.php b/app/code/Magento/CatalogUrlRewrite/registration.php index cbc5df17eb124..8dc5ed7f29d11 100644 --- a/app/code/Magento/CatalogUrlRewrite/registration.php +++ b/app/code/Magento/CatalogUrlRewrite/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 0f665984b0e04..d9ea8196ab975 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CatalogWidget/etc/di.xml b/app/code/Magento/CatalogWidget/etc/di.xml index 625bcf58c5ca7..dbf2833ee88e3 100644 --- a/app/code/Magento/CatalogWidget/etc/di.xml +++ b/app/code/Magento/CatalogWidget/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogWidget/etc/module.xml b/app/code/Magento/CatalogWidget/etc/module.xml index d091335c5d2d7..a335a9a3d4a07 100644 --- a/app/code/Magento/CatalogWidget/etc/module.xml +++ b/app/code/Magento/CatalogWidget/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogWidget/etc/widget.xml b/app/code/Magento/CatalogWidget/etc/widget.xml index 50f152ee86b5d..c08d3e4da9c6a 100644 --- a/app/code/Magento/CatalogWidget/etc/widget.xml +++ b/app/code/Magento/CatalogWidget/etc/widget.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CatalogWidget/registration.php b/app/code/Magento/CatalogWidget/registration.php index d4c87863956e8..5a08e70aab0c4 100644 --- a/app/code/Magento/CatalogWidget/registration.php +++ b/app/code/Magento/CatalogWidget/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/etc/config.xml b/app/code/Magento/Checkout/etc/config.xml index 2712f5df5ef5d..4bac74fb0efdc 100644 --- a/app/code/Magento/Checkout/etc/config.xml +++ b/app/code/Magento/Checkout/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/di.xml b/app/code/Magento/Checkout/etc/di.xml index 81a430d52c499..5e769e4748be1 100644 --- a/app/code/Magento/Checkout/etc/di.xml +++ b/app/code/Magento/Checkout/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/email_templates.xml b/app/code/Magento/Checkout/etc/email_templates.xml index 15f836522a8c6..2fb2f1ca37992 100644 --- a/app/code/Magento/Checkout/etc/email_templates.xml +++ b/app/code/Magento/Checkout/etc/email_templates.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/events.xml b/app/code/Magento/Checkout/etc/events.xml index 8bca9e6dba54d..8c657c5d8b09e 100644 --- a/app/code/Magento/Checkout/etc/events.xml +++ b/app/code/Magento/Checkout/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/fieldset.xml b/app/code/Magento/Checkout/etc/fieldset.xml index f8bd9b9b84cb5..44bcdc9367c51 100644 --- a/app/code/Magento/Checkout/etc/fieldset.xml +++ b/app/code/Magento/Checkout/etc/fieldset.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/frontend/di.xml b/app/code/Magento/Checkout/etc/frontend/di.xml index 69ed33721740d..2ef7a2498fd6a 100644 --- a/app/code/Magento/Checkout/etc/frontend/di.xml +++ b/app/code/Magento/Checkout/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/frontend/events.xml b/app/code/Magento/Checkout/etc/frontend/events.xml index ca766ae9a75bc..dce51690514b4 100644 --- a/app/code/Magento/Checkout/etc/frontend/events.xml +++ b/app/code/Magento/Checkout/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/frontend/page_types.xml b/app/code/Magento/Checkout/etc/frontend/page_types.xml index 60b9b16e54971..25200529e6d74 100644 --- a/app/code/Magento/Checkout/etc/frontend/page_types.xml +++ b/app/code/Magento/Checkout/etc/frontend/page_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/frontend/routes.xml b/app/code/Magento/Checkout/etc/frontend/routes.xml index 754f4c0bbcec9..3d50251a2247e 100644 --- a/app/code/Magento/Checkout/etc/frontend/routes.xml +++ b/app/code/Magento/Checkout/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Checkout/etc/frontend/sections.xml b/app/code/Magento/Checkout/etc/frontend/sections.xml index cd3133bef9f11..b0fd4d9e38a81 100644 --- a/app/code/Magento/Checkout/etc/frontend/sections.xml +++ b/app/code/Magento/Checkout/etc/frontend/sections.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml index 8de6bb4c62597..3357b79479b95 100644 --- a/app/code/Magento/Checkout/etc/module.xml +++ b/app/code/Magento/Checkout/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/etc/webapi.xml b/app/code/Magento/Checkout/etc/webapi.xml index fe2e588501287..8c2c1f3820d4c 100644 --- a/app/code/Magento/Checkout/etc/webapi.xml +++ b/app/code/Magento/Checkout/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/registration.php b/app/code/Magento/Checkout/registration.php index fbbbd7e975e99..915fa033ac1cb 100644 --- a/app/code/Magento/Checkout/registration.php +++ b/app/code/Magento/Checkout/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/Checkout/view/frontend/layout/catalog_category_view.xml index afd8817c8b759..4bfe51a17fa48 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/catalog_category_view.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/catalog_category_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Checkout/view/frontend/layout/catalog_product_view.xml index afd8817c8b759..4bfe51a17fa48 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/catalog_product_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml index c255f17cd3697..57b32c26a7619 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure_type_simple.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure_type_simple.xml index 4790c10b08b1d..b4250c802711b 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure_type_simple.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure_type_simple.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml index 3676e2f45cba3..0c619e89cc9f6 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml index f3cfea8836e72..69fc24be97757 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml index f6584364fc760..622841071c2c3 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_price_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml index daa88abf8f34c..b48123cec8bc0 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml index 60e88c5a4ac1b..169d29099f81d 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_sidebar_total_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml index 4aa569c18cb40..3ca0234043762 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml index b1ca511ae2dd1..39cb66575990f 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_item_price_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml index 68a9a4d08675c..6a5b33ce6cec2 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml index f68633e449288..f3a4dfb080e62 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_success.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_success.xml index 880bcb672ba19..3218c00e96ab3 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_success.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_success.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/layout/default.xml b/app/code/Magento/Checkout/view/frontend/layout/default.xml index 06eb85907dda9..fe26adbe3c7cf 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/default.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/page_layout/checkout.xml b/app/code/Magento/Checkout/view/frontend/page_layout/checkout.xml index f3b42213d4ef1..7bf4024438386 100644 --- a/app/code/Magento/Checkout/view/frontend/page_layout/checkout.xml +++ b/app/code/Magento/Checkout/view/frontend/page_layout/checkout.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Checkout/view/frontend/requirejs-config.js b/app/code/Magento/Checkout/view/frontend/requirejs-config.js index 74429e17ffddc..68e95b48e8d05 100644 --- a/app/code/Magento/Checkout/view/frontend/requirejs-config.js +++ b/app/code/Magento/Checkout/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Checkout/view/frontend/templates/button.phtml b/app/code/Magento/Checkout/view/frontend/templates/button.phtml index 2bf0632a15297..b2cf1b8e82ccf 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/button.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/button.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml index d831d7184b439..44f8d1a3889f8 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/additional/info.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml b/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml index b0a93ac2cd7ae..cbbd571a3fd96 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/item/price/row.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html index 23c02caa70b1a..6f13f3379b07c 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html @@ -1,6 +1,6 @@ @@ -29,4 +29,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html index 798be1f978f54..6ad343ce22196 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html index 079dce9e2607f..7b9c5d286cb62 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/list.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/list.html index 1cdd1ce419ad2..1869b514d02f9 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/list.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/list.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-estimation.html b/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-estimation.html index f20d3eee23e08..186b932b4e2b2 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-estimation.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-estimation.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html b/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html index eae097d04a2bc..3f465d5018847 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/cart/totals.html b/app/code/Magento/Checkout/view/frontend/web/template/cart/totals.html index e4322f023c360..a6549d19c9146 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/cart/totals.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/cart/totals.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/grand-total.html b/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/grand-total.html index 0d8c7bdb438de..6ff15eca9a95e 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/grand-total.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/grand-total.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/shipping.html b/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/shipping.html index 6d7fe4d500d33..31394da7d9d21 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/shipping.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/shipping.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/subtotal.html b/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/subtotal.html index a1ff5d9a046af..ba908bf0ec18e 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/subtotal.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/cart/totals/subtotal.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/estimation.html b/app/code/Magento/Checkout/view/frontend/web/template/estimation.html index 7b5bdacc99038..c360a40d7ef8c 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/estimation.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/estimation.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html b/app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html index 7bae4135a4697..f67970754b70b 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html index 24671cb48c59b..97a075d3227f4 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html index 8796152eb6031..c2b4e038ddc21 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/price.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/price.html index 6bbd6048b80f7..c54426e901463 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/price.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/price.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/subtotal.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/subtotal.html index 1355c43c0faba..d2b4566ebc673 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/subtotal.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/subtotal.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/subtotal/totals.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/subtotal/totals.html index d5e2d95e68638..4af767fb5cab0 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/subtotal/totals.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/subtotal/totals.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/onepage.html b/app/code/Magento/Checkout/view/frontend/web/template/onepage.html index 20be1662c1f7c..8ec57b6b17cd8 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/onepage.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/onepage.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/payment-methods/list.html b/app/code/Magento/Checkout/view/frontend/web/template/payment-methods/list.html index f6c41c62eeca6..f64223cafe1e1 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/payment-methods/list.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/payment-methods/list.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/payment.html b/app/code/Magento/Checkout/view/frontend/web/template/payment.html index 46467839da3fb..62e9ad0ec13fb 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/payment.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/payment.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/payment/before-place-order.html b/app/code/Magento/Checkout/view/frontend/web/template/payment/before-place-order.html index 04be67cd44db5..2a617a7bea54c 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/payment/before-place-order.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/payment/before-place-order.html @@ -1,6 +1,6 @@ @@ -8,4 +8,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Checkout/view/frontend/web/template/payment/generic-title.html b/app/code/Magento/Checkout/view/frontend/web/template/payment/generic-title.html index 5e77467c82370..4a049082f00f4 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/payment/generic-title.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/payment/generic-title.html @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Checkout/view/frontend/web/template/progress-bar.html b/app/code/Magento/Checkout/view/frontend/web/template/progress-bar.html index 8fa7eeb511b59..9359986671986 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/progress-bar.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/progress-bar.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/registration.html b/app/code/Magento/Checkout/view/frontend/web/template/registration.html index 10c4a76ccd69a..e58a09f478f16 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/registration.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/registration.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/review/actions.html b/app/code/Magento/Checkout/view/frontend/web/template/review/actions.html index 4ae4c490ced8f..ed05c3954e35a 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/review/actions.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/review/actions.html @@ -1,9 +1,9 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Checkout/view/frontend/web/template/review/actions/default.html b/app/code/Magento/Checkout/view/frontend/web/template/review/actions/default.html index 7fda6d2a3c266..859c0e49c86bf 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/review/actions/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/review/actions/default.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html index 92469fdec3d7f..103274e3ef6da 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/form.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/form.html index beb63bc6f345a..89f26bee1da73 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/form.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/form.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/list.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/list.html index 9b7851ea683b4..d631229a33fce 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/list.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/list.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information.html index c0360d8ebde0d..b32e96641f30c 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html index 36ea556ae9ec9..9b493e9ed1e9e 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/list.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/list.html index 17a1a37d701ac..f421e1052f675 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/list.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/list.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping.html index 5049aac2bbc9b..3b3b4f09c63b8 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/sidebar.html b/app/code/Magento/Checkout/view/frontend/web/template/sidebar.html index ab76be64a5b30..751e2c461dcaa 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/sidebar.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/sidebar.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary.html b/app/code/Magento/Checkout/view/frontend/web/template/summary.html index fed42c9ffbc32..c9a4ab81ed514 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/cart-items.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/cart-items.html index 498a9f852d06b..ee4738eda998b 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/cart-items.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/cart-items.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/grand-total.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/grand-total.html index cef1f58d093e5..1e9cecc6b23f4 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/grand-total.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/grand-total.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html index 86547d4fa14bf..5436e82f9db2b 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/subtotal.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/subtotal.html index f9c6153312d2f..c99d2f05445b1 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/subtotal.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/subtotal.html @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/thumbnail.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/thumbnail.html index 9268ef71c6b2f..a9ed49da52599 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/thumbnail.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/thumbnail.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/shipping.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/shipping.html index 706cdf560a81c..187328360087f 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/shipping.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/shipping.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/subtotal.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/subtotal.html index 69b4863da1cbb..dcfd270e80b36 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/subtotal.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/subtotal.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/totals.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/totals.html index 28478703db04b..627bd6e827fd2 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/totals.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/totals.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CheckoutAgreements/Api/CheckoutAgreementsRepositoryInterface.php b/app/code/Magento/CheckoutAgreements/Api/CheckoutAgreementsRepositoryInterface.php index 03b7d21a5f516..2e60aec29f0a1 100644 --- a/app/code/Magento/CheckoutAgreements/Api/CheckoutAgreementsRepositoryInterface.php +++ b/app/code/Magento/CheckoutAgreements/Api/CheckoutAgreementsRepositoryInterface.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CheckoutAgreements/etc/adminhtml/menu.xml b/app/code/Magento/CheckoutAgreements/etc/adminhtml/menu.xml index e2ac0d8584c43..c6cece231c3aa 100644 --- a/app/code/Magento/CheckoutAgreements/etc/adminhtml/menu.xml +++ b/app/code/Magento/CheckoutAgreements/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/etc/adminhtml/routes.xml b/app/code/Magento/CheckoutAgreements/etc/adminhtml/routes.xml index da8eae7f8fdb7..c047706860c0e 100644 --- a/app/code/Magento/CheckoutAgreements/etc/adminhtml/routes.xml +++ b/app/code/Magento/CheckoutAgreements/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/etc/adminhtml/system.xml b/app/code/Magento/CheckoutAgreements/etc/adminhtml/system.xml index f82f7ec71cfc5..bfb813ea4c269 100644 --- a/app/code/Magento/CheckoutAgreements/etc/adminhtml/system.xml +++ b/app/code/Magento/CheckoutAgreements/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/etc/di.xml b/app/code/Magento/CheckoutAgreements/etc/di.xml index d4c4b95479720..4d80a4776a8c5 100644 --- a/app/code/Magento/CheckoutAgreements/etc/di.xml +++ b/app/code/Magento/CheckoutAgreements/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/etc/extension_attributes.xml b/app/code/Magento/CheckoutAgreements/etc/extension_attributes.xml index f79d5d4974792..3b6d490e04ebc 100644 --- a/app/code/Magento/CheckoutAgreements/etc/extension_attributes.xml +++ b/app/code/Magento/CheckoutAgreements/etc/extension_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/etc/frontend/di.xml b/app/code/Magento/CheckoutAgreements/etc/frontend/di.xml index c462e6c812df4..f33eced3401d4 100644 --- a/app/code/Magento/CheckoutAgreements/etc/frontend/di.xml +++ b/app/code/Magento/CheckoutAgreements/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/etc/module.xml b/app/code/Magento/CheckoutAgreements/etc/module.xml index 1f0ec4f353265..797102ee1dc78 100644 --- a/app/code/Magento/CheckoutAgreements/etc/module.xml +++ b/app/code/Magento/CheckoutAgreements/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/etc/webapi.xml b/app/code/Magento/CheckoutAgreements/etc/webapi.xml index 2a5b36fa3c6bb..41267e2d75fed 100644 --- a/app/code/Magento/CheckoutAgreements/etc/webapi.xml +++ b/app/code/Magento/CheckoutAgreements/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/registration.php b/app/code/Magento/CheckoutAgreements/registration.php index 825eec9031cf7..b81f45461d83f 100644 --- a/app/code/Magento/CheckoutAgreements/registration.php +++ b/app/code/Magento/CheckoutAgreements/registration.php @@ -1,6 +1,6 @@ @@ -54,4 +54,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/CheckoutAgreements/view/frontend/layout/multishipping_checkout_overview.xml b/app/code/Magento/CheckoutAgreements/view/frontend/layout/multishipping_checkout_overview.xml index d1790b5790788..6cd283c7f392c 100644 --- a/app/code/Magento/CheckoutAgreements/view/frontend/layout/multishipping_checkout_overview.xml +++ b/app/code/Magento/CheckoutAgreements/view/frontend/layout/multishipping_checkout_overview.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CheckoutAgreements/view/frontend/requirejs-config.js b/app/code/Magento/CheckoutAgreements/view/frontend/requirejs-config.js index d0876cc49ce0f..4a20149774d3b 100644 --- a/app/code/Magento/CheckoutAgreements/view/frontend/requirejs-config.js +++ b/app/code/Magento/CheckoutAgreements/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true jquery:true*/ diff --git a/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml b/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml index 5aea3bf200aaf..20840500a246f 100644 --- a/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml +++ b/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cms/Api/BlockRepositoryInterface.php b/app/code/Magento/Cms/Api/BlockRepositoryInterface.php index 880b6aea15c0a..64ff3c1c8f036 100644 --- a/app/code/Magento/Cms/Api/BlockRepositoryInterface.php +++ b/app/code/Magento/Cms/Api/BlockRepositoryInterface.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cms/etc/adminhtml/di.xml b/app/code/Magento/Cms/etc/adminhtml/di.xml index 6eac9af5925af..f35fd13c10f3c 100644 --- a/app/code/Magento/Cms/etc/adminhtml/di.xml +++ b/app/code/Magento/Cms/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/adminhtml/menu.xml b/app/code/Magento/Cms/etc/adminhtml/menu.xml index 06cb4446d83a5..c29d127650ecf 100644 --- a/app/code/Magento/Cms/etc/adminhtml/menu.xml +++ b/app/code/Magento/Cms/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/adminhtml/routes.xml b/app/code/Magento/Cms/etc/adminhtml/routes.xml index 42c4cda87b958..401010f25f889 100644 --- a/app/code/Magento/Cms/etc/adminhtml/routes.xml +++ b/app/code/Magento/Cms/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/adminhtml/system.xml b/app/code/Magento/Cms/etc/adminhtml/system.xml index ee0c3d4ebfd09..f460ca83637df 100644 --- a/app/code/Magento/Cms/etc/adminhtml/system.xml +++ b/app/code/Magento/Cms/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/config.xml b/app/code/Magento/Cms/etc/config.xml index d7b7bb863865a..80b635771b373 100644 --- a/app/code/Magento/Cms/etc/config.xml +++ b/app/code/Magento/Cms/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/di.xml b/app/code/Magento/Cms/etc/di.xml index cae674b4a0d3b..eb4583b81b04b 100644 --- a/app/code/Magento/Cms/etc/di.xml +++ b/app/code/Magento/Cms/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/events.xml b/app/code/Magento/Cms/etc/events.xml index c3bd2dbea3f96..698d655a25b26 100644 --- a/app/code/Magento/Cms/etc/events.xml +++ b/app/code/Magento/Cms/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/frontend/di.xml b/app/code/Magento/Cms/etc/frontend/di.xml index 1718e36f409dd..8e01e229f3fa9 100644 --- a/app/code/Magento/Cms/etc/frontend/di.xml +++ b/app/code/Magento/Cms/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/frontend/events.xml b/app/code/Magento/Cms/etc/frontend/events.xml index 81d2ccea4fefb..20049ba2e3c1e 100644 --- a/app/code/Magento/Cms/etc/frontend/events.xml +++ b/app/code/Magento/Cms/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/frontend/page_types.xml b/app/code/Magento/Cms/etc/frontend/page_types.xml index c5df71b7904ff..b7c6d8bf953f9 100644 --- a/app/code/Magento/Cms/etc/frontend/page_types.xml +++ b/app/code/Magento/Cms/etc/frontend/page_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/frontend/routes.xml b/app/code/Magento/Cms/etc/frontend/routes.xml index 4c6598aec4977..07703696500e2 100644 --- a/app/code/Magento/Cms/etc/frontend/routes.xml +++ b/app/code/Magento/Cms/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Cms/etc/module.xml b/app/code/Magento/Cms/etc/module.xml index bb3aaf184fd65..6ade3050020b4 100644 --- a/app/code/Magento/Cms/etc/module.xml +++ b/app/code/Magento/Cms/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/mview.xml b/app/code/Magento/Cms/etc/mview.xml index f7014794b4030..c61128dd1bf1a 100644 --- a/app/code/Magento/Cms/etc/mview.xml +++ b/app/code/Magento/Cms/etc/mview.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/webapi.xml b/app/code/Magento/Cms/etc/webapi.xml index 3da517e7b2c0f..e1f25900a933c 100644 --- a/app/code/Magento/Cms/etc/webapi.xml +++ b/app/code/Magento/Cms/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/etc/widget.xml b/app/code/Magento/Cms/etc/widget.xml index e21470b7d9437..1cecd91df6163 100644 --- a/app/code/Magento/Cms/etc/widget.xml +++ b/app/code/Magento/Cms/etc/widget.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/registration.php b/app/code/Magento/Cms/registration.php index 04edc95954744..926e792c92ac1 100644 --- a/app/code/Magento/Cms/registration.php +++ b/app/code/Magento/Cms/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml index 3df999a087ba3..7008d92109ab9 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_new.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_new.xml index 0eda18ec064d9..10ad53bb55820 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_block_new.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_block_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml index 05d59b2b74098..c2b8f136baee3 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml index 51e96834d8faf..1bd5368d7cb6f 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_new.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_new.xml index 7234d1d9ede29..b5befcb1019ed 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_page_new.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_page_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_contents.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_contents.xml index 9a9c1d83ac1eb..a8139b1ac8482 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_contents.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_contents.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml index 4e8d459a6ac2a..3c1689556590d 100644 --- a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml +++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/requirejs-config.js b/app/code/Magento/Cms/view/adminhtml/requirejs-config.js index 1e5eafa3c01fc..733f2e4217422 100644 --- a/app/code/Magento/Cms/view/adminhtml/requirejs-config.js +++ b/app/code/Magento/Cms/view/adminhtml/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -9,4 +9,4 @@ var config = { folderTree: 'Magento_Cms/js/folder-tree' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content.phtml index 703eea1f56a76..71a02950b0ef3 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml index 0dbf365d3674b..b2ea3dd658ad0 100644 --- a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml +++ b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml index b47e634cfb0c7..a5dcdc06f82fc 100644 --- a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml +++ b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml index 33dde070c381f..15f078e5d9089 100644 --- a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml +++ b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js b/app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js index 50aaf47912c3f..a72db4db80242 100644 --- a/app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js +++ b/app/code/Magento/Cms/view/adminhtml/web/js/folder-tree.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ @@ -84,4 +84,4 @@ define([ }); return $.mage.folderTree; -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_index_defaultindex.xml b/app/code/Magento/Cms/view/frontend/layout/cms_index_defaultindex.xml index 6aa6f51204f72..ec68cb946b3ad 100644 --- a/app/code/Magento/Cms/view/frontend/layout/cms_index_defaultindex.xml +++ b/app/code/Magento/Cms/view/frontend/layout/cms_index_defaultindex.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_index_defaultnoroute.xml b/app/code/Magento/Cms/view/frontend/layout/cms_index_defaultnoroute.xml index ed7bc4f815a36..39607b840044b 100644 --- a/app/code/Magento/Cms/view/frontend/layout/cms_index_defaultnoroute.xml +++ b/app/code/Magento/Cms/view/frontend/layout/cms_index_defaultnoroute.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_index_index.xml b/app/code/Magento/Cms/view/frontend/layout/cms_index_index.xml index 7509438df2553..e01b48cc71b11 100644 --- a/app/code/Magento/Cms/view/frontend/layout/cms_index_index.xml +++ b/app/code/Magento/Cms/view/frontend/layout/cms_index_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_index_nocookies.xml b/app/code/Magento/Cms/view/frontend/layout/cms_index_nocookies.xml index 7509438df2553..e01b48cc71b11 100644 --- a/app/code/Magento/Cms/view/frontend/layout/cms_index_nocookies.xml +++ b/app/code/Magento/Cms/view/frontend/layout/cms_index_nocookies.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_index_noroute.xml b/app/code/Magento/Cms/view/frontend/layout/cms_index_noroute.xml index 7509438df2553..e01b48cc71b11 100644 --- a/app/code/Magento/Cms/view/frontend/layout/cms_index_noroute.xml +++ b/app/code/Magento/Cms/view/frontend/layout/cms_index_noroute.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_page_view.xml b/app/code/Magento/Cms/view/frontend/layout/cms_page_view.xml index 615a7b42853a9..9b49cd29a5ade 100644 --- a/app/code/Magento/Cms/view/frontend/layout/cms_page_view.xml +++ b/app/code/Magento/Cms/view/frontend/layout/cms_page_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/frontend/layout/default.xml b/app/code/Magento/Cms/view/frontend/layout/default.xml index 88675207b6e72..d6e411815703b 100644 --- a/app/code/Magento/Cms/view/frontend/layout/default.xml +++ b/app/code/Magento/Cms/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/frontend/layout/print.xml b/app/code/Magento/Cms/view/frontend/layout/print.xml index 7509438df2553..e01b48cc71b11 100644 --- a/app/code/Magento/Cms/view/frontend/layout/print.xml +++ b/app/code/Magento/Cms/view/frontend/layout/print.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cms/view/frontend/templates/content.phtml b/app/code/Magento/Cms/view/frontend/templates/content.phtml index 29d92eb4f826e..5087ccbc95781 100644 --- a/app/code/Magento/Cms/view/frontend/templates/content.phtml +++ b/app/code/Magento/Cms/view/frontend/templates/content.phtml @@ -1,6 +1,6 @@ -There was no Home CMS page configured or found. \ No newline at end of file +There was no Home CMS page configured or found. diff --git a/app/code/Magento/Cms/view/frontend/templates/default/no-route.phtml b/app/code/Magento/Cms/view/frontend/templates/default/no-route.phtml index 384e2c14aee9a..2013ef4ca6720 100644 --- a/app/code/Magento/Cms/view/frontend/templates/default/no-route.phtml +++ b/app/code/Magento/Cms/view/frontend/templates/default/no-route.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cms/view/frontend/templates/meta.phtml b/app/code/Magento/Cms/view/frontend/templates/meta.phtml index d6e3b81b8cbc0..7b9235dc8e040 100644 --- a/app/code/Magento/Cms/view/frontend/templates/meta.phtml +++ b/app/code/Magento/Cms/view/frontend/templates/meta.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CmsUrlRewrite/etc/events.xml b/app/code/Magento/CmsUrlRewrite/etc/events.xml index 79798b599e294..fef365af721a7 100644 --- a/app/code/Magento/CmsUrlRewrite/etc/events.xml +++ b/app/code/Magento/CmsUrlRewrite/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CmsUrlRewrite/etc/module.xml b/app/code/Magento/CmsUrlRewrite/etc/module.xml index 6f7228c92f0bc..5d29e1201841e 100644 --- a/app/code/Magento/CmsUrlRewrite/etc/module.xml +++ b/app/code/Magento/CmsUrlRewrite/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CmsUrlRewrite/registration.php b/app/code/Magento/CmsUrlRewrite/registration.php index 6b4a345baa4b1..94f20986c3a66 100644 --- a/app/code/Magento/CmsUrlRewrite/registration.php +++ b/app/code/Magento/CmsUrlRewrite/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Config/Test/Unit/Model/ConfigTest.php index b8e3942ca03bb..dacd4b811cfe9 100644 --- a/app/code/Magento/Config/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/acl_1.xml b/app/code/Magento/Config/Test/Unit/Model/_files/acl_1.xml index 8777b5a5c9b04..7a64451132077 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/acl_1.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/acl_1.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/acl_2.xml b/app/code/Magento/Config/Test/Unit/Model/_files/acl_2.xml index f1d1a58519055..25ffd2e232bb7 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/acl_2.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/acl_2.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/acl_merged.xml b/app/code/Magento/Config/Test/Unit/Model/_files/acl_merged.xml index 533b80a833442..4f64fcfd1978a 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/acl_merged.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/acl_merged.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php index cf015e3f4fa81..fb14e864b4fb0 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php +++ b/app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/menu_2.xml b/app/code/Magento/Config/Test/Unit/Model/_files/menu_2.xml index a3ce4a37b5442..be40b39845cde 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/menu_2.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/menu_2.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/system_1.xml b/app/code/Magento/Config/Test/Unit/Model/_files/system_1.xml index d4e82056c7d52..f457f5561ad73 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/system_1.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/system_1.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/system_2.xml b/app/code/Magento/Config/Test/Unit/Model/_files/system_2.xml index 507d14dfb8360..c532d3b784fe9 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/system_2.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/system_2.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/system_config_options_1.xml b/app/code/Magento/Config/Test/Unit/Model/_files/system_config_options_1.xml index 585090d2e3640..742773c27730b 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/system_config_options_1.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/system_config_options_1.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/system_config_options_2.xml b/app/code/Magento/Config/Test/Unit/Model/_files/system_config_options_2.xml index 85ee630d0491a..51dd03e0b00df 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/system_config_options_2.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/system_config_options_2.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/system_unknown_attribute_1.xml b/app/code/Magento/Config/Test/Unit/Model/_files/system_unknown_attribute_1.xml index 9dddfc75dc53f..aafdd903b9cc3 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/system_unknown_attribute_1.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/system_unknown_attribute_1.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/Test/Unit/Model/_files/system_unknown_attribute_2.xml b/app/code/Magento/Config/Test/Unit/Model/_files/system_unknown_attribute_2.xml index 7f1cf40924c95..a343a1ab45396 100644 --- a/app/code/Magento/Config/Test/Unit/Model/_files/system_unknown_attribute_2.xml +++ b/app/code/Magento/Config/Test/Unit/Model/_files/system_unknown_attribute_2.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/acl.xml b/app/code/Magento/Config/etc/acl.xml index 4378d5476eaf0..14a29ff3bae41 100644 --- a/app/code/Magento/Config/etc/acl.xml +++ b/app/code/Magento/Config/etc/acl.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/adminhtml/di.xml b/app/code/Magento/Config/etc/adminhtml/di.xml index 48d6f597b6dd0..672693b9a400b 100644 --- a/app/code/Magento/Config/etc/adminhtml/di.xml +++ b/app/code/Magento/Config/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/adminhtml/events.xml b/app/code/Magento/Config/etc/adminhtml/events.xml index 0e93efa442771..dcaa2961f9ca0 100644 --- a/app/code/Magento/Config/etc/adminhtml/events.xml +++ b/app/code/Magento/Config/etc/adminhtml/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/adminhtml/menu.xml b/app/code/Magento/Config/etc/adminhtml/menu.xml index 3228c6678b67e..62083660f411b 100644 --- a/app/code/Magento/Config/etc/adminhtml/menu.xml +++ b/app/code/Magento/Config/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/adminhtml/routes.xml b/app/code/Magento/Config/etc/adminhtml/routes.xml index 47a0de2890a2f..b96cbba088a85 100644 --- a/app/code/Magento/Config/etc/adminhtml/routes.xml +++ b/app/code/Magento/Config/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/di.xml b/app/code/Magento/Config/etc/di.xml index 3e2fa4fbecf6d..9579e1ca31914 100644 --- a/app/code/Magento/Config/etc/di.xml +++ b/app/code/Magento/Config/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/module.xml b/app/code/Magento/Config/etc/module.xml index be109bc027d2a..41b35ad1bf9eb 100644 --- a/app/code/Magento/Config/etc/module.xml +++ b/app/code/Magento/Config/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/system.xsd b/app/code/Magento/Config/etc/system.xsd index b0b62101d35c1..8579d14a9cf31 100644 --- a/app/code/Magento/Config/etc/system.xsd +++ b/app/code/Magento/Config/etc/system.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/system_file.xsd b/app/code/Magento/Config/etc/system_file.xsd index fc90d36ebaae6..0914312c76362 100644 --- a/app/code/Magento/Config/etc/system_file.xsd +++ b/app/code/Magento/Config/etc/system_file.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/etc/system_include.xsd b/app/code/Magento/Config/etc/system_include.xsd index a7ef13ef11ebf..563448c25078a 100644 --- a/app/code/Magento/Config/etc/system_include.xsd +++ b/app/code/Magento/Config/etc/system_include.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Config/registration.php b/app/code/Magento/Config/registration.php index ebf8ea2bf6871..29c42cd42e789 100644 --- a/app/code/Magento/Config/registration.php +++ b/app/code/Magento/Config/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml b/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml index 9f1fb1bf29f09..6dcdf371eeadc 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ConfigurableImportExport/etc/export.xml b/app/code/Magento/ConfigurableImportExport/etc/export.xml index 897b4ac4c5959..7579f1ed01b5d 100644 --- a/app/code/Magento/ConfigurableImportExport/etc/export.xml +++ b/app/code/Magento/ConfigurableImportExport/etc/export.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableImportExport/etc/import.xml b/app/code/Magento/ConfigurableImportExport/etc/import.xml index 7e6d400e04a20..6be1a1deef9a4 100644 --- a/app/code/Magento/ConfigurableImportExport/etc/import.xml +++ b/app/code/Magento/ConfigurableImportExport/etc/import.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableImportExport/etc/module.xml b/app/code/Magento/ConfigurableImportExport/etc/module.xml index bb27c872fff9c..8aa43f90dc401 100644 --- a/app/code/Magento/ConfigurableImportExport/etc/module.xml +++ b/app/code/Magento/ConfigurableImportExport/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableImportExport/registration.php b/app/code/Magento/ConfigurableImportExport/registration.php index 467b113eec2bb..dfece572c23e8 100644 --- a/app/code/Magento/ConfigurableImportExport/registration.php +++ b/app/code/Magento/ConfigurableImportExport/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/adminhtml/events.xml b/app/code/Magento/ConfigurableProduct/etc/adminhtml/events.xml index 88df2d60a7dd4..70fb2a15438d5 100644 --- a/app/code/Magento/ConfigurableProduct/etc/adminhtml/events.xml +++ b/app/code/Magento/ConfigurableProduct/etc/adminhtml/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/adminhtml/routes.xml b/app/code/Magento/ConfigurableProduct/etc/adminhtml/routes.xml index 71b8d9fc3491b..4fe6563978362 100644 --- a/app/code/Magento/ConfigurableProduct/etc/adminhtml/routes.xml +++ b/app/code/Magento/ConfigurableProduct/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml b/app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml index c7e4090948fad..494b09d031c56 100644 --- a/app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml +++ b/app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/config.xml b/app/code/Magento/ConfigurableProduct/etc/config.xml index f8cd8f1096e99..98b1658bc52c4 100644 --- a/app/code/Magento/ConfigurableProduct/etc/config.xml +++ b/app/code/Magento/ConfigurableProduct/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/di.xml b/app/code/Magento/ConfigurableProduct/etc/di.xml index ca06ce5cc974b..30535cb86d567 100644 --- a/app/code/Magento/ConfigurableProduct/etc/di.xml +++ b/app/code/Magento/ConfigurableProduct/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/extension_attributes.xml b/app/code/Magento/ConfigurableProduct/etc/extension_attributes.xml index 12461665fa107..45cb1e66dc8b7 100644 --- a/app/code/Magento/ConfigurableProduct/etc/extension_attributes.xml +++ b/app/code/Magento/ConfigurableProduct/etc/extension_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/frontend/di.xml b/app/code/Magento/ConfigurableProduct/etc/frontend/di.xml index 43ed1f707caa7..aa2dec7eb78ec 100644 --- a/app/code/Magento/ConfigurableProduct/etc/frontend/di.xml +++ b/app/code/Magento/ConfigurableProduct/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml index 706338092c4b6..a0f11f5c73e85 100644 --- a/app/code/Magento/ConfigurableProduct/etc/module.xml +++ b/app/code/Magento/ConfigurableProduct/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/product_types.xml b/app/code/Magento/ConfigurableProduct/etc/product_types.xml index b33f67dbc159f..201da50fa47fa 100644 --- a/app/code/Magento/ConfigurableProduct/etc/product_types.xml +++ b/app/code/Magento/ConfigurableProduct/etc/product_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/sales.xml b/app/code/Magento/ConfigurableProduct/etc/sales.xml index 4efc7b09e861e..8e56542a28ae2 100644 --- a/app/code/Magento/ConfigurableProduct/etc/sales.xml +++ b/app/code/Magento/ConfigurableProduct/etc/sales.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/etc/webapi.xml b/app/code/Magento/ConfigurableProduct/etc/webapi.xml index aa8103da274ac..13a647f70c359 100644 --- a/app/code/Magento/ConfigurableProduct/etc/webapi.xml +++ b/app/code/Magento/ConfigurableProduct/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/registration.php b/app/code/Magento/ConfigurableProduct/registration.php index 13ff30e84637c..9cd8c621920f6 100644 --- a/app/code/Magento/ConfigurableProduct/registration.php +++ b/app/code/Magento/ConfigurableProduct/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_associated_grid.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_associated_grid.xml index 40bafbc4f8b8e..769300a80c820 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_associated_grid.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_associated_grid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_attribute_edit_product_tab_variations_popup.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_attribute_edit_product_tab_variations_popup.xml index a6fbfb23162ca..16c1c38f4d42b 100755 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_attribute_edit_product_tab_variations_popup.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_attribute_edit_product_tab_variations_popup.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_configurable.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_configurable.xml index a69692fc7a171..b4d18dc122080 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_configurable.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_configurable.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_downloadable.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_downloadable.xml index 15a7d680aa2dd..566bcc861857d 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_downloadable.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_downloadable.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml index b8f8d47b8f46b..11fe045901aac 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_set_edit.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_set_edit.xml index a72f712e77f3f..b30ad947c5dbe 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_set_edit.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_set_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_simple.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_simple.xml index 15a7d680aa2dd..566bcc861857d 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_simple.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_simple.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_superconfig_config.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_superconfig_config.xml index 74084d9a63eb4..6b39e64b95d4c 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_superconfig_config.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_superconfig_config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_view_type_configurable.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_view_type_configurable.xml index b0d6ea3101e2c..457539b1279e4 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_view_type_configurable.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_view_type_configurable.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_virtual.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_virtual.xml index 15a7d680aa2dd..566bcc861857d 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_virtual.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_virtual.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_wizard.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_wizard.xml index b526cde2022c6..8db28bde0a0cb 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_wizard.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_wizard.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml index a5a21b0940054..c37400baef7a4 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/new/created.phtml @@ -1,6 +1,6 @@ \ No newline at end of file + diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml index ff4d27dc6852b..da52cf1d16c89 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml index 1366208038e0f..5fb4cc6420557 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/configurable_associated_product_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml index fd7759725e4bc..cac255af99610 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_attributes_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_form.xml index 2896efca648e6..a928988a29cd9 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/ui_component/product_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/css/configurable-product.css b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/css/configurable-product.css index 88a8e3876832a..30d75898e79bc 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/css/configurable-product.css +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/css/configurable-product.css @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/associated-product-insert-listing.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/associated-product-insert-listing.js index ecc960bdb9ea5..98461addf4c4f 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/associated-product-insert-listing.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/associated-product-insert-listing.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/container-configurable-handler.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/container-configurable-handler.js index 542a9e492d586..e3834bc3464c1 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/container-configurable-handler.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/container-configurable-handler.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js index 107fa05af1d3d..99a495a509179 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-price-type.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-warning.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-warning.js index 3c0b5b82633cc..210361945c541 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-warning.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/custom-options-warning.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js index be44c110c2b62..d11acc8cc9699 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js index 37f183197dae0..a90d977da6056 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/modal-configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/modal-configurable.js index 81f1387eb4f46..b0dfe14fe9d6b 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/modal-configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/modal-configurable.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/price-configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/price-configurable.js index 9a676d660c7ab..c83697874d7cf 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/price-configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/price-configurable.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable-type-handler.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable-type-handler.js index ed881be011d7f..857dd8cfa38e8 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable-type-handler.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable-type-handler.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable.js index 988f5f963e2fb..df3b1638f61d1 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/configurable.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /**************************** CONFIGURABLE PRODUCT **************************/ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/options/price-type-handler.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/options/price-type-handler.js index 4a9edda0eb496..cd354741bb061 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/options/price-type-handler.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/options/price-type-handler.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /* @@ -80,4 +80,4 @@ define([ } }; }); -*/ \ No newline at end of file +*/ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/paging/sizes.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/paging/sizes.js index 92a83f1bbdd49..386c486cea7b7 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/paging/sizes.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/paging/sizes.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js index 7d574a32498d0..ce2fd9ac5ea80 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js @@ -1,6 +1,6 @@ // jscs:disable requireDotNotation /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/attributes_values.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/attributes_values.js index e16ea059c2b1f..c3c4bc2336a1b 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/attributes_values.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/attributes_values.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // jscs:disable jsDoc diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/bulk.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/bulk.js index f6769b0d0a9f9..ae4a51fb3b0bd 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/bulk.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/bulk.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true jquery:true*/ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js index 994fbf25e3b0f..18a1b30c051ce 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // jscs:disable jsDoc diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js index c0d1dd642c8b9..1d504cda1738b 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // jscs:disable jsDoc diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js index 45bd795572d04..ff83a9828c180 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js @@ -1,6 +1,6 @@ // jscs:disable requireDotNotation /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // jscs:disable jsDoc 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 cf7a314d8636e..69b45d7fc6552 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/actions-list.html b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/actions-list.html index b423b66971b06..290491a938b05 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/actions-list.html +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/actions-list.html @@ -1,6 +1,6 @@ @@ -41,4 +41,4 @@ "> - \ No newline at end of file + diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/cell-html.html b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/cell-html.html index 8611ea9b3d03b..bb6b3556734fe 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/cell-html.html +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/cell-html.html @@ -1,6 +1,6 @@ @@ -10,4 +10,4 @@ css: {_disabled: disabled} "> - \ No newline at end of file + diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/cell-status.html b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/cell-status.html index c66c058668cff..4006a8937d2df 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/cell-status.html +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/cell-status.html @@ -1,6 +1,6 @@ @@ -10,4 +10,4 @@ css: {_disabled: disabled} "> - \ No newline at end of file + diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/file-uploader.html b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/file-uploader.html index 8fd1604fafb10..8bdb919d138a9 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/file-uploader.html +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/components/file-uploader.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/variations/steps/summary-grid.html b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/variations/steps/summary-grid.html index ada2e2205e9fb..4ef980d98bed8 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/variations/steps/summary-grid.html +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/variations/steps/summary-grid.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/base/layout/catalog_product_prices.xml b/app/code/Magento/ConfigurableProduct/view/base/layout/catalog_product_prices.xml index 545b04dc0a327..0ae2972fd36aa 100644 --- a/app/code/Magento/ConfigurableProduct/view/base/layout/catalog_product_prices.xml +++ b/app/code/Magento/ConfigurableProduct/view/base/layout/catalog_product_prices.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml index 5943b1ea2af5b..ab3abad184226 100644 --- a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/final_price.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_configure_type_configurable.xml b/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_configure_type_configurable.xml index 41655260017b1..a73350bd95db6 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_configure_type_configurable.xml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_configure_type_configurable.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_item_renderers.xml index 9d22b2a65cc2e..9577f947a7a48 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml index 0993cbf80770f..e861caa27aa2d 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js b/app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js index 8794db668f40b..58b294fe7face 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -9,4 +9,4 @@ var config = { configurable: 'Magento_ConfigurableProduct/js/configurable' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml b/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml index e490a6aa04923..bdcb2e9bf7747 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/templates/js/components.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Contact/etc/adminhtml/system.xml b/app/code/Magento/Contact/etc/adminhtml/system.xml index ca1ced83457d4..6d39846019a36 100644 --- a/app/code/Magento/Contact/etc/adminhtml/system.xml +++ b/app/code/Magento/Contact/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/etc/config.xml b/app/code/Magento/Contact/etc/config.xml index c40b752cf17c4..3a3e3460585b9 100644 --- a/app/code/Magento/Contact/etc/config.xml +++ b/app/code/Magento/Contact/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/etc/di.xml b/app/code/Magento/Contact/etc/di.xml index 95cd40cb55e31..0800e42b0ec0c 100644 --- a/app/code/Magento/Contact/etc/di.xml +++ b/app/code/Magento/Contact/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/etc/email_templates.xml b/app/code/Magento/Contact/etc/email_templates.xml index 17bcfeb0d18a5..be2cf76d5911b 100644 --- a/app/code/Magento/Contact/etc/email_templates.xml +++ b/app/code/Magento/Contact/etc/email_templates.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/etc/frontend/di.xml b/app/code/Magento/Contact/etc/frontend/di.xml index d376dca8c834d..b520c9f0e865d 100644 --- a/app/code/Magento/Contact/etc/frontend/di.xml +++ b/app/code/Magento/Contact/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/etc/frontend/page_types.xml b/app/code/Magento/Contact/etc/frontend/page_types.xml index bdf9f108ba355..a6f630d892114 100644 --- a/app/code/Magento/Contact/etc/frontend/page_types.xml +++ b/app/code/Magento/Contact/etc/frontend/page_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/etc/frontend/routes.xml b/app/code/Magento/Contact/etc/frontend/routes.xml index ab07f5492bdbf..ba548c605b71b 100644 --- a/app/code/Magento/Contact/etc/frontend/routes.xml +++ b/app/code/Magento/Contact/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Contact/etc/module.xml b/app/code/Magento/Contact/etc/module.xml index 837b37efec72a..ea6c3d05c692c 100644 --- a/app/code/Magento/Contact/etc/module.xml +++ b/app/code/Magento/Contact/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/registration.php b/app/code/Magento/Contact/registration.php index b7e0223259d3b..6d3f8dc31a95d 100644 --- a/app/code/Magento/Contact/registration.php +++ b/app/code/Magento/Contact/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml b/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml index ff22911fc0e75..740647609b195 100644 --- a/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml +++ b/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/view/frontend/layout/default.xml b/app/code/Magento/Contact/view/frontend/layout/default.xml index 6eb2f280e164d..a97cf0ddc64e0 100644 --- a/app/code/Magento/Contact/view/frontend/layout/default.xml +++ b/app/code/Magento/Contact/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Contact/view/frontend/templates/form.phtml b/app/code/Magento/Contact/view/frontend/templates/form.phtml index 6322c5b2fe54b..5380deea65ec7 100644 --- a/app/code/Magento/Contact/view/frontend/templates/form.phtml +++ b/app/code/Magento/Contact/view/frontend/templates/form.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cookie/etc/config.xml b/app/code/Magento/Cookie/etc/config.xml index f50e5fea8facd..4266c755f7737 100644 --- a/app/code/Magento/Cookie/etc/config.xml +++ b/app/code/Magento/Cookie/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cookie/etc/di.xml b/app/code/Magento/Cookie/etc/di.xml index 0cd62d0632f37..73e5dacb9b2fe 100644 --- a/app/code/Magento/Cookie/etc/di.xml +++ b/app/code/Magento/Cookie/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cookie/etc/frontend/routes.xml b/app/code/Magento/Cookie/etc/frontend/routes.xml index 70ea487ab5b16..ca903f9d58e5b 100644 --- a/app/code/Magento/Cookie/etc/frontend/routes.xml +++ b/app/code/Magento/Cookie/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Cookie/etc/module.xml b/app/code/Magento/Cookie/etc/module.xml index 0efe82649693a..75b6e7bad6df0 100644 --- a/app/code/Magento/Cookie/etc/module.xml +++ b/app/code/Magento/Cookie/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cookie/registration.php b/app/code/Magento/Cookie/registration.php index ab3fb6ac73e3f..696427c020dc3 100644 --- a/app/code/Magento/Cookie/registration.php +++ b/app/code/Magento/Cookie/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cookie/view/frontend/requirejs-config.js b/app/code/Magento/Cookie/view/frontend/requirejs-config.js index 7c90d480ebdfc..680ca42ebd11d 100644 --- a/app/code/Magento/Cookie/view/frontend/requirejs-config.js +++ b/app/code/Magento/Cookie/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -10,4 +10,4 @@ var config = { cookieNotices: 'Magento_Cookie/js/notices' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml index 7b6e178447fd9..741d88df1e4b7 100644 --- a/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml +++ b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml @@ -1,6 +1,6 @@ getScriptOptions(); ?> } } - \ No newline at end of file + diff --git a/app/code/Magento/Cookie/view/frontend/web/js/notices.js b/app/code/Magento/Cookie/view/frontend/web/js/notices.js index 8d0e81c473874..d7f0fa3874756 100644 --- a/app/code/Magento/Cookie/view/frontend/web/js/notices.js +++ b/app/code/Magento/Cookie/view/frontend/web/js/notices.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true jquery:true*/ diff --git a/app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js b/app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js index 8dfa50ac26d8c..ca8861cc68533 100644 --- a/app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js +++ b/app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint evil:true browser:true jquery:true */ diff --git a/app/code/Magento/Cron/Console/Command/CronCommand.php b/app/code/Magento/Cron/Console/Command/CronCommand.php index 5202c3edcc1a9..a1f0ad5b47e8b 100644 --- a/app/code/Magento/Cron/Console/Command/CronCommand.php +++ b/app/code/Magento/Cron/Console/Command/CronCommand.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_duplicates.xml b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_duplicates.xml index b899a6ee89dee..1512aafb9abb2 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_duplicates.xml +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_duplicates.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_node_typo.xml b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_node_typo.xml index a5cd3f2b4413d..17e6850474e79 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_node_typo.xml +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_node_typo.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_instance.xml b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_instance.xml index 5243210c7c736..1b7f2a2f70daf 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_instance.xml +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_instance.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_method.xml b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_method.xml index 35ce23871fcf9..1c0654811d4cd 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_method.xml +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_method.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_name.xml b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_name.xml index 747bf5febb209..8bf7f63b97979 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_name.xml +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_invalid_without_name.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_valid.xml b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_valid.xml index 444c228299dfe..79c4da8a7837e 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_valid.xml +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_valid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_valid_without_schedule.xml b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_valid_without_schedule.xml index e527465d1fe3e..4e255306e503c 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_valid_without_schedule.xml +++ b/app/code/Magento/Cron/Test/Unit/Model/Config/_files/crontab_valid_without_schedule.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Cron/Test/Unit/Model/ConfigTest.php index 9a9ffb09ae93a..01d550611868c 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Cron/Test/Unit/Model/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Cron/etc/cron_groups.xml b/app/code/Magento/Cron/etc/cron_groups.xml index 339ed3fa4a734..d3e091c862531 100644 --- a/app/code/Magento/Cron/etc/cron_groups.xml +++ b/app/code/Magento/Cron/etc/cron_groups.xml @@ -1,7 +1,7 @@ @@ -15,4 +15,4 @@ 600 0 - \ No newline at end of file + diff --git a/app/code/Magento/Cron/etc/cron_groups.xsd b/app/code/Magento/Cron/etc/cron_groups.xsd index 87d2cb5bfb13e..15074997589de 100644 --- a/app/code/Magento/Cron/etc/cron_groups.xsd +++ b/app/code/Magento/Cron/etc/cron_groups.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/etc/crontab.xsd b/app/code/Magento/Cron/etc/crontab.xsd index 2a2ae3ff06a00..68279da5aec84 100644 --- a/app/code/Magento/Cron/etc/crontab.xsd +++ b/app/code/Magento/Cron/etc/crontab.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/etc/crontab/events.xml b/app/code/Magento/Cron/etc/crontab/events.xml index b24feb04c577f..9de72ebb03eb5 100644 --- a/app/code/Magento/Cron/etc/crontab/events.xml +++ b/app/code/Magento/Cron/etc/crontab/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/etc/di.xml b/app/code/Magento/Cron/etc/di.xml index 6abc9096f2401..98aa08815d3aa 100644 --- a/app/code/Magento/Cron/etc/di.xml +++ b/app/code/Magento/Cron/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/etc/module.xml b/app/code/Magento/Cron/etc/module.xml index 6d197d16b78a8..288aa6fbec23e 100644 --- a/app/code/Magento/Cron/etc/module.xml +++ b/app/code/Magento/Cron/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Cron/registration.php b/app/code/Magento/Cron/registration.php index 2510e93c6b76b..227c716af1862 100644 --- a/app/code/Magento/Cron/registration.php +++ b/app/code/Magento/Cron/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CurrencySymbol/etc/adminhtml/menu.xml b/app/code/Magento/CurrencySymbol/etc/adminhtml/menu.xml index ae6e8ef40de84..5dbf49d2c1cf3 100644 --- a/app/code/Magento/CurrencySymbol/etc/adminhtml/menu.xml +++ b/app/code/Magento/CurrencySymbol/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CurrencySymbol/etc/adminhtml/routes.xml b/app/code/Magento/CurrencySymbol/etc/adminhtml/routes.xml index bf0c1873e0f2d..31353a45c2859 100644 --- a/app/code/Magento/CurrencySymbol/etc/adminhtml/routes.xml +++ b/app/code/Magento/CurrencySymbol/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CurrencySymbol/etc/di.xml b/app/code/Magento/CurrencySymbol/etc/di.xml index 15de35ba58ad2..cbce50306bc45 100644 --- a/app/code/Magento/CurrencySymbol/etc/di.xml +++ b/app/code/Magento/CurrencySymbol/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CurrencySymbol/etc/events.xml b/app/code/Magento/CurrencySymbol/etc/events.xml index 7f5e98b1dcd60..aff0fea744c43 100644 --- a/app/code/Magento/CurrencySymbol/etc/events.xml +++ b/app/code/Magento/CurrencySymbol/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CurrencySymbol/etc/module.xml b/app/code/Magento/CurrencySymbol/etc/module.xml index 96994b03ce6c7..cbda20acdad82 100644 --- a/app/code/Magento/CurrencySymbol/etc/module.xml +++ b/app/code/Magento/CurrencySymbol/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CurrencySymbol/registration.php b/app/code/Magento/CurrencySymbol/registration.php index 15ba3ffc36701..ab086a95e2d6c 100644 --- a/app/code/Magento/CurrencySymbol/registration.php +++ b/app/code/Magento/CurrencySymbol/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/layout/adminhtml_system_currencysymbol_index.xml b/app/code/Magento/CurrencySymbol/view/adminhtml/layout/adminhtml_system_currencysymbol_index.xml index 7fc5203224c05..bf7126f432cf9 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/layout/adminhtml_system_currencysymbol_index.xml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/layout/adminhtml_system_currencysymbol_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml index 4e0d45395ed65..b3edf7a397bff 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/grid.phtml @@ -1,6 +1,6 @@ getChildHtml('import_services') ?> - \ No newline at end of file + diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rates.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rates.phtml index 20e36a1d0ce80..e6b0635b2e292 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rates.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rates.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php index 4329c33f3161f..13bd067dbff01 100644 --- a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php +++ b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/Test/Unit/Model/Address/Config/_files/formats_one.xml b/app/code/Magento/Customer/Test/Unit/Model/Address/Config/_files/formats_one.xml index cbb32e5347cd2..fe42eff100fde 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Address/Config/_files/formats_one.xml +++ b/app/code/Magento/Customer/Test/Unit/Model/Address/Config/_files/formats_one.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/Test/Unit/Model/Address/Config/_files/formats_two.xml b/app/code/Magento/Customer/Test/Unit/Model/Address/Config/_files/formats_two.xml index c5a18ed44d499..0b46b5291ec14 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Address/Config/_files/formats_two.xml +++ b/app/code/Magento/Customer/Test/Unit/Model/Address/Config/_files/formats_two.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php b/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php index 2b4a93084c7ac..9bb5f39d2188f 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Address/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/etc/address_formats.xml b/app/code/Magento/Customer/etc/address_formats.xml index f501df2f3b63a..c4d74375c32d3 100644 --- a/app/code/Magento/Customer/etc/address_formats.xml +++ b/app/code/Magento/Customer/etc/address_formats.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/address_formats.xsd b/app/code/Magento/Customer/etc/address_formats.xsd index f5df16ffcc5ea..14d0ad4598054 100644 --- a/app/code/Magento/Customer/etc/address_formats.xsd +++ b/app/code/Magento/Customer/etc/address_formats.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/adminhtml/di.xml b/app/code/Magento/Customer/etc/adminhtml/di.xml index 08c9cb95efe66..cf2254307a9ed 100644 --- a/app/code/Magento/Customer/etc/adminhtml/di.xml +++ b/app/code/Magento/Customer/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/adminhtml/menu.xml b/app/code/Magento/Customer/etc/adminhtml/menu.xml index 31765fa89e8fe..eaa65dc280b00 100644 --- a/app/code/Magento/Customer/etc/adminhtml/menu.xml +++ b/app/code/Magento/Customer/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/adminhtml/routes.xml b/app/code/Magento/Customer/etc/adminhtml/routes.xml index 9f3b07f486025..4c68008dd1437 100644 --- a/app/code/Magento/Customer/etc/adminhtml/routes.xml +++ b/app/code/Magento/Customer/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml index f542c2b6e0f5e..66c54016fc227 100644 --- a/app/code/Magento/Customer/etc/adminhtml/system.xml +++ b/app/code/Magento/Customer/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/cache.xml b/app/code/Magento/Customer/etc/cache.xml index 37d1a63f69a4e..553f1f6535d52 100644 --- a/app/code/Magento/Customer/etc/cache.xml +++ b/app/code/Magento/Customer/etc/cache.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/config.xml b/app/code/Magento/Customer/etc/config.xml index dae8447191833..540918d44c139 100644 --- a/app/code/Magento/Customer/etc/config.xml +++ b/app/code/Magento/Customer/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/crontab.xml b/app/code/Magento/Customer/etc/crontab.xml index 472a49feb39fc..eda64cf2eca93 100644 --- a/app/code/Magento/Customer/etc/crontab.xml +++ b/app/code/Magento/Customer/etc/crontab.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 9113895f2e58a..225290f35c73f 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/email_templates.xml b/app/code/Magento/Customer/etc/email_templates.xml index 0d6b4d5877088..23fa73056b4c2 100644 --- a/app/code/Magento/Customer/etc/email_templates.xml +++ b/app/code/Magento/Customer/etc/email_templates.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/events.xml b/app/code/Magento/Customer/etc/events.xml index 45caa32d680c6..0e65ddca44924 100644 --- a/app/code/Magento/Customer/etc/events.xml +++ b/app/code/Magento/Customer/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/fieldset.xml b/app/code/Magento/Customer/etc/fieldset.xml index a43df71873475..b219305e3b9fa 100644 --- a/app/code/Magento/Customer/etc/fieldset.xml +++ b/app/code/Magento/Customer/etc/fieldset.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/frontend/di.xml b/app/code/Magento/Customer/etc/frontend/di.xml index 389d0eea246ea..4562acb00fe5b 100644 --- a/app/code/Magento/Customer/etc/frontend/di.xml +++ b/app/code/Magento/Customer/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/frontend/events.xml b/app/code/Magento/Customer/etc/frontend/events.xml index 5bb0ffe3cb7c2..75cc5f7c929dc 100644 --- a/app/code/Magento/Customer/etc/frontend/events.xml +++ b/app/code/Magento/Customer/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/frontend/page_types.xml b/app/code/Magento/Customer/etc/frontend/page_types.xml index bfcda34cc3111..77a0fb520bbd3 100644 --- a/app/code/Magento/Customer/etc/frontend/page_types.xml +++ b/app/code/Magento/Customer/etc/frontend/page_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/frontend/routes.xml b/app/code/Magento/Customer/etc/frontend/routes.xml index d448185245add..eb91d26288ab4 100644 --- a/app/code/Magento/Customer/etc/frontend/routes.xml +++ b/app/code/Magento/Customer/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Customer/etc/frontend/sections.xml b/app/code/Magento/Customer/etc/frontend/sections.xml index 83d6394cd0951..877be8e0266ee 100644 --- a/app/code/Magento/Customer/etc/frontend/sections.xml +++ b/app/code/Magento/Customer/etc/frontend/sections.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/indexer.xml b/app/code/Magento/Customer/etc/indexer.xml index 5f644426d8169..1b831f778864c 100644 --- a/app/code/Magento/Customer/etc/indexer.xml +++ b/app/code/Magento/Customer/etc/indexer.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index f505adb98a0fa..5d9ae7ae8f9b4 100644 --- a/app/code/Magento/Customer/etc/module.xml +++ b/app/code/Magento/Customer/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/mview.xml b/app/code/Magento/Customer/etc/mview.xml index 4f88d94f15ede..ebeaac0114158 100644 --- a/app/code/Magento/Customer/etc/mview.xml +++ b/app/code/Magento/Customer/etc/mview.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/sections.xsd b/app/code/Magento/Customer/etc/sections.xsd index 91a09129357bb..f2be0302db725 100644 --- a/app/code/Magento/Customer/etc/sections.xsd +++ b/app/code/Magento/Customer/etc/sections.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/validation.xml b/app/code/Magento/Customer/etc/validation.xml index b496a9345cb82..d06164942c7d4 100644 --- a/app/code/Magento/Customer/etc/validation.xml +++ b/app/code/Magento/Customer/etc/validation.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/webapi.xml b/app/code/Magento/Customer/etc/webapi.xml index 3a492e7370242..f78d9c01d16a3 100644 --- a/app/code/Magento/Customer/etc/webapi.xml +++ b/app/code/Magento/Customer/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/webapi_rest/di.xml b/app/code/Magento/Customer/etc/webapi_rest/di.xml index 045f16cc6d028..a9d21aea930d3 100644 --- a/app/code/Magento/Customer/etc/webapi_rest/di.xml +++ b/app/code/Magento/Customer/etc/webapi_rest/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/etc/webapi_soap/di.xml b/app/code/Magento/Customer/etc/webapi_soap/di.xml index ae882cfacba68..61cdd928de4f4 100644 --- a/app/code/Magento/Customer/etc/webapi_soap/di.xml +++ b/app/code/Magento/Customer/etc/webapi_soap/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/registration.php b/app/code/Magento/Customer/registration.php index a1f0064643132..4c1e81d195b19 100644 --- a/app/code/Magento/Customer/registration.php +++ b/app/code/Magento/Customer/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_cart.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_cart.xml index 965dc8fa4d3ad..1cb5d82323760 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_cart.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_cart.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_carts.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_carts.xml index c5ffdc4fbae7e..3fa611ebd6e88 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_carts.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_carts.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml index 7d13c2dcf9a02..dfa8379891ad2 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_index.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_index.xml index 2bf05d10369f5..c6f3c3e2ead71 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_index.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_newsletter.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_newsletter.xml index 103b5ac2b38c4..10b4a31f5d963 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_newsletter.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_newsletter.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_orders.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_orders.xml index 031ae90eeab4c..e99d0a053eb0d 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_orders.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_orders.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml index 5b074b5095fef..671ef7ec0e7cc 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewcart.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewcart.xml index b44f04157ebe0..cc5d9e0da8225 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewcart.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewcart.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewwishlist.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewwishlist.xml index bad08a8f09737..8cd4ec724e3e3 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewwishlist.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_index_viewwishlist.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_online_index.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_online_index.xml index fb34ba65f7e26..1ae4259bc75fe 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_online_index.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_online_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/requirejs-config.js b/app/code/Magento/Customer/view/adminhtml/requirejs-config.js index 666193865f20a..589ece5b14104 100644 --- a/app/code/Magento/Customer/view/adminhtml/requirejs-config.js +++ b/app/code/Magento/Customer/view/adminhtml/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -14,4 +14,4 @@ var config = { observableInputs: 'Magento_Customer/edit/tab/js/addresses' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/Customer/view/adminhtml/templates/edit/js.phtml b/app/code/Magento/Customer/view/adminhtml/templates/edit/js.phtml index e5450890826b1..49cc0c8c7395a 100644 --- a/app/code/Magento/Customer/view/adminhtml/templates/edit/js.phtml +++ b/app/code/Magento/Customer/view/adminhtml/templates/edit/js.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml index 2dc9e89090c4c..4cb3547cb76a7 100644 --- a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml +++ b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/adminhtml/web/edit/post-wrapper.js b/app/code/Magento/Customer/view/adminhtml/web/edit/post-wrapper.js index d6fc60b5fb932..9b368adcbe665 100644 --- a/app/code/Magento/Customer/view/adminhtml/web/edit/post-wrapper.js +++ b/app/code/Magento/Customer/view/adminhtml/web/edit/post-wrapper.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js b/app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js index a3e04fc43fc40..7242dc945178d 100644 --- a/app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js +++ b/app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ @@ -563,4 +563,4 @@ define([ observableInputs: $.mage.observableInputs, dataItemDeleteButton: $.mage.dataItemDeleteButton }; -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Customer/view/adminhtml/web/js/bootstrap/customer-post-action.js b/app/code/Magento/Customer/view/adminhtml/web/js/bootstrap/customer-post-action.js index 7ea9247ecd94b..661c4e3d471c3 100644 --- a/app/code/Magento/Customer/view/adminhtml/web/js/bootstrap/customer-post-action.js +++ b/app/code/Magento/Customer/view/adminhtml/web/js/bootstrap/customer-post-action.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml index 61d2900af4bcb..ab5a89f9d3571 100644 --- a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml +++ b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/account_new.html b/app/code/Magento/Customer/view/frontend/email/account_new.html index 9d67e26e8e715..dac8e1ce57505 100644 --- a/app/code/Magento/Customer/view/frontend/email/account_new.html +++ b/app/code/Magento/Customer/view/frontend/email/account_new.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html b/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html index 193a1faed662d..5432956e8f03f 100644 --- a/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html +++ b/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html b/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html index 6e94fbdcc7807..b50c944c18b46 100644 --- a/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html +++ b/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/account_new_no_password.html b/app/code/Magento/Customer/view/frontend/email/account_new_no_password.html index 14cd8e98f8bfe..1c5371bd4868b 100644 --- a/app/code/Magento/Customer/view/frontend/email/account_new_no_password.html +++ b/app/code/Magento/Customer/view/frontend/email/account_new_no_password.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/change_email.html b/app/code/Magento/Customer/view/frontend/email/change_email.html index ab24368c02239..09d1537e1cc07 100644 --- a/app/code/Magento/Customer/view/frontend/email/change_email.html +++ b/app/code/Magento/Customer/view/frontend/email/change_email.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/change_email_and_password.html b/app/code/Magento/Customer/view/frontend/email/change_email_and_password.html index d2ca4d4cae0a2..23280b2822b48 100644 --- a/app/code/Magento/Customer/view/frontend/email/change_email_and_password.html +++ b/app/code/Magento/Customer/view/frontend/email/change_email_and_password.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/password_new.html b/app/code/Magento/Customer/view/frontend/email/password_new.html index 12c5a30ddf103..f5c2d87128300 100644 --- a/app/code/Magento/Customer/view/frontend/email/password_new.html +++ b/app/code/Magento/Customer/view/frontend/email/password_new.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/password_reset.html b/app/code/Magento/Customer/view/frontend/email/password_reset.html index 061e640810705..a255e2f99e575 100644 --- a/app/code/Magento/Customer/view/frontend/email/password_reset.html +++ b/app/code/Magento/Customer/view/frontend/email/password_reset.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html b/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html index a07b36c148005..efdd89bbec720 100644 --- a/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html +++ b/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml index 0f95cde6798fe..12849c5b0762b 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_confirmation.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_confirmation.xml index 5bf52253badd7..c2d7dc01dbbea 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_confirmation.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_confirmation.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml index 8eaba5c75fe1d..8a42132dd01fd 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_createpassword.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_createpassword.xml index 298ad6e9c3968..878fd56999045 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_createpassword.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_createpassword.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml index aa09fecc68170..452d98821105f 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml index e33da515e150a..a39f15c201c65 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml index c3a255192eb9b..6e738ac2980be 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_login.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_login.xml index 32b471dff8b33..e7c157acb1bfb 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_login.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_login.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_logoutsuccess.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_logoutsuccess.xml index 93b522c90dc60..d76363eaffb05 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_logoutsuccess.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_logoutsuccess.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml index 46bea31094523..67ab9768157e5 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_index.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_index.xml index 8706ba25c5691..42f7b5ea38a69 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_index.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/layout/default.xml b/app/code/Magento/Customer/view/frontend/layout/default.xml index 278c16b324da4..d80391c4973b6 100644 --- a/app/code/Magento/Customer/view/frontend/layout/default.xml +++ b/app/code/Magento/Customer/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Customer/view/frontend/requirejs-config.js b/app/code/Magento/Customer/view/frontend/requirejs-config.js index 508737742cafe..99442b69ac04e 100644 --- a/app/code/Magento/Customer/view/frontend/requirejs-config.js +++ b/app/code/Magento/Customer/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml b/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml index f34cc41344ebd..bcf0cc92bc912 100644 --- a/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/account/authentication-popup.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Customer/view/frontend/templates/account/navigation.phtml b/app/code/Magento/Customer/view/frontend/templates/account/navigation.phtml index 3c287e2b09d5c..9bd08ffedc9e0 100644 --- a/app/code/Magento/Customer/view/frontend/templates/account/navigation.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/account/navigation.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CustomerImportExport/Controller/Adminhtml/Index/ExportCsv.php b/app/code/Magento/CustomerImportExport/Controller/Adminhtml/Index/ExportCsv.php index b54be91ad1788..81a310be67965 100644 --- a/app/code/Magento/CustomerImportExport/Controller/Adminhtml/Index/ExportCsv.php +++ b/app/code/Magento/CustomerImportExport/Controller/Adminhtml/Index/ExportCsv.php @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/CustomerImportExport/etc/config.xml b/app/code/Magento/CustomerImportExport/etc/config.xml index 4e520d21a7e75..8240c00223600 100644 --- a/app/code/Magento/CustomerImportExport/etc/config.xml +++ b/app/code/Magento/CustomerImportExport/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CustomerImportExport/etc/export.xml b/app/code/Magento/CustomerImportExport/etc/export.xml index 933f4e99c528d..cf226c50ef681 100644 --- a/app/code/Magento/CustomerImportExport/etc/export.xml +++ b/app/code/Magento/CustomerImportExport/etc/export.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CustomerImportExport/etc/import.xml b/app/code/Magento/CustomerImportExport/etc/import.xml index cc6715f9995f9..316947ffaf028 100644 --- a/app/code/Magento/CustomerImportExport/etc/import.xml +++ b/app/code/Magento/CustomerImportExport/etc/import.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CustomerImportExport/etc/module.xml b/app/code/Magento/CustomerImportExport/etc/module.xml index f38e2ad009643..a2bb69023d2f5 100644 --- a/app/code/Magento/CustomerImportExport/etc/module.xml +++ b/app/code/Magento/CustomerImportExport/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CustomerImportExport/registration.php b/app/code/Magento/CustomerImportExport/registration.php index cbcf924475865..9aac304811a85 100644 --- a/app/code/Magento/CustomerImportExport/registration.php +++ b/app/code/Magento/CustomerImportExport/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/CustomerImportExport/view/adminhtml/layout/customer_import_export_index_exportxml.xml b/app/code/Magento/CustomerImportExport/view/adminhtml/layout/customer_import_export_index_exportxml.xml index 63f0f5b51c45e..581c23c802683 100644 --- a/app/code/Magento/CustomerImportExport/view/adminhtml/layout/customer_import_export_index_exportxml.xml +++ b/app/code/Magento/CustomerImportExport/view/adminhtml/layout/customer_import_export_index_exportxml.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/CustomerImportExport/view/adminhtml/layout/customer_index_grid_block.xml b/app/code/Magento/CustomerImportExport/view/adminhtml/layout/customer_index_grid_block.xml index 513a2d02ff48a..39f50e92aeafc 100644 --- a/app/code/Magento/CustomerImportExport/view/adminhtml/layout/customer_index_grid_block.xml +++ b/app/code/Magento/CustomerImportExport/view/adminhtml/layout/customer_index_grid_block.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php b/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php index 40b262e3e4f51..b63357be6bf8a 100644 --- a/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php +++ b/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Deploy/etc/module.xml b/app/code/Magento/Deploy/etc/module.xml index aa7e755178ccd..9197c17ef0931 100644 --- a/app/code/Magento/Deploy/etc/module.xml +++ b/app/code/Magento/Deploy/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Deploy/registration.php b/app/code/Magento/Deploy/registration.php index b692eb97c29d8..eda7bc5ea47a5 100644 --- a/app/code/Magento/Deploy/registration.php +++ b/app/code/Magento/Deploy/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Developer/Test/Unit/Helper/DataTest.php b/app/code/Magento/Developer/Test/Unit/Helper/DataTest.php index 8bb90eda5ad1a..4e4f0ab09fdc5 100644 --- a/app/code/Magento/Developer/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Developer/Test/Unit/Helper/DataTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Developer/etc/adminhtml/system.xml b/app/code/Magento/Developer/etc/adminhtml/system.xml index 0f1d43c8a5608..37a2cb581202a 100644 --- a/app/code/Magento/Developer/etc/adminhtml/system.xml +++ b/app/code/Magento/Developer/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Developer/etc/config.xml b/app/code/Magento/Developer/etc/config.xml index a39cd241fe63d..4bdd425bca51f 100644 --- a/app/code/Magento/Developer/etc/config.xml +++ b/app/code/Magento/Developer/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml index 2362aaa0780de..c0eaf8cfdd40c 100644 --- a/app/code/Magento/Developer/etc/di.xml +++ b/app/code/Magento/Developer/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Developer/etc/frontend/di.xml b/app/code/Magento/Developer/etc/frontend/di.xml index 23be59086b84e..6d526d8d02fc5 100644 --- a/app/code/Magento/Developer/etc/frontend/di.xml +++ b/app/code/Magento/Developer/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Developer/etc/module.xml b/app/code/Magento/Developer/etc/module.xml index 8069b14ddea05..ebdc7587eda41 100644 --- a/app/code/Magento/Developer/etc/module.xml +++ b/app/code/Magento/Developer/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Developer/registration.php b/app/code/Magento/Developer/registration.php index 95ae8d00e3ec4..5b0bab4b1d463 100644 --- a/app/code/Magento/Developer/registration.php +++ b/app/code/Magento/Developer/registration.php @@ -1,6 +1,6 @@ @@ -1557,4 +1557,4 @@ CM Zimbabwe - \ No newline at end of file + diff --git a/app/code/Magento/Dhl/Test/Unit/Model/_files/rates_request_data_dhl.php b/app/code/Magento/Dhl/Test/Unit/Model/_files/rates_request_data_dhl.php index 78e6dddb8c8eb..cbe3cf6b9f59b 100644 --- a/app/code/Magento/Dhl/Test/Unit/Model/_files/rates_request_data_dhl.php +++ b/app/code/Magento/Dhl/Test/Unit/Model/_files/rates_request_data_dhl.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Dhl/Test/Unit/Model/_files/success_dhl_response_rates.xml b/app/code/Magento/Dhl/Test/Unit/Model/_files/success_dhl_response_rates.xml index ac3a29e4a2e6d..1f8635a8b97a1 100644 --- a/app/code/Magento/Dhl/Test/Unit/Model/_files/success_dhl_response_rates.xml +++ b/app/code/Magento/Dhl/Test/Unit/Model/_files/success_dhl_response_rates.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Dhl/etc/adminhtml/system.xml b/app/code/Magento/Dhl/etc/adminhtml/system.xml index 4f28555021d99..dbbfe2a9ff415 100644 --- a/app/code/Magento/Dhl/etc/adminhtml/system.xml +++ b/app/code/Magento/Dhl/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Dhl/etc/config.xml b/app/code/Magento/Dhl/etc/config.xml index 5f094005afa2b..416c6ab271e0b 100644 --- a/app/code/Magento/Dhl/etc/config.xml +++ b/app/code/Magento/Dhl/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Dhl/etc/countries.xml b/app/code/Magento/Dhl/etc/countries.xml index 6402094f08dee..1b795fe8aad0b 100644 --- a/app/code/Magento/Dhl/etc/countries.xml +++ b/app/code/Magento/Dhl/etc/countries.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Dhl/etc/di.xml b/app/code/Magento/Dhl/etc/di.xml index cbe795791147c..bfcf0ffafdbac 100644 --- a/app/code/Magento/Dhl/etc/di.xml +++ b/app/code/Magento/Dhl/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Dhl/etc/module.xml b/app/code/Magento/Dhl/etc/module.xml index eccbdf0a0c19c..9e3feb6517b5a 100644 --- a/app/code/Magento/Dhl/etc/module.xml +++ b/app/code/Magento/Dhl/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Dhl/registration.php b/app/code/Magento/Dhl/registration.php index 4bafb33380909..0463140f1263a 100644 --- a/app/code/Magento/Dhl/registration.php +++ b/app/code/Magento/Dhl/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Dhl/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Dhl/view/frontend/layout/checkout_index_index.xml index df08f1b1234fe..5fc507914bce9 100644 --- a/app/code/Magento/Dhl/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Dhl/view/frontend/layout/checkout_index_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validation-rules.js b/app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validation-rules.js index 990f015e3e24a..6752f87f5272e 100644 --- a/app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validation-rules.js +++ b/app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validation-rules.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*global define*/ diff --git a/app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validator.js b/app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validator.js index e41297ad6906c..f193cb77b8875 100644 --- a/app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validator.js +++ b/app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validator.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*global define*/ diff --git a/app/code/Magento/Dhl/view/frontend/web/js/view/shipping-rates-validation.js b/app/code/Magento/Dhl/view/frontend/web/js/view/shipping-rates-validation.js index 317c09864e68f..3133ba351541b 100644 --- a/app/code/Magento/Dhl/view/frontend/web/js/view/shipping-rates-validation.js +++ b/app/code/Magento/Dhl/view/frontend/web/js/view/shipping-rates-validation.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*browser:true*/ diff --git a/app/code/Magento/Directory/Api/CountryInformationAcquirerInterface.php b/app/code/Magento/Directory/Api/CountryInformationAcquirerInterface.php index 67c40e149839a..b8790fad2d23d 100644 --- a/app/code/Magento/Directory/Api/CountryInformationAcquirerInterface.php +++ b/app/code/Magento/Directory/Api/CountryInformationAcquirerInterface.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Directory/etc/adminhtml/di.xml b/app/code/Magento/Directory/etc/adminhtml/di.xml index 04c02acb98b12..8f85798987b5f 100644 --- a/app/code/Magento/Directory/etc/adminhtml/di.xml +++ b/app/code/Magento/Directory/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/adminhtml/routes.xml b/app/code/Magento/Directory/etc/adminhtml/routes.xml index f992e11ffb35a..301b06c4c75d2 100644 --- a/app/code/Magento/Directory/etc/adminhtml/routes.xml +++ b/app/code/Magento/Directory/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/adminhtml/system.xml b/app/code/Magento/Directory/etc/adminhtml/system.xml index dc56a23d20280..6232ddfdd287d 100644 --- a/app/code/Magento/Directory/etc/adminhtml/system.xml +++ b/app/code/Magento/Directory/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/config.xml b/app/code/Magento/Directory/etc/config.xml index 5c4de023286c8..b434865e00cfb 100644 --- a/app/code/Magento/Directory/etc/config.xml +++ b/app/code/Magento/Directory/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/crontab.xml b/app/code/Magento/Directory/etc/crontab.xml index 5e7a1da6e6c5a..825fb3e37f1eb 100644 --- a/app/code/Magento/Directory/etc/crontab.xml +++ b/app/code/Magento/Directory/etc/crontab.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/di.xml b/app/code/Magento/Directory/etc/di.xml index b4da40d119fe3..82e08bc8ec037 100644 --- a/app/code/Magento/Directory/etc/di.xml +++ b/app/code/Magento/Directory/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/email_templates.xml b/app/code/Magento/Directory/etc/email_templates.xml index 8d5d3ebf9bdc7..65567fd7c3a6c 100644 --- a/app/code/Magento/Directory/etc/email_templates.xml +++ b/app/code/Magento/Directory/etc/email_templates.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/frontend/routes.xml b/app/code/Magento/Directory/etc/frontend/routes.xml index 79c92226d6446..303a7ab360a1d 100644 --- a/app/code/Magento/Directory/etc/frontend/routes.xml +++ b/app/code/Magento/Directory/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Directory/etc/frontend/sections.xml b/app/code/Magento/Directory/etc/frontend/sections.xml index fa48977872631..6f61593787460 100644 --- a/app/code/Magento/Directory/etc/frontend/sections.xml +++ b/app/code/Magento/Directory/etc/frontend/sections.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/module.xml b/app/code/Magento/Directory/etc/module.xml index 394060b473ff2..9d464d2788464 100644 --- a/app/code/Magento/Directory/etc/module.xml +++ b/app/code/Magento/Directory/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/webapi.xml b/app/code/Magento/Directory/etc/webapi.xml index 4794a2fe80944..1edd1191134c1 100644 --- a/app/code/Magento/Directory/etc/webapi.xml +++ b/app/code/Magento/Directory/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/zip_codes.xml b/app/code/Magento/Directory/etc/zip_codes.xml index e48a3c196aa45..1976c2cb46b25 100644 --- a/app/code/Magento/Directory/etc/zip_codes.xml +++ b/app/code/Magento/Directory/etc/zip_codes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/etc/zip_codes.xsd b/app/code/Magento/Directory/etc/zip_codes.xsd index ac6262480d343..399f997acc4d0 100644 --- a/app/code/Magento/Directory/etc/zip_codes.xsd +++ b/app/code/Magento/Directory/etc/zip_codes.xsd @@ -1,7 +1,7 @@ @@ -37,4 +37,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Directory/registration.php b/app/code/Magento/Directory/registration.php index 610af25ffffc2..58b24c70bdbf1 100644 --- a/app/code/Magento/Directory/registration.php +++ b/app/code/Magento/Directory/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Directory/view/adminhtml/templates/js/optional_zip_countries.phtml b/app/code/Magento/Directory/view/adminhtml/templates/js/optional_zip_countries.phtml index 4b849d6abf650..bae65bcb7d160 100644 --- a/app/code/Magento/Directory/view/adminhtml/templates/js/optional_zip_countries.phtml +++ b/app/code/Magento/Directory/view/adminhtml/templates/js/optional_zip_countries.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Directory/view/frontend/layout/catalogsearch_advanced_index.xml b/app/code/Magento/Directory/view/frontend/layout/catalogsearch_advanced_index.xml index 7509438df2553..e01b48cc71b11 100644 --- a/app/code/Magento/Directory/view/frontend/layout/catalogsearch_advanced_index.xml +++ b/app/code/Magento/Directory/view/frontend/layout/catalogsearch_advanced_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/view/frontend/layout/catalogsearch_advanced_result.xml b/app/code/Magento/Directory/view/frontend/layout/catalogsearch_advanced_result.xml index 7509438df2553..e01b48cc71b11 100644 --- a/app/code/Magento/Directory/view/frontend/layout/catalogsearch_advanced_result.xml +++ b/app/code/Magento/Directory/view/frontend/layout/catalogsearch_advanced_result.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/view/frontend/layout/catalogsearch_result_index.xml b/app/code/Magento/Directory/view/frontend/layout/catalogsearch_result_index.xml index 7509438df2553..e01b48cc71b11 100644 --- a/app/code/Magento/Directory/view/frontend/layout/catalogsearch_result_index.xml +++ b/app/code/Magento/Directory/view/frontend/layout/catalogsearch_result_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/view/frontend/layout/default.xml b/app/code/Magento/Directory/view/frontend/layout/default.xml index e2cea7afc99cc..979fcd6e3d139 100644 --- a/app/code/Magento/Directory/view/frontend/layout/default.xml +++ b/app/code/Magento/Directory/view/frontend/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Directory/view/frontend/templates/currency.phtml b/app/code/Magento/Directory/view/frontend/templates/currency.phtml index e5e4b0fa9f4cf..a3015d0ec4eb4 100644 --- a/app/code/Magento/Directory/view/frontend/templates/currency.phtml +++ b/app/code/Magento/Directory/view/frontend/templates/currency.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Downloadable/etc/adminhtml/di.xml b/app/code/Magento/Downloadable/etc/adminhtml/di.xml index a4f24ced94fcf..d6af2661df0f3 100644 --- a/app/code/Magento/Downloadable/etc/adminhtml/di.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/adminhtml/menu.xml b/app/code/Magento/Downloadable/etc/adminhtml/menu.xml index 0fa664accfb66..55359b3045521 100644 --- a/app/code/Magento/Downloadable/etc/adminhtml/menu.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/adminhtml/routes.xml b/app/code/Magento/Downloadable/etc/adminhtml/routes.xml index c2d077bdd680c..a3fca45339548 100644 --- a/app/code/Magento/Downloadable/etc/adminhtml/routes.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/adminhtml/system.xml b/app/code/Magento/Downloadable/etc/adminhtml/system.xml index 2fdf6be5b88c3..a8f8315360339 100644 --- a/app/code/Magento/Downloadable/etc/adminhtml/system.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/catalog_attributes.xml b/app/code/Magento/Downloadable/etc/catalog_attributes.xml index 7f3ae728853bd..081f9e8764b7f 100644 --- a/app/code/Magento/Downloadable/etc/catalog_attributes.xml +++ b/app/code/Magento/Downloadable/etc/catalog_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/config.xml b/app/code/Magento/Downloadable/etc/config.xml index d434ac16d068b..9582cea6da007 100644 --- a/app/code/Magento/Downloadable/etc/config.xml +++ b/app/code/Magento/Downloadable/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/di.xml b/app/code/Magento/Downloadable/etc/di.xml index 8e3d0bb6c5c5a..62e15cddca4b5 100644 --- a/app/code/Magento/Downloadable/etc/di.xml +++ b/app/code/Magento/Downloadable/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/events.xml b/app/code/Magento/Downloadable/etc/events.xml index eeafbf26ba4ec..da7cc5b5c9150 100644 --- a/app/code/Magento/Downloadable/etc/events.xml +++ b/app/code/Magento/Downloadable/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/extension_attributes.xml b/app/code/Magento/Downloadable/etc/extension_attributes.xml index 63789663921a2..c1d5f9e37c47e 100644 --- a/app/code/Magento/Downloadable/etc/extension_attributes.xml +++ b/app/code/Magento/Downloadable/etc/extension_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/fieldset.xml b/app/code/Magento/Downloadable/etc/fieldset.xml index 680857d7e5dcc..dfc475f4b27c2 100644 --- a/app/code/Magento/Downloadable/etc/fieldset.xml +++ b/app/code/Magento/Downloadable/etc/fieldset.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/frontend/di.xml b/app/code/Magento/Downloadable/etc/frontend/di.xml index a4b6dcd23e8f8..7920c2a5cf48b 100644 --- a/app/code/Magento/Downloadable/etc/frontend/di.xml +++ b/app/code/Magento/Downloadable/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/frontend/events.xml b/app/code/Magento/Downloadable/etc/frontend/events.xml index 0ea805bbfc921..3c024793a3744 100644 --- a/app/code/Magento/Downloadable/etc/frontend/events.xml +++ b/app/code/Magento/Downloadable/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/frontend/page_types.xml b/app/code/Magento/Downloadable/etc/frontend/page_types.xml index f8514e050a702..aabe2d70a3e41 100644 --- a/app/code/Magento/Downloadable/etc/frontend/page_types.xml +++ b/app/code/Magento/Downloadable/etc/frontend/page_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/frontend/routes.xml b/app/code/Magento/Downloadable/etc/frontend/routes.xml index 2e4df8f654331..0f5d7a974982d 100644 --- a/app/code/Magento/Downloadable/etc/frontend/routes.xml +++ b/app/code/Magento/Downloadable/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Downloadable/etc/module.xml b/app/code/Magento/Downloadable/etc/module.xml index c6fd9c6a982e4..fd4d885b3e466 100644 --- a/app/code/Magento/Downloadable/etc/module.xml +++ b/app/code/Magento/Downloadable/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/pdf.xml b/app/code/Magento/Downloadable/etc/pdf.xml index 2e71823cc690f..efc0e038a892e 100644 --- a/app/code/Magento/Downloadable/etc/pdf.xml +++ b/app/code/Magento/Downloadable/etc/pdf.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/product_types.xml b/app/code/Magento/Downloadable/etc/product_types.xml index 2f262cba218ba..08e02028965c0 100644 --- a/app/code/Magento/Downloadable/etc/product_types.xml +++ b/app/code/Magento/Downloadable/etc/product_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/sales.xml b/app/code/Magento/Downloadable/etc/sales.xml index adaddcdf672e2..2a10842dd3319 100644 --- a/app/code/Magento/Downloadable/etc/sales.xml +++ b/app/code/Magento/Downloadable/etc/sales.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/webapi.xml b/app/code/Magento/Downloadable/etc/webapi.xml index 06902aa646656..773b31ab2be66 100644 --- a/app/code/Magento/Downloadable/etc/webapi.xml +++ b/app/code/Magento/Downloadable/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/webapi_rest/di.xml b/app/code/Magento/Downloadable/etc/webapi_rest/di.xml index a4aa62194a39c..6e1c41b1c9606 100644 --- a/app/code/Magento/Downloadable/etc/webapi_rest/di.xml +++ b/app/code/Magento/Downloadable/etc/webapi_rest/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/etc/webapi_soap/di.xml b/app/code/Magento/Downloadable/etc/webapi_soap/di.xml index a4aa62194a39c..6e1c41b1c9606 100644 --- a/app/code/Magento/Downloadable/etc/webapi_soap/di.xml +++ b/app/code/Magento/Downloadable/etc/webapi_soap/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/registration.php b/app/code/Magento/Downloadable/registration.php index 0164a72a02b91..516a177e10c1c 100644 --- a/app/code/Magento/Downloadable/registration.php +++ b/app/code/Magento/Downloadable/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_simple.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_simple.xml index 0eeed489a5ed0..5866d21ff46d7 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_simple.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_simple.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_view_type_downloadable.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_view_type_downloadable.xml index 1661a7be27d60..823b83c7cdf33 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_view_type_downloadable.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_view_type_downloadable.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_virtual.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_virtual.xml index 0eeed489a5ed0..5866d21ff46d7 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_virtual.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/catalog_product_virtual.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/customer_index_wishlist.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/customer_index_wishlist.xml index be88b8b88771e..1355e7a0c8562 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/customer_index_wishlist.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/customer_index_wishlist.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/downloadable_items.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/downloadable_items.xml index 0d7bb35904d26..5a8056106444f 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/downloadable_items.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/downloadable_items.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_new.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_new.xml index 7206a5e8aa877..50c7e06227afb 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_new.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml index 7206a5e8aa877..50c7e06227afb 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_view.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_view.xml index 9c221ebbfe46d..d06b80071892e 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_view.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_creditmemo_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_new.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_new.xml index 0aa400ff3a5a4..9b3c2af9d0ff4 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_new.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_updateqty.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_updateqty.xml index 0aa400ff3a5a4..9b3c2af9d0ff4 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_updateqty.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_updateqty.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_view.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_view.xml index 8eb1288dd4c6b..dfbbe17392e2e 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_view.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_invoice_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_view.xml index 61d85ae24f5dd..d2e7658639935 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_view.xml +++ b/app/code/Magento/Downloadable/view/adminhtml/layout/sales_order_view.xml @@ -1,7 +1,7 @@ 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 ace16699931a3..ff66ccd5dc73b 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 @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml b/app/code/Magento/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml index 2d31df0711ad7..f5ca22b19fd97 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_cart_configure_type_downloadable.xml b/app/code/Magento/Downloadable/view/frontend/layout/checkout_cart_configure_type_downloadable.xml index f1e267b259c28..6d0c8b366f853 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/checkout_cart_configure_type_downloadable.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/checkout_cart_configure_type_downloadable.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/checkout_cart_item_renderers.xml index 6caf33617e6f3..4840c49e24c5a 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/checkout_cart_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_review_item_renderers.xml index 586b24e070148..104ba3cba6ab0 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_success.xml b/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_success.xml index f3fc88ae57a9f..8307b3f4630cb 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_success.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_success.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/customer_account.xml b/app/code/Magento/Downloadable/view/frontend/layout/customer_account.xml index 96bcb556edf0d..2dec0b76fea61 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/customer_account.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/customer_account.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/downloadable_customer_products.xml b/app/code/Magento/Downloadable/view/frontend/layout/downloadable_customer_products.xml index 991015cba9af3..b548547224aa3 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/downloadable_customer_products.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/downloadable_customer_products.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_success.xml b/app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_success.xml index 29902fd07014a..62080117ae55e 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_success.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_success.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_creditmemo_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_creditmemo_renderers.xml index 6b58d2be20e2e..b7519ba763a27 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_creditmemo_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_invoice_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_invoice_renderers.xml index d8e04774ba9fb..8fd23a49cd90f 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_invoice_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_renderers.xml index c8a59438f7a33..e3d68ac505ff0 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_creditmemo_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_creditmemo_renderers.xml index 17c2dc1803799..b08ad83799117 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_creditmemo_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_invoice_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_invoice_renderers.xml index a6456830b403d..243dd2124f406 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_invoice_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_item_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_item_renderers.xml index 85aa800ca9e0e..ca8af720a7c16 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_item_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_creditmemo_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_creditmemo_renderers.xml index 393428217da47..82ce1a00df1ed 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_creditmemo_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_invoice_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_invoice_renderers.xml index 903266531c91a..565567d0835da 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_invoice_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_renderers.xml index 1bc8a1feb1db2..7053a0643a36e 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Downloadable/view/frontend/requirejs-config.js b/app/code/Magento/Downloadable/view/frontend/requirejs-config.js index b96ac9961b1e7..1a27eb7d5ff79 100644 --- a/app/code/Magento/Downloadable/view/frontend/requirejs-config.js +++ b/app/code/Magento/Downloadable/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -9,4 +9,4 @@ var config = { downloadable: 'Magento_Downloadable/downloadable' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/links.phtml b/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/links.phtml index 908a956fec1db..e8f8d2d93f2f8 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/links.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/catalog/product/links.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/DownloadableImportExport/etc/module.xml b/app/code/Magento/DownloadableImportExport/etc/module.xml index e3be073f07462..be3e7a67690eb 100644 --- a/app/code/Magento/DownloadableImportExport/etc/module.xml +++ b/app/code/Magento/DownloadableImportExport/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/DownloadableImportExport/registration.php b/app/code/Magento/DownloadableImportExport/registration.php index bd61216c039d4..e94d3ff9b415a 100644 --- a/app/code/Magento/DownloadableImportExport/registration.php +++ b/app/code/Magento/DownloadableImportExport/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Config/_files/invalidEavAttributeXmlArray.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Config/_files/invalidEavAttributeXmlArray.php index 3e56fdaa079b2..7a78f5d3319b2 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Config/_files/invalidEavAttributeXmlArray.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Config/_files/invalidEavAttributeXmlArray.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Eav/etc/config.xml b/app/code/Magento/Eav/etc/config.xml index f7ef6bb445673..2271c370266ad 100644 --- a/app/code/Magento/Eav/etc/config.xml +++ b/app/code/Magento/Eav/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml index 2de184b01d7c4..95625392efdbb 100644 --- a/app/code/Magento/Eav/etc/di.xml +++ b/app/code/Magento/Eav/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Eav/etc/eav_attributes.xsd b/app/code/Magento/Eav/etc/eav_attributes.xsd index d6669c042f2da..578838d8da2e6 100644 --- a/app/code/Magento/Eav/etc/eav_attributes.xsd +++ b/app/code/Magento/Eav/etc/eav_attributes.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Eav/etc/extension_attributes.xml b/app/code/Magento/Eav/etc/extension_attributes.xml index 19e2e8a66fb38..d2cf83bd8aee3 100644 --- a/app/code/Magento/Eav/etc/extension_attributes.xml +++ b/app/code/Magento/Eav/etc/extension_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Eav/etc/module.xml b/app/code/Magento/Eav/etc/module.xml index d03606d1eeb90..76c34cd1ec570 100644 --- a/app/code/Magento/Eav/etc/module.xml +++ b/app/code/Magento/Eav/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Eav/etc/validation.xml b/app/code/Magento/Eav/etc/validation.xml index b7f7016a4e9b4..4afe79aac155a 100644 --- a/app/code/Magento/Eav/etc/validation.xml +++ b/app/code/Magento/Eav/etc/validation.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Eav/etc/webapi.xml b/app/code/Magento/Eav/etc/webapi.xml index b14ab4514e084..2c84241ac9d07 100644 --- a/app/code/Magento/Eav/etc/webapi.xml +++ b/app/code/Magento/Eav/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Eav/registration.php b/app/code/Magento/Eav/registration.php index fba2c277fc218..ce31dcc9e679b 100644 --- a/app/code/Magento/Eav/registration.php +++ b/app/code/Magento/Eav/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleTwo/etc/email_templates_two.xml b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleTwo/etc/email_templates_two.xml index 6d98d47380e3d..8b698fb496f14 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleTwo/etc/email_templates_two.xml +++ b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleTwo/etc/email_templates_two.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.php b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.php index b6cddd94f0026..9ca1a4395cec5 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php index 46366488e62f0..d83b280da005d 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php @@ -1,6 +1,6 @@ [ 'templateType' => 'text', - 'templateText' => '', + 'templateText' => '', 'parsedTemplateText' => '', 'expectedTemplateSubject' => null, 'expectedOrigTemplateVariables' => null, @@ -311,7 +311,7 @@ public function loadDefaultDataProvider() ], 'copyright in HTML Removed' => [ 'templateType' => 'html', - 'templateText' => '', + 'templateText' => '', 'parsedTemplateText' => '', 'expectedTemplateSubject' => null, 'expectedOrigTemplateVariables' => null, diff --git a/app/code/Magento/Email/etc/acl.xml b/app/code/Magento/Email/etc/acl.xml index 196cad452d87f..9d70af504cb79 100644 --- a/app/code/Magento/Email/etc/acl.xml +++ b/app/code/Magento/Email/etc/acl.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/etc/adminhtml/di.xml b/app/code/Magento/Email/etc/adminhtml/di.xml index 0d1730aeb174f..d276e099a3cdb 100644 --- a/app/code/Magento/Email/etc/adminhtml/di.xml +++ b/app/code/Magento/Email/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/etc/adminhtml/menu.xml b/app/code/Magento/Email/etc/adminhtml/menu.xml index 88de0d3712b82..74392027f8be7 100644 --- a/app/code/Magento/Email/etc/adminhtml/menu.xml +++ b/app/code/Magento/Email/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/etc/adminhtml/routes.xml b/app/code/Magento/Email/etc/adminhtml/routes.xml index d046727306240..ca44e51bdb419 100644 --- a/app/code/Magento/Email/etc/adminhtml/routes.xml +++ b/app/code/Magento/Email/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/etc/config.xml b/app/code/Magento/Email/etc/config.xml index 1b4063eaab294..ac1b27f737f8d 100644 --- a/app/code/Magento/Email/etc/config.xml +++ b/app/code/Magento/Email/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/etc/di.xml b/app/code/Magento/Email/etc/di.xml index 380e5e6248fb3..b1c3aacc3f403 100644 --- a/app/code/Magento/Email/etc/di.xml +++ b/app/code/Magento/Email/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/etc/email_templates.xml b/app/code/Magento/Email/etc/email_templates.xml index 8ae04e8f8d870..db40f8a4ea31b 100644 --- a/app/code/Magento/Email/etc/email_templates.xml +++ b/app/code/Magento/Email/etc/email_templates.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/etc/email_templates.xsd b/app/code/Magento/Email/etc/email_templates.xsd index 1b76c112c9d95..0d0040804e324 100644 --- a/app/code/Magento/Email/etc/email_templates.xsd +++ b/app/code/Magento/Email/etc/email_templates.xsd @@ -3,7 +3,7 @@ /** * Format of merged email templates configuration * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> diff --git a/app/code/Magento/Email/etc/frontend/di.xml b/app/code/Magento/Email/etc/frontend/di.xml index efa8fdc2c954d..c3a5c47605156 100644 --- a/app/code/Magento/Email/etc/frontend/di.xml +++ b/app/code/Magento/Email/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/etc/module.xml b/app/code/Magento/Email/etc/module.xml index 0c3262ff0e75a..eb2b5cdf25a74 100644 --- a/app/code/Magento/Email/etc/module.xml +++ b/app/code/Magento/Email/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/registration.php b/app/code/Magento/Email/registration.php index bd8a577077028..0a8cf96b09cc4 100644 --- a/app/code/Magento/Email/registration.php +++ b/app/code/Magento/Email/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_grid_block.xml b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_grid_block.xml index f5411da7ff4c2..5a5cd07e99c66 100644 --- a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_grid_block.xml +++ b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_grid_block.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_index.xml b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_index.xml index 2fe95e1279a5f..66638e24af575 100644 --- a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_index.xml +++ b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml index 7cf8aa41675ab..47bdaf01809f0 100644 --- a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml +++ b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml index 91b4300ddad98..04002deae0122 100644 --- a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml +++ b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Email/view/frontend/email/footer.html b/app/code/Magento/Email/view/frontend/email/footer.html index af97c24bacd69..e877e29bda5ab 100644 --- a/app/code/Magento/Email/view/frontend/email/footer.html +++ b/app/code/Magento/Email/view/frontend/email/footer.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Email/view/frontend/email/header.html b/app/code/Magento/Email/view/frontend/email/header.html index 09b6b155d639c..c86cbab461f71 100644 --- a/app/code/Magento/Email/view/frontend/email/header.html +++ b/app/code/Magento/Email/view/frontend/email/header.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/Edit.php b/app/code/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/Edit.php index a79257a965fbf..3386dd95d604e 100644 --- a/app/code/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/Edit.php +++ b/app/code/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/Edit.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/EncryptionKey/etc/adminhtml/menu.xml b/app/code/Magento/EncryptionKey/etc/adminhtml/menu.xml index e06fd7c57d517..71a0ff5470158 100644 --- a/app/code/Magento/EncryptionKey/etc/adminhtml/menu.xml +++ b/app/code/Magento/EncryptionKey/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/EncryptionKey/etc/adminhtml/routes.xml b/app/code/Magento/EncryptionKey/etc/adminhtml/routes.xml index f01babac19953..89ee76a7e3b81 100644 --- a/app/code/Magento/EncryptionKey/etc/adminhtml/routes.xml +++ b/app/code/Magento/EncryptionKey/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/EncryptionKey/etc/config.xml b/app/code/Magento/EncryptionKey/etc/config.xml index 92847ba864132..25a789115d997 100644 --- a/app/code/Magento/EncryptionKey/etc/config.xml +++ b/app/code/Magento/EncryptionKey/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/EncryptionKey/etc/module.xml b/app/code/Magento/EncryptionKey/etc/module.xml index 36688aeaa8ef1..5c4d2a35219aa 100644 --- a/app/code/Magento/EncryptionKey/etc/module.xml +++ b/app/code/Magento/EncryptionKey/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/EncryptionKey/registration.php b/app/code/Magento/EncryptionKey/registration.php index 69f7efd16802d..bcb8f627b4bca 100644 --- a/app/code/Magento/EncryptionKey/registration.php +++ b/app/code/Magento/EncryptionKey/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index 3fe23389ea75b..f00b4e3164cfb 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Fedex/etc/config.xml b/app/code/Magento/Fedex/etc/config.xml index d3dc876d670aa..0e7a178fe504b 100644 --- a/app/code/Magento/Fedex/etc/config.xml +++ b/app/code/Magento/Fedex/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Fedex/etc/module.xml b/app/code/Magento/Fedex/etc/module.xml index af58dd2e800ab..f435c72c601b9 100644 --- a/app/code/Magento/Fedex/etc/module.xml +++ b/app/code/Magento/Fedex/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Fedex/registration.php b/app/code/Magento/Fedex/registration.php index 23e968edcd3f0..4cfeeb8940d67 100644 --- a/app/code/Magento/Fedex/registration.php +++ b/app/code/Magento/Fedex/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Fedex/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Fedex/view/frontend/layout/checkout_index_index.xml index 758217c58b88e..f5ab9ee82e0bd 100644 --- a/app/code/Magento/Fedex/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Fedex/view/frontend/layout/checkout_index_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validation-rules.js b/app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validation-rules.js index 990f015e3e24a..6752f87f5272e 100644 --- a/app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validation-rules.js +++ b/app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validation-rules.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*global define*/ diff --git a/app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validator.js b/app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validator.js index 326c3462e25e1..18c88cccbd024 100644 --- a/app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validator.js +++ b/app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validator.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*global define*/ diff --git a/app/code/Magento/Fedex/view/frontend/web/js/view/shipping-rates-validation.js b/app/code/Magento/Fedex/view/frontend/web/js/view/shipping-rates-validation.js index 74d58b5ee6459..906c23040e747 100644 --- a/app/code/Magento/Fedex/view/frontend/web/js/view/shipping-rates-validation.js +++ b/app/code/Magento/Fedex/view/frontend/web/js/view/shipping-rates-validation.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*browser:true*/ diff --git a/app/code/Magento/GiftMessage/Api/CartRepositoryInterface.php b/app/code/Magento/GiftMessage/Api/CartRepositoryInterface.php index bd6b02b0ce4cd..08c373973ba41 100644 --- a/app/code/Magento/GiftMessage/Api/CartRepositoryInterface.php +++ b/app/code/Magento/GiftMessage/Api/CartRepositoryInterface.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GiftMessage/etc/adminhtml/events.xml b/app/code/Magento/GiftMessage/etc/adminhtml/events.xml index 2741ed49dbb19..6ac8eb1411e0b 100644 --- a/app/code/Magento/GiftMessage/etc/adminhtml/events.xml +++ b/app/code/Magento/GiftMessage/etc/adminhtml/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/adminhtml/system.xml b/app/code/Magento/GiftMessage/etc/adminhtml/system.xml index 89228928a651a..b8e28717c426e 100644 --- a/app/code/Magento/GiftMessage/etc/adminhtml/system.xml +++ b/app/code/Magento/GiftMessage/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/catalog_attributes.xml b/app/code/Magento/GiftMessage/etc/catalog_attributes.xml index 6d112591edac6..20596c9b6466a 100644 --- a/app/code/Magento/GiftMessage/etc/catalog_attributes.xml +++ b/app/code/Magento/GiftMessage/etc/catalog_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/config.xml b/app/code/Magento/GiftMessage/etc/config.xml index 9f4e1996f7d93..fd78b91ee0d64 100644 --- a/app/code/Magento/GiftMessage/etc/config.xml +++ b/app/code/Magento/GiftMessage/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/di.xml b/app/code/Magento/GiftMessage/etc/di.xml index d660115822d69..7486b32099b5a 100644 --- a/app/code/Magento/GiftMessage/etc/di.xml +++ b/app/code/Magento/GiftMessage/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/extension_attributes.xml b/app/code/Magento/GiftMessage/etc/extension_attributes.xml index 1bc636cb66464..8ca36ce1507e1 100644 --- a/app/code/Magento/GiftMessage/etc/extension_attributes.xml +++ b/app/code/Magento/GiftMessage/etc/extension_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/fieldset.xml b/app/code/Magento/GiftMessage/etc/fieldset.xml index dfc40cc5c1c58..99c6da99ecf37 100644 --- a/app/code/Magento/GiftMessage/etc/fieldset.xml +++ b/app/code/Magento/GiftMessage/etc/fieldset.xml @@ -1,7 +1,7 @@ @@ -14,4 +14,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/GiftMessage/etc/frontend/di.xml b/app/code/Magento/GiftMessage/etc/frontend/di.xml index 19f0f5c95fa67..cb7365b794787 100644 --- a/app/code/Magento/GiftMessage/etc/frontend/di.xml +++ b/app/code/Magento/GiftMessage/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/frontend/events.xml b/app/code/Magento/GiftMessage/etc/frontend/events.xml index 381edb0111978..fd7c77dc499e2 100644 --- a/app/code/Magento/GiftMessage/etc/frontend/events.xml +++ b/app/code/Magento/GiftMessage/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/frontend/routes.xml b/app/code/Magento/GiftMessage/etc/frontend/routes.xml index 5b2f62b0753c9..f1454b3a4265d 100644 --- a/app/code/Magento/GiftMessage/etc/frontend/routes.xml +++ b/app/code/Magento/GiftMessage/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/GiftMessage/etc/module.xml b/app/code/Magento/GiftMessage/etc/module.xml index 33df6bf08e02e..b2deceb6b6d04 100644 --- a/app/code/Magento/GiftMessage/etc/module.xml +++ b/app/code/Magento/GiftMessage/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/webapi.xml b/app/code/Magento/GiftMessage/etc/webapi.xml index a24fbe74c559c..aee7d4443259d 100644 --- a/app/code/Magento/GiftMessage/etc/webapi.xml +++ b/app/code/Magento/GiftMessage/etc/webapi.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/etc/webapi_rest/events.xml b/app/code/Magento/GiftMessage/etc/webapi_rest/events.xml index 7afd66acace75..ce2e2ac39d9d4 100644 --- a/app/code/Magento/GiftMessage/etc/webapi_rest/events.xml +++ b/app/code/Magento/GiftMessage/etc/webapi_rest/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/registration.php b/app/code/Magento/GiftMessage/registration.php index a8a77dadb86a8..49add57ba473d 100644 --- a/app/code/Magento/GiftMessage/registration.php +++ b/app/code/Magento/GiftMessage/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_create_load_block_data.xml b/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_create_load_block_data.xml index 307ba157cd14c..b705fa78a060f 100644 --- a/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_create_load_block_data.xml +++ b/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_create_load_block_data.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_create_load_block_items.xml b/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_create_load_block_items.xml index 307ba157cd14c..b705fa78a060f 100644 --- a/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_create_load_block_items.xml +++ b/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_create_load_block_items.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_view.xml index be90cf4e30073..dc3de7bf9178f 100644 --- a/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_view.xml +++ b/app/code/Magento/GiftMessage/view/adminhtml/layout/sales_order_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/view/adminhtml/templates/giftoptionsform.phtml b/app/code/Magento/GiftMessage/view/adminhtml/templates/giftoptionsform.phtml index f76e24958f4de..9e8fbf1c5b69d 100644 --- a/app/code/Magento/GiftMessage/view/adminhtml/templates/giftoptionsform.phtml +++ b/app/code/Magento/GiftMessage/view/adminhtml/templates/giftoptionsform.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GiftMessage/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/GiftMessage/view/frontend/layout/checkout_cart_item_renderers.xml index fb2d4fd68f68f..ac5e728a828b8 100644 --- a/app/code/Magento/GiftMessage/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/GiftMessage/view/frontend/layout/checkout_cart_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GiftMessage/view/frontend/requirejs-config.js b/app/code/Magento/GiftMessage/view/frontend/requirejs-config.js index 208964d20c061..b59db70335d05 100644 --- a/app/code/Magento/GiftMessage/view/frontend/requirejs-config.js +++ b/app/code/Magento/GiftMessage/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -10,4 +10,4 @@ var config = { extraOptions: 'Magento_GiftMessage/extra-options' } } -}; \ No newline at end of file +}; diff --git a/app/code/Magento/GiftMessage/view/frontend/templates/cart/gift_options.phtml b/app/code/Magento/GiftMessage/view/frontend/templates/cart/gift_options.phtml index ed4b5d2f5de0c..230515897d220 100644 --- a/app/code/Magento/GiftMessage/view/frontend/templates/cart/gift_options.phtml +++ b/app/code/Magento/GiftMessage/view/frontend/templates/cart/gift_options.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GiftMessage/view/frontend/templates/cart/item/renderer/actions/gift_options.phtml b/app/code/Magento/GiftMessage/view/frontend/templates/cart/item/renderer/actions/gift_options.phtml index 703c27b82e196..095a97d6630e4 100644 --- a/app/code/Magento/GiftMessage/view/frontend/templates/cart/item/renderer/actions/gift_options.phtml +++ b/app/code/Magento/GiftMessage/view/frontend/templates/cart/item/renderer/actions/gift_options.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message-item-level.html b/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message-item-level.html index a310dcddf6a19..15d7da8fc800d 100644 --- a/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message-item-level.html +++ b/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message-item-level.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message.html b/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message.html index ca929146d5e66..dc7f50107d2f2 100644 --- a/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message.html +++ b/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GoogleAdwords/Block/Code.php b/app/code/Magento/GoogleAdwords/Block/Code.php index f0fd7222de1c1..84ba572a50302 100644 --- a/app/code/Magento/GoogleAdwords/Block/Code.php +++ b/app/code/Magento/GoogleAdwords/Block/Code.php @@ -2,7 +2,7 @@ /** * Google AdWords Code block * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Block; diff --git a/app/code/Magento/GoogleAdwords/Helper/Data.php b/app/code/Magento/GoogleAdwords/Helper/Data.php index d04c3687627ae..900447e2da3d5 100644 --- a/app/code/Magento/GoogleAdwords/Helper/Data.php +++ b/app/code/Magento/GoogleAdwords/Helper/Data.php @@ -2,7 +2,7 @@ /** * Google AdWords Data Helper * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Helper; diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php index 626f4b99fe7c5..a3b8c31157b61 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php @@ -2,7 +2,7 @@ /** * Google AdWords Conversion Abstract Backend model * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Model\Config\Backend; diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Backend/Color.php b/app/code/Magento/GoogleAdwords/Model/Config/Backend/Color.php index 2e7e27daa626a..5a133a098879a 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Backend/Color.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Backend/Color.php @@ -2,7 +2,7 @@ /** * Google AdWords Color Backend model * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Model\Config\Backend; diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Backend/ConversionId.php b/app/code/Magento/GoogleAdwords/Model/Config/Backend/ConversionId.php index bb894f3b69294..3e3d3190999f6 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Backend/ConversionId.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Backend/ConversionId.php @@ -2,7 +2,7 @@ /** * Google AdWords Conversion Id Backend model * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Model\Config\Backend; diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Source/Language.php b/app/code/Magento/GoogleAdwords/Model/Config/Source/Language.php index 4d5c399cdbac8..01e2bebeeff3a 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Source/Language.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Source/Language.php @@ -2,7 +2,7 @@ /** * Google AdWords language source * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Model\Config\Source; diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Source/ValueType.php b/app/code/Magento/GoogleAdwords/Model/Config/Source/ValueType.php index bc11e17b6a56b..35dd325af3a64 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Source/ValueType.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Source/ValueType.php @@ -2,7 +2,7 @@ /** * Google AdWords conversation value type source * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Model\Config\Source; diff --git a/app/code/Magento/GoogleAdwords/Model/Filter/UppercaseTitle.php b/app/code/Magento/GoogleAdwords/Model/Filter/UppercaseTitle.php index bd35e76d59bd7..d984abd2de550 100644 --- a/app/code/Magento/GoogleAdwords/Model/Filter/UppercaseTitle.php +++ b/app/code/Magento/GoogleAdwords/Model/Filter/UppercaseTitle.php @@ -2,7 +2,7 @@ /** * Filter to uppercase the first character of each word in a string * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Model\Filter; diff --git a/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php b/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php index c78a8a12009d3..506d3a6ba8c50 100644 --- a/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php +++ b/app/code/Magento/GoogleAdwords/Model/Validator/Factory.php @@ -2,7 +2,7 @@ /** * Google AdWords Validator Factory * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. * @SuppressWarnings(PHPMD.LongVariable) */ diff --git a/app/code/Magento/GoogleAdwords/Observer/SetConversionValueObserver.php b/app/code/Magento/GoogleAdwords/Observer/SetConversionValueObserver.php index 5f1578f7ee672..2c62a670c342a 100644 --- a/app/code/Magento/GoogleAdwords/Observer/SetConversionValueObserver.php +++ b/app/code/Magento/GoogleAdwords/Observer/SetConversionValueObserver.php @@ -2,7 +2,7 @@ /** * Google AdWords module observer * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GoogleAdwords\Observer; diff --git a/app/code/Magento/GoogleAdwords/Test/Unit/Helper/DataTest.php b/app/code/Magento/GoogleAdwords/Test/Unit/Helper/DataTest.php index 5aafb1129c430..76124bcd63db0 100644 --- a/app/code/Magento/GoogleAdwords/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/GoogleAdwords/Test/Unit/Helper/DataTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GoogleAdwords/etc/config.xml b/app/code/Magento/GoogleAdwords/etc/config.xml index a27ef2ae59661..33278c81226c8 100644 --- a/app/code/Magento/GoogleAdwords/etc/config.xml +++ b/app/code/Magento/GoogleAdwords/etc/config.xml @@ -1,7 +1,7 @@ @@ -69,4 +69,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/GoogleAdwords/etc/di.xml b/app/code/Magento/GoogleAdwords/etc/di.xml index ab368af295294..8e6bfa9f58324 100644 --- a/app/code/Magento/GoogleAdwords/etc/di.xml +++ b/app/code/Magento/GoogleAdwords/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleAdwords/etc/frontend/events.xml b/app/code/Magento/GoogleAdwords/etc/frontend/events.xml index 08e4497f4b477..ee30ac6cc0998 100644 --- a/app/code/Magento/GoogleAdwords/etc/frontend/events.xml +++ b/app/code/Magento/GoogleAdwords/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleAdwords/etc/module.xml b/app/code/Magento/GoogleAdwords/etc/module.xml index 1e34c30b93790..c0549848ea442 100644 --- a/app/code/Magento/GoogleAdwords/etc/module.xml +++ b/app/code/Magento/GoogleAdwords/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleAdwords/registration.php b/app/code/Magento/GoogleAdwords/registration.php index 9d1ca0a3dae78..816ca597014aa 100644 --- a/app/code/Magento/GoogleAdwords/registration.php +++ b/app/code/Magento/GoogleAdwords/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GoogleAdwords/view/frontend/templates/code.phtml b/app/code/Magento/GoogleAdwords/view/frontend/templates/code.phtml index dae452b9373e9..27717a2fade96 100644 --- a/app/code/Magento/GoogleAdwords/view/frontend/templates/code.phtml +++ b/app/code/Magento/GoogleAdwords/view/frontend/templates/code.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GoogleAnalytics/etc/adminhtml/system.xml b/app/code/Magento/GoogleAnalytics/etc/adminhtml/system.xml index a5a5df5d68556..1238ab525e1a4 100644 --- a/app/code/Magento/GoogleAnalytics/etc/adminhtml/system.xml +++ b/app/code/Magento/GoogleAnalytics/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleAnalytics/etc/di.xml b/app/code/Magento/GoogleAnalytics/etc/di.xml index c837007469acc..9865bf935e489 100644 --- a/app/code/Magento/GoogleAnalytics/etc/di.xml +++ b/app/code/Magento/GoogleAnalytics/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleAnalytics/etc/frontend/events.xml b/app/code/Magento/GoogleAnalytics/etc/frontend/events.xml index a325d25a9722d..bf2d3695ef11a 100644 --- a/app/code/Magento/GoogleAnalytics/etc/frontend/events.xml +++ b/app/code/Magento/GoogleAnalytics/etc/frontend/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleAnalytics/etc/module.xml b/app/code/Magento/GoogleAnalytics/etc/module.xml index ff0205f27a33c..2f19cf9e03294 100644 --- a/app/code/Magento/GoogleAnalytics/etc/module.xml +++ b/app/code/Magento/GoogleAnalytics/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleAnalytics/registration.php b/app/code/Magento/GoogleAnalytics/registration.php index 8781279105f19..778faafb34ef3 100644 --- a/app/code/Magento/GoogleAnalytics/registration.php +++ b/app/code/Magento/GoogleAnalytics/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GoogleAnalytics/view/frontend/templates/ga.phtml b/app/code/Magento/GoogleAnalytics/view/frontend/templates/ga.phtml index 0093f91e6cdab..52a7f186a19bd 100644 --- a/app/code/Magento/GoogleAnalytics/view/frontend/templates/ga.phtml +++ b/app/code/Magento/GoogleAnalytics/view/frontend/templates/ga.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GoogleOptimizer/etc/adminhtml/system.xml b/app/code/Magento/GoogleOptimizer/etc/adminhtml/system.xml index 50b5ad1f81c04..ff58c7a6467a2 100644 --- a/app/code/Magento/GoogleOptimizer/etc/adminhtml/system.xml +++ b/app/code/Magento/GoogleOptimizer/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/etc/config.xml b/app/code/Magento/GoogleOptimizer/etc/config.xml index 9704a13537f89..fd0cf59f56861 100644 --- a/app/code/Magento/GoogleOptimizer/etc/config.xml +++ b/app/code/Magento/GoogleOptimizer/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/etc/events.xml b/app/code/Magento/GoogleOptimizer/etc/events.xml index 41a8917513c12..d637f28fe47d1 100644 --- a/app/code/Magento/GoogleOptimizer/etc/events.xml +++ b/app/code/Magento/GoogleOptimizer/etc/events.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/etc/module.xml b/app/code/Magento/GoogleOptimizer/etc/module.xml index 692a5960f89a5..1c5f5c124a912 100644 --- a/app/code/Magento/GoogleOptimizer/etc/module.xml +++ b/app/code/Magento/GoogleOptimizer/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/registration.php b/app/code/Magento/GoogleOptimizer/registration.php index 52517d100db4a..1d648a2983e2a 100644 --- a/app/code/Magento/GoogleOptimizer/registration.php +++ b/app/code/Magento/GoogleOptimizer/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GoogleOptimizer/view/adminhtml/layout/cms_page_edit.xml b/app/code/Magento/GoogleOptimizer/view/adminhtml/layout/cms_page_edit.xml index 3b337f5a333c7..d2c8863956d3e 100644 --- a/app/code/Magento/GoogleOptimizer/view/adminhtml/layout/cms_page_edit.xml +++ b/app/code/Magento/GoogleOptimizer/view/adminhtml/layout/cms_page_edit.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/category_form.xml b/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/category_form.xml index 3fc937e6f1c6b..1387e4a2e6783 100644 --- a/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/category_form.xml +++ b/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/category_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml b/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml index c27ea723a0570..235b216d8fb67 100644 --- a/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml +++ b/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/new_category_form.xml b/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/new_category_form.xml index 632dc91b45b8c..264dabcc861ca 100644 --- a/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/new_category_form.xml +++ b/app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/new_category_form.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_category_view.xml index 3725ba5fc5e4d..f2d1a03d1fd7c 100644 --- a/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_category_view.xml +++ b/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_category_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_product_view.xml index 89ac360a8cee8..50a5e534cb536 100644 --- a/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/GoogleOptimizer/view/frontend/layout/catalog_product_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GoogleOptimizer/view/frontend/layout/cms_page_view.xml b/app/code/Magento/GoogleOptimizer/view/frontend/layout/cms_page_view.xml index 3890610f9c3eb..f2c032e7bed02 100644 --- a/app/code/Magento/GoogleOptimizer/view/frontend/layout/cms_page_view.xml +++ b/app/code/Magento/GoogleOptimizer/view/frontend/layout/cms_page_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedImportExport/Model/Export/Product/Type/Grouped.php b/app/code/Magento/GroupedImportExport/Model/Export/Product/Type/Grouped.php index ad153c297b329..3e7b4a3976938 100644 --- a/app/code/Magento/GroupedImportExport/Model/Export/Product/Type/Grouped.php +++ b/app/code/Magento/GroupedImportExport/Model/Export/Product/Type/Grouped.php @@ -2,7 +2,7 @@ /** * Export entity of grouped product type * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\GroupedImportExport\Model\Export\Product\Type; diff --git a/app/code/Magento/GroupedImportExport/Model/Export/RowCustomizer.php b/app/code/Magento/GroupedImportExport/Model/Export/RowCustomizer.php index 62cd9c6aa996f..dff2663dea913 100644 --- a/app/code/Magento/GroupedImportExport/Model/Export/RowCustomizer.php +++ b/app/code/Magento/GroupedImportExport/Model/Export/RowCustomizer.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GroupedImportExport/etc/export.xml b/app/code/Magento/GroupedImportExport/etc/export.xml index a41343cbfae53..5271ad58bbbd5 100644 --- a/app/code/Magento/GroupedImportExport/etc/export.xml +++ b/app/code/Magento/GroupedImportExport/etc/export.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedImportExport/etc/import.xml b/app/code/Magento/GroupedImportExport/etc/import.xml index 9e25ef3addccd..d82507f622b9b 100644 --- a/app/code/Magento/GroupedImportExport/etc/import.xml +++ b/app/code/Magento/GroupedImportExport/etc/import.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedImportExport/etc/module.xml b/app/code/Magento/GroupedImportExport/etc/module.xml index 60a23f6122a87..1051080c6c0bb 100644 --- a/app/code/Magento/GroupedImportExport/etc/module.xml +++ b/app/code/Magento/GroupedImportExport/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedImportExport/registration.php b/app/code/Magento/GroupedImportExport/registration.php index 284dc9b4eff00..1f5d2158a51ae 100644 --- a/app/code/Magento/GroupedImportExport/registration.php +++ b/app/code/Magento/GroupedImportExport/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GroupedProduct/etc/adminhtml/routes.xml b/app/code/Magento/GroupedProduct/etc/adminhtml/routes.xml index 970710dedebd8..b56a47161b0cb 100644 --- a/app/code/Magento/GroupedProduct/etc/adminhtml/routes.xml +++ b/app/code/Magento/GroupedProduct/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/adminhtml/system.xml b/app/code/Magento/GroupedProduct/etc/adminhtml/system.xml index b8a6c6b51de28..c295f7abf44ce 100644 --- a/app/code/Magento/GroupedProduct/etc/adminhtml/system.xml +++ b/app/code/Magento/GroupedProduct/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/config.xml b/app/code/Magento/GroupedProduct/etc/config.xml index 539c3d72b05b4..6f33654ca8ac7 100644 --- a/app/code/Magento/GroupedProduct/etc/config.xml +++ b/app/code/Magento/GroupedProduct/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/di.xml b/app/code/Magento/GroupedProduct/etc/di.xml index 2348a0df881cd..788052d07fca5 100644 --- a/app/code/Magento/GroupedProduct/etc/di.xml +++ b/app/code/Magento/GroupedProduct/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/extension_attributes.xml b/app/code/Magento/GroupedProduct/etc/extension_attributes.xml index 89a5cdeb1c7f3..dec84c4c27a98 100644 --- a/app/code/Magento/GroupedProduct/etc/extension_attributes.xml +++ b/app/code/Magento/GroupedProduct/etc/extension_attributes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/frontend/di.xml b/app/code/Magento/GroupedProduct/etc/frontend/di.xml index ce50f40144c9f..a6ad9efbb0eb3 100644 --- a/app/code/Magento/GroupedProduct/etc/frontend/di.xml +++ b/app/code/Magento/GroupedProduct/etc/frontend/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/module.xml b/app/code/Magento/GroupedProduct/etc/module.xml index 5a03ee430ea1b..2294ea45aab55 100644 --- a/app/code/Magento/GroupedProduct/etc/module.xml +++ b/app/code/Magento/GroupedProduct/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/pdf.xml b/app/code/Magento/GroupedProduct/etc/pdf.xml index ea1c03dacac44..24f0ff29518c5 100644 --- a/app/code/Magento/GroupedProduct/etc/pdf.xml +++ b/app/code/Magento/GroupedProduct/etc/pdf.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/product_types.xml b/app/code/Magento/GroupedProduct/etc/product_types.xml index 8e7573c94677f..3b4f7b7fbeb79 100644 --- a/app/code/Magento/GroupedProduct/etc/product_types.xml +++ b/app/code/Magento/GroupedProduct/etc/product_types.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/etc/sales.xml b/app/code/Magento/GroupedProduct/etc/sales.xml index 914ec168ec32b..16b18b4415d9f 100644 --- a/app/code/Magento/GroupedProduct/etc/sales.xml +++ b/app/code/Magento/GroupedProduct/etc/sales.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/registration.php b/app/code/Magento/GroupedProduct/registration.php index ae4763b0f375c..c0e1e34bc2824 100644 --- a/app/code/Magento/GroupedProduct/registration.php +++ b/app/code/Magento/GroupedProduct/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_new.xml index 2dd2171001988..6647ba4365458 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_view_type_grouped.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_view_type_grouped.xml index a67f1c6f6201b..d8bcde7f55d30 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_view_type_grouped.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_view_type_grouped.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_edit_popup.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_edit_popup.xml index 9875355a70546..6e8587a805a33 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_edit_popup.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_edit_popup.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml index 8fb09eaa0f9cf..ab3c4204c4ab4 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_new.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_new.xml index 0135aa7521236..dc9a19e91ed76 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_new.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml index 0135aa7521236..dc9a19e91ed76 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_updateqty.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_view.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_view.xml index 1f370af9fd503..9ed2f6976c78e 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_view.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_creditmemo_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_new.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_new.xml index 0135aa7521236..dc9a19e91ed76 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_new.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_new.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_updateqty.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_updateqty.xml index 0135aa7521236..dc9a19e91ed76 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_updateqty.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_updateqty.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_view.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_view.xml index 31f256e8a27ed..d40b0405bcf82 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_view.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_invoice_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_view.xml index 0135aa7521236..dc9a19e91ed76 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_view.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/sales_order_view.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/requirejs-config.js b/app/code/Magento/GroupedProduct/view/adminhtml/requirejs-config.js index b223755c35edf..7fdb1fe9c9250 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/requirejs-config.js +++ b/app/code/Magento/GroupedProduct/view/adminhtml/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -9,4 +9,4 @@ var config = { groupedProduct: 'Magento_GroupedProduct/js/grouped-product' } } -}; \ No newline at end of file +}; 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 26eee1d66eef6..96c918e8ff8e6 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 @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/ui_component/grouped_product_listing.xml b/app/code/Magento/GroupedProduct/view/adminhtml/ui_component/grouped_product_listing.xml index 9d356d53ce613..5b5a170513925 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/ui_component/grouped_product_listing.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/ui_component/grouped_product_listing.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/web/css/grouped-product.css b/app/code/Magento/GroupedProduct/view/adminhtml/web/css/grouped-product.css index 769b1d81821f5..df86b3bc44be1 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/web/css/grouped-product.css +++ b/app/code/Magento/GroupedProduct/view/adminhtml/web/css/grouped-product.css @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js b/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js index ba1a46bf17d38..d8841f2118f15 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js +++ b/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*jshint browser:true */ diff --git a/app/code/Magento/GroupedProduct/view/base/layout/catalog_product_prices.xml b/app/code/Magento/GroupedProduct/view/base/layout/catalog_product_prices.xml index 0b391109dcf37..d13e6611a935c 100644 --- a/app/code/Magento/GroupedProduct/view/base/layout/catalog_product_prices.xml +++ b/app/code/Magento/GroupedProduct/view/base/layout/catalog_product_prices.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml b/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml index bcdbcbcc424d3..bce8f36f12f7d 100644 --- a/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml +++ b/app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_view_type_grouped.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_view_type_grouped.xml index 6c8f871a3632d..ef17f6f2ebaa4 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_view_type_grouped.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_view_type_grouped.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_cart_item_renderers.xml index 2101c940c3a4d..2d6dc79b7643e 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_cart_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml index 216f8736d2915..b713558b10633 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_creditmemo_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_creditmemo_renderers.xml index 1de085ae24198..13952d3bc7c00 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_creditmemo_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_invoice_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_invoice_renderers.xml index 3ee63835c4c4d..ca6e286e30f69 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_invoice_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_renderers.xml index 11f93d5e7c1fa..9f2166f345e0b 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_guest_invoice.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_guest_invoice.xml index fd3e59f7e2a9f..495268bb8e5d9 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_guest_invoice.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_guest_invoice.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_creditmemo_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_creditmemo_renderers.xml index 2732a60331875..30eebc159fdb3 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_creditmemo_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_invoice_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_invoice_renderers.xml index fd3e59f7e2a9f..495268bb8e5d9 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_invoice_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_item_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_item_renderers.xml index 28873219cefbb..c51e36c80b86a 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_item_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_item_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_creditmemo_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_creditmemo_renderers.xml index 941430f3773db..e0a9fca4a41a9 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_creditmemo_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_creditmemo_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_invoice_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_invoice_renderers.xml index f1da901e54a9f..fb76469b4eaaf 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_invoice_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_invoice_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_renderers.xml index c01e8e7e0f688..bbf433f80e406 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_renderers.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/GroupedProduct/view/frontend/templates/product/view/type/default.phtml b/app/code/Magento/GroupedProduct/view/frontend/templates/product/view/type/default.phtml index a5b5de2bf2c77..054fcb95038e0 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/templates/product/view/type/default.phtml +++ b/app/code/Magento/GroupedProduct/view/frontend/templates/product/view/type/default.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/export_merged_valid.xml b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/export_merged_valid.xml index 244b0b91e9fda..b1cf370e1c5dd 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/export_merged_valid.xml +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/export_merged_valid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/export_valid.xml b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/export_valid.xml index 13490296206e8..c59fb52f05704 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/export_valid.xml +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/export_valid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/invalidExportMergedXmlArray.php b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/invalidExportMergedXmlArray.php index b3a801d85b860..66121ce773b75 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/invalidExportMergedXmlArray.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Export/Config/_files/invalidExportMergedXmlArray.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php index f63163d5f5f6b..35c8a8e854712 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/invalidImportMergedXmlArray.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/valid_import_merged.xml b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/valid_import_merged.xml index 20596d3b814ed..f6ea8ddaa7025 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/valid_import_merged.xml +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/Config/_files/valid_import_merged.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/Test/Unit/Model/Import/ConfigTest.php b/app/code/Magento/ImportExport/Test/Unit/Model/Import/ConfigTest.php index 60cd1f50238a4..55f205553efd8 100644 --- a/app/code/Magento/ImportExport/Test/Unit/Model/Import/ConfigTest.php +++ b/app/code/Magento/ImportExport/Test/Unit/Model/Import/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/etc/adminhtml/menu.xml b/app/code/Magento/ImportExport/etc/adminhtml/menu.xml index ea9c15ad7a673..32f33227952b3 100644 --- a/app/code/Magento/ImportExport/etc/adminhtml/menu.xml +++ b/app/code/Magento/ImportExport/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/etc/adminhtml/routes.xml b/app/code/Magento/ImportExport/etc/adminhtml/routes.xml index 459629f7b3640..22448a8609aa0 100644 --- a/app/code/Magento/ImportExport/etc/adminhtml/routes.xml +++ b/app/code/Magento/ImportExport/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/etc/config.xml b/app/code/Magento/ImportExport/etc/config.xml index 8614565f5fd98..7a7fe0e10e9b6 100644 --- a/app/code/Magento/ImportExport/etc/config.xml +++ b/app/code/Magento/ImportExport/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/etc/di.xml b/app/code/Magento/ImportExport/etc/di.xml index de637c7104dac..4c357782d80c3 100644 --- a/app/code/Magento/ImportExport/etc/di.xml +++ b/app/code/Magento/ImportExport/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/etc/export.xsd b/app/code/Magento/ImportExport/etc/export.xsd index c7316873d8998..e6d69809d55b9 100644 --- a/app/code/Magento/ImportExport/etc/export.xsd +++ b/app/code/Magento/ImportExport/etc/export.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/etc/export_merged.xsd b/app/code/Magento/ImportExport/etc/export_merged.xsd index 200a173b81f07..352c78ee76038 100644 --- a/app/code/Magento/ImportExport/etc/export_merged.xsd +++ b/app/code/Magento/ImportExport/etc/export_merged.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/etc/import.xsd b/app/code/Magento/ImportExport/etc/import.xsd index 2d6ab40c3c895..4aac9792ce741 100644 --- a/app/code/Magento/ImportExport/etc/import.xsd +++ b/app/code/Magento/ImportExport/etc/import.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/etc/import_merged.xsd b/app/code/Magento/ImportExport/etc/import_merged.xsd index c654c04c8ded4..898a835c7b2d7 100644 --- a/app/code/Magento/ImportExport/etc/import_merged.xsd +++ b/app/code/Magento/ImportExport/etc/import_merged.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/etc/module.xml b/app/code/Magento/ImportExport/etc/module.xml index fde05d4e2448d..0b7b0329c39c3 100644 --- a/app/code/Magento/ImportExport/etc/module.xml +++ b/app/code/Magento/ImportExport/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/registration.php b/app/code/Magento/ImportExport/registration.php index 80dce0d7e03b3..e879d8fe8217c 100644 --- a/app/code/Magento/ImportExport/registration.php +++ b/app/code/Magento/ImportExport/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_export_index.xml b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_export_index.xml index 53783e0a31026..f81887fe53896 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_export_index.xml +++ b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_export_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_grid_block.xml b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_grid_block.xml index 3ff79ba46ccc5..3e8e26d45635e 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_grid_block.xml +++ b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_grid_block.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_index.xml b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_index.xml index 1055151c3d739..70ec84dd18638 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_index.xml +++ b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_history_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_busy.xml b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_busy.xml index ed04365a172c9..96923815d4001 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_busy.xml +++ b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_busy.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_index.xml b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_index.xml index 1e99b42c3182a..e6485407fce68 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_index.xml +++ b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_index.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_start.xml b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_start.xml index cac0aa44a22ee..0c03442c8ad20 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_start.xml +++ b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_start.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_validate.xml b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_validate.xml index cac0aa44a22ee..0c03442c8ad20 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_validate.xml +++ b/app/code/Magento/ImportExport/view/adminhtml/layout/adminhtml_import_validate.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/busy.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/busy.phtml index 5e6e0b8e9abf4..2c3a2534ea9ab 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/templates/busy.phtml +++ b/app/code/Magento/ImportExport/view/adminhtml/templates/busy.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml index e551dca72e224..2b036ffb11360 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml +++ b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/filter/after.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/filter/after.phtml index aa2dbce2b72a5..365ad1a22587a 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/filter/after.phtml +++ b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/filter/after.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/after.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/after.phtml index 62ac37926260e..513d32073b97c 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/after.phtml +++ b/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/after.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/ImportExport/view/adminhtml/web/css/importexport.css b/app/code/Magento/ImportExport/view/adminhtml/web/css/importexport.css index 9ddae017cbcea..6d08f0be2b94a 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/web/css/importexport.css +++ b/app/code/Magento/ImportExport/view/adminhtml/web/css/importexport.css @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ .import-error-wrapper { diff --git a/app/code/Magento/Indexer/App/Indexer.php b/app/code/Magento/Indexer/App/Indexer.php index 58c58608984a3..827d7393bed37 100644 --- a/app/code/Magento/Indexer/App/Indexer.php +++ b/app/code/Magento/Indexer/App/Indexer.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Indexer/etc/adminhtml/di.xml b/app/code/Magento/Indexer/etc/adminhtml/di.xml index 5f6a5d7200dba..76b8f8b841120 100644 --- a/app/code/Magento/Indexer/etc/adminhtml/di.xml +++ b/app/code/Magento/Indexer/etc/adminhtml/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Indexer/etc/adminhtml/menu.xml b/app/code/Magento/Indexer/etc/adminhtml/menu.xml index 09fc0b2e5ffbf..432a0cf1a9d0e 100644 --- a/app/code/Magento/Indexer/etc/adminhtml/menu.xml +++ b/app/code/Magento/Indexer/etc/adminhtml/menu.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Indexer/etc/adminhtml/routes.xml b/app/code/Magento/Indexer/etc/adminhtml/routes.xml index 0e134cd64a08a..ceccb8d0917c6 100644 --- a/app/code/Magento/Indexer/etc/adminhtml/routes.xml +++ b/app/code/Magento/Indexer/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Indexer/etc/cron_groups.xml b/app/code/Magento/Indexer/etc/cron_groups.xml index d3d7ccd1994d9..8d5309c9657a1 100644 --- a/app/code/Magento/Indexer/etc/cron_groups.xml +++ b/app/code/Magento/Indexer/etc/cron_groups.xml @@ -1,7 +1,7 @@ @@ -15,4 +15,4 @@ 600 1 - \ No newline at end of file + diff --git a/app/code/Magento/Indexer/etc/crontab.xml b/app/code/Magento/Indexer/etc/crontab.xml index 7bf3d2ed610aa..b3a701c1dd651 100644 --- a/app/code/Magento/Indexer/etc/crontab.xml +++ b/app/code/Magento/Indexer/etc/crontab.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Indexer/etc/di.xml b/app/code/Magento/Indexer/etc/di.xml index 80b42bd2f72e4..1d3f125406f7d 100644 --- a/app/code/Magento/Indexer/etc/di.xml +++ b/app/code/Magento/Indexer/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Indexer/etc/module.xml b/app/code/Magento/Indexer/etc/module.xml index 01e57c942a37b..a2beac159902b 100644 --- a/app/code/Magento/Indexer/etc/module.xml +++ b/app/code/Magento/Indexer/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Indexer/registration.php b/app/code/Magento/Indexer/registration.php index e589abd999953..ac23ea0b4e6b3 100644 --- a/app/code/Magento/Indexer/registration.php +++ b/app/code/Magento/Indexer/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml index 63ef028238393..98623890a904d 100644 --- a/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml +++ b/app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Integration/Api/AdminTokenServiceInterface.php b/app/code/Magento/Integration/Api/AdminTokenServiceInterface.php index f7b12e6afb734..e7368e74f4e92 100644 --- a/app/code/Magento/Integration/Api/AdminTokenServiceInterface.php +++ b/app/code/Magento/Integration/Api/AdminTokenServiceInterface.php @@ -1,6 +1,6 @@ tag with "edit" action for the integration grid. * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php index 1e87b194ac648..81ed706a5785a 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php @@ -2,7 +2,7 @@ /** * Render HTML \ No newline at end of file + diff --git a/app/code/Magento/Theme/view/base/layouts.xml b/app/code/Magento/Theme/view/base/layouts.xml index 05598b5c83e43..c1489a2e66c47 100644 --- a/app/code/Magento/Theme/view/base/layouts.xml +++ b/app/code/Magento/Theme/view/base/layouts.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/base/page_layout/empty.xml b/app/code/Magento/Theme/view/base/page_layout/empty.xml index 82b36252e6f1a..395e629d04ad3 100644 --- a/app/code/Magento/Theme/view/base/page_layout/empty.xml +++ b/app/code/Magento/Theme/view/base/page_layout/empty.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/base/requirejs-config.js b/app/code/Magento/Theme/view/base/requirejs-config.js index 3f83f46e430c1..05a0574779543 100644 --- a/app/code/Magento/Theme/view/base/requirejs-config.js +++ b/app/code/Magento/Theme/view/base/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Theme/view/base/templates/root.phtml b/app/code/Magento/Theme/view/base/templates/root.phtml index 5b8e62a03db01..ff5e67235e2fe 100644 --- a/app/code/Magento/Theme/view/base/templates/root.phtml +++ b/app/code/Magento/Theme/view/base/templates/root.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 25950342da680..fd2d6c6dbb2f1 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/frontend/layout/page_calendar.xml b/app/code/Magento/Theme/view/frontend/layout/page_calendar.xml index 353cb19f80da8..4093e646d48b6 100644 --- a/app/code/Magento/Theme/view/frontend/layout/page_calendar.xml +++ b/app/code/Magento/Theme/view/frontend/layout/page_calendar.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/frontend/layout/print.xml b/app/code/Magento/Theme/view/frontend/layout/print.xml index 9a4fe9578540d..37d599f301c93 100644 --- a/app/code/Magento/Theme/view/frontend/layout/print.xml +++ b/app/code/Magento/Theme/view/frontend/layout/print.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/frontend/layouts.xml b/app/code/Magento/Theme/view/frontend/layouts.xml index 143de45e9d43c..1b1a9c1956c51 100644 --- a/app/code/Magento/Theme/view/frontend/layouts.xml +++ b/app/code/Magento/Theme/view/frontend/layouts.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/frontend/page_layout/1column.xml b/app/code/Magento/Theme/view/frontend/page_layout/1column.xml index 268f14012d71a..0ce264465ca61 100644 --- a/app/code/Magento/Theme/view/frontend/page_layout/1column.xml +++ b/app/code/Magento/Theme/view/frontend/page_layout/1column.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/frontend/page_layout/2columns-left.xml b/app/code/Magento/Theme/view/frontend/page_layout/2columns-left.xml index 8c7994db8efaf..74fdf1dd176ed 100644 --- a/app/code/Magento/Theme/view/frontend/page_layout/2columns-left.xml +++ b/app/code/Magento/Theme/view/frontend/page_layout/2columns-left.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/frontend/page_layout/2columns-right.xml b/app/code/Magento/Theme/view/frontend/page_layout/2columns-right.xml index 3b6569068ac7a..62cda64a18d2c 100644 --- a/app/code/Magento/Theme/view/frontend/page_layout/2columns-right.xml +++ b/app/code/Magento/Theme/view/frontend/page_layout/2columns-right.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/frontend/page_layout/3columns.xml b/app/code/Magento/Theme/view/frontend/page_layout/3columns.xml index 3b6569068ac7a..62cda64a18d2c 100644 --- a/app/code/Magento/Theme/view/frontend/page_layout/3columns.xml +++ b/app/code/Magento/Theme/view/frontend/page_layout/3columns.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Theme/view/frontend/requirejs-config.js b/app/code/Magento/Theme/view/frontend/requirejs-config.js index 863a57e419387..4bd09ebd0ad2c 100644 --- a/app/code/Magento/Theme/view/frontend/requirejs-config.js +++ b/app/code/Magento/Theme/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Theme/view/frontend/templates/callouts/left_col.phtml b/app/code/Magento/Theme/view/frontend/templates/callouts/left_col.phtml index 20721c177ca17..5740c91b5b0c5 100644 --- a/app/code/Magento/Theme/view/frontend/templates/callouts/left_col.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/callouts/left_col.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/templates/html/block.phtml b/app/code/Magento/Theme/view/frontend/templates/html/block.phtml index 89950dd77af5b..a9bffb4bbe269 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/block.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/block.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/templates/html/collapsible.phtml b/app/code/Magento/Theme/view/frontend/templates/html/collapsible.phtml index 72ccd2e648e8d..32933e3a32747 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/collapsible.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/collapsible.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/templates/html/footer.phtml b/app/code/Magento/Theme/view/frontend/templates/html/footer.phtml index 2a22184431ff4..d9de080002604 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/footer.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/footer.phtml @@ -1,6 +1,6 @@ -
    \ No newline at end of file +
    diff --git a/app/code/Magento/Theme/view/frontend/templates/html/notices.phtml b/app/code/Magento/Theme/view/frontend/templates/html/notices.phtml index 2d9c6877800d4..457da22298014 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/notices.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/notices.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/templates/html/sections.phtml b/app/code/Magento/Theme/view/frontend/templates/html/sections.phtml index 04d211407db85..34deb16aa2b9b 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/sections.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/sections.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/templates/js/components.phtml b/app/code/Magento/Theme/view/frontend/templates/js/components.phtml index e490a6aa04923..bdcb2e9bf7747 100644 --- a/app/code/Magento/Theme/view/frontend/templates/js/components.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/js/components.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/templates/link.phtml b/app/code/Magento/Theme/view/frontend/templates/link.phtml index 42cdddf029931..c75589a8815ed 100644 --- a/app/code/Magento/Theme/view/frontend/templates/link.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/link.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml b/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml index 6866f6698c46b..d3bf6a342924d 100644 --- a/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Theme/view/frontend/templates/template.phtml b/app/code/Magento/Theme/view/frontend/templates/template.phtml index 0e7b5ee0a97dc..b836a0d1b8fa2 100644 --- a/app/code/Magento/Theme/view/frontend/templates/template.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/template.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Translation/etc/adminhtml/routes.xml b/app/code/Magento/Translation/etc/adminhtml/routes.xml index 06080c51733f5..96cbaa2d184b9 100644 --- a/app/code/Magento/Translation/etc/adminhtml/routes.xml +++ b/app/code/Magento/Translation/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Translation/etc/adminhtml/system.xml b/app/code/Magento/Translation/etc/adminhtml/system.xml index c60ff0db60100..7ce6719d92e01 100644 --- a/app/code/Magento/Translation/etc/adminhtml/system.xml +++ b/app/code/Magento/Translation/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Translation/etc/cache.xml b/app/code/Magento/Translation/etc/cache.xml index 00ad9577b5421..8e3f03dd503c5 100644 --- a/app/code/Magento/Translation/etc/cache.xml +++ b/app/code/Magento/Translation/etc/cache.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Translation/etc/config.xml b/app/code/Magento/Translation/etc/config.xml index 4ba907067cbfe..3c7fdbcead9cc 100644 --- a/app/code/Magento/Translation/etc/config.xml +++ b/app/code/Magento/Translation/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml index 3e76f80fff261..062d62c7cdbc7 100644 --- a/app/code/Magento/Translation/etc/di.xml +++ b/app/code/Magento/Translation/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Translation/etc/frontend/routes.xml b/app/code/Magento/Translation/etc/frontend/routes.xml index d275b571e5f18..44eb6b5b7d68d 100644 --- a/app/code/Magento/Translation/etc/frontend/routes.xml +++ b/app/code/Magento/Translation/etc/frontend/routes.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Translation/etc/module.xml b/app/code/Magento/Translation/etc/module.xml index e97d7ca3b3024..7abeb5bbdd49e 100644 --- a/app/code/Magento/Translation/etc/module.xml +++ b/app/code/Magento/Translation/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Translation/registration.php b/app/code/Magento/Translation/registration.php index cb7594cc431ef..d4118679a31be 100644 --- a/app/code/Magento/Translation/registration.php +++ b/app/code/Magento/Translation/registration.php @@ -1,6 +1,6 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Translation/view/base/web/js/i18n-config.js b/app/code/Magento/Translation/view/base/web/js/i18n-config.js index bc828f1dbe989..a880f615c609d 100644 --- a/app/code/Magento/Translation/view/base/web/js/i18n-config.js +++ b/app/code/Magento/Translation/view/base/web/js/i18n-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ 'use strict'; diff --git a/app/code/Magento/Translation/view/frontend/requirejs-config.js b/app/code/Magento/Translation/view/frontend/requirejs-config.js index ad5c6fb3c4973..236bb0e504bdb 100644 --- a/app/code/Magento/Translation/view/frontend/requirejs-config.js +++ b/app/code/Magento/Translation/view/frontend/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml b/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml index bed01d2489ef0..9d6beb4565cdc 100644 --- a/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml +++ b/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml @@ -1,6 +1,6 @@ @@ -45,4 +45,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/etc/adminhtml/routes.xml b/app/code/Magento/Ui/etc/adminhtml/routes.xml index 19da45aef65d5..9b5a5d97f06d7 100644 --- a/app/code/Magento/Ui/etc/adminhtml/routes.xml +++ b/app/code/Magento/Ui/etc/adminhtml/routes.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/adminhtml/system.xml b/app/code/Magento/Ui/etc/adminhtml/system.xml index 7df7570471b39..796304ff790fc 100644 --- a/app/code/Magento/Ui/etc/adminhtml/system.xml +++ b/app/code/Magento/Ui/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/config.xml b/app/code/Magento/Ui/etc/config.xml index ddf2323431590..042d40eb5dcb5 100644 --- a/app/code/Magento/Ui/etc/config.xml +++ b/app/code/Magento/Ui/etc/config.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/data_source.xsd b/app/code/Magento/Ui/etc/data_source.xsd index c0bac03543f81..9d098f9998572 100644 --- a/app/code/Magento/Ui/etc/data_source.xsd +++ b/app/code/Magento/Ui/etc/data_source.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/di.xml b/app/code/Magento/Ui/etc/di.xml index 96525abe9f081..39a2935c67df1 100644 --- a/app/code/Magento/Ui/etc/di.xml +++ b/app/code/Magento/Ui/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/module.xml b/app/code/Magento/Ui/etc/module.xml index 81585d7fd16c3..f9e1c5f041fbb 100644 --- a/app/code/Magento/Ui/etc/module.xml +++ b/app/code/Magento/Ui/etc/module.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/ui_components.xsd b/app/code/Magento/Ui/etc/ui_components.xsd index ace63b8a0b68c..aa84445ba1fb4 100644 --- a/app/code/Magento/Ui/etc/ui_components.xsd +++ b/app/code/Magento/Ui/etc/ui_components.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/ui_configuration.xsd b/app/code/Magento/Ui/etc/ui_configuration.xsd index e8c69d8e12d7c..adbe7e7cc8fd4 100644 --- a/app/code/Magento/Ui/etc/ui_configuration.xsd +++ b/app/code/Magento/Ui/etc/ui_configuration.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/ui_definition.xsd b/app/code/Magento/Ui/etc/ui_definition.xsd index c7160c7475bd4..f50bb6dfbe788 100644 --- a/app/code/Magento/Ui/etc/ui_definition.xsd +++ b/app/code/Magento/Ui/etc/ui_definition.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/etc/ui_template.xsd b/app/code/Magento/Ui/etc/ui_template.xsd index ed4c07d844585..e8e088ffa9115 100644 --- a/app/code/Magento/Ui/etc/ui_template.xsd +++ b/app/code/Magento/Ui/etc/ui_template.xsd @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/registration.php b/app/code/Magento/Ui/registration.php index 5c33ba05f074b..e7976c82547b0 100644 --- a/app/code/Magento/Ui/registration.php +++ b/app/code/Magento/Ui/registration.php @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/layout/default.xml b/app/code/Magento/Ui/view/base/layout/default.xml index 64d5f1483a2f3..73caec4dedd6a 100644 --- a/app/code/Magento/Ui/view/base/layout/default.xml +++ b/app/code/Magento/Ui/view/base/layout/default.xml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/view/base/requirejs-config.js b/app/code/Magento/Ui/view/base/requirejs-config.js index ad2b75fd06f61..d0170d06c7697 100644 --- a/app/code/Magento/Ui/view/base/requirejs-config.js +++ b/app/code/Magento/Ui/view/base/requirejs-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/templates/container/content/default.phtml b/app/code/Magento/Ui/view/base/templates/container/content/default.phtml index 2a0cd37c68d37..1e805048885be 100644 --- a/app/code/Magento/Ui/view/base/templates/container/content/default.phtml +++ b/app/code/Magento/Ui/view/base/templates/container/content/default.phtml @@ -1,5 +1,5 @@ diff --git a/app/code/Magento/Ui/view/base/templates/control/button/default.phtml b/app/code/Magento/Ui/view/base/templates/control/button/default.phtml index 7cb9db02b52c4..5fb56e2a35ffe 100644 --- a/app/code/Magento/Ui/view/base/templates/control/button/default.phtml +++ b/app/code/Magento/Ui/view/base/templates/control/button/default.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/templates/layout/tabs/default.phtml b/app/code/Magento/Ui/view/base/templates/layout/tabs/default.phtml index bd25b7cc2823f..ca5a5a769da09 100644 --- a/app/code/Magento/Ui/view/base/templates/layout/tabs/default.phtml +++ b/app/code/Magento/Ui/view/base/templates/layout/tabs/default.phtml @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/container/default.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/container/default.xhtml index d36d46312bfd6..a3088c81e1af5 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/container/default.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/container/default.xhtml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/export/button.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/export/button.xhtml index c7410bd088f10..5045d6dbad8eb 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/export/button.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/export/button.xhtml @@ -1,7 +1,7 @@ @@ -9,4 +9,4 @@
    - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/form/collapsible.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/form/collapsible.xhtml index 4bc71f97da1d8..82cb73533286c 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/form/collapsible.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/form/collapsible.xhtml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/form/default.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/form/default.xhtml index b9764d403f5cb..1029a55892da9 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/form/default.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/form/default.xhtml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/view/base/ui_component/templates/listing/default.xhtml b/app/code/Magento/Ui/view/base/ui_component/templates/listing/default.xhtml index c515b356651ea..6b3feb43e27d7 100644 --- a/app/code/Magento/Ui/view/base/ui_component/templates/listing/default.xhtml +++ b/app/code/Magento/Ui/view/base/ui_component/templates/listing/default.xhtml @@ -1,7 +1,7 @@ diff --git a/app/code/Magento/Ui/view/base/web/js/block-loader.js b/app/code/Magento/Ui/view/base/web/js/block-loader.js index 0464c6f489ac7..419cbff22d214 100644 --- a/app/code/Magento/Ui/view/base/web/js/block-loader.js +++ b/app/code/Magento/Ui/view/base/web/js/block-loader.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/core/app.js b/app/code/Magento/Ui/view/base/web/js/core/app.js index 8c4539c14577b..d6b612dcde21b 100644 --- a/app/code/Magento/Ui/view/base/web/js/core/app.js +++ b/app/code/Magento/Ui/view/base/web/js/core/app.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/core/renderer/layout.js b/app/code/Magento/Ui/view/base/web/js/core/renderer/layout.js index 9dbd57b72341f..6f9bf5cc52859 100644 --- a/app/code/Magento/Ui/view/base/web/js/core/renderer/layout.js +++ b/app/code/Magento/Ui/view/base/web/js/core/renderer/layout.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/core/renderer/types.js b/app/code/Magento/Ui/view/base/web/js/core/renderer/types.js index e4fa285aaf440..2335a0bc4805e 100644 --- a/app/code/Magento/Ui/view/base/web/js/core/renderer/types.js +++ b/app/code/Magento/Ui/view/base/web/js/core/renderer/types.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/action-delete.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/action-delete.js index 6643639f59961..f00cfc6c8be04 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/action-delete.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/action-delete.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js index 2e0cbff3c21e0..d8f453fd56350 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js index 518f09fa73ba6..f89509128b102 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index bfae1cf87030f..9e32b394bc831 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js index 595031a329b5d..f1c434ad56863 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/adapter.js b/app/code/Magento/Ui/view/base/web/js/form/adapter.js index 33cd1ba08deed..0e3c4ce60f4f4 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/adapter.js +++ b/app/code/Magento/Ui/view/base/web/js/form/adapter.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ @@ -84,4 +84,4 @@ define([ _.each(handlers, destroyListener); } }; -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Ui/view/base/web/js/form/button-adapter.js b/app/code/Magento/Ui/view/base/web/js/form/button-adapter.js index a074ee24dddde..4d602ec9c4c69 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/button-adapter.js +++ b/app/code/Magento/Ui/view/base/web/js/form/button-adapter.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/client.js b/app/code/Magento/Ui/view/base/web/js/form/client.js index 03cc557e87509..6b4c1a3262273 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/client.js +++ b/app/code/Magento/Ui/view/base/web/js/form/client.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/area.js b/app/code/Magento/Ui/view/base/web/js/form/components/area.js index 0185d3fbeeb64..b0547d30f3057 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/area.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/area.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/button.js b/app/code/Magento/Ui/view/base/web/js/form/components/button.js index cdcf2e9bb0789..81f93466bb8ab 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/button.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/button.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/collection.js b/app/code/Magento/Ui/view/base/web/js/form/components/collection.js index 9f7a74b481f2d..7fe3bb9b74599 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/collection.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/collection.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/collection/item.js b/app/code/Magento/Ui/view/base/web/js/form/components/collection/item.js index 7b8431143923d..7557c8801f486 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/collection/item.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/collection/item.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js b/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js index d0799aad750d9..4d850dd3071ed 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/group.js b/app/code/Magento/Ui/view/base/web/js/form/components/group.js index 377261707dcf4..0ec4b88f8fc16 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/group.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/group.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/html.js b/app/code/Magento/Ui/view/base/web/js/form/components/html.js index 0daa67789e9d8..5bb96f8c78892 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/html.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/html.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/insert-form.js b/app/code/Magento/Ui/view/base/web/js/form/components/insert-form.js index 11643d075a796..695c0664f281e 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/insert-form.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/insert-form.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/insert-listing.js b/app/code/Magento/Ui/view/base/web/js/form/components/insert-listing.js index 74a8a50491b29..e18bcdcd5961b 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/insert-listing.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/insert-listing.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/insert.js b/app/code/Magento/Ui/view/base/web/js/form/components/insert.js index 0d3e9d99d39f9..6569266902b9b 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/insert.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/insert.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/tab.js b/app/code/Magento/Ui/view/base/web/js/form/components/tab.js index 81130caf18daa..0cd56d1b093e5 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/tab.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/tab.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js b/app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js index 5d1af64a2b4ef..83be734666034 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js b/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js index 151219b87abc5..6a577701e211f 100755 --- a/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/boolean.js b/app/code/Magento/Ui/view/base/web/js/form/element/boolean.js index c426da9a1574c..813624b0928cb 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/boolean.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/boolean.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/checkbox-set.js b/app/code/Magento/Ui/view/base/web/js/form/element/checkbox-set.js index 3627d5d67752f..18f5722abe81b 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/checkbox-set.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/checkbox-set.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/country.js b/app/code/Magento/Ui/view/base/web/js/form/element/country.js index cd611a04a1569..6bf716be62d2b 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/country.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/country.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index eb8dfb4b4057e..8ed458c0ce194 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js index a695102bfdfa6..c12ca1fdcfa73 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/media.js b/app/code/Magento/Ui/view/base/web/js/form/element/media.js index f8c27b55120cc..30b77626209f1 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/media.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/media.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/multiselect.js b/app/code/Magento/Ui/view/base/web/js/form/element/multiselect.js index 0a2d08b29f154..37b389dcba027 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/multiselect.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/multiselect.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/post-code.js b/app/code/Magento/Ui/view/base/web/js/form/element/post-code.js index 8edddba5ac807..66776725923e8 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/post-code.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/post-code.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/region.js b/app/code/Magento/Ui/view/base/web/js/form/element/region.js index 6414b90ad02ee..79b88eeb6be22 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/region.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/region.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/select.js b/app/code/Magento/Ui/view/base/web/js/form/element/select.js index 4567bba1d017a..8f77b9819e180 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/select.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox-toggle-notice.js b/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox-toggle-notice.js index 1287a1e343891..bcad5c55080cb 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox-toggle-notice.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox-toggle-notice.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox-use-config.js b/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox-use-config.js index ad21484947049..b32d74ebeacb6 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox-use-config.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox-use-config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox.js b/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox.js index c303e5b09c716..5d4f6b48776d3 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/single-checkbox.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/text.js b/app/code/Magento/Ui/view/base/web/js/form/element/text.js index a30074431ff9a..779ed6b2fac83 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/text.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/text.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/textarea.js b/app/code/Magento/Ui/view/base/web/js/form/element/textarea.js index 36c3ae0b142b1..be4157c67d5d2 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/textarea.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/textarea.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js b/app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js index b640b131aaf6f..f73f884263969 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/website.js b/app/code/Magento/Ui/view/base/web/js/form/element/website.js index 095e2c4740305..a5b08dadcf2e1 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/website.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/website.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index 209b05773a497..f42288ce98a02 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/form/form.js b/app/code/Magento/Ui/view/base/web/js/form/form.js index 0a3d6ee5850c4..d97c382770378 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/form.js +++ b/app/code/Magento/Ui/view/base/web/js/form/form.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/form/provider.js b/app/code/Magento/Ui/view/base/web/js/form/provider.js index ae6cb6aca371b..3e53979de381d 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/provider.js +++ b/app/code/Magento/Ui/view/base/web/js/form/provider.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js index 82cb14f0f7b91..cd3a6bf9be78d 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/column.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/column.js index 81aed578c1411..03f0c2a69ead5 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/column.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/column.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js index 0b694bb94ca20..a7e33a739330b 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/date.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/link.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/link.js index dbe6498f13a38..54e28ea9a31ad 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/link.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/link.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js index dfc57613c9e95..8436ff81da1f5 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/multiselect.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js index b9670993f4a37..9f25cd47f8975 100755 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/onoff.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/select.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/select.js index c710ef606dcd0..a52996f8db742 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/select.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/select.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js index f4bde3969e006..2c771c460bf91 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/controls/bookmarks/bookmarks.js b/app/code/Magento/Ui/view/base/web/js/grid/controls/bookmarks/bookmarks.js index e0e5ca5c5e830..89e71b47f16dd 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/controls/bookmarks/bookmarks.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/controls/bookmarks/bookmarks.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/controls/bookmarks/storage.js b/app/code/Magento/Ui/view/base/web/js/grid/controls/bookmarks/storage.js index a4280d72d6fd7..31cb26a97aa2c 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/controls/bookmarks/storage.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/controls/bookmarks/storage.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/controls/columns.js b/app/code/Magento/Ui/view/base/web/js/grid/controls/columns.js index 67fc893452cfc..6bb7a082e6e06 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/controls/columns.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/controls/columns.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/data-storage.js b/app/code/Magento/Ui/view/base/web/js/grid/data-storage.js index dca12f832cd15..950e87b2bfb58 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/data-storage.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/data-storage.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/dnd.js b/app/code/Magento/Ui/view/base/web/js/grid/dnd.js index 1ebe9c1c099dc..314348619e140 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/dnd.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/dnd.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/editing/bulk.js b/app/code/Magento/Ui/view/base/web/js/grid/editing/bulk.js index b7a688fa1b4fe..59b4978555b89 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/editing/bulk.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/editing/bulk.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/editing/client.js b/app/code/Magento/Ui/view/base/web/js/grid/editing/client.js index 87bec175766d2..e38a8f1e9a169 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/editing/client.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/editing/client.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/editing/editor-view.js b/app/code/Magento/Ui/view/base/web/js/grid/editing/editor-view.js index c2ed421c9276e..c6d03010bbec0 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/editing/editor-view.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/editing/editor-view.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/editing/editor.js b/app/code/Magento/Ui/view/base/web/js/grid/editing/editor.js index 0fc16010af363..f22fa6ee0663b 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/editing/editor.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/editing/editor.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/editing/record.js b/app/code/Magento/Ui/view/base/web/js/grid/editing/record.js index cb81adc69d72c..1b33355981341 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/editing/record.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/editing/record.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/export.js b/app/code/Magento/Ui/view/base/web/js/grid/export.js index ce60207b6ef43..826fc6f6ca2ba 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/export.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/export.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/filters/chips.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/chips.js index 75ec9452b192b..2a94e14d32da5 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/chips.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/chips.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js index 24e502549ac0b..5baf89a6a9461 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js index 6af90fdf688a7..fa09136f793df 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/range.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/listing.js b/app/code/Magento/Ui/view/base/web/js/grid/listing.js index 2ab3794783e47..d1e00374e064e 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/listing.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/listing.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/massactions.js b/app/code/Magento/Ui/view/base/web/js/grid/massactions.js index fda02be219b58..cd7e749914b0d 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/massactions.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/massactions.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js b/app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js index c77b4b9560a61..8a01ff014d3aa 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/paging/sizes.js b/app/code/Magento/Ui/view/base/web/js/grid/paging/sizes.js index a4c423e13849a..4998c89cc7271 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/paging/sizes.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/paging/sizes.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/provider.js b/app/code/Magento/Ui/view/base/web/js/grid/provider.js index 7bca45d0253d0..8b5997f840884 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/provider.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/provider.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/resize.js b/app/code/Magento/Ui/view/base/web/js/grid/resize.js index f7edde0ea47c4..1987aed938507 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/resize.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/resize.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/search/search.js b/app/code/Magento/Ui/view/base/web/js/grid/search/search.js index 16b850e7641d6..5e27f19f09792 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/search/search.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/search/search.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js b/app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js index feea9a4359aa5..90f695da17980 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/toolbar.js b/app/code/Magento/Ui/view/base/web/js/grid/toolbar.js index 692176ab2a43a..036be579edcbb 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/toolbar.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/toolbar.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/tree-massactions.js b/app/code/Magento/Ui/view/base/web/js/grid/tree-massactions.js index 57aacde2553c5..57e3a43245e56 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/tree-massactions.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/tree-massactions.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/collapsible.js b/app/code/Magento/Ui/view/base/web/js/lib/collapsible.js index 54ed9e8099817..9c18c97dbc4cb 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/collapsible.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/collapsible.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/class.js b/app/code/Magento/Ui/view/base/web/js/lib/core/class.js index 42458cc539e27..8cf4a6497254f 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/class.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/class.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js b/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js index 493b8c78f0cdf..abfb0c2545799 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/element/element.js b/app/code/Magento/Ui/view/base/web/js/lib/core/element/element.js index 0b2ce22c03c42..a4b9d478567c3 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/element/element.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/element/element.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/element/links.js b/app/code/Magento/Ui/view/base/web/js/lib/core/element/links.js index 36fe39038a8a7..918a881cc6206 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/element/links.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/element/links.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/events.js b/app/code/Magento/Ui/view/base/web/js/lib/core/events.js index 10d0d788524e7..ac540ecf9250b 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/events.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/events.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/storage/local.js b/app/code/Magento/Ui/view/base/web/js/lib/core/storage/local.js index f1b7097686a55..41dba4c928c6c 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/storage/local.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/storage/local.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/key-codes.js b/app/code/Magento/Ui/view/base/web/js/lib/key-codes.js index caa03401632cd..e04c68118186b 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/key-codes.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/key-codes.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/after-render.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/after-render.js index feac4919520f7..9f44678e53df5 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/after-render.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/after-render.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/autoselect.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/autoselect.js index 69cbcec3121d1..350c478ddee0d 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/autoselect.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/autoselect.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bind-html.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bind-html.js index 14474d240130d..f6d6a54554800 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bind-html.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bind-html.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js index 7948db67a269e..236dda8d68df1 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define(function (require) { diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/collapsible.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/collapsible.js index c14a39cd657a4..20afa10f00686 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/collapsible.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/collapsible.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/datepicker.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/datepicker.js index 4f52aa431632c..05423a4d0680f 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/datepicker.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/datepicker.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** Creates datepicker binding and registers in to ko.bindingHandlers object */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/fadeVisible.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/fadeVisible.js index 2d728c7cdfd4c..819ae4694f3e8 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/fadeVisible.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/fadeVisible.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/i18n.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/i18n.js index d72a2eb44a7df..2d76217280c27 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/i18n.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/i18n.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/keyboard.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/keyboard.js index 55e092463bdb5..990d8c1a9a076 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/keyboard.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/keyboard.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/mage-init.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/mage-init.js index 1c39f5b76ddc2..f4dd857829cec 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/mage-init.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/mage-init.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/optgroup.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/optgroup.js index aff207681c61c..daad48d4618b7 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/optgroup.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/optgroup.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -289,4 +289,4 @@ define([ } }; ko.bindingHandlers.selectedOptions.after.push('optgroup'); -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/outer_click.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/outer_click.js index 43ecd7b73289f..cf2d2c8bcc932 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/outer_click.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/outer_click.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** Creates outerClick binding and registers in to ko.bindingHandlers object */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/range.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/range.js index 6af75d555e127..f60882ad81f54 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/range.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/range.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/resizable.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/resizable.js index c83c0f6a79af0..cbafdec12066b 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/resizable.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/resizable.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/scope.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/scope.js index 24c45af372b5b..2a96198f8d157 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/scope.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/scope.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** Creates scope binding and registers in to ko.bindingHandlers object */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/simple-checked.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/simple-checked.js index 9b3a01fe90ef6..3ac920170c03f 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/simple-checked.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/simple-checked.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/staticChecked.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/staticChecked.js index 4237e50ca7e0b..51785d14013cd 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/staticChecked.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/staticChecked.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/tooltip.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/tooltip.js index 6040b1efa7a85..4600ec08a5392 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/tooltip.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/tooltip.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bootstrap.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bootstrap.js index 47cfc1135eb99..8ead6884dc570 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bootstrap.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bootstrap.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** Loads all available knockout bindings, sets custom template engine, initializes knockout on page */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js index 7b297a6a1ea14..2601486a8a649 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/observable_array.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/observable_array.js index 3c3898234c7cb..a768de38b2048 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/observable_array.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/observable_array.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/engine.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/engine.js index b612d4be5f02b..11cfe300cfbfc 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/engine.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/engine.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/loader.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/loader.js index b1d878c43db9e..5d5961f320442 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/loader.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/loader.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/observable_source.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/observable_source.js index b5c1af3c2eaac..f126a1abf6478 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/observable_source.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/observable_source.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/renderer.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/renderer.js index c668dde7a17c2..f1c51be0087ba 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/renderer.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/template/renderer.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/registry/registry.js b/app/code/Magento/Ui/view/base/web/js/lib/registry/registry.js index 034eae9c67b33..98261af055666 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/registry/registry.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/registry/registry.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/spinner.js b/app/code/Magento/Ui/view/base/web/js/lib/spinner.js index 905fb88852bbb..e98e7a51226b5 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/spinner.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/spinner.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js b/app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js index ace6f2255dac4..4cbf90c32e6ee 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/step-wizard.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // jscs:disable jsDoc diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js index 1f031a3aefcbd..7b89650fe8d38 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/utils.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/utils.js index 99b1944a012f5..4ed81c10e0348 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/utils.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/utils.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define(function () { @@ -69,4 +69,4 @@ define(function () { } return utils; -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/validator.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/validator.js index 7823871fd694c..6c7d9dab5116f 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/validator.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/validator.js @@ -1,5 +1,5 @@ /* - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js index b5313f7611e41..5d52acf0e4d38 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/bindings.js b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/bindings.js index 336a7f3b3c446..3c6db4827a5ad 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/bindings.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/bindings.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/dom-observer.js b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/dom-observer.js index 9329422d2f26b..b2fb171b5e178 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/dom-observer.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/dom-observer.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/raf.js b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/raf.js index d91b916df99bc..8b3a39b8ab847 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/raf.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/raf.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/modal/alert.js b/app/code/Magento/Ui/view/base/web/js/modal/alert.js index 73fbc62936aa4..241410bfa3abc 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/alert.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/alert.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/modal/confirm.js b/app/code/Magento/Ui/view/base/web/js/modal/confirm.js index 184db1f8c4a22..2bde2afd6faff 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/confirm.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/confirm.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/modal/modal-component.js b/app/code/Magento/Ui/view/base/web/js/modal/modal-component.js index 5c242bbebfae4..8683ac385ec36 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/modal-component.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/modal-component.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/modal/modal.js b/app/code/Magento/Ui/view/base/web/js/modal/modal.js index ab9dc49751774..1b2bb2382389b 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/modal.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/modal.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/modal/modalToggle.js b/app/code/Magento/Ui/view/base/web/js/modal/modalToggle.js index fa4347d0df50e..8a717557536e3 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/modalToggle.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/modalToggle.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/app/code/Magento/Ui/view/base/web/js/modal/prompt.js b/app/code/Magento/Ui/view/base/web/js/modal/prompt.js index d32605d2db4f9..3a08c913244fc 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/prompt.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/prompt.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/timeline/timeline-view.js b/app/code/Magento/Ui/view/base/web/js/timeline/timeline-view.js index 1b59680881144..478ce528ae9cc 100644 --- a/app/code/Magento/Ui/view/base/web/js/timeline/timeline-view.js +++ b/app/code/Magento/Ui/view/base/web/js/timeline/timeline-view.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/js/timeline/timeline.js b/app/code/Magento/Ui/view/base/web/js/timeline/timeline.js index 27678c477edf9..571b03317ac09 100644 --- a/app/code/Magento/Ui/view/base/web/js/timeline/timeline.js +++ b/app/code/Magento/Ui/view/base/web/js/timeline/timeline.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/app/code/Magento/Ui/view/base/web/templates/area.html b/app/code/Magento/Ui/view/base/web/templates/area.html index 4639a32ff6fc9..9d32e2a795104 100644 --- a/app/code/Magento/Ui/view/base/web/templates/area.html +++ b/app/code/Magento/Ui/view/base/web/templates/area.html @@ -1,9 +1,9 @@
    - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/block-loader.html b/app/code/Magento/Ui/view/base/web/templates/block-loader.html index e7915bb9a4088..0f879e469371e 100644 --- a/app/code/Magento/Ui/view/base/web/templates/block-loader.html +++ b/app/code/Magento/Ui/view/base/web/templates/block-loader.html @@ -1,6 +1,6 @@ @@ -8,4 +8,4 @@
    Loading...
    -
    \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/collection.html b/app/code/Magento/Ui/view/base/web/templates/collection.html index 3ac74b0716660..1c515e5d311b7 100644 --- a/app/code/Magento/Ui/view/base/web/templates/collection.html +++ b/app/code/Magento/Ui/view/base/web/templates/collection.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/content/content.html b/app/code/Magento/Ui/view/base/web/templates/content/content.html index 0dac3f792e0e2..3fee830c6bf40 100644 --- a/app/code/Magento/Ui/view/base/web/templates/content/content.html +++ b/app/code/Magento/Ui/view/base/web/templates/content/content.html @@ -1,6 +1,6 @@ @@ -16,4 +16,4 @@
    - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/action-delete.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/action-delete.html index 01b07d1ace07b..4fdb31ac16f0a 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/action-delete.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/action-delete.html @@ -1,6 +1,6 @@ @@ -13,4 +13,4 @@ } "> - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/dnd.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/dnd.html index 95d3464bf3859..3068964174784 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/dnd.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/dnd.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/text.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/text.html index 0f48a294e6c0d..a8bc63109a688 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/text.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/text.html @@ -1,6 +1,6 @@ @@ -10,4 +10,4 @@ css: {_disabled: disabled} "> - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/thumbnail.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/thumbnail.html index e205b9933930a..5b74e4230fe42 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/thumbnail.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/cells/thumbnail.html @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html index d1ec1d26df6c5..6e4c49a89e5a4 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/collapsible.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html index 77ea6573c39be..cee563bb43c3f 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html index 8171f9ac322f6..c323797d08306 100644 --- a/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html +++ b/app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/grid.html @@ -1,6 +1,6 @@ @@ -78,4 +78,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/form/collection.html b/app/code/Magento/Ui/view/base/web/templates/form/collection.html index 8f98af63a8eba..72a0189ddb26e 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/collection.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/collection.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/button/container.html b/app/code/Magento/Ui/view/base/web/templates/form/components/button/container.html index 96b153e1208e0..4043db33abd09 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/button/container.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/button/container.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/button/simple.html b/app/code/Magento/Ui/view/base/web/templates/form/components/button/simple.html index 481010ca85f82..4d9f86697f449 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/button/simple.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/button/simple.html @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/collection.html b/app/code/Magento/Ui/view/base/web/templates/form/components/collection.html index 094baf9258053..75b5832027767 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/collection.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/collection.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/collection/preview.html b/app/code/Magento/Ui/view/base/web/templates/form/components/collection/preview.html index e4d81c53f8a80..9ace6f80c569a 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/collection/preview.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/collection/preview.html @@ -1,6 +1,6 @@ @@ -39,4 +39,4 @@
    - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/complex.html b/app/code/Magento/Ui/view/base/web/templates/form/components/complex.html index ff7c023ff7fef..3d25d93245c36 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/complex.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/complex.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/single/checkbox.html b/app/code/Magento/Ui/view/base/web/templates/form/components/single/checkbox.html index b885ae9d8078f..9085e9f6368bd 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/single/checkbox.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/single/checkbox.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/single/field.html b/app/code/Magento/Ui/view/base/web/templates/form/components/single/field.html index 9c86e55dc0984..eb00b278acfaf 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/single/field.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/single/field.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/single/radio.html b/app/code/Magento/Ui/view/base/web/templates/form/components/single/radio.html index 20722feea738a..95f604ad0397b 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/single/radio.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/single/radio.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/components/single/switcher.html b/app/code/Magento/Ui/view/base/web/templates/form/components/single/switcher.html index 4b467f8d7d4d3..aac8bc8dbf9aa 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/components/single/switcher.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/components/single/switcher.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/button.html b/app/code/Magento/Ui/view/base/web/templates/form/element/button.html index a0835388b50ba..432816f37a2ee 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/button.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/button.html @@ -1,6 +1,6 @@ @@ -14,4 +14,4 @@ attr="'data-index': index"> - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/checkbox-set.html b/app/code/Magento/Ui/view/base/web/templates/form/element/checkbox-set.html index 48328690d701e..2a44c516850ad 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/checkbox-set.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/checkbox-set.html @@ -1,6 +1,6 @@ @@ -40,4 +40,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/checkbox.html b/app/code/Magento/Ui/view/base/web/templates/form/element/checkbox.html index c4a4e43d1bee7..31bbaa2a82891 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/checkbox.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/checkbox.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/date.html b/app/code/Magento/Ui/view/base/web/templates/form/element/date.html index 542b81fb918f1..e278455e12d2a 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/date.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/date.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/email.html b/app/code/Magento/Ui/view/base/web/templates/form/element/email.html index d90895c8ec242..00306b78ad620 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/email.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/email.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/helper/fallback-reset.html b/app/code/Magento/Ui/view/base/web/templates/form/element/helper/fallback-reset.html index e2cf3f80fc6d6..4bad21fc81a1a 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/helper/fallback-reset.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/helper/fallback-reset.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/helper/service.html b/app/code/Magento/Ui/view/base/web/templates/form/element/helper/service.html index 2fdb900fa1fbc..911c1e20b0065 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/helper/service.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/helper/service.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/helper/tooltip.html b/app/code/Magento/Ui/view/base/web/templates/form/element/helper/tooltip.html index 8ec294cc2cce4..b5d68b9b5e34b 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/helper/tooltip.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/helper/tooltip.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/hidden.html b/app/code/Magento/Ui/view/base/web/templates/form/element/hidden.html index c2973db15ee6c..dd0d5fbd10150 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/hidden.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/hidden.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/input.html b/app/code/Magento/Ui/view/base/web/templates/form/element/input.html index ad15f9436413d..b923b7e7b4475 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/input.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/input.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/media.html b/app/code/Magento/Ui/view/base/web/templates/form/element/media.html index 2b2bd0ad02bf9..b42e955fed5ec 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/media.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/media.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/multiselect.html b/app/code/Magento/Ui/view/base/web/templates/form/element/multiselect.html index 1745579b53078..6661dcfa42cb7 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/multiselect.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/multiselect.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/preview.html b/app/code/Magento/Ui/view/base/web/templates/form/element/preview.html index 06a8acbf13af9..c1f3609d7295e 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/preview.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/preview.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/price.html b/app/code/Magento/Ui/view/base/web/templates/form/element/price.html index 9ed4f36ecde0c..ae2155912cc25 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/price.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/price.html @@ -1,10 +1,10 @@
    -
    \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/radio.html b/app/code/Magento/Ui/view/base/web/templates/form/element/radio.html index 25b4785e03232..d7aea465eade2 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/radio.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/radio.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/select.html b/app/code/Magento/Ui/view/base/web/templates/form/element/select.html index 17bd01e3b1918..f7515b92c46e2 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/select.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/select.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/split-button.html b/app/code/Magento/Ui/view/base/web/templates/form/element/split-button.html index 5ca274540102f..ea8873fa395ce 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/split-button.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/split-button.html @@ -1,6 +1,6 @@ @@ -16,4 +16,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/switcher.html b/app/code/Magento/Ui/view/base/web/templates/form/element/switcher.html index 7529d07818294..f09865d0e53c2 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/switcher.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/switcher.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/text.html b/app/code/Magento/Ui/view/base/web/templates/form/element/text.html index f77b4d128b100..15aa6a6d19604 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/text.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/text.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/textDate.html b/app/code/Magento/Ui/view/base/web/templates/form/element/textDate.html index 599f439ad6663..79cc01fcca838 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/textDate.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/textDate.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/textarea.html b/app/code/Magento/Ui/view/base/web/templates/form/element/textarea.html index 597fcd75aa075..e07e4056af2dd 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/textarea.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/textarea.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/uploader/preview.html b/app/code/Magento/Ui/view/base/web/templates/form/element/uploader/preview.html index 45493b83d8f58..8895a60b9f2ff 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/uploader/preview.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/uploader/preview.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/uploader/uploader.html b/app/code/Magento/Ui/view/base/web/templates/form/element/uploader/uploader.html index f0f80efdb16d6..c7477cdb78444 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/uploader/uploader.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/uploader/uploader.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/element/wysiwyg.html b/app/code/Magento/Ui/view/base/web/templates/form/element/wysiwyg.html index 6cd0efd96462c..04408cb845d43 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/element/wysiwyg.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/element/wysiwyg.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/field.html b/app/code/Magento/Ui/view/base/web/templates/form/field.html index 4a9d8f8c75a77..ad2096783acbb 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/field.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/field.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/fieldset.html b/app/code/Magento/Ui/view/base/web/templates/form/fieldset.html index 6cb7fb62b3a91..a97eb85b225dc 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/fieldset.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/fieldset.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/form/insert.html b/app/code/Magento/Ui/view/base/web/templates/form/insert.html index 118c910c66096..bf97bf8fbf01a 100644 --- a/app/code/Magento/Ui/view/base/web/templates/form/insert.html +++ b/app/code/Magento/Ui/view/base/web/templates/form/insert.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/actions.html b/app/code/Magento/Ui/view/base/web/templates/grid/actions.html index f944d7ec38972..e9944a63bbbfe 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/actions.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/actions.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html index 00b9e090769f4..c7b0c49af3dcd 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/html.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/html.html index 694517f48ebce..032b67d3b2fca 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/html.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/html.html @@ -1,7 +1,7 @@ -
    \ No newline at end of file +
    diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/link.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/link.html index 9ece01ae76ded..401cb16664a09 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/link.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/link.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/multiselect.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/multiselect.html index 1eb2129f67a11..7cc068fe723ec 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/multiselect.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/multiselect.html @@ -1,6 +1,6 @@ @@ -14,4 +14,4 @@ id: index + 'check' + $row()[$col.indexField] }"> \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/onoff.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/onoff.html index fd37a20ec6b73..f927f578f0d1e 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/onoff.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/onoff.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/text.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/text.html index 6669461711087..725e6409feb8b 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/text.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/text.html @@ -1,7 +1,7 @@ -
    \ No newline at end of file +
    diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/thumbnail.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/thumbnail.html index 8e835357b1f2b..16447ab9f64d3 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/thumbnail.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/thumbnail.html @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/thumbnail/preview.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/thumbnail/preview.html index 9020960d2262a..bc62199abeab9 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/thumbnail/preview.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/thumbnail/preview.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/columns/multiselect.html b/app/code/Magento/Ui/view/base/web/templates/grid/columns/multiselect.html index 1e090d50b816d..5e10572651352 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/columns/multiselect.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/columns/multiselect.html @@ -1,6 +1,6 @@ @@ -28,4 +28,4 @@
    - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/columns/onoff.html b/app/code/Magento/Ui/view/base/web/templates/grid/columns/onoff.html index 137b46d63a163..a5db2f959ca85 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/columns/onoff.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/columns/onoff.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/columns/text.html b/app/code/Magento/Ui/view/base/web/templates/grid/columns/text.html index b045149dda5fc..26aad7106d9fc 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/columns/text.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/columns/text.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html index e2b60900c246b..e338f76686b7b 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html index 5d3e64c94775e..a424d8040735b 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html @@ -1,6 +1,6 @@ @@ -37,4 +37,4 @@
    -
    \ No newline at end of file +
    diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/controls/columns.html b/app/code/Magento/Ui/view/base/web/templates/grid/controls/columns.html index 56a69b6bc3cc3..acf627f76c2af 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/controls/columns.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/controls/columns.html @@ -1,6 +1,6 @@ @@ -30,4 +30,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/editing/bulk.html b/app/code/Magento/Ui/view/base/web/templates/grid/editing/bulk.html index b2588ba9f362d..32c078d5eaa82 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/editing/bulk.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/editing/bulk.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/editing/field.html b/app/code/Magento/Ui/view/base/web/templates/grid/editing/field.html index 062e8e67e6c44..3cd1953d53539 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/editing/field.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/editing/field.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/editing/header-buttons.html b/app/code/Magento/Ui/view/base/web/templates/grid/editing/header-buttons.html index fd4e61108aae0..05cc6ef3add50 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/editing/header-buttons.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/editing/header-buttons.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/editing/row-buttons.html b/app/code/Magento/Ui/view/base/web/templates/grid/editing/row-buttons.html index 7d6d804b1b537..6545e85222e68 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/editing/row-buttons.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/editing/row-buttons.html @@ -1,6 +1,6 @@ @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/editing/row.html b/app/code/Magento/Ui/view/base/web/templates/grid/editing/row.html index d8334806b463c..10ec4665c992e 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/editing/row.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/editing/row.html @@ -1,6 +1,6 @@ diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/exportButton.html b/app/code/Magento/Ui/view/base/web/templates/grid/exportButton.html index 7e632d94fdd34..f8ff827add0b8 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/exportButton.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/exportButton.html @@ -1,6 +1,6 @@ @@ -25,4 +25,4 @@ */ -}; \ No newline at end of file +}; diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html index 95450cb849e77..8e6db393e6dcb 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html +++ b/dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html @@ -2,7 +2,7 @@ /** * @category mage.menu * @package test - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js b/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js index 57a87a14c3e49..ad8ae39c63280 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js @@ -1,7 +1,7 @@ /** * @category mage.js * @package test - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js index f0eda9d082376..32c7e425b4e1d 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js @@ -1,7 +1,7 @@ /** * @category mage.js * @package test - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ //Code to be tested for /app/code/Magento/Search/view/frontend/form-mini.js (_onSubmit) diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/suggest/suggest-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/suggest/suggest-test.js index 2f17ecc00aabc..065e9ed0a66d0 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/suggest/suggest-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/suggest/suggest-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ SuggestTest = TestCase('SuggestTest'); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/suggest/tree-suggest-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/suggest/tree-suggest-test.js index cffdc06c10533..a3657d8680ac8 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/suggest/tree-suggest-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/suggest/tree-suggest-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/index.html index 65defb9e707e5..316c098033c67 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/index.html +++ b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/index.html @@ -1,6 +1,6 @@ diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs-test.js index b12bc8ab7746a..16d75863913dd 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ TabsTest = TestCase('TabsTest'); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs.js b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs.js index 1cfacb7acf4e0..3761e75fa6d90 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/tabs/tabs.js @@ -1,7 +1,7 @@ /** * @category mage.js * @package test - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate/translate-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate/translate-test.js index de9acabc90947..021e13f0a3cef 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/translate/translate-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/translate/translate-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ TranslateTest = TestCase('TranslateTest'); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline/translate-inline-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline/translate-inline-test.js index 300dc2b0a43f0..d3a4826f85661 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline/translate-inline-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline/translate-inline-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ TranslateInlineTest = TestCase('TranslateInlineTest'); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js index e9961cd512978..cba9e8527f3b0 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ TranslateInlineDialogVdeTest = TestCase('TranslateInlineDialogVdeTest'); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js index b17959e4f88a0..4dcd3fcd90eab 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ TranslateInlineVdeTest = TestCase('TranslateInlineVdeTest'); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html index feaa72204f3b0..89ad8726bb81a 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html +++ b/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html @@ -2,7 +2,7 @@ /** * @category mage.validation * @package test - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> @@ -32,4 +32,4 @@
    - \ No newline at end of file + diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js b/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js index 58b2c628ca1d0..e105142d42336 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ test( "testValidateNoHtmlTags", function() { @@ -608,4 +608,4 @@ test( "testValidateDigitsRange", function() { ok($.validator.methods['validate-digits-range'].call(this, '15', el1, null)); ok(!$.validator.methods['validate-digits-range'].call(this, '1', el1, null)); ok(!$.validator.methods['validate-digits-range'].call(this, '30', el1, null)); -}); \ No newline at end of file +}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js index 644576a16ac01..f4a1081aab7b5 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ WebapiTest = TestCase('WebapiTest'); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js index 46d0d1227daa8..342f0c39d2130 100644 --- a/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js +++ b/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ ZoomTest = TestCase('ZoomTest'); @@ -334,4 +334,4 @@ ZoomTest.prototype.testGetAspectRatio = function() { assertNull(aspectRatio); aspectRatio = zoomInstance._getAspectRatio(jQuery('
    ', size)); assertEquals((Math.round((size.width / size.height) * 100) / 100), aspectRatio); -}; \ No newline at end of file +}; diff --git a/dev/tests/js/jasmine/assets/apply/components/fn.js b/dev/tests/js/jasmine/assets/apply/components/fn.js index 0a92f4799b05c..da37fe805b246 100644 --- a/dev/tests/js/jasmine/assets/apply/components/fn.js +++ b/dev/tests/js/jasmine/assets/apply/components/fn.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([], function () { diff --git a/dev/tests/js/jasmine/assets/apply/index.js b/dev/tests/js/jasmine/assets/apply/index.js index 000564aafcafe..64f066642d045 100644 --- a/dev/tests/js/jasmine/assets/apply/index.js +++ b/dev/tests/js/jasmine/assets/apply/index.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/assets/apply/templates/node.html b/dev/tests/js/jasmine/assets/apply/templates/node.html index 4a42567327395..260370525b89c 100644 --- a/dev/tests/js/jasmine/assets/apply/templates/node.html +++ b/dev/tests/js/jasmine/assets/apply/templates/node.html @@ -1,10 +1,10 @@
    ='<%= JSON.stringify(nodeData) %>'>
    -
    \ No newline at end of file +
    diff --git a/dev/tests/js/jasmine/assets/jsbuild/config.js b/dev/tests/js/jasmine/assets/jsbuild/config.js index 46c8d246f9137..4145998f16844 100644 --- a/dev/tests/js/jasmine/assets/jsbuild/config.js +++ b/dev/tests/js/jasmine/assets/jsbuild/config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define(function () { diff --git a/dev/tests/js/jasmine/assets/jsbuild/external.js b/dev/tests/js/jasmine/assets/jsbuild/external.js index 7836099a952a6..e500c569093e8 100644 --- a/dev/tests/js/jasmine/assets/jsbuild/external.js +++ b/dev/tests/js/jasmine/assets/jsbuild/external.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([], function () { diff --git a/dev/tests/js/jasmine/assets/jsbuild/local.js b/dev/tests/js/jasmine/assets/jsbuild/local.js index adb37196d1c89..53db06a73e97b 100644 --- a/dev/tests/js/jasmine/assets/jsbuild/local.js +++ b/dev/tests/js/jasmine/assets/jsbuild/local.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([], function () { diff --git a/dev/tests/js/jasmine/assets/script/index.js b/dev/tests/js/jasmine/assets/script/index.js index f945add10b49b..e708d6827ca30 100644 --- a/dev/tests/js/jasmine/assets/script/index.js +++ b/dev/tests/js/jasmine/assets/script/index.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/assets/script/templates/selector.html b/dev/tests/js/jasmine/assets/script/templates/selector.html index 4399a402b9275..fd3a65d5fb733 100644 --- a/dev/tests/js/jasmine/assets/script/templates/selector.html +++ b/dev/tests/js/jasmine/assets/script/templates/selector.html @@ -1,6 +1,6 @@ @@ -12,4 +12,4 @@ - \ No newline at end of file + diff --git a/dev/tests/js/jasmine/assets/script/templates/virtual.html b/dev/tests/js/jasmine/assets/script/templates/virtual.html index 2de6c79f77b8d..d2e5329c2c830 100644 --- a/dev/tests/js/jasmine/assets/script/templates/virtual.html +++ b/dev/tests/js/jasmine/assets/script/templates/virtual.html @@ -1,6 +1,6 @@ diff --git a/dev/tests/js/jasmine/assets/text/config.js b/dev/tests/js/jasmine/assets/text/config.js index d20ecb0c87f40..b456aa0468460 100644 --- a/dev/tests/js/jasmine/assets/text/config.js +++ b/dev/tests/js/jasmine/assets/text/config.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define(function () { @@ -8,11 +8,11 @@ define(function () { return { local: { path: 'text!tests/assets/text/local.html', - result: '\nLocal Template' + result: '\nLocal Template' }, external: { path: 'text!tests/assets/text/external.html', - result: '\nExternal Template' + result: '\nExternal Template' } }; }); diff --git a/dev/tests/js/jasmine/assets/text/external.html b/dev/tests/js/jasmine/assets/text/external.html index e86236ea312ad..8f3539355536c 100644 --- a/dev/tests/js/jasmine/assets/text/external.html +++ b/dev/tests/js/jasmine/assets/text/external.html @@ -1,7 +1,7 @@ -External Template \ No newline at end of file +External Template diff --git a/dev/tests/js/jasmine/assets/text/local.html b/dev/tests/js/jasmine/assets/text/local.html index 9e6a10a534aaa..442fd26c7afc0 100644 --- a/dev/tests/js/jasmine/assets/text/local.html +++ b/dev/tests/js/jasmine/assets/text/local.html @@ -1,7 +1,7 @@ -Local Template \ No newline at end of file +Local Template diff --git a/dev/tests/js/jasmine/assets/tools.js b/dev/tests/js/jasmine/assets/tools.js index 5945be8d06474..32ed8d366325b 100644 --- a/dev/tests/js/jasmine/assets/tools.js +++ b/dev/tests/js/jasmine/assets/tools.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/require.conf.js b/dev/tests/js/jasmine/require.conf.js index c60ec02943b5b..f069042a98aa3 100644 --- a/dev/tests/js/jasmine/require.conf.js +++ b/dev/tests/js/jasmine/require.conf.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -29,10 +29,10 @@ require.config({ 'dev/tests/js/jasmine/assets/jsbuild/local.js': 'define([], function () {\'use strict\'; return \'internal module\'; });' }, text: { - 'dev/tests/js/jasmine/assets/text/local.html': '\nLocal Template' + 'dev/tests/js/jasmine/assets/text/local.html': '\nLocal Template' } }, deps: [ 'mage/requirejs/static' ] -}); \ No newline at end of file +}); diff --git a/dev/tests/js/jasmine/spec_runner/index.js b/dev/tests/js/jasmine/spec_runner/index.js index d8329bb35178f..625b75a7c3e84 100644 --- a/dev/tests/js/jasmine/spec_runner/index.js +++ b/dev/tests/js/jasmine/spec_runner/index.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -66,4 +66,4 @@ function getTasks() { module.exports = { init: init, getTasks: getTasks -}; \ No newline at end of file +}; diff --git a/dev/tests/js/jasmine/spec_runner/tasks/connect.js b/dev/tests/js/jasmine/spec_runner/tasks/connect.js index 4d27b8c0be7fd..9134e84573c12 100644 --- a/dev/tests/js/jasmine/spec_runner/tasks/connect.js +++ b/dev/tests/js/jasmine/spec_runner/tasks/connect.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -61,4 +61,4 @@ function getTasks() { module.exports = { init: init, getTasks: getTasks -}; \ No newline at end of file +}; diff --git a/dev/tests/js/jasmine/spec_runner/tasks/jasmine.js b/dev/tests/js/jasmine/spec_runner/tasks/jasmine.js index 99f05198000ec..75a27fcb387c4 100644 --- a/dev/tests/js/jasmine/spec_runner/tasks/jasmine.js +++ b/dev/tests/js/jasmine/spec_runner/tasks/jasmine.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -71,4 +71,4 @@ function getTasks() { module.exports = { init: init, getTasks: getTasks -}; \ No newline at end of file +}; diff --git a/dev/tests/js/jasmine/spec_runner/template.html b/dev/tests/js/jasmine/spec_runner/template.html index 3d3f61913da54..30f7138266614 100644 --- a/dev/tests/js/jasmine/spec_runner/template.html +++ b/dev/tests/js/jasmine/spec_runner/template.html @@ -1,6 +1,6 @@ @@ -27,4 +27,4 @@ - \ No newline at end of file + diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/utils/percentage-price-calculator.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/utils/percentage-price-calculator.test.js index 8785e41c2920c..22e73621c3e2b 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/utils/percentage-price-calculator.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/utils/percentage-price-calculator.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/new-customer-address.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/new-customer-address.test.js index ae7ff3d145e2b..325a63a670380 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/new-customer-address.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/model/new-customer-address.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/cart/shipping-estimation.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/cart/shipping-estimation.test.js index 785d88d81e354..1ffb12126203d 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/cart/shipping-estimation.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/cart/shipping-estimation.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js index 20f3b2a090d7a..03fa401b3f11a 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/model/customer/address.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/model/customer/address.test.js index 0384c9df2c583..f79ef3e5139b9 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/model/customer/address.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/model/customer/address.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/view/authentication-popup.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/view/authentication-popup.test.js index 128bd86edbf99..4e830f8aad426 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/view/authentication-popup.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/view/authentication-popup.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Msrp/frontend/js/msrp.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Msrp/frontend/js/msrp.test.js index bcb99deaff20f..4f28934c874ef 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Msrp/frontend/js/msrp.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Msrp/frontend/js/msrp.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/page-cache.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/page-cache.test.js index 1fba5d18e9b60..500787f844004 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/page-cache.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/page-cache.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Review/view/frontend/web/js/process-review.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Review/view/frontend/web/js/process-review.test.js index 66c9ccccb23be..58b254db52349 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Review/view/frontend/web/js/process-review.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Review/view/frontend/web/js/process-review.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/core/layout.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/core/layout.test.js index 748a1dd5333f5..656185c5af5c0 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/core/layout.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/core/layout.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ @@ -18,4 +18,4 @@ define([ expect(typeof layoutObj).toEqual("function"); }); }); -}); \ No newline at end of file +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/adapter.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/adapter.test.js index c3b20b0af59e6..595e97ff2c089 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/adapter.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/adapter.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/client.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/client.test.js index 06da0e0ce2db0..8a14feccd6910 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/client.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/client.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/area.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/area.test.js index 7ba3972f5bb06..2e4238aa62a05 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/area.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/area.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/collection.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/collection.test.js index 9d0aa62d67eab..53d487aec4b6e 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/collection.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/collection.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/collection/item.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/collection/item.test.js index 6fbbc63af473c..45da8dafc57a0 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/collection/item.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/collection/item.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/group.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/group.test.js index efeca14c3271b..f417b5f884e0a 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/group.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/group.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/html.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/html.test.js index dfdf0fea34d76..18a3ef789842b 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/html.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/html.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/tab.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/tab.test.js index 10c9e5d35daed..e9d4d4cdf8274 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/tab.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/tab.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/tab_group.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/tab_group.test.js index 311b023a003a8..cc89e9abec67e 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/tab_group.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/components/tab_group.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/abstract.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/abstract.test.js index 7730bc72f7af6..ce07b709467f2 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/abstract.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/abstract.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/boolean.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/boolean.test.js index a17a06ea55810..96814ce5ba23c 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/boolean.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/boolean.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date-time.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date-time.test.js index 4271ecc563b9a..9767ef81317fb 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date-time.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date-time.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date.test.js index 51a998e6eb2a0..a91a7d93089c6 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js index b32c30a0127e9..64a31985360a2 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/post-code.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/post-code.test.js index 77c71ff103665..61adf4a0d8374 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/post-code.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/post-code.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/region.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/region.test.js index fa61cfa780b3d..642bff4bf34fd 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/region.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/region.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js index 5d75b8c595366..2e82c877c10e3 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/textarea.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/textarea.test.js index 608a2cd27d25e..c93769e5f9a1d 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/textarea.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/textarea.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js index 88203afba3313..3fb10ff2b401e 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/provider.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/provider.test.js index 3b112d0b43ebb..04e0abcb63b50 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/provider.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/provider.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/ui-select.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/ui-select.test.js index 5ffa5792b0882..0f987080f093c 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/ui-select.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/ui-select.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/actions.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/actions.test.js index 318e09453dc5a..999d1f4a037d7 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/actions.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/actions.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -83,4 +83,4 @@ define([ expect(model.isActionVisible(action)).toBeTruthy(); }); }); -}); \ No newline at end of file +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/column.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/column.test.js index ccfccdd195f02..fa0148096add0 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/column.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/column.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*eslint max-nested-callbacks: 0*/ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/date.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/date.test.js index bee9a76a8ed39..7e82592d36de9 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/date.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/date.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*eslint max-nested-callbacks: 0*/ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js index 194c9f4919c0c..2f522dce21f16 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/multiselect.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -142,4 +142,4 @@ define([ expect(multiSelect.selected()).toEqual([5, 6]); }); }); -}); \ No newline at end of file +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/select.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/select.test.js index 3179490ab1ed6..ea134c86f5121 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/select.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/select.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /*eslint max-nested-callbacks: 0*/ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/controls/bookmarks/storage.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/controls/bookmarks/storage.test.js index 42eee106807b5..f9273089ce298 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/controls/bookmarks/storage.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/controls/bookmarks/storage.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/controls/columns.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/controls/columns.test.js index 85bb3ae2bb5ba..8d88b0f2802d6 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/controls/columns.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/controls/columns.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/editing/bulk.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/editing/bulk.test.js index bdbffbff347fe..f6809d9c22c23 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/editing/bulk.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/editing/bulk.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/filters/filters.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/filters/filters.test.js index 05a65b038f3e3..712506b4b7b47 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/filters/filters.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/filters/filters.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/filters/range.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/filters/range.test.js index c2f798927fa8e..78c66acbb08b8 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/filters/range.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/filters/range.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/paging/paging.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/paging/paging.test.js index d6480261c3fe1..2f9c747d181f0 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/paging/paging.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/paging/paging.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/resize.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/resize.test.js index 4cbb9e73d5ae7..07a38e4ad5d13 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/resize.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/resize.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/search/search.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/search/search.test.js index e10061263d13a..8977d804c7c24 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/search/search.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/search/search.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/sticky/sticky.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/sticky/sticky.test.js index 426b453ab4285..8fce94fb61efe 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/sticky/sticky.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/sticky/sticky.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -161,4 +161,4 @@ define([ }); }); }) -}); \ No newline at end of file +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/tree-massactions.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/tree-massactions.test.js index 299fdc1b22d6a..f00524355f86a 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/tree-massactions.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/tree-massactions.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/component/links.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/component/links.test.js index ff17bd826b5c2..0459456ec5455 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/component/links.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/component/links.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/events.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/events.test.js index a2a98975a1243..c9011e374ed43 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/events.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/events.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js index e5f90863ec630..203925165b204 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -56,4 +56,4 @@ define([ expect(todayDate).toEqual(result); }); }); -}); \ No newline at end of file +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/i18n.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/i18n.test.js index 8f7485a2f0bed..572b08e3a2b42 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/i18n.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/i18n.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/registry/registry.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/registry/registry.test.js index a45deb1df23af..249aad292cdd9 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/registry/registry.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/registry/registry.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/alert.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/alert.test.js index 8dd704917fc4d..415b50865ed61 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/alert.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/alert.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/confirm.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/confirm.test.js index 24d953205927f..32c5f97c75bbd 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/confirm.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/confirm.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/modal.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/modal.test.js index 68e8ae79d43e6..412a3676c2e14 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/modal.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/modal.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/prompt.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/prompt.test.js index 7de07fde4712c..138e20bf9efc5 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/prompt.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/modal/prompt.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/lib/mage/apply.test.js b/dev/tests/js/jasmine/tests/lib/mage/apply.test.js index d460acba690ce..2742b7218bfd7 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/apply.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/apply.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/lib/mage/misc.test.js b/dev/tests/js/jasmine/tests/lib/mage/misc.test.js index 62950372d3a73..02e94524aae41 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/misc.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/misc.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/lib/mage/requirejs/static-jsbuild.test.js b/dev/tests/js/jasmine/tests/lib/mage/requirejs/static-jsbuild.test.js index 9ca9dbf0d440e..844b948eff926 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/requirejs/static-jsbuild.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/requirejs/static-jsbuild.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/lib/mage/requirejs/static-text.test.js b/dev/tests/js/jasmine/tests/lib/mage/requirejs/static-text.test.js index 73044c95c634b..b54ea1f20b906 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/requirejs/static-text.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/requirejs/static-text.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/lib/mage/requirejs/statistician.test.js b/dev/tests/js/jasmine/tests/lib/mage/requirejs/statistician.test.js index 1cbe51f83c995..8b5864e21a8a6 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/requirejs/statistician.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/requirejs/statistician.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/js/jasmine/tests/lib/mage/scripts.test.js b/dev/tests/js/jasmine/tests/lib/mage/scripts.test.js index e82d229fea125..706f3b2e3731b 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/scripts.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/scripts.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/lib/mage/template.test.js b/dev/tests/js/jasmine/tests/lib/mage/template.test.js index ebdf57a0d4a88..1d7680c56c9f0 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/template.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/template.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js index c3a355babced8..6df64eb9a53b2 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js @@ -1,5 +1,5 @@ /** - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ diff --git a/dev/tests/static/framework/Magento/Sniffs/Arrays/ShortArraySyntaxSniff.php b/dev/tests/static/framework/Magento/Sniffs/Arrays/ShortArraySyntaxSniff.php index 09edad817802d..4325c480b6633 100644 --- a/dev/tests/static/framework/Magento/Sniffs/Arrays/ShortArraySyntaxSniff.php +++ b/dev/tests/static/framework/Magento/Sniffs/Arrays/ShortArraySyntaxSniff.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/framework/autoload.php b/dev/tests/static/framework/autoload.php index 479225bef078f..a5750d9303c94 100644 --- a/dev/tests/static/framework/autoload.php +++ b/dev/tests/static/framework/autoload.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php index a64d47054ede9..72dc0ab31cfcb 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Translation/ConstantUsageSniffTest.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/VirtualType/_files/etc/di.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/VirtualType/_files/etc/di.xml index a2eda94d38027..8d8f01b5a9ae8 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/VirtualType/_files/etc/di.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/VirtualType/_files/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_external_dependency.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_external_dependency.xml index 63493ef8b5d95..11ca402d144b6 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_external_dependency.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_external_dependency.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_in_module_dependency.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_in_module_dependency.xml index c4b0c3cb5b0ea..c18cc3cca959a 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_in_module_dependency.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_in_module_dependency.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_no_dependency.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_no_dependency.xml index 04c02acb98b12..8f85798987b5f 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_no_dependency.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_no_dependency.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_virtual_dependency.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_virtual_dependency.xml index de96c5d13ad66..8e575d628718c 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_virtual_dependency.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/di_virtual_dependency.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle.xml index 8f27101b04f2d..f059e2cbeaa12 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_parent.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_parent.xml index 009a16e8b261f..e08eae0702853 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_parent.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_parent.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_update.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_update.xml index 56ffa1d64e058..ff1212cdce479 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_update.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_update.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_reference.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_reference.xml index 7789b86ee2190..3f7fdb2745f19 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_reference.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_reference.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/JsHint/CommandTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/JsHint/CommandTest.php index 0bafef54a634c..a455c6489c684 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/JsHint/CommandTest.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/JsHint/CommandTest.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/config.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/config.xml index 2f39c3b27ae1e..e5c070ff78cfd 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/config.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/config.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/config_additional.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/config_additional.xml index 39ad0224c49eb..87285efbb057a 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/config_additional.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/config_additional.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/empty_whitelist_path.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/empty_whitelist_path.xml index d1a351a4150f4..a8f779713cb08 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/empty_whitelist_path.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/empty_whitelist_path.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/empty_words_config.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/empty_words_config.xml index d655220de0cd8..7fab5dd61de58 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/empty_words_config.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/empty_words_config.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/words_finder/buffy.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/words_finder/buffy.php index 3370d5772687f..7ef667b2f46f2 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/words_finder/buffy.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/words_finder/buffy.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/words_finder/twilight/eclipse.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/words_finder/twilight/eclipse.php index a9035aafcee7c..fcb3eb247f9b2 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/words_finder/twilight/eclipse.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Inspection/_files/words_finder/twilight/eclipse.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/phpunit.xml.dist b/dev/tests/static/phpunit.xml.dist index 5b226e0d2bb40..c498348343540 100644 --- a/dev/tests/static/phpunit.xml.dist +++ b/dev/tests/static/phpunit.xml.dist @@ -3,7 +3,7 @@ /** * Default test suites declaration: run verification of coding standards and code integrity test suites * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/CircularDependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/CircularDependencyTest.php index bd34804c02637..f49fddddb11d3 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/CircularDependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/CircularDependencyTest.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/_files/known_valid.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/_files/known_valid.xml index 445f91932e2ba..c83e66da61d60 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/_files/known_valid.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/_files/known_valid.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php index 426279746b379..100ef425252ca 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/CircularDependencyTest.php @@ -2,7 +2,7 @@ /** * Scan source code for incorrect or undeclared modules dependencies * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Test\Integrity; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php index 16cf02c62aa48..09a507c09fad5 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php @@ -2,7 +2,7 @@ /** * Scan source code for references to classes and see if they indeed exist * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Test\Integrity; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php index 430d72bf11c6e..52b1f4fa7dce5 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset_file.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset_file.xml index 254b5b617765f..f106f2a105fab 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset_file.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/fieldset_file.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/invalid_fieldset.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/invalid_fieldset.xml index 1bf673812d0aa..97e0e3e09b9ca 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/invalid_fieldset.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/Fieldset/_files/invalid_fieldset.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php index 0519028c9ed78..65b44a047179b 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/invalid_partial.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/invalid_partial.xml index 04ddbe89772cf..462000280c8e8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/invalid_partial.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/invalid_partial.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/valid.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/valid.xml index 555722e21f410..02c57ce5259d9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/valid.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/valid.xml @@ -1,7 +1,7 @@ @@ -98,4 +98,4 @@ 0 10 - \ No newline at end of file + diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/valid_partial.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/valid_partial.xml index b531494906e02..811785310fe7a 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/valid_partial.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/request/valid_partial.xml @@ -1,7 +1,7 @@ @@ -68,4 +68,4 @@ 10 10 - \ No newline at end of file + diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/search_engine/invalid.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/search_engine/invalid.xml index 7bc394909165a..0c3c0fd863fbc 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/search_engine/invalid.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/search_engine/invalid.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/search_engine/valid.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/search_engine/valid.xml index b163f45bea5c7..c6d006b77f0f2 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/search_engine/valid.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/_files/search_engine/valid.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/ConfigTest.php index deefc9aba3a3a..201de5608a791 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/ConfigTest.php @@ -5,7 +5,7 @@ * Find "indexer.xml" files in code tree and validate them. Also verify schema fails on an invalid xml and * passes on a valid xml. * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Test\Integrity\Magento\Indexer; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/invalid.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/invalid.xml index b91ad27413007..6dba8a48050d0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/invalid.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/invalid.xml @@ -3,7 +3,7 @@ /** * This file contains errors that will fail schema validation. * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/valid.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/valid.xml index c5fd73f7b25d5..c8dd8ad01063c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/valid.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/valid.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/valid_partial.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/valid_partial.xml index f5a341b289287..3a20c81dc4bb3 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/valid_partial.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Indexer/_files/valid_partial.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Config/ReferentialTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Config/ReferentialTest.php index 74ee4e5eeb77f..fa4196bf63271 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Config/ReferentialTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Config/ReferentialTest.php @@ -2,7 +2,7 @@ /** * Validates that payment groups referenced from store configuration matches the groups declared in payment.xml * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Test\Integrity\Magento\Payment\Config; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/ConfigTest.php index 7dbee705485e5..c7385c42ed669 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/ConfigTest.php @@ -2,7 +2,7 @@ /** * Find "payment.xml" files and validate them * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Test\Integrity\Magento\Payment\Model; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/invalid_payment.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/invalid_payment.xml index aa707e68bb403..2f7cbd10410bd 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/invalid_payment.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/invalid_payment.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/invalid_payment_partial.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/invalid_payment_partial.xml index b4462b8d8f62b..c1eccbff21f4c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/invalid_payment_partial.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/invalid_payment_partial.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/payment.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/payment.xml index c439e12434a10..969f5ce6abb53 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/payment.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/payment.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/payment_partial.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/payment_partial.xml index 456efdb3ec3ae..b80e698744aaf 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/payment_partial.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Payment/Model/_files/payment_partial.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/ConfigTest.php index 17e3f4e44b135..f5d1de340f966 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/ConfigTest.php @@ -5,7 +5,7 @@ * Find "persistent.xml" files in code tree and validate them. Also verify schema fails on an invalid xml and * passes on a valid xml. * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Test\Integrity\Magento\Persistent; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/_files/invalid_persistent.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/_files/invalid_persistent.xml index e698d6972ebe9..e3555f4391e06 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/_files/invalid_persistent.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/_files/invalid_persistent.xml @@ -5,7 +5,7 @@ * * The welcome and models nodes will be unexpected - this is the old version of persistent.xml. * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/_files/valid_persistent.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/_files/valid_persistent.xml index 9ebe1e8bf6009..23d78fd6a91b9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/_files/valid_persistent.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Persistent/_files/valid_persistent.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Webapi/Model/ConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Webapi/Model/ConfigTest.php index d1d3f3b2f2c0e..fd8401d7189a5 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Webapi/Model/ConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Webapi/Model/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Webapi/Model/_files/webapi.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Webapi/Model/_files/webapi.xml index 9605858f32936..141bef254453c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Webapi/Model/_files/webapi.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Webapi/Model/_files/webapi.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php index 30321c6e695e3..02cc7e43e8fd9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/WidgetConfigTest.php @@ -2,7 +2,7 @@ /** * Find "widget.xml" files and validate them * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Test\Integrity\Magento\Widget; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/invalid_widget.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/invalid_widget.xml index c9eec21bc16ca..20f90ac424936 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/invalid_widget.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/invalid_widget.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget.xml index a6d85da8e13b7..176b25649a7b1 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget_file.xml b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget_file.xml index c809ee6346912..a7b0bf27b50cd 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget_file.xml +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Widget/_files/widget_file.xml @@ -1,7 +1,7 @@ @@ -18,4 +18,4 @@ - \ No newline at end of file + diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php index 6c4bc5f52c0c0..61a2338c9672b 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php @@ -1,6 +1,6 @@ [, ]) * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ return [ diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php index e064965473ce5..65a631ba5c60f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php @@ -4,7 +4,7 @@ * * Format: => * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php index 491f02c8e0752..552bec8e87e73 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php @@ -4,7 +4,7 @@ * * Format: array([, = ''[, ]]) * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ 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 2ce1bf02bf389..20cf93e55b8c6 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 @@ -2,7 +2,7 @@ /** * Obsolete methods * Format: array([, = ''[, [, ]]]) - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php index 9dd8ad6c6d5dd..e6901cc6a27ef 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php @@ -4,7 +4,7 @@ * * Format: array([, ]) * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ return [ diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_paths.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_paths.php index 0eaf08b63298e..9621625f75f74 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_paths.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_paths.php @@ -4,7 +4,7 @@ * * Format: array([, ]) * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ return [ diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index 421ba4f1498b2..640a02955d3d4 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -4,7 +4,7 @@ * * Format: array([, = ''[, ]]) * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/response/blacklist/files_list.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/response/blacklist/files_list.php index c93b7f009285c..33611a02b3341 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/response/blacklist/files_list.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/response/blacklist/files_list.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php index a31bc279fc92f..e58226347deac 100644 --- a/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php @@ -1,6 +1,6 @@ @@ -12,4 +12,4 @@ - \ No newline at end of file + diff --git a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php index 68fac7bf5f372..2d968602b6fa8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php @@ -1,6 +1,6 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml index 4b592d8646a8d..bb17510603d16 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml @@ -1,7 +1,7 @@ diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php index 8075f9bddc318..5ef7a8a1fb3e5 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/exempt_modules/ce.php @@ -1,6 +1,6 @@ @@ -52,4 +52,4 @@ coverage_crap4j_placeholder--> - \ No newline at end of file + diff --git a/dev/tools/Magento/Tools/Layout/processors/addItemRenderer.xsl b/dev/tools/Magento/Tools/Layout/processors/addItemRenderer.xsl index 14852ef4025cd..5787399fe3565 100644 --- a/dev/tools/Magento/Tools/Layout/processors/addItemRenderer.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/addItemRenderer.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/Magento/Tools/Layout/processors/addToParentGroup.xsl b/dev/tools/Magento/Tools/Layout/processors/addToParentGroup.xsl index 7c0b64e849a6d..413bda2432ddb 100644 --- a/dev/tools/Magento/Tools/Layout/processors/addToParentGroup.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/addToParentGroup.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/Magento/Tools/Layout/processors/headBlocks.xsl b/dev/tools/Magento/Tools/Layout/processors/headBlocks.xsl index 8171706704ac6..158706bea326b 100644 --- a/dev/tools/Magento/Tools/Layout/processors/headBlocks.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/headBlocks.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/Magento/Tools/Layout/processors/layoutArguments.xsl b/dev/tools/Magento/Tools/Layout/processors/layoutArguments.xsl index f73e5c3cb48b0..14c2c61c61bd3 100644 --- a/dev/tools/Magento/Tools/Layout/processors/layoutArguments.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/layoutArguments.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/Magento/Tools/Layout/processors/layoutGridContainer.xsl b/dev/tools/Magento/Tools/Layout/processors/layoutGridContainer.xsl index 333f084f38c4b..95985c3aae689 100644 --- a/dev/tools/Magento/Tools/Layout/processors/layoutGridContainer.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/layoutGridContainer.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/Magento/Tools/Layout/processors/layoutHandles.xsl b/dev/tools/Magento/Tools/Layout/processors/layoutHandles.xsl index 9fb9b0bb3c95d..f9002e2ca819c 100644 --- a/dev/tools/Magento/Tools/Layout/processors/layoutHandles.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/layoutHandles.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/Magento/Tools/Layout/processors/layoutLabels.xsl b/dev/tools/Magento/Tools/Layout/processors/layoutLabels.xsl index 1c8d7aa3d0a2d..7c86130406779 100644 --- a/dev/tools/Magento/Tools/Layout/processors/layoutLabels.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/layoutLabels.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/Magento/Tools/Layout/processors/layoutReferences.xsl b/dev/tools/Magento/Tools/Layout/processors/layoutReferences.xsl index 577dbbbafd496..b0d2fc5b06329 100644 --- a/dev/tools/Magento/Tools/Layout/processors/layoutReferences.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/layoutReferences.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/Magento/Tools/Layout/processors/layoutTranslate.xsl b/dev/tools/Magento/Tools/Layout/processors/layoutTranslate.xsl index f793d42ac4245..aff4607b2cb87 100644 --- a/dev/tools/Magento/Tools/Layout/processors/layoutTranslate.xsl +++ b/dev/tools/Magento/Tools/Layout/processors/layoutTranslate.xsl @@ -1,6 +1,6 @@ diff --git a/dev/tools/bootstrap.php b/dev/tools/bootstrap.php index 11941dd7ffee4..3336124de0fd4 100644 --- a/dev/tools/bootstrap.php +++ b/dev/tools/bootstrap.php @@ -1,6 +1,6 @@ run($app); * -------------------------------------------- * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/lib/internal/Magento/Framework/Acl.php b/lib/internal/Magento/Framework/Acl.php index ff4d65936fd0d..e17033c764740 100644 --- a/lib/internal/Magento/Framework/Acl.php +++ b/lib/internal/Magento/Framework/Acl.php @@ -2,7 +2,7 @@ /** * ACL. Can be queried for relations between roles and resources. * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework; diff --git a/lib/internal/Magento/Framework/Acl/AclResource.php b/lib/internal/Magento/Framework/Acl/AclResource.php index 93fb1a6fa18f4..1e5336db9086f 100644 --- a/lib/internal/Magento/Framework/Acl/AclResource.php +++ b/lib/internal/Magento/Framework/Acl/AclResource.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/MergedXsdTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/MergedXsdTest.php index 397f3211777ab..92d55531d1ff5 100644 --- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/MergedXsdTest.php +++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/MergedXsdTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/_files/valid_merged_acl.xml b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/_files/valid_merged_acl.xml index c6139b9845e75..3c423920206a6 100644 --- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/_files/valid_merged_acl.xml +++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/_files/valid_merged_acl.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/ProviderTest.php b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/ProviderTest.php index 1d46d4eac48aa..6f47ce71c9257 100644 --- a/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/ProviderTest.php +++ b/lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/ProviderTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Acl/etc/acl_merged.xsd b/lib/internal/Magento/Framework/Acl/etc/acl_merged.xsd index f49d11b85ca9b..c5cada298aee9 100644 --- a/lib/internal/Magento/Framework/Acl/etc/acl_merged.xsd +++ b/lib/internal/Magento/Framework/Acl/etc/acl_merged.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/AclFactory.php b/lib/internal/Magento/Framework/AclFactory.php index 0e24bb9f997f0..62ac63a516a39 100644 --- a/lib/internal/Magento/Framework/AclFactory.php +++ b/lib/internal/Magento/Framework/AclFactory.php @@ -2,7 +2,7 @@ /** * Acl object factory. * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework; diff --git a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php index 4ef85a3ef5258..b9b6c58e31be3 100644 --- a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php +++ b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/_files/extension_attributes_with_join_directives.xml b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/_files/extension_attributes_with_join_directives.xml index 1b9ebd42dc61a..d766fd42300fe 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/_files/extension_attributes_with_join_directives.xml +++ b/lib/internal/Magento/Framework/Api/Test/Unit/ExtensionAttribute/Config/_files/extension_attributes_with_join_directives.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Search/SearchResultTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Search/SearchResultTest.php index 5d28929199690..5459d00760217 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Search/SearchResultTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Search/SearchResultTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Action/AbstractAction.php b/lib/internal/Magento/Framework/App/Action/AbstractAction.php index dab12da1597a2..e081c29def49e 100644 --- a/lib/internal/Magento/Framework/App/Action/AbstractAction.php +++ b/lib/internal/Magento/Framework/App/Action/AbstractAction.php @@ -2,7 +2,7 @@ /** * Abstract redirect/forward action class * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\App\Action; diff --git a/lib/internal/Magento/Framework/App/Action/Action.php b/lib/internal/Magento/Framework/App/Action/Action.php index 82ecde1d95bf7..5500a4fd7aec2 100644 --- a/lib/internal/Magento/Framework/App/Action/Action.php +++ b/lib/internal/Magento/Framework/App/Action/Action.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/MaintenanceMode.php b/lib/internal/Magento/Framework/App/MaintenanceMode.php index 66ed4538231e9..fd5971779b7e1 100644 --- a/lib/internal/Magento/Framework/App/MaintenanceMode.php +++ b/lib/internal/Magento/Framework/App/MaintenanceMode.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/app/etc/custom/config.xml b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/app/etc/custom/config.xml index 2def17182e59f..622b238d90f33 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/app/etc/custom/config.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/app/etc/custom/config.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/primary/app/etc/di.xml b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/primary/app/etc/di.xml index 2def17182e59f..622b238d90f33 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/primary/app/etc/di.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/primary/app/etc/di.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/primary/app/etc/some_config/di.xml b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/primary/app/etc/some_config/di.xml index 2def17182e59f..622b238d90f33 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/primary/app/etc/some_config/di.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Arguments/FileResolver/_files/primary/app/etc/some_config/di.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php index 66564cc7f2120..a218055d8b32a 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/config.xsd b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/config.xsd index 62a9fdc20aa90..e60063522c757 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/config.xsd +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/config.xsd @@ -1,10 +1,10 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/converted_config.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/converted_config.php index 17f7f9bbbdce0..bcc119b33bdf5 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/converted_config.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/converted_config.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config2.xml b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config2.xml index abaed7a879f2b..0016210cd149d 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config2.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config2.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config_merged.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config_merged.php index f9876e7ba8cae..69b85fedbfc6e 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config_merged.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config_merged.php @@ -1,6 +1,6 @@ [], 'metadata' => []]; diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/invalidConfigXmlArray.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/invalidConfigXmlArray.php index b947757146a13..f4b31f8ee52cc 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/invalidConfigXmlArray.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/invalidConfigXmlArray.php @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/valid_config.xml b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/valid_config.xml index 076ff2f542a1a..a4e7b80295b81 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/valid_config.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/valid_config.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php index e1b8d1e465141..cb92ac4ab405a 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/InitialConfigSourceTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/_files/invalidRoutesXmlArray.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/_files/invalidRoutesXmlArray.php index 5f716001548d4..e73d43d360735 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/_files/invalidRoutesXmlArray.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/_files/invalidRoutesXmlArray.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php index d2474829693e4..b464bf75cac52 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php b/lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php index 3311e4d48e77f..97be7fdd34f9f 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/MaintenanceModeTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/_files/valid_resources.xml b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/_files/valid_resources.xml index a42cfb478da8a..4bb71f77dc4e7 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/_files/valid_resources.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/Config/_files/valid_resources.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php index 4b6944146e5ed..3042904fe22dc 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ResourceConnection/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigInterface/ProxyTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigInterface/ProxyTest.php index 6d65e95d847c1..f022a079e5c45 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigInterface/ProxyTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Route/ConfigInterface/ProxyTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/Test/Unit/_files/config.php b/lib/internal/Magento/Framework/App/Test/Unit/_files/config.php index 9a10809b20f35..69f881a7919b4 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/_files/config.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/_files/config.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/App/etc/routes.xsd b/lib/internal/Magento/Framework/App/etc/routes.xsd index 0edea0731dc44..b4e0063b38b16 100644 --- a/lib/internal/Magento/Framework/App/etc/routes.xsd +++ b/lib/internal/Magento/Framework/App/etc/routes.xsd @@ -3,7 +3,7 @@ /** * This schema should be applied for validation of separate router.xml files * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> diff --git a/lib/internal/Magento/Framework/App/etc/routes_merged.xsd b/lib/internal/Magento/Framework/App/etc/routes_merged.xsd index 972b8fb348922..a5b3efca864a5 100644 --- a/lib/internal/Magento/Framework/App/etc/routes_merged.xsd +++ b/lib/internal/Magento/Framework/App/etc/routes_merged.xsd @@ -3,7 +3,7 @@ /** * This schema should be applied for validation of merged router.xml file * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php index d9a532b540142..31fc7d0fedd82 100644 --- a/lib/internal/Magento/Framework/AppInterface.php +++ b/lib/internal/Magento/Framework/AppInterface.php @@ -2,7 +2,7 @@ /** * Application interface * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework; diff --git a/lib/internal/Magento/Framework/Archive.php b/lib/internal/Magento/Framework/Archive.php index e8c69928aba04..b6f30b5d95af1 100644 --- a/lib/internal/Magento/Framework/Archive.php +++ b/lib/internal/Magento/Framework/Archive.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/ConfigTest.php index a4e1a248a51d9..212c151c25955 100644 --- a/lib/internal/Magento/Framework/Cache/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Cache/Test/Unit/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Code/GeneratedFiles.php b/lib/internal/Magento/Framework/Code/GeneratedFiles.php index f3d3c2bd611d5..e33b311e74c62 100644 --- a/lib/internal/Magento/Framework/Code/GeneratedFiles.php +++ b/lib/internal/Magento/Framework/Code/GeneratedFiles.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Component/ComponentFile.php b/lib/internal/Magento/Framework/Component/ComponentFile.php index f5f325ac5b36a..df80eed3ab15e 100644 --- a/lib/internal/Magento/Framework/Component/ComponentFile.php +++ b/lib/internal/Magento/Framework/Component/ComponentFile.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/default_test/theme.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/default_test/theme.xml index 36a606ac057f9..9173b0981ec2d 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/default_test/theme.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/default_test/theme.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/default_test2/theme.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/default_test2/theme.xml index 34aaacbfd6347..6e6062b45ba1a 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/default_test2/theme.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/default_test2/theme.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/test_default/theme.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/test_default/theme.xml index 937c33ce4662d..24d4d5b46b3d7 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/test_default/theme.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/test_default/theme.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/test_external_package_descendant/theme.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/test_external_package_descendant/theme.xml index 9dbbd03eb6e0d..e0c09036aa113 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/test_external_package_descendant/theme.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/area/test_external_package_descendant/theme.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/attributes.php b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/attributes.php index 979bb9f6d1168..695bb1e66f16c 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/attributes.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/attributes.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/cdata.php b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/cdata.php index 5f018f418b333..73b5e98545794 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/cdata.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/cdata.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php index 1ecf62df9813a..01701bc0ccbe4 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source_notuniq.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source_notuniq.xml index 2fd96b65ed32b..a8e8ef10e9a1f 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source_notuniq.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source_notuniq.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source_wrongarray.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source_wrongarray.xml index 433e6ab9040f3..a0844e6309d0c 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source_wrongarray.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source_wrongarray.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_merged.xml index 77a770181154a..808949ac34e40 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_merged.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_new_one.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_new_one.xml index 77a770181154a..808949ac34e40 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_new_one.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_new_one.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_new_two.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_new_two.xml index 11e0e9ad346e8..04d7ce5767db5 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_new_two.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_new_two.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_one.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_one.xml index 22e79d8a382ba..634ff9a44588f 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_one.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_one.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_two.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_two.xml index 8f76f92eb4641..fd1f5fc61d545 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_two.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ambiguous_two.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes.xml index 8d2b1136b4e28..e7328d629c321 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes_merged.xml index 2ee72eb3c497d..9c9962da64665 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes_merged.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes_new.xml index 89ff68df93817..298ee2ba22f15 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/attributes_new.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/cdata.php b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/cdata.php index c691465160c07..5a8f0198dbcb0 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/cdata.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/cdata.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/no_attributes.php b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/no_attributes.php index e71787e7ecdd8..9b50697651e7b 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/no_attributes.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/no_attributes.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/with_attributes.php b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/with_attributes.php index 67e1d32fddc82..54aa19ca64425 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/with_attributes.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/converter/with_attributes.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids.xml index 1b122d7e4d945..3cd91e441d850 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids_merged.xml index 3eb3d825193f3..ea045ed4c4c6a 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids_merged.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids_new.xml index a56666c7a9201..30dcd761a8423 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/ids_new.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced.xml index d7814a418574f..b996ce6c4717c 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced_merged.xml index bdc62a58f53e3..7badd80b73b6f 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced_merged.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced_new.xml index fa18cb430c243..ddd1f97cdf9b1 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/namespaced_new.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids.xml index 371fed257d238..31604e890a682 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids_merged.xml index 79b8a3c1a066a..b3b3092330c25 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids_merged.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids_new.xml index d0b483435ae76..0747eb5b470fd 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/no_ids_new.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node.xml index 4a8320c0c49f2..e11388f3d5ee0 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node_merged.xml index 4a8320c0c49f2..e11388f3d5ee0 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node_merged.xml @@ -1,7 +1,7 @@ @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node_new.xml index 7c7b9cb155879..b6a04c46ddd46 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/override_node_new.xml @@ -1,7 +1,7 @@ @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive.xml index 976acad4e5680..05fd81f2a9299 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep.xml index 1eafa6a3c71bf..3aa5b7e9e54ab 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep_merged.xml index 941de2ddcd5ef..e326a81f33e29 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep_merged.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep_new.xml index 46c6a895cd15e..1afb4db78167f 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_deep_new.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_merged.xml index 693d7d684fdd6..4dc5163e6461f 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_merged.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_new.xml index a309e7ab14b15..6b7aaa63902a8 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/recursive_new.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node.xml index 6f45ac413b32b..d880659788c1e 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node.xml @@ -1,7 +1,7 @@ @@ -9,4 +9,4 @@ Some Phrase - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node_merged.xml index 9b255a09ecea5..4826bab100f5f 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node_merged.xml @@ -1,7 +1,7 @@ @@ -9,4 +9,4 @@ Some Other Phrase - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node_new.xml index 9b255a09ecea5..4826bab100f5f 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/text_node_new.xml @@ -1,7 +1,7 @@ @@ -9,4 +9,4 @@ Some Other Phrase - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types.xml index ea8833a096472..79b2ed02d3045 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types_merged.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types_merged.xml index 78e8bba8427f2..91bbb1243ae1f 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types_merged.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types_merged.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types_new.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types_new.xml index c79575ea5e641..5a4bb9ecda6b6 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types_new.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/dom/types_new.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/reader/config.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/reader/config.xml index 93ec5f0fcce89..82b6fdbef6432 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/reader/config.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/reader/config.xml @@ -1,7 +1,7 @@ @@ -12,4 +12,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/reader/schema.xsd b/lib/internal/Magento/Framework/Config/Test/Unit/_files/reader/schema.xsd index 62a9fdc20aa90..e60063522c757 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/reader/schema.xsd +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/reader/schema.xsd @@ -1,10 +1,10 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/sample.xsd b/lib/internal/Magento/Framework/Config/Test/Unit/_files/sample.xsd index dd0a6590e883c..21c672f552283 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/sample.xsd +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/sample.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/theme_invalid.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/theme_invalid.xml index 3dd3a0cfd6455..0b2f14bea7d94 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/theme_invalid.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/theme_invalid.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_invalid.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_invalid.xml index 946901dfa646d..4b31a0aee8c22 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_invalid.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_invalid.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_one.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_one.xml index 3291a94d11bb2..dec0e4fda45db 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_one.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_one.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_two.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_two.xml index 8747cb214a4a6..5fff96a18f2c9 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_two.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/view_two.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Config/Theme.php b/lib/internal/Magento/Framework/Config/Theme.php index d06f4f6da7af7..1ab2271735e42 100644 --- a/lib/internal/Magento/Framework/Config/Theme.php +++ b/lib/internal/Magento/Framework/Config/Theme.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Config/etc/view.xsd b/lib/internal/Magento/Framework/Config/etc/view.xsd index 7d826eac5fc0d..72939b3090116 100644 --- a/lib/internal/Magento/Framework/Config/etc/view.xsd +++ b/lib/internal/Magento/Framework/Config/etc/view.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Console/Cli.php b/lib/internal/Magento/Framework/Console/Cli.php index 4da186fcf8864..5a89d0f6b6057 100644 --- a/lib/internal/Magento/Framework/Console/Cli.php +++ b/lib/internal/Magento/Framework/Console/Cli.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Convert/Xml.php b/lib/internal/Magento/Framework/Convert/Xml.php index ce2f203ee14e9..a836206db0882 100644 --- a/lib/internal/Magento/Framework/Convert/Xml.php +++ b/lib/internal/Magento/Framework/Convert/Xml.php @@ -1,6 +1,6 @@ * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Data\Helper; diff --git a/lib/internal/Magento/Framework/Data/ObjectFactory.php b/lib/internal/Magento/Framework/Data/ObjectFactory.php index 16ded50588e90..cf2ad968ee15c 100644 --- a/lib/internal/Magento/Framework/Data/ObjectFactory.php +++ b/lib/internal/Magento/Framework/Data/ObjectFactory.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Argument/_files/types_valid.xml b/lib/internal/Magento/Framework/Data/Test/Unit/Argument/_files/types_valid.xml index 14666e87393cf..654e11e81b4e4 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Argument/_files/types_valid.xml +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Argument/_files/types_valid.xml @@ -3,7 +3,7 @@ /** * Valid argument types declaration * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Collection/Db/FetchStrategy/CacheTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Collection/Db/FetchStrategy/CacheTest.php index 15485720df3d9..dc99750757c6b 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Collection/Db/FetchStrategy/CacheTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Collection/Db/FetchStrategy/CacheTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/DataObject.php b/lib/internal/Magento/Framework/DataObject.php index 6a4da11d07417..3c5209c579467 100644 --- a/lib/internal/Magento/Framework/DataObject.php +++ b/lib/internal/Magento/Framework/DataObject.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/DataObject/Test/Unit/Copy/Config/_files/fieldset_config.php b/lib/internal/Magento/Framework/DataObject/Test/Unit/Copy/Config/_files/fieldset_config.php index 6ad60fb743c89..e127004ba321b 100644 --- a/lib/internal/Magento/Framework/DataObject/Test/Unit/Copy/Config/_files/fieldset_config.php +++ b/lib/internal/Magento/Framework/DataObject/Test/Unit/Copy/Config/_files/fieldset_config.php @@ -1,6 +1,6 @@ @@ -66,4 +66,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd b/lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd index a4dab210ebcb8..a1b04bfca0fb3 100644 --- a/lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd +++ b/lib/internal/Magento/Framework/DataObject/etc/fieldset_file.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Debug.php b/lib/internal/Magento/Framework/Debug.php index 09bb44e1af37a..45cc8fe4186c4 100644 --- a/lib/internal/Magento/Framework/Debug.php +++ b/lib/internal/Magento/Framework/Debug.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Encryption/Test/Unit/Crypt/_files/_crypt_fixtures.php b/lib/internal/Magento/Framework/Encryption/Test/Unit/Crypt/_files/_crypt_fixtures.php index 385a6223f08e1..3bc5ff71fc8bd 100644 --- a/lib/internal/Magento/Framework/Encryption/Test/Unit/Crypt/_files/_crypt_fixtures.php +++ b/lib/internal/Magento/Framework/Encryption/Test/Unit/Crypt/_files/_crypt_fixtures.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Encryption/Test/Unit/CryptTest.php b/lib/internal/Magento/Framework/Encryption/Test/Unit/CryptTest.php index 7abc67337ac66..c95ab13ba6496 100644 --- a/lib/internal/Magento/Framework/Encryption/Test/Unit/CryptTest.php +++ b/lib/internal/Magento/Framework/Encryption/Test/Unit/CryptTest.php @@ -1,6 +1,6 @@ @@ -16,4 +16,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_invalid_config.xml b/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_invalid_config.xml index d1e308cada5e3..fafe76ea5a9b2 100644 --- a/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_invalid_config.xml +++ b/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/event_invalid_config.xml @@ -1,7 +1,7 @@ @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/invalidEventsXmlArray.php b/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/invalidEventsXmlArray.php index cabe1e141ddb8..fd950552d7fa9 100644 --- a/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/invalidEventsXmlArray.php +++ b/lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/invalidEventsXmlArray.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Event/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Event/Test/Unit/ConfigTest.php index 5a7fc373bab10..7906587c1bd86 100644 --- a/lib/internal/Magento/Framework/Event/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Event/Test/Unit/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/EventFactory.php b/lib/internal/Magento/Framework/EventFactory.php index 7bc756b425cf6..452b8dbde546d 100644 --- a/lib/internal/Magento/Framework/EventFactory.php +++ b/lib/internal/Magento/Framework/EventFactory.php @@ -1,6 +1,6 @@ * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Filter; diff --git a/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php b/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php index ad4746a36513c..6639e754de21d 100644 --- a/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php +++ b/lib/internal/Magento/Framework/Filter/Input/MaliciousCode.php @@ -2,7 +2,7 @@ /** * Filter for removing malicious code from HTML * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/lib/internal/Magento/Framework/Filter/LocalizedToNormalized.php b/lib/internal/Magento/Framework/Filter/LocalizedToNormalized.php index 82685e3b332b8..cbe9e460a720f 100644 --- a/lib/internal/Magento/Framework/Filter/LocalizedToNormalized.php +++ b/lib/internal/Magento/Framework/Filter/LocalizedToNormalized.php @@ -1,6 +1,6 @@ @@ -18,4 +18,4 @@ Indexer public name three Indexer public description three - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_merged_two.xml b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_merged_two.xml index fc3b526f5f6a2..4e6cccae3fe2b 100644 --- a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_merged_two.xml +++ b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_merged_two.xml @@ -1,7 +1,7 @@ @@ -14,4 +14,4 @@ Indexer public name three Indexer public description three - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_one.xml b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_one.xml index 68b7f9a6ad3f8..7c48afc403d54 100644 --- a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_one.xml +++ b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_one.xml @@ -1,7 +1,7 @@ @@ -10,4 +10,4 @@ Indexer public name one Indexer public description one - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_three.xml b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_three.xml index fc3b526f5f6a2..4e6cccae3fe2b 100644 --- a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_three.xml +++ b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_three.xml @@ -1,7 +1,7 @@ @@ -14,4 +14,4 @@ Indexer public name three Indexer public description three - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_two.xml b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_two.xml index f1c73990be463..e92913cd191fc 100644 --- a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_two.xml +++ b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/indexer_two.xml @@ -1,7 +1,7 @@ @@ -14,4 +14,4 @@ Indexer public name three Indexer public description three - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/invalidIndexerXmlArray.php b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/invalidIndexerXmlArray.php index c7352fdf98455..eb98346f3e88f 100644 --- a/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/invalidIndexerXmlArray.php +++ b/lib/internal/Magento/Framework/Indexer/Test/Unit/_files/invalidIndexerXmlArray.php @@ -1,6 +1,6 @@ @@ -14,4 +14,4 @@ Indexer public name Indexer public description - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Indexer/etc/indexer.xsd b/lib/internal/Magento/Framework/Indexer/etc/indexer.xsd index e4a33c72fe883..f196cc1f32a2d 100644 --- a/lib/internal/Magento/Framework/Indexer/etc/indexer.xsd +++ b/lib/internal/Magento/Framework/Indexer/etc/indexer.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Indexer/etc/indexer_merged.xsd b/lib/internal/Magento/Framework/Indexer/etc/indexer_merged.xsd index 91887a4e4ddcb..054cbaf141b0c 100644 --- a/lib/internal/Magento/Framework/Indexer/etc/indexer_merged.xsd +++ b/lib/internal/Magento/Framework/Indexer/etc/indexer_merged.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php b/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php index 0c920717bdf38..701532fdd04ad 100644 --- a/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php +++ b/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/DependencyCheckerTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/DependencyCheckerTest.php index 2c199d5bcf797..301541f4d0f0b 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/DependencyCheckerTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/DependencyCheckerTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Mview/ActionFactory.php b/lib/internal/Magento/Framework/Mview/ActionFactory.php index 77b0c89c8cc39..af65ca15cb424 100644 --- a/lib/internal/Magento/Framework/Mview/ActionFactory.php +++ b/lib/internal/Magento/Framework/Mview/ActionFactory.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_merged_two.xml b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_merged_two.xml index 32d049f1570cf..030dc1b7c16fc 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_merged_two.xml +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_merged_two.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_one.xml b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_one.xml index 1ec8400e7f303..f6da086def77b 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_one.xml +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_one.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_three.xml b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_three.xml index a0ee312109cd4..340a12f306d1d 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_three.xml +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_three.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_two.xml b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_two.xml index 7e67bee354883..1553d12eaadb0 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_two.xml +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/mview_two.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/valid_mview.xml b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/valid_mview.xml index d53d88943faf5..c4bba92f9955b 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/_files/valid_mview.xml +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/_files/valid_mview.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Mview/View.php b/lib/internal/Magento/Framework/Mview/View.php index 16d88767e508c..80b743b3f87fa 100644 --- a/lib/internal/Magento/Framework/Mview/View.php +++ b/lib/internal/Magento/Framework/Mview/View.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Notification/MessageInterface.php b/lib/internal/Magento/Framework/Notification/MessageInterface.php index cb5392b1114fe..70cf1637e412c 100644 --- a/lib/internal/Magento/Framework/Notification/MessageInterface.php +++ b/lib/internal/Magento/Framework/Notification/MessageInterface.php @@ -2,7 +2,7 @@ /** * System message * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ diff --git a/lib/internal/Magento/Framework/Notification/MessageList.php b/lib/internal/Magento/Framework/Notification/MessageList.php index 87e0905f89229..dcaa6e04618b8 100644 --- a/lib/internal/Magento/Framework/Notification/MessageList.php +++ b/lib/internal/Magento/Framework/Notification/MessageList.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/mapped_simple_di_config.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/mapped_simple_di_config.php index dd94048d59d84..eb20fa307f718 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/mapped_simple_di_config.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/mapped_simple_di_config.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/DomFactoryTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/DomFactoryTest.php index 2f5c6027d0f1f..1ec8c28e20390 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/DomFactoryTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Reader/DomFactoryTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php index 8c587cec4351c..9d61b925e2141 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/DefinitionFactoryTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/ObjectManagerInterface.php b/lib/internal/Magento/Framework/ObjectManagerInterface.php index e30b040866b74..6041f63d1e7d4 100644 --- a/lib/internal/Magento/Framework/ObjectManagerInterface.php +++ b/lib/internal/Magento/Framework/ObjectManagerInterface.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Search/etc/requests.xsd b/lib/internal/Magento/Framework/Search/etc/requests.xsd index 294232513b7d2..67ce202c7f951 100644 --- a/lib/internal/Magento/Framework/Search/etc/requests.xsd +++ b/lib/internal/Magento/Framework/Search/etc/requests.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Search/etc/search_engine.xsd b/lib/internal/Magento/Framework/Search/etc/search_engine.xsd index c6dad2d6b3f8c..3ca174a8d49c5 100644 --- a/lib/internal/Magento/Framework/Search/etc/search_engine.xsd +++ b/lib/internal/Magento/Framework/Search/etc/search_engine.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Search/etc/search_request.xsd b/lib/internal/Magento/Framework/Search/etc/search_request.xsd index e4ca02d9f0997..01851b1695d5a 100644 --- a/lib/internal/Magento/Framework/Search/etc/search_request.xsd +++ b/lib/internal/Magento/Framework/Search/etc/search_request.xsd @@ -1,7 +1,7 @@ @@ -25,4 +25,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd b/lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd index dab110ee5333a..b0243ae7e5b4c 100644 --- a/lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd +++ b/lib/internal/Magento/Framework/Search/etc/search_request_merged.xsd @@ -1,7 +1,7 @@ @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Serialize/Serializer/Json.php b/lib/internal/Magento/Framework/Serialize/Serializer/Json.php index 9c5e55b194165..24fadfcb0deee 100644 --- a/lib/internal/Magento/Framework/Serialize/Serializer/Json.php +++ b/lib/internal/Magento/Framework/Serialize/Serializer/Json.php @@ -1,6 +1,6 @@ @@ -12,4 +12,4 @@ - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/Simplexml/Test/Unit/_files/extend_data.xml b/lib/internal/Magento/Framework/Simplexml/Test/Unit/_files/extend_data.xml index c070901c5d978..fc75234d3b471 100644 --- a/lib/internal/Magento/Framework/Simplexml/Test/Unit/_files/extend_data.xml +++ b/lib/internal/Magento/Framework/Simplexml/Test/Unit/_files/extend_data.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Simplexml/Test/Unit/_files/mixed_data.xml b/lib/internal/Magento/Framework/Simplexml/Test/Unit/_files/mixed_data.xml index 193d0c752369e..34356fdd6dbac 100644 --- a/lib/internal/Magento/Framework/Simplexml/Test/Unit/_files/mixed_data.xml +++ b/lib/internal/Magento/Framework/Simplexml/Test/Unit/_files/mixed_data.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Stdlib/ArrayManager.php b/lib/internal/Magento/Framework/Stdlib/ArrayManager.php index edce214cc3091..2ee1a23ce8380 100644 --- a/lib/internal/Magento/Framework/Stdlib/ArrayManager.php +++ b/lib/internal/Magento/Framework/Stdlib/ArrayManager.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Utility/_files/valid.xml b/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Utility/_files/valid.xml index 8eee79f23b73e..2afb2f8379e9b 100644 --- a/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Utility/_files/valid.xml +++ b/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Utility/_files/valid.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Utility/_files/valid.xsd b/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Utility/_files/valid.xsd index aec264cdb4173..4640abfcf07e8 100644 --- a/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Utility/_files/valid.xsd +++ b/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Utility/_files/valid.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/TestFramework/Unit/AbstractFactoryTestCase.php b/lib/internal/Magento/Framework/TestFramework/Unit/AbstractFactoryTestCase.php index 1efff6d6761dd..87c0f48eb7c82 100644 --- a/lib/internal/Magento/Framework/TestFramework/Unit/AbstractFactoryTestCase.php +++ b/lib/internal/Magento/Framework/TestFramework/Unit/AbstractFactoryTestCase.php @@ -2,7 +2,7 @@ /** * Framework for unit tests containing helper methods * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. * * Number of fields is necessary because of the number of fields used by multiple layers diff --git a/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/ExtensionGeneratorAutoloader.php b/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/ExtensionGeneratorAutoloader.php index 4e0fcac1fdff2..9f8cb85b76ecd 100644 --- a/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/ExtensionGeneratorAutoloader.php +++ b/lib/internal/Magento/Framework/TestFramework/Unit/Autoloader/ExtensionGeneratorAutoloader.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_builder_instance.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_builder_instance.xml index 9a2c90714d526..9e4a25549084b 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_builder_instance.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_builder_instance.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_child_for_option.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_child_for_option.xml index 9aea586b4bee7..0cc14bf204049 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_child_for_option.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_child_for_option.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_constraint.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_constraint.xml index 57944f0143b2f..4b7b0a24e6772 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_constraint.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_constraint.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_content_for_callback.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_content_for_callback.xml index 3a61e4575ef85..9a07e7bc1bdf2 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_content_for_callback.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_content_for_callback.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_entity_callback.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_entity_callback.xml index ca4bd7fcd527c..8b3ff7a17ee3e 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_entity_callback.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_entity_callback.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_method.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_method.xml index c8ed7062f0b5a..a13efa48945ca 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_method.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_method.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_method_callback.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_method_callback.xml index 2b7267be73a63..14ef83699b01d 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_method_callback.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/invalid_method_callback.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/multiple_callback_in_argument.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/multiple_callback_in_argument.xml index 7d9e2a81dbd28..422d097360eef 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/multiple_callback_in_argument.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/multiple_callback_in_argument.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_class_for_constraint.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_class_for_constraint.xml index 86280ce54b062..042932dea0f17 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_class_for_constraint.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_class_for_constraint.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_constraint.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_constraint.xml index 61dcec47f583f..63b15da6656c5 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_constraint.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_constraint.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_entity.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_entity.xml index 94ee985d62511..0b848083efefc 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_entity.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_entity.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_group.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_group.xml index 17c388ee915ab..79121eb16ff65 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_group.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_group.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_rule.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_rule.xml index 483da577d5f9f..82bc468323460 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_rule.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_name_for_rule.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_rule_for_reference.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_rule_for_reference.xml index 812d6f862d839..500e52d20ed65 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_rule_for_reference.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/no_rule_for_reference.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/not_unique_use.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/not_unique_use.xml index 97468d6448e3e..07571c6164b84 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/not_unique_use.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/negative/not_unique_use.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/builder/validation.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/builder/validation.xml index fb4693b450797..9ba4ccdeb2eed 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/builder/validation.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/builder/validation.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_a/validation.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_a/validation.xml index 87348b1c340b6..97b0880fd9b8b 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_a/validation.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_a/validation.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_b/validation.xml b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_b/validation.xml index c060e26469cb1..ba3ef4c988137 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_b/validation.xml +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/_files/validation/positive/module_b/validation.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/Validator/Timezone.php b/lib/internal/Magento/Framework/Validator/Timezone.php index ec221fc308705..0e5f87c7724a9 100644 --- a/lib/internal/Magento/Framework/Validator/Timezone.php +++ b/lib/internal/Magento/Framework/Validator/Timezone.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/ValidatorFactory.php b/lib/internal/Magento/Framework/ValidatorFactory.php index 6508be8bf243f..efdaf300e7917 100644 --- a/lib/internal/Magento/Framework/ValidatorFactory.php +++ b/lib/internal/Magento/Framework/ValidatorFactory.php @@ -1,6 +1,6 @@ * - * Copyright © 2016 Magento. All rights reserved. + * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\View\Helper; diff --git a/lib/internal/Magento/Framework/View/Helper/PathPattern.php b/lib/internal/Magento/Framework/View/Helper/PathPattern.php index 7ff51613dbd1a..6d677d77a3200 100644 --- a/lib/internal/Magento/Framework/View/Helper/PathPattern.php +++ b/lib/internal/Magento/Framework/View/Helper/PathPattern.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd index 401bf2e93f366..41c6195a6a8ff 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/elements.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd index 7e26ed41a6941..141e42db113cb 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Layout/etc/html.xsd b/lib/internal/Magento/Framework/View/Layout/etc/html.xsd index 24a04fe922761..ddc12f3c413d0 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/html.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/html.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd b/lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd index 6624495d3a8ff..b174d3008e93b 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/layout_generic.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Layout/etc/layout_merged.xsd b/lib/internal/Magento/Framework/View/Layout/etc/layout_merged.xsd index d6faf66fdc094..665b7504255e0 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/layout_merged.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/layout_merged.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd b/lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd index b77c440ef2e6b..b4b9dcbb43948 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd b/lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd index 7d62f2b903d66..9ea11a18ad23c 100755 --- a/lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd b/lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd index 9cc119a646827..06088726fd598 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/LayoutFactory.php b/lib/internal/Magento/Framework/View/LayoutFactory.php index 2890ec5cb8a15..86ac802f654d2 100644 --- a/lib/internal/Magento/Framework/View/LayoutFactory.php +++ b/lib/internal/Magento/Framework/View/LayoutFactory.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/View/Render/RenderFactory.php b/lib/internal/Magento/Framework/View/Render/RenderFactory.php index 1b96a01e84451..4fc8a7e065e4a 100644 --- a/lib/internal/Magento/Framework/View/Render/RenderFactory.php +++ b/lib/internal/Magento/Framework/View/Render/RenderFactory.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/BuilderFactoryTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/BuilderFactoryTest.php index 6afd0ca712149..bbbc2f252b480 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/BuilderFactoryTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/BuilderFactoryTest.php @@ -1,6 +1,6 @@ test test - \ No newline at end of file + diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/arguments.xml b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/arguments.xml index d92121ddb77be..04b102f7aa0df 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/arguments.xml +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/arguments.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/invalidLayoutArgumentsXmlArray.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/invalidLayoutArgumentsXmlArray.php index c6ec5526e4033..810692b94fa49 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/invalidLayoutArgumentsXmlArray.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/invalidLayoutArgumentsXmlArray.php @@ -1,6 +1,6 @@ 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 9ed7ae97f18e7..27c6a73879a0f 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 @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/_files/template_html.xml b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/_files/template_html.xml index b6e011039ff89..35c4306ee74a5 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/_files/template_html.xml +++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/_files/template_html.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php index 32f319f51c732..9ae9241e739f8 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php @@ -1,6 +1,6 @@ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/PageLayout/_files/layouts_two.xml b/lib/internal/Magento/Framework/View/Test/Unit/PageLayout/_files/layouts_two.xml index 285dd37a4c2b4..6103558052070 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/PageLayout/_files/layouts_two.xml +++ b/lib/internal/Magento/Framework/View/Test/Unit/PageLayout/_files/layouts_two.xml @@ -1,7 +1,7 @@ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Render/RenderFactoryTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Render/RenderFactoryTest.php index 0ae4cf420a4ec..ea88eb9f10889 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Render/RenderFactoryTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Render/RenderFactoryTest.php @@ -1,6 +1,6 @@ @@ -160,7 +160,7 @@ public function testMinify() TEXT; $expectedContent = << Test titleText Link some textsomeMethod(); ?>