Skip to content

Commit 13ec629

Browse files
authored
Merge pull request #984 from magento-engcom/develop-prs
[EngCom] Public Pull Requests
2 parents 99e85cb + 753f25d commit 13ec629

File tree

34 files changed

+169
-60
lines changed

34 files changed

+169
-60
lines changed

.travis.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,31 @@ env:
1515
global:
1616
- COMPOSER_BIN_DIR=~/bin
1717
- INTEGRATION_SETS=3
18+
- NODE_JS_VERSION=6
1819
matrix:
1920
- TEST_SUITE=unit
2021
- TEST_SUITE=integration INTEGRATION_INDEX=1
2122
- TEST_SUITE=integration INTEGRATION_INDEX=2
2223
- TEST_SUITE=integration INTEGRATION_INDEX=3
2324
- TEST_SUITE=static
25+
- TEST_SUITE=js
2426
cache:
2527
apt: true
26-
directories: $HOME/.composer/cache
28+
directories:
29+
- $HOME/.composer/cache
30+
- $HOME/.nvm
31+
- $HOME/node_modules
32+
- $HOME/yarn.lock
2733
matrix:
2834
exclude:
2935
- php: 5.6.29
3036
env: TEST_SUITE=static
37+
- php: 5.6.29
38+
env: TEST_SUITE=js
3139
before_install: ./dev/travis/before_install.sh
3240
install: composer install --no-interaction --prefer-dist
3341
before_script: ./dev/travis/before_script.sh
3442
script:
3543
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
36-
- phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER
44+
- if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
45+
- if [ $TEST_SUITE == "js" ]; then grunt spec; fi

app/code/Magento/Analytics/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"require": {
55
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
66
"magento/module-backend": "100.2.*",
7-
"magento/module-admin-notification": "100.2.*",
87
"magento/module-config": "100.2.*",
98
"magento/module-integration": "100.2.*",
109
"magento/module-store": "100.2.*",

app/code/Magento/Analytics/etc/module.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<module name="Magento_Backend"/>
1313
<module name="Magento_Store"/>
1414
<module name="Magento_Config"/>
15-
<module name="Magento_AdminNotification"/>
1615
</sequence>
1716
</module>
1817
</config>

app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ private function updateQuote(Quote $quote, array $details)
8484

8585
$quote->collectTotals();
8686

87+
/**
88+
* Unset shipping assignment to prevent from saving / applying outdated data
89+
* @see \Magento\Quote\Model\QuoteRepository\SaveHandler::processShippingAssignment
90+
*/
91+
if ($quote->getExtensionAttributes()) {
92+
$quote->getExtensionAttributes()->setShippingAssignments(null);
93+
}
94+
8795
$this->quoteRepository->save($quote);
8896
}
8997

@@ -122,6 +130,11 @@ private function updateShippingAddress(Quote $quote, array $details)
122130
$shippingAddress->setCollectShippingRates(true);
123131

124132
$this->updateAddressData($shippingAddress, $details['shippingAddress']);
133+
134+
// PayPal's address supposes not saving against customer account
135+
$shippingAddress->setSaveInAddressBook(false);
136+
$shippingAddress->setSameAsBilling(false);
137+
$shippingAddress->unsCustomerAddressId();
125138
}
126139

