Skip to content

Commit

Permalink
Merge pull request #40 from magento-mpi/public-pulls
Browse files Browse the repository at this point in the history
[Github] Merge public Github commits
  • Loading branch information
vpelipenko committed Jan 16, 2015
2 parents 5dde4a3 + 2da98de commit ea1c57c
Show file tree
Hide file tree
Showing 23 changed files with 155 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
*
* @SuppressWarnings(PHPMD.LongVariable)
*/
class Groupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Groupprice\AbstractGroupprice
class GroupPrice extends \Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice\AbstractGroupPrice
{
/**
* Catalog product attribute backend groupprice
*
* @var \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice
* @var \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice
*/
protected $_productAttributeBackendGroupprice;
protected $_productAttributeBackendGroupPrice;

/**
* @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
Expand All @@ -26,7 +26,7 @@ class Groupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Groupp
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Catalog\Model\Product\Type $catalogProductType
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
* @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice
* @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice $productAttributeBackendGroupPrice
*/
public function __construct(
\Magento\Directory\Model\CurrencyFactory $currencyFactory,
Expand All @@ -35,9 +35,9 @@ public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Catalog\Model\Product\Type $catalogProductType,
\Magento\Customer\Api\GroupManagementInterface $groupManagement,
\Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice
\Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice $productAttributeBackendGroupPrice
) {
$this->_productAttributeBackendGroupprice = $productAttributeBackendGroupprice;
$this->_productAttributeBackendGroupPrice = $productAttributeBackendGroupPrice;
parent::__construct(
$currencyFactory,
$storeManager,
Expand All @@ -51,11 +51,11 @@ public function __construct(
/**
* Retrieve resource instance
*
* @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice
* @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice
*/
protected function _getResource()
{
return $this->_productAttributeBackendGroupprice;
return $this->_productAttributeBackendGroupPrice;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\Product\Attribute\Backend\Groupprice;
namespace Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice;

use Magento\Catalog\Model\Product\Attribute\Backend\Price;
use Magento\Customer\Api\GroupManagementInterface;

/**
* Catalog product abstract group price backend attribute model
*/
abstract class AbstractGroupprice extends Price
abstract class AbstractGroupPrice extends Price
{
/**
* Website currency codes and rates
Expand Down Expand Up @@ -100,7 +100,7 @@ protected function _getWebsiteCurrencyRates()
/**
* Retrieve resource instance
*
* @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice
* @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice
*/
abstract protected function _getResource();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
namespace Magento\Catalog\Model\Product\Attribute\Backend;

class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Groupprice\AbstractGroupprice
class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice\AbstractGroupPrice
{
/**
* Catalog product attribute backend tierprice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/
namespace Magento\Catalog\Model\Resource\Product\Attribute\Backend;

use Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice\AbstractGroupprice;
use Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice\AbstractGroupPrice;

/**
* Catalog product group price backend attribute model
*
* @author Magento Core Team <[email protected]>
*/
class Groupprice extends AbstractGroupprice
class GroupPrice extends AbstractGroupPrice
{
/**
* Initialize connection and define main table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice;
namespace Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice;

abstract class AbstractGroupprice extends \Magento\Framework\Model\Resource\Db\AbstractDb
abstract class AbstractGroupPrice extends \Magento\Framework\Model\Resource\Db\AbstractDb
{
/**
* Load Tier Prices for product
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/
namespace Magento\Catalog\Model\Resource\Product\Attribute\Backend;

use Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice\AbstractGroupprice;
use Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice\AbstractGroupPrice;

/**
* Catalog product tier price backend attribute model
*
* @author Magento Core Team <[email protected]>
*/
class Tierprice extends AbstractGroupprice
class Tierprice extends AbstractGroupPrice
{
/**
* Initialize connection and define main table
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Resource/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ public function getDefaultEntities()
'type' => 'decimal',
'label' => 'Group Price',
'input' => 'text',
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice',
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice',
'required' => false,
'sort_order' => 2,
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ define([
*/
_renderSelectOption: function(selectElement, key, value) {
selectElement.append($.proxy(function() {
if (value.code && $(value.name).is('span')) {
var name = value.name.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&");
if (value.code && $(name).is('span')) {
key = value.code;
value.name = $(value.name).text();
value.name = $(name).text();
}
$.template('regionTemplate', this.options.regionTemplate);
if (this.options.defaultRegion === key) {
Expand Down Expand Up @@ -173,4 +174,4 @@ define([
});

return $.mage.regionUpdater;
});
});
2 changes: 1 addition & 1 deletion app/code/Magento/Ui/DataProvider/Config/FileResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function get($filename, $scope)
{
$iterator = $this->iteratorFactory->create(
$this->directoryRead,
$this->directoryRead->search('/*/*/etc/data_source/*')
$this->directoryRead->search('/*/*/etc/data_source/' . $filename)
);
return $iterator;
}
Expand Down
3 changes: 3 additions & 0 deletions dev/shell/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@

$usage = 'Usage: php -f cache.php -- [--' . ManagerApp::KEY_SET . '=1|0]'
. ' [--' . ManagerApp::KEY_CLEAN . ']'
. ' [--' . ManagerApp::KEY_STATUS . ']'
. ' [--' . ManagerApp::KEY_FLUSH . ']'
. ' [--' . ManagerApp::KEY_TYPES . '=<type1>,<type2>,...]'
. ' [--bootstrap=' . escapeshellarg('INIT_PARAM=foo&ANOTHER_PARAM[key]=bar') . ']
--' . ManagerApp::KEY_TYPES . ' - list of cache types, comma-separated. If omitted, all caches will be affected
--' . ManagerApp::KEY_SET . ' - enable or disable the specified cache types
--' . ManagerApp::KEY_CLEAN . ' - clean data of the specified cache types
--' . ManagerApp::KEY_STATUS . ' - display current status for each cache type
--' . ManagerApp::KEY_FLUSH . ' - destroy all data in storage that the specified cache types reside on
--bootstrap - add or override parameters of the bootstrap' . PHP_EOL;
$longOpts = [
ManagerApp::KEY_SET . '::',
ManagerApp::KEY_CLEAN,
ManagerApp::KEY_STATUS,
ManagerApp::KEY_FLUSH,
ManagerApp::KEY_TYPES . '::',
'bootstrap::',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class UpdateCustomerFrontendEntity extends Injectable
class UpdateCustomerFrontendEntityTest extends Injectable
{
/**
* Factory for Fixtures
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"customer/data/firstname";"customer/data/lastname";"customer/data/email";"address/data/firstname";"address/data/lastname";"address/data/company";"address/data/street";"address/data/city";"address/data/country_id";"address/data/region_id";"address/data/region";"address/data/telephone";"address/data/fax";"address/data/postcode";"constraint"
"Jany %isolation%";"Doe %isolation%";"janydoe%isolation%@example.com";"Jany %isolation%";"Doe %isolation%";"Company %isolation%";"Some street %isolation%";"City %isolation%";"United States";"Colorado";"-";"555-888-111-999";"161-999-8888";"12345";"assertCustomerAddressSuccessSaveMessage, assertCustomerDefaultAddresses"
"Jonny %isolation%";"Doe %isolation%";"jonny%isolation%@example.com";"John %isolation%";"Doe %isolation%";"Company %isolation%";"Some street %isolation%";"City %isolation%";"United Kingdom";"-";"Region %isolation%";"0123456789-02134567";"5555-874-99634";"12345";"assertCustomerAddressSuccessSaveMessage, assertCustomerDefaultAddresses"
"Jean %isolation%";"Reno %isolation%";"jean%isolation%@example.com";"Jean %isolation%";"Reno %isolation%";"Magento %isolation%";"18-20 Rue Maréchal Leclerc";"Quintin";"France";"Côtes-d'Armor";"-";"555-888-111-999";"161-999-8888";"12345";"assertCustomerAddressSuccessSaveMessage, assertCustomerDefaultAddresses"
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\View\Page\Config\Reader;

class HtmlTest extends \PHPUnit_Framework_TestCase
{
public function testInterpret()
{
/** @var \Magento\Framework\View\Layout\Reader\Context $readerContext */
$readerContext = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
'Magento\Framework\View\Layout\Reader\Context'
);
$pageXml = new \Magento\Framework\View\Layout\Element(__DIR__ . '/_files/_layout_update.xml', 0, true);
$parentElement = new \Magento\Framework\View\Layout\Element('<page></page>');

$html = new Html();
foreach ($pageXml->xpath('html') as $htmlElement) {
$html->interpret($readerContext, $htmlElement, $parentElement);
}

$structure = $readerContext->getPageConfigStructure();
$this->assertEquals(['html' => ['test-name' => 'test-value']], $structure->getElementAttributes());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<html>
<attribute name="test-name" value="test-value"/>
</html>
</page>
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class GroupPriceTest extends \PHPUnit_Framework_TestCase
protected $attributeMock;

/**
* @var \Magento\Catalog\Model\Product\Attribute\Backend\Groupprice|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice|\PHPUnit_Framework_MockObject_MockObject
*/
protected $backendMock;

Expand Down Expand Up @@ -110,7 +110,7 @@ public function setUp()
false
);
$this->backendMock = $this->getMock(
'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice',
'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice',
[],
[],
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\Product\Attribute\Backend\Groupprice;
namespace Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice;

class AbstractTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice\AbstractGroupprice
* @var \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice\AbstractGroupPrice
*/
protected $_model;

Expand All @@ -31,7 +31,7 @@ protected function setUp()
$groupManagement = $this->getMock('Magento\Customer\Api\GroupManagementInterface', [], [], '', false);

$this->_model = $this->getMockForAbstractClass(
'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice\AbstractGroupprice',
'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice\AbstractGroupPrice',
[
'currencyFactory' => $currencyFactoryMock,
'storeManager' => $storeManagerMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GroupPriceTest extends \PHPUnit_Framework_TestCase
protected $attributeMock;

/**
* @var \Magento\Catalog\Model\Product\Attribute\Backend\Groupprice|\PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice|\PHPUnit_Framework_MockObject_MockObject
*/
protected $backendMock;

Expand Down Expand Up @@ -104,7 +104,7 @@ public function setUp()
false
);
$this->backendMock = $this->getMock(
'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice',
'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice',
[],
[],
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ protected function setUp()

public function testLaunchStatus()
{
$requestArgs = [
ManagerApp::KEY_STATUS => true
];

$this->response->expects($this->once())
->method('setBody')
->with(
$this->matches("Current status:%afoo: 1%abar: 1%abaz: 0")
);

$model = new ManagerApp($this->cacheManager, $this->response, []);
$model = new ManagerApp($this->cacheManager, $this->response, $requestArgs);
$model->launch();
}

Expand All @@ -58,7 +62,7 @@ public function testLaunchEnable()
$this->response->expects($this->once())
->method('setBody')
->with(
$this->matches("Changed cache status:%abaz: 0 -> 1%aCleaned cache types: baz%a")
$this->matches("Changed cache status:\n%abaz: 0 -> 1\nCleaned cache types:\nbaz")
);

$model = new ManagerApp($this->cacheManager, $this->response, $requestArgs);
Expand All @@ -80,7 +84,7 @@ public function testLaunchDisable()
$this->response->expects($this->once())
->method('setBody')
->with(
$this->matches("Changed cache status:%abaz: 1 -> 0%a%a")
$this->matches("Changed cache status:\n%abaz: 1 -> 0\n")
);

$model = new ManagerApp($this->cacheManager, $this->response, $requestArgs);
Expand All @@ -103,7 +107,7 @@ public function testLaunchFlush()
$this->response->expects($this->once())
->method('setBody')
->with(
$this->matches("Flushed cache types: foo, bar%a")
$this->matches("Flushed cache types:\nfoo\nbar")
);

$model = new ManagerApp($this->cacheManager, $this->response, $requestArgs);
Expand All @@ -126,7 +130,7 @@ public function testLaunchClean()
$this->response->expects($this->once())
->method('setBody')
->with(
$this->matches("Cleaned cache types: foo, bar%a")
$this->matches("Cleaned cache types:\nfoo\nbar")
);

$model = new ManagerApp($this->cacheManager, $this->response, $requestArgs);
Expand All @@ -152,7 +156,7 @@ public function testLaunchSetAndClean()
$this->response->expects($this->once())
->method('setBody')
->with(
$this->matches("Changed cache status:%afoo: 0 -> 1%aCleaned cache types: foo, bar%a")
$this->matches("Changed cache status:\n%afoo: 0 -> 1\nCleaned cache types:\nfoo\nbar")
);

$model = new ManagerApp($this->cacheManager, $this->response, $requestArgs);
Expand All @@ -179,7 +183,7 @@ public function testLaunchAll()
$this->response->expects($this->once())
->method('setBody')
->with(
$this->matches("Changed cache status:%abaz: 0 -> 1%aFlushed cache types: foo, baz%a")
$this->matches("Changed cache status:\n%abaz: 0 -> 1%aFlushed cache types:\nfoo\nbaz")
);

$model = new ManagerApp($this->cacheManager, $this->response, $requestArgs);
Expand Down
Loading

0 comments on commit ea1c57c

Please sign in to comment.