Skip to content

Commit

Permalink
MAGETWO-69373: Merge branch 'develop' of github.com:magento/magento2c…
Browse files Browse the repository at this point in the history
…e into MAGETWO-69373-PR-9712
  • Loading branch information
ishakhsuvarov committed May 29, 2017
2 parents 296b43b + 83e7b3b commit bc664fa
Show file tree
Hide file tree
Showing 213 changed files with 6,101 additions and 1,098 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ addons:
- mysql-client-core-5.6
- mysql-client-5.6
- postfix
firefox: "46.0"
hosts:
- magento2.travis
language: php
php:
- 7.0
Expand All @@ -16,19 +19,26 @@ env:
- COMPOSER_BIN_DIR=~/bin
- INTEGRATION_SETS=3
- NODE_JS_VERSION=6
- MAGENTO_HOST_NAME="magento2.travis"
matrix:
- TEST_SUITE=unit
- TEST_SUITE=integration INTEGRATION_INDEX=1
- TEST_SUITE=integration INTEGRATION_INDEX=2
- TEST_SUITE=integration INTEGRATION_INDEX=3
- TEST_SUITE=static
- TEST_SUITE=js
- TEST_SUITE=functional ACCEPTANCE_INDEX=1
- TEST_SUITE=functional ACCEPTANCE_INDEX=2
matrix:
exclude:
- php: 7.0
env: TEST_SUITE=static
- php: 7.0
env: TEST_SUITE=js
- php: 7.0
env: TEST_SUITE=functional ACCEPTANCE_INDEX=1
- php: 7.0
env: TEST_SUITE=functional ACCEPTANCE_INDEX=2
cache:
apt: true
directories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

namespace Magento\AdminNotification\Block\Grid\Renderer;

