Skip to content

Commit

Permalink
MAGETWO-55345: Grunt uses actual theme's list
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirZaets committed Aug 29, 2016
2 parents a441f22 + 8744435 commit ee2ce79
Show file tree
Hide file tree
Showing 454 changed files with 9,169 additions and 3,474 deletions.
10 changes: 10 additions & 0 deletions app/code/Magento/Braintree/Gateway/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,14 @@ public function getDynamicDescriptors()
}
return $values;
}

/**
* Get Merchant account ID
*
* @return string
*/
public function getMerchantAccountId()
{
return $this->getValue(self::KEY_MERCHANT_ACCOUNT_ID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function build(array $buildSubject)
self::ORDER_ID => $order->getOrderIncrementId()
];

$merchantAccountId = $this->config->getValue(Config::KEY_MERCHANT_ACCOUNT_ID);
$merchantAccountId = $this->config->getMerchantAccountId();
if (!empty($merchantAccountId)) {
$result[self::MERCHANT_ACCOUNT_ID] = $merchantAccountId;
}
Expand Down
10 changes: 9 additions & 1 deletion app/code/Magento/Braintree/Model/Ui/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
namespace Magento\Braintree\Model\Ui;

use Magento\Braintree\Gateway\Request\PaymentDataBuilder;
use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Braintree\Gateway\Config\Config;
use Magento\Braintree\Model\Adapter\BraintreeAdapter;
Expand Down Expand Up @@ -86,7 +87,14 @@ public function getConfig()
public function getClientToken()
{
if (empty($this->clientToken)) {
$this->clientToken = $this->adapter->generate();
$params = [];

$merchantAccountId = $this->config->getMerchantAccountId();
if (!empty($merchantAccountId)) {
$params[PaymentDataBuilder::MERCHANT_ACCOUNT_ID] = $merchantAccountId;
}

$this->clientToken = $this->adapter->generate($params);
}

return $this->clientToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ public function testBuild()
->willReturnMap($additionalData);

$this->configMock->expects(static::once())
->method('getValue')
->with(Config::KEY_MERCHANT_ACCOUNT_ID)
->method('getMerchantAccountId')
->willReturn(self::MERCHANT_ACCOUNT_ID);

$this->paymentDO->expects(static::once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
class ConfigProviderTest extends \PHPUnit_Framework_TestCase
{
const SDK_URL = 'https://js.braintreegateway.com/v2/braintree.js';

const CLIENT_TOKEN = 'token';
const MERCHANT_ACCOUNT_ID = '245345';

/**
* @var Config|MockObject
Expand Down Expand Up @@ -76,11 +76,17 @@ public function testGetConfig($config, $expected)

/**
* @covers \Magento\Braintree\Model\Ui\ConfigProvider::getClientToken
* @dataProvider getClientTokenDataProvider
*/
public function testGetClientToken()
public function testGetClientToken($merchantAccountId, $params)
{
$this->config->expects(static::once())
->method('getMerchantAccountId')
->willReturn($merchantAccountId);

$this->braintreeAdapter->expects(static::once())
->method('generate')
->with($params)
->willReturn(self::CLIENT_TOKEN);

static::assertEquals(self::CLIENT_TOKEN, $this->configProvider->getClientToken());
Expand Down Expand Up @@ -140,4 +146,21 @@ public function getConfigDataProvider()
]
];
}

/**
* @return array
*/
public function getClientTokenDataProvider()
{
return [
[
'merchantAccountId' => '',
'params' => []
],
[
'merchantAccountId' => self::MERCHANT_ACCOUNT_ID,
'params' => ['merchantAccountId' => self::MERCHANT_ACCOUNT_ID]
]
];
}
}
1 change: 1 addition & 0 deletions app/code/Magento/Catalog/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ Image,Image
"Allowed file types: jpeg, gif, png.","Allowed file types: jpeg, gif, png."
"Image Opacity","Image Opacity"
"Example format: 200x300.","Example format: 200x300."
"This value does not follow the specified format (for example, 200X300).","This value does not follow the specified format (for example, 200X300)."
"Image Position","Image Position"
Small,Small
"Attribute Label","Attribute Label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@
<field name="watermark_image_size">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Catalog/component/image-size-field</item>
<item name="label" xsi:type="string" translate="true">Image Size</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="dataScope" xsi:type="string">watermark_image_size</item>
<item name="validation" xsi:type="array">
<item name="validate-digits" xsi:type="boolean">true</item>
<item name="validate-image-size-range" xsi:type="boolean">true</item>
</item>
<item name="notice" xsi:type="string" translate="true">Example format: 200x300.</item>
</item>
Expand Down Expand Up @@ -118,12 +119,13 @@
<field name="watermark_thumbnail_size">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Catalog/component/image-size-field</item>
<item name="label" xsi:type="string" translate="true">Image Size</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="dataScope" xsi:type="string">watermark_thumbnail_size</item>
<item name="validation" xsi:type="array">
<item name="validate-digits" xsi:type="boolean">true</item>
<item name="validate-image-size-range" xsi:type="boolean">true</item>
</item>
<item name="notice" xsi:type="string" translate="true">Example format: 200x300.</item>
</item>
Expand Down Expand Up @@ -181,12 +183,13 @@
<field name="watermark_small_image_size">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Catalog/component/image-size-field</item>
<item name="label" xsi:type="string" translate="true">Image Size</item>
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item>
<item name="dataScope" xsi:type="string">watermark_small_image_size</item>
<item name="validation" xsi:type="array">
<item name="validate-digits" xsi:type="boolean">true</item>
<item name="validate-image-size-range" xsi:type="boolean">true</item>
</item>
<item name="notice" xsi:type="string" translate="true">Example format: 200x300.</item>
</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

define([
'jquery',
'Magento_Ui/js/lib/validation/utils',
'Magento_Ui/js/form/element/abstract',
'Magento_Ui/js/lib/validation/validator'
], function ($, utils, Abstract, validator) {
'use strict';

validator.addRule(
'validate-image-size-range',
function (value) {
var dataAttrRange = /^(\d+)x(\d+)$/,
m;

if (utils.isEmptyNoTrim(value)) {
return true;
}

m = dataAttrRange.exec(value);

return !!(m && m[1] > 0 && m[2] > 0);
},
$.mage.__('This value does not follow the specified format (for example, 200X300).')
);

return Abstract.extend({

/**
* Checks for relevant value
*
* @returns {Boolean}
*/
isRangeCorrect: function () {
return validator('validate-image-size-range', this.value()).passed;
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<script>
require([
'jquery',
'Magento_Catalog/js/price-box'
'priceBox'
], function($){
var priceBoxes = $('[data-role=priceBox]');

Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/CatalogImportExport/Model/Export/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,14 @@ protected function getCustomOptionsData($productIds)
$row['max_characters'] = $option['max_characters'];
}

foreach (['file_extension', 'image_size_x', 'image_size_y'] as $fileOptionKey) {
if (!isset($option[$fileOptionKey])) {
continue;
}

$row[$fileOptionKey] = $option[$fileOptionKey];
}

$values = $option->getValues();

if ($values) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
'radio' => true,
'checkbox' => true,
'multiple' => true,
'file' => ['sku', 'file_extension', 'image_size_x', 'image_size_y'],
];

/**
Expand Down Expand Up @@ -1136,6 +1137,28 @@ private function processOptionRow($name, $optionRow)
$result[$this->columnMaxCharacters] = $optionRow['max_characters'];
}

$result = $this->addFileOptions($result, $optionRow);

return $result;
}

/**
* Add file options
*
* @param array $result
* @param array $optionRow
* @return array
*/
private function addFileOptions($result, $optionRow)
{
foreach (['file_extension', 'image_size_x', 'image_size_y'] as $fileOptionKey) {
if (!isset($optionRow[$fileOptionKey])) {
continue;
}

$result[self::COLUMN_PREFIX . $fileOptionKey] = $optionRow[$fileOptionKey];
}

return $result;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogInventory/Setup/InstallSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
5,
['unsigned' => true, 'nullable' => false, 'default' => 0],
'Is Divided into Multiple Boxes for Shipping'
'Website ID'
)
->addIndex(
$installer->getIdxName(
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogInventory/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
<plugin name="catalogInventoryAfterLoad" type="\Magento\CatalogInventory\Model\Plugin\AfterProductLoad"/>
</type>
<type name="Magento\Catalog\Api\ProductRepositoryInterface">
<plugin name="catalogInventoryAroundSave" type="\Magento\CatalogInventory\Model\Plugin\AroundProductRepositorySave"/>
<plugin name="catalogInventoryAroundSave" sortOrder="20" type="Magento\CatalogInventory\Model\Plugin\AroundProductRepositorySave"/>
</type>
</config>
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogInventory/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_CatalogInventory" setup_version="2.0.0">
<module name="Magento_CatalogInventory" setup_version="2.0.1">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
Expand Down
11 changes: 5 additions & 6 deletions app/code/Magento/CatalogSearch/Model/Search/ReaderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ public function __construct(
/**
* Merge reader's value with generated
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @param \Magento\Framework\Config\ReaderInterface $subject
* @param \Closure $proceed
* @param string $scope
* @param array $result
* @param string|null $scope
* @return array
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function aroundRead(
public function afterRead(
\Magento\Framework\Config\ReaderInterface $subject,
\Closure $proceed,
array $result,
$scope = null
) {
$result = $proceed($scope);
$result = array_merge_recursive($result, $this->requestGenerator->generate());
return $result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ protected function setUp()
);
}

public function testAroundRead()
public function testAfterRead()
{
$readerConfig = ['test' => 'b', 'd' => 'e'];
$this->requestGenerator->expects($this->once())
->method('generate')
->will($this->returnValue(['test' => 'a']));

$result = $this->object->aroundRead(
$result = $this->object->afterRead(
$this->getMockBuilder(\Magento\Framework\Config\ReaderInterface::class)
->disableOriginalConstructor()->getMock(),
function () {
return ['test' => 'b', 'd' => 'e'];
}
$readerConfig,
null
);

$this->assertEquals(['test' => ['b', 'a'], 'd' => 'e'], $result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class Move
/** @var CategoryUrlPathGenerator */
protected $categoryUrlPathGenerator;

/**
* @var ChildrenCategoriesProvider
*/
private $childrenCategoriesProvider;

/**
* @param CategoryUrlPathGenerator $categoryUrlPathGenerator
* @param ChildrenCategoriesProvider $childrenCategoriesProvider
Expand All @@ -27,22 +32,23 @@ public function __construct(
}

/**
* Perform url updating for children categories
*
* @param \Magento\Catalog\Model\ResourceModel\Category $subject
* @param callable $proceed
* @param \Magento\Catalog\Model\ResourceModel\Category $result
* @param Category $category
* @param Category $newParent
* @param null|int $afterCategoryId
* @return callable
* @return \Magento\Catalog\Model\ResourceModel\Category
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function aroundChangeParent(
public function afterChangeParent(
\Magento\Catalog\Model\ResourceModel\Category $subject,
\Closure $proceed,
$category,
$newParent,
\Magento\Catalog\Model\ResourceModel\Category $result,
Category $category,
Category $newParent,
$afterCategoryId
) {
$result = $proceed($category, $newParent, $afterCategoryId);
$category->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
$category->getResource()->saveAttribute($category, 'url_path');
$this->updateUrlPathForChildren($category);
Expand Down
Loading

0 comments on commit ee2ce79

Please sign in to comment.