Skip to content

Commit

Permalink
Merge pull request #1354 from magento-folks/2.2-bugs
Browse files Browse the repository at this point in the history
[Folks] Bugs
  • Loading branch information
Oleksii Korshenko authored Jul 21, 2017
2 parents a89d82f + 92e4c62 commit a0428fe
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 49 deletions.
1 change: 1 addition & 0 deletions app/code/Magento/Checkout/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<arguments>
<argument name="clientSideSections" xsi:type="array">
<item name="checkout-data" xsi:type="string">checkout-data</item>
<item name="cart-data" xsi:type="string">cart-data</item>
</argument>
</arguments>
</type>
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Customer/Model/Address/AbstractAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ public function getStreetLine($number)
*/
public function getStreetFull()
{
return $this->getData('street');
$street = $this->getData('street');
return is_array($street) ? implode("\n", $street) : $street;
}

/**
Expand Down
28 changes: 1 addition & 27 deletions app/code/Magento/Customer/Model/EmailNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ class EmailNotification implements EmailNotificationInterface
self::NEW_ACCOUNT_EMAIL_CONFIRMATION => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE,
];

/**
* Map of templates. Use for backward compatibility
*/
const TEMPLATE_MAP = [
self::XML_PATH_FORGOT_EMAIL_TEMPLATE => self::XML_PATH_RESET_PASSWORD_TEMPLATE
];

/**#@-*/

/**
Expand Down Expand Up @@ -248,7 +241,7 @@ private function sendEmailTemplate(
$storeId = null,
$email = null
) {
$templateId = $this->getTemplateId($template, 'store', $storeId);
$templateId = $this->scopeConfig->getValue($template, 'store', $storeId);
if ($email === null) {
$email = $customer->getEmail();
}
Expand Down Expand Up @@ -384,23 +377,4 @@ public function newAccount(
$storeId
);
}

/**
* Get templateId include considering template map
*
* @param string $template
* @param string $scopeType
* @param string $storeId
* @return string
*/
private function getTemplateId($template, $scopeType, $storeId)
{
if (array_key_exists($template, self::TEMPLATE_MAP)) {
$templateId = $this->scopeConfig->getValue(self::TEMPLATE_MAP[$template], $scopeType, $storeId);
if ($templateId) {
return $templateId;
}
}
return $this->scopeConfig->getValue($template, $scopeType, $storeId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -377,4 +377,27 @@ public function validateDataProvider()
'validated' => [array_merge($data, ['country_id' => $countryId++]), true],
];
}

/**
* @dataProvider getStreetFullDataProvider
*/
public function testGetStreetFullAlwaysReturnsString($expectedResult, $street)
{
$this->model->setData('street', $street);
$this->assertEquals($expectedResult, $this->model->getStreetFull());
}

/**
* @return array
*/
public function getStreetFullDataProvider()
{
return [
[null, null],
['', []],
["first line\nsecond line", ['first line', 'second line']],
['single line', ['single line']],
['single line', 'single line'],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public function testPasswordResetConfirmation()

$this->scopeConfigMock->expects($this->at(0))
->method('getValue')
->with(EmailNotification::XML_PATH_RESET_PASSWORD_TEMPLATE, ScopeInterface::SCOPE_STORE, $customerStoreId)
->with(EmailNotification::XML_PATH_FORGOT_EMAIL_TEMPLATE, ScopeInterface::SCOPE_STORE, $customerStoreId)
->willReturn($templateIdentifier);
$this->scopeConfigMock->expects($this->at(1))
->method('getValue')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $girthEnabled = $block->isDisplayGirthValue() && $block->isGirthAllowed() ? 1 :
"Magento_Ui/js/modal/modal"
], function(jQuery){

packaging = new Packaging(<?= /* @escapeNotVerified */ $block->getConfigDataJson() ?>);
window.packaging = new Packaging(<?= /* @escapeNotVerified */ $block->getConfigDataJson() ?>);
packaging.changeContainerType($$('select[name=package_container]')[0]);
packaging.checkSizeAndGirthParameter(
$$('select[name=package_container]')[0],
Expand Down Expand Up @@ -76,6 +76,8 @@ $girthEnabled = $block->isDisplayGirthValue() && $block->isGirthAllowed() ? 1 :
}
}]
});
jQuery(document).trigger('packaging:inited');
jQuery(document).data('packagingInited', true);
});
</script>
<?php include ($block->getTemplateFile('Magento_Shipping::order/packaging/popup_content.phtml')) ?>
41 changes: 23 additions & 18 deletions app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,30 @@
<?= $block->getChildHtml('shipment_tracking') ?>

<?= $block->getChildHtml('shipment_packaging') ?>
<script>
require([
'prototype'
], function () {
<script>
require([
'jquery',
'prototype'
], function (jQuery) {
var setCallbacks = function () {
window.packaging.setConfirmPackagingCallback(function () {
window.packaging.sendCreateLabelRequest();
});
window.packaging.setLabelCreatedCallback(function () {
setLocation("<?php /* @escapeNotVerified */ echo $block->getUrl(
'adminhtml/order_shipment/view',
['shipment_id' => $block->getShipment()->getId()]
); ?>");
});
};

setTimeout(function () {
packaging.setConfirmPackagingCallback(function () {
packaging.sendCreateLabelRequest();
});
packaging.setLabelCreatedCallback(function (response) {
setLocation("<?php /* @escapeNotVerified */ echo $block->getUrl(
'adminhtml/order_shipment/view',
['shipment_id' => $block->getShipment()->getId()]
); ?>");
});
}, 500);

});
</script>
if (jQuery(document).data('packagingInited')) {
setCallbacks();
} else {
jQuery(document).on('packaging:inited', setCallbacks);
}
});
</script>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion dev/travis/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ case $TEST_SUITE in
--output-file="$changed_files_ce" \
--base-path="$TRAVIS_BUILD_DIR" \
--repo='https://github.com/magento/magento2.git' \
--branch='develop'
--branch='$TRAVIS_BRANCH'
cat "$changed_files_ce" | sed 's/^/ + including /'

cd ../../..
Expand Down

0 comments on commit a0428fe

Please sign in to comment.