class Actions extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
Expand Down Expand Up @@ -39,9 +37,8 @@ public function __construct(
*/
public function render(\Magento\Framework\DataObject $row)
{
$readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' . __(
'Read Details'
) . '</a>' : '';
$readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' .
__('Read Details') . '</a>' : '';

$markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl(
'*/*/markAsRead/',
Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/AdminNotification/Block/ToolbarEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

namespace Magento\AdminNotification\Block;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* AdminNotification Inbox model
*
Expand All @@ -18,7 +16,7 @@ class Collection extends \Magento\AdminNotification\Model\ResourceModel\Inbox\Co
/**
* Add remove filter
*
* @return \Magento\AdminNotification\Model\ResourceModel\Grid\Collection|\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
* @return Collection|\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
*/
protected function _initSelect()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* Test class for \Magento\AdminNotification\Block\ToolbarEntry
*/
Expand Down Expand Up @@ -53,7 +51,8 @@ public function testGetLatestUnreadNotifications()

// 1. Create mocks
$notificationList = $this->getMockBuilder(
\Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread::class)
\Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread::class
)
->disableOriginalConstructor()
->getMock();

Expand Down
9 changes: 6 additions & 3 deletions app/code/Magento/Braintree/Gateway/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ public function __construct(
*/
public function getCountrySpecificCardTypeConfig()
{
$countriesCardTypes = $this->serializer->unserialize($this->getValue(self::KEY_COUNTRY_CREDIT_CARD));

return is_array($countriesCardTypes) ? $countriesCardTypes : [];
$countryCardTypes = $this->getValue(self::KEY_COUNTRY_CREDIT_CARD);
if (!$countryCardTypes) {
return [];
}
$countryCardTypes = $this->serializer->unserialize($countryCardTypes);
return is_array($countryCardTypes) ? $countryCardTypes : [];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ public function beforeSave()
*/
public function afterLoad()
{
$value = $this->serializer->unserialize($this->getValue());
if (is_array($value)) {
$value = $this->encodeArrayFieldValue($value);
$this->setValue($value);
if ($this->getValue()) {
$value = $this->serializer->unserialize($this->getValue());
if (is_array($value)) {
$this->setValue($this->encodeArrayFieldValue($value));
}
}
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,30 @@ public function beforeSaveDataProvider()
}

/**
* @dataProvider afterLoadDataProvider
* @param string $encodedValue
* @param array|null $value
* @param array $hashData
* @param array|null $expected
* @param int $unserializeCalledNum
* @dataProvider afterLoadDataProvider
*/
public function testAfterLoad($encodedValue, $value, array $hashData, $expected)
{
public function testAfterLoad(
$encodedValue,
$value,
array $hashData,
$expected,
$unserializeCalledNum = 1
) {
$this->model->setValue($encodedValue);
$index = 0;
foreach ($hashData as $hash) {
$this->mathRandomMock->expects(static::at($index))
$this->mathRandomMock->expects($this->at($index))
->method('getUniqueHash')
->willReturn($hash);
$index++;
}

$this->serializerMock->expects($this->once())
$this->serializerMock->expects($this->exactly($unserializeCalledNum))
->method('unserialize')
->with($encodedValue)
->willReturn($value);
Expand All @@ -178,6 +184,7 @@ public function testAfterLoad($encodedValue, $value, array $hashData, $expected)

/**
* Get data to test saved credit cards types
*
* @return array
*/
public function afterLoadDataProvider()
Expand All @@ -193,7 +200,8 @@ public function afterLoadDataProvider()
'encoded' => '',
'value' => null,
'randomHash' => [],
'expected' => null
'expected' => null,
0
],
'valid data' => [
'encoded' => '{"US":["AE","VI","MA"],"AF":["AE","MA"]}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ define(
braintreeDeviceData: null,
paymentMethodNonce: null,
lastBillingAddress: null,
ccCode: null,
ccMessageContainer: null,
validatorManager: validatorManager,
code: 'braintree',

Expand Down Expand Up @@ -138,9 +140,39 @@ define(
return;
}

this.restoreMessageContainer();
this.restoreCode();

/**
* Define onReady callback
*/
braintree.onReady = function () {};
this.initBraintree();
},

/**
* Restore original message container for cc-form component
*/
restoreMessageContainer: function () {
this.messageContainer = this.ccMessageContainer;
},

/**
* Restore original code for cc-form component
*/
restoreCode: function () {
this.code = this.ccCode;
},

/** @inheritdoc */
initChildren: function () {
this._super();
this.ccMessageContainer = this.messageContainer;
this.ccCode = this.code;

return this;
},

/**
* Init config
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ define([
var self = this;

/**
* Define already callback
* Define onReady callback
*/
Braintree.onReady = function () {
self.getPaymentMethodNonce();
Expand All @@ -78,6 +78,7 @@ define([
formComponent.setPaymentMethodNonce(response.paymentMethodNonce);
formComponent.additionalData['public_hash'] = self.publicHash;
formComponent.code = self.code;
formComponent.messageContainer = self.messageContainer;
formComponent.placeOrder();
});
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,12 @@
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrderClick,
attr: {title: $t('Place Order')}
">
click: placeOrderClick,
attr: {title: $t('Place Order')},
css: {disabled: !isPlaceOrderActionAllowed()},
enable: isActive()
"
disabled>
<span data-bind="i18n: 'Place Order'"></span>
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Bundle/Model/Product/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected function getBundleSelectionIds(\Magento\Catalog\Model\Product $product
$customOption = $product->getCustomOption('bundle_selection_ids');
if ($customOption) {
$selectionIds = $this->serializer->unserialize($customOption->getValue());
if (!empty($selectionIds) && is_array($selectionIds)) {
if (is_array($selectionIds) && !empty($selectionIds)) {
return $selectionIds;
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Bundle/Model/Product/SaveHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public function execute($entity, $arguments = [])
$options = $bundleProductOptions ?: [];
foreach ($options as $option) {
$this->optionRepository->save($entity, $option);
$entity->setCopyFromView(false);
}
$entity->setCopyFromView(false);
}
return $entity;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Bundle/Model/ResourceModel/Selection.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function getParentIdsByChild($childId)
'e.' . $metadata->getLinkField() . ' = ' . $this->getMainTable() . '.parent_product_id',
['e.entity_id as parent_product_id']
)->where(
'e.entity_id IN(?)',
$this->getMainTable() . '.product_id IN(?)',
$childId
);

Expand Down
Loading

0 comments on commit bc664fa

Please sign in to comment.