127140
/**
@@ -144,6 +157,11 @@ private function updateBillingAddress(Quote $quote, array $details)
144157
$billingAddress->setFirstname($details['firstName']);
145158
$billingAddress->setLastname($details['lastName']);
146159
$billingAddress->setEmail($details['email']);
160+
161+
// PayPal's address supposes not saving against customer account
162+
$billingAddress->setSaveInAddressBook(false);
163+
$billingAddress->setSameAsBilling(false);
164+
$billingAddress->unsCustomerAddressId();
147165
}
148166

149167
/**

app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function getConfig()
5555
'isAllowShippingAddressOverride' => $this->config->isAllowToEditShippingAddress(),
5656
'merchantName' => $this->config->getMerchantName(),
5757
'locale' => strtolower($this->resolver->getLocale()),
58-
'paymentAcceptanceMarkSrc' => 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png',
58+
'paymentAcceptanceMarkSrc' =>
59+
'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png',
5960
'vaultCode' => self::PAYPAL_VAULT_CODE,
6061
'skipOrderReview' => $this->config->isSkipOrderReview(),
6162
'paymentIcon' => $this->config->getPayPalIcon(),

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,10 @@ public function modifyMeta(array $meta)
134134
'autoRender' => false,
135135
'componentType' => 'insertListing',
136136
'dataScope' => 'bundle_product_listing',
137-
'externalProvider' => 'bundle_product_listing.bundle_product_listing_data_source',
138-
'selectionsProvider' => 'bundle_product_listing.bundle_product_listing.product_columns.ids',
137+
'externalProvider' =>
138+
'bundle_product_listing.bundle_product_listing_data_source',
139+
'selectionsProvider' =>
140+
'bundle_product_listing.bundle_product_listing.product_columns.ids',
139141
'ns' => 'bundle_product_listing',
140142
'render_url' => $this->urlBuilder->getUrl('mui/index/render'),
141143
'realTimeLink' => false,

app/code/Magento/Catalog/etc/acl.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<acl>
1010
<resources>
1111
<resource id="Magento_Backend::admin">
12-
<resource id="Magento_Catalog::catalog" title="Products" translate="title" sortOrder="30">
12+
<resource id="Magento_Catalog::catalog" title="Catalog" translate="title" sortOrder="30">
1313
<resource id="Magento_Catalog::catalog_inventory" title="Inventory" translate="title" sortOrder="10">
14-
<resource id="Magento_Catalog::products" title="Catalog" translate="title" sortOrder="10" />
14+
<resource id="Magento_Catalog::products" title="Products" translate="title" sortOrder="10" />
1515
<resource id="Magento_Catalog::categories" title="Categories" translate="title" sortOrder="20" />
1616
</resource>
1717
</resource>

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,9 @@ protected function _saveProducts()
15291529
$existingImages = $this->getExistingImages($bunch);
15301530

15311531
foreach ($bunch as $rowNum => $rowData) {
1532+
// reset category processor's failed categories array
1533+
$this->categoryProcessor->clearFailedCategories();
1534+
15321535
if (!$this->validateRow($rowData, $rowNum)) {
15331536
continue;
15341537
}

app/code/Magento/CatalogImportExport/Model/Import/Product/CategoryProcessor.php

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ protected function initCategories()
7979
for ($i = 1; $i < $pathSize; $i++) {
8080
$path[] = $collection->getItemById((int)$structure[$i])->getName();
8181
}
82-
$index = implode(self::DELIMITER_CATEGORY, $path);
82+
/** @var string $index */
83+
$index = $this->standardizeString(
84+
implode(self::DELIMITER_CATEGORY, $path)
85+
);
8386
$this->categories[$index] = $category->getId();
8487
}
8588
}
@@ -123,13 +126,16 @@ protected function createCategory($name, $parentId)
123126
*/
124127
protected function upsertCategory($categoryPath)
125128
{
126-
if (!isset($this->categories[$categoryPath])) {
129+
/** @var string $index */
130+
$index = $this->standardizeString($categoryPath);
131+
132+
if (!isset($this->categories[$index])) {
127133
$pathParts = explode(self::DELIMITER_CATEGORY, $categoryPath);
128134
$parentId = \Magento\Catalog\Model\Category::TREE_ROOT_ID;
129135
$path = '';
130136

131137
foreach ($pathParts as $pathPart) {
132-
$path .= $pathPart;
138+
$path .= $this->standardizeString($pathPart);
133139
if (!isset($this->categories[$path])) {
134140
$this->categories[$path] = $this->createCategory($pathPart, $parentId);
135141
}
@@ -138,7 +144,7 @@ protected function upsertCategory($categoryPath)
138144
}
139145
}
140146

141-
return $this->categories[$categoryPath];
147+
return $this->categories[$index];
142148
}
143149

144150
/**
@@ -171,7 +177,7 @@ public function upsertCategories($categoriesString, $categoriesSeparator)
171177
* @param string $category
172178
* @param \Magento\Framework\Exception\AlreadyExistsException $exception
173179
*
174-
* @return array
180+
* @return $this
175181
*/
176182
private function addFailedCategory($category, $exception)
177183
{
@@ -190,7 +196,18 @@ private function addFailedCategory($category, $exception)
190196
*/
191197
public function getFailedCategories()
192198
{
193-
return $this->failedCategories;
199+
return $this->failedCategories;
200+
}
201+
202+
/**
203+
* Resets failed categories' array
204+
*
205+
* @return $this
206+
*/
207+
public function clearFailedCategories()
208+
{
209+
$this->failedCategories = [];
210+
return $this;
194211
}
195212

196213
/**
@@ -204,4 +221,17 @@ public function getCategoryById($categoryId)
204221
{
205222
return isset($this->categoriesCache[$categoryId]) ? $this->categoriesCache[$categoryId] : null;
206223
}
224+
225+
/**
226+
* Standardize a string.
227+
* For now it performs only a lowercase action, this method is here to include more complex checks in the future
228+
* if needed.
229+
*
230+
* @param string $string
231+
* @return string
232+
*/
233+
private function standardizeString($string)
234+
{
235+
return mb_strtolower($string);
236+
}
207237
}

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/CategoryProcessorTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function setUp()
4444
->disableOriginalConstructor()
4545
->getMock();
4646
$childCategory->method('getId')->will($this->returnValue(self::CHILD_CATEGORY_ID));
47-
$childCategory->method('getName')->will($this->returnValue('Child'));
47+
$childCategory->method('getName')->will($this->returnValue(self::CHILD_CATEGORY_NAME));
4848
$childCategory->method('getPath')->will($this->returnValue(
4949
self::PARENT_CATEGORY_ID . CategoryProcessor::DELIMITER_CATEGORY
5050
. self::CHILD_CATEGORY_ID
@@ -115,6 +115,22 @@ public function testUpsertCategories()
115115
$this->assertArrayHasKey(self::CHILD_CATEGORY_ID, array_flip($categoryIds));
116116
}
117117

118+
public function testClearFailedCategories()
119+
{
120+
$dummyFailedCategory = [
121+
[
122+
'category' => 'dummy category',
123+
'exception' => 'dummy exception',
124+
]
125+
];
126+
127+
$this->setPropertyValue($this->categoryProcessor, 'failedCategories', $dummyFailedCategory);
128+
$this->assertCount(count($dummyFailedCategory), $this->categoryProcessor->getFailedCategories());
129+
130+
$this->categoryProcessor->clearFailedCategories();
131+
$this->assertEmpty($this->categoryProcessor->getFailedCategories());
132+
}
133+
118134
/**
119135
* Cover getCategoryById().
120136
*

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,8 @@ public function testValidateRowValidateNewProductTypeGetNewSkuCall()
10711071
'entity_id' => null,
10721072
'type_id' => $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_TYPE],//value
10731073
//attr_set_id_val
1074-
'attr_set_id' => $_attrSetNameToId[$rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET]],
1074+
'attr_set_id' =>
1075+
$_attrSetNameToId[$rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET]],
10751076
'attr_set_code' => $rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET],//value
10761077
'row_id' => null
10771078
];

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,17 @@ public function __construct(
7272
private function addErrorInfoToQuote($result, $quoteItem)
7373
{
7474
$quoteItem->addErrorInfo(
75-
'cataloginventory',
76-
Data::ERROR_QTY,
77-
$result->getMessage()
78-
);
75+
'cataloginventory',
76+
Data::ERROR_QTY,
77+
$result->getMessage()
78+
);
7979

8080
$quoteItem->getQuote()->addErrorInfo(
81-
$result->getQuoteMessageIndex(),
82-
'cataloginventory',
83-
Data::ERROR_QTY,
84-
$result->getQuoteMessage()
85-
);
81+
$result->getQuoteMessageIndex(),
82+
'cataloginventory',
83+
Data::ERROR_QTY,
84+
$result->getQuoteMessage()
85+
);
8686
}
8787

8888
/**

app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ private function prepareMeta()
205205
'scopeLabel' => '[GLOBAL]',
206206
'source' => 'product_details',
207207
'sortOrder' => (int) $this->arrayManager->get(
208-
$this->arrayManager->slicePath($pathField, 0, -2) . '/arguments/data/config/sortOrder',
209-
$this->meta
210-
) - 1,
208+
$this->arrayManager->slicePath($pathField, 0, -2) . '/arguments/data/config/sortOrder',
209+
$this->meta
210+
) - 1,
211211
];
212212
$qty['arguments']['data']['config'] = [
213213
'component' => 'Magento_CatalogInventory/js/components/qty-validator-changer',

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ public function getConfig()
306306
private function isAutocompleteEnabled()
307307
{
308308
return $this->scopeConfig->getValue(
309-
\Magento\Customer\Model\Form::XML_PATH_ENABLE_AUTOCOMPLETE,
310-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
311-
) ? 'on' : 'off';
309+
\Magento\Customer\Model\Form::XML_PATH_ENABLE_AUTOCOMPLETE,
310+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
311+
) ? 'on' : 'off';
312312
}
313313

314314
/**

app/code/Magento/Config/Test/Unit/Model/_files/converted_config.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
'id' => 'field_3_1_1',
7676
'translate' => 'label',
7777
'showInWebsite' => '1',
78-
'backend_model' => \Magento\Config\Model\Config\Backend\Encrypted::class,
78+
'backend_model' =>
79+
\Magento\Config\Model\Config\Backend\Encrypted::class,
7980
'type' => 'text',
8081
'label' => 'Field 3.1.1',
8182
'_elementType' => 'field',

app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class ProcessCronQueueObserver implements ObserverInterface
128128
* @param \Magento\Framework\Process\PhpExecutableFinderFactory $phpExecutableFinderFactory
129129
* @param \Psr\Log\LoggerInterface $logger
130130
* @param \Magento\Framework\App\State $state
131+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
131132
*/
132133
public function __construct(
133134
\Magento\Framework\ObjectManagerInterface $objectManager,
@@ -486,7 +487,6 @@ protected function saveSchedule($jobCode, $cronExpression, $timeInterval, $exist
486487
if ($schedule->trySchedule()) {
487488
// time matches cron expression
488489
$schedule->save();
489-
return;
490490
}
491491
}
492492
}

app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ public function testDispatchGenerate()
660660
$schedule->expects($this->any())->method('unsScheduleId')->willReturnSelf();
661661
$schedule->expects($this->any())->method('trySchedule')->willReturnSelf();
662662
$schedule->expects($this->any())->method('getCollection')->willReturn($this->_collection);
663-
$schedule->expects($this->exactly(1))->method('save')->willReturnSelf();
663+
$schedule->expects($this->atLeastOnce())->method('save')->willReturnSelf();
664664

665665
$this->_collection->addItem(new \Magento\Framework\DataObject());
666666
$this->_collection->addItem($schedule);

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ define([
344344
var sections,
345345
redirects;
346346

347-
if (settings.type.match(/post|put/i)) {
347+
if (settings.type.match(/post|put|delete/i)) {
348348
sections = sectionConfig.getAffectedSections(settings.url);
349349

350350
if (sections) {
@@ -365,7 +365,7 @@ define([
365365
$(document).on('submit', function (event) {
366366
var sections;
367367

368-
if (event.target.method.match(/post|put/i)) {
368+
if (event.target.method.match(/post|put|delete/i)) {
369369
sections = sectionConfig.getAffectedSections(event.target.action);
370370

371371
if (sections) {

app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ protected function _prepareForm()
126126
'class' => $behaviorCode,
127127
'disabled' => true,
128128
'values' => [
129-
ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_STOP_ON_ERROR => 'Stop on Error',
130-
ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS => 'Skip error entries'
129+
ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_STOP_ON_ERROR => __('Stop on Error'),
130+
ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS => __('Skip error entries')
131131
],
132132
'after_element_html' => $this->getDownloadSampleFileHtml(),
133133
]

app/code/Magento/ImportExport/Model/Import/AbstractEntity.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ abstract class AbstractEntity
7171
self::ERROR_CODE_COLUMNS_NUMBER => "Number of columns does not correspond to the number of rows in the header",
7272
self::ERROR_EXCEEDED_MAX_LENGTH => 'Attribute %s exceeded max length',
7373
self::ERROR_INVALID_ATTRIBUTE_TYPE => 'Value for \'%s\' attribute contains incorrect value',
74-
self::ERROR_INVALID_ATTRIBUTE_OPTION => "Value for %s attribute contains incorrect value, see acceptable values on settings specified for Admin",
74+
self::ERROR_INVALID_ATTRIBUTE_OPTION =>
75+
"Value for %s attribute contains incorrect value, see acceptable values on settings specified for Admin",
7576
];
7677

7778
/**#@-*/

0 commit comments

Comments
 (0)