Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-92986
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohdan Korablov committed Jul 9, 2018
2 parents 9838f83 + 0c2fa6f commit 0dfe22b
Show file tree
Hide file tree
Showing 65 changed files with 1,523 additions and 620 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ protected function setUp()
* @dataProvider errorDataProvider
* @param string $reportName
* @param array $result
* @param \PHPUnit_Framework_MockObject_Stub $queryReturnStub
* @param \PHPUnit\Framework\MockObject\Stub $queryReturnStub
*/
public function testValidate($reportName, $result, \PHPUnit_Framework_MockObject_Stub $queryReturnStub)
public function testValidate($reportName, $result, \PHPUnit\Framework\MockObject\Stub $queryReturnStub)
{
$connectionName = 'testConnection';
$this->queryFactoryMock->expects($this->once())
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<backend_model>Magento\Config\Model\Config\Backend\Store</backend_model>
<comment>
<![CDATA[<strong style="color:red">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).]]>
<![CDATA[<strong style="color:red">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).]]>
</comment>
</field>
<field id="redirect_to_base" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Backend/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ Web,Web
"Url Options","Url Options"
"Add Store Code to Urls","Add Store Code to Urls"
"
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).
","
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).
"
"Auto-redirect to Base URL","Auto-redirect to Base URL"
"Search Engine Optimization","Search Engine Optimization"
Expand Down Expand Up @@ -447,7 +447,7 @@ Tags,Tags
"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>"
"Community Edition","Community Edition"
"Default Theme","Default Theme"
"If no value is specified, the system default is used. The system default may be modified by third party extensions.","If no value is specified, the system default is used. The system default may be modified by third party extensions."
"If no value is specified, the system default is used. The system default may be modified by third-party extensions.","If no value is specified, the system default is used. The system default may be modified by third-party extensions."
"Applied Theme","Applied Theme"
"Design Rule","Design Rule"
"User Agent Rules","User Agent Rules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</settings>
<field name="theme_theme_id" sortOrder="10" formElement="select">
<settings>
<notice translate="true">If no value is specified, the system default is used. The system default may be modified by third party extensions.</notice>
<notice translate="true">If no value is specified, the system default is used. The system default may be modified by third-party extensions.</notice>
<dataType>text</dataType>
<label translate="true">Applied Theme</label>
<dataScope>theme_theme_id</dataScope>
Expand Down
49 changes: 38 additions & 11 deletions app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
*/
namespace Magento\Catalog\Controller\Adminhtml\Product\Set;

use Magento\Framework\App\ObjectManager;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Set
{
/**
Expand All @@ -17,22 +22,49 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Set
* @var \Magento\Framework\Controller\Result\JsonFactory
*/
protected $resultJsonFactory;


/*
* @var \Magento\Eav\Model\Entity\Attribute\SetFactory
*/
private $attributeSetFactory;

/*
* @var \Magento\Framework\Filter\FilterManager
*/
private $filterManager;

/*
* @var \Magento\Framework\Json\Helper\Data
*/
private $jsonHelper;

/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
* @param \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory
* @param \Magento\Framework\Filter\FilterManager $filterManager
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\View\LayoutFactory $layoutFactory,
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
\Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory = null,
\Magento\Framework\Filter\FilterManager $filterManager = null,
\Magento\Framework\Json\Helper\Data $jsonHelper = null
) {
parent::__construct($context, $coreRegistry);
$this->layoutFactory = $layoutFactory;
$this->resultJsonFactory = $resultJsonFactory;
$this->attributeSetFactory = $attributeSetFactory ?: ObjectManager::getInstance()
->get(\Magento\Eav\Model\Entity\Attribute\SetFactory::class);
$this->filterManager = $filterManager ?: ObjectManager::getInstance()
->get(\Magento\Framework\Filter\FilterManager::class);
$this->jsonHelper = $jsonHelper ?: ObjectManager::getInstance()
->get(\Magento\Framework\Json\Helper\Data::class);
}

/**
Expand Down Expand Up @@ -65,16 +97,12 @@ public function execute()
$isNewSet = $this->getRequest()->getParam('gotoEdit', false) == '1';

/* @var $model \Magento\Eav\Model\Entity\Attribute\Set */
$model = $this->_objectManager->create(\Magento\Eav\Model\Entity\Attribute\Set::class)
->setEntityTypeId($entityTypeId);

/** @var $filterManager \Magento\Framework\Filter\FilterManager */
$filterManager = $this->_objectManager->get(\Magento\Framework\Filter\FilterManager::class);
$model = $this->attributeSetFactory->create()->setEntityTypeId($entityTypeId);

try {
if ($isNewSet) {
//filter html tags
$name = $filterManager->stripTags($this->getRequest()->getParam('attribute_set_name'));
$name = $this->filterManager->stripTags($this->getRequest()->getParam('attribute_set_name'));
$model->setAttributeSetName(trim($name));
} else {
if ($attributeSetId) {
Expand All @@ -85,11 +113,10 @@ public function execute()
__('This attribute set no longer exists.')
);
}
$data = $this->_objectManager->get(\Magento\Framework\Json\Helper\Data::class)
->jsonDecode($this->getRequest()->getPost('data'));
$data = $this->jsonHelper->jsonDecode($this->getRequest()->getPost('data'));

//filter html tags
$data['attribute_set_name'] = $filterManager->stripTags($data['attribute_set_name']);
$data['attribute_set_name'] = $this->filterManager->stripTags($data['attribute_set_name']);

$model->organizeData($data);
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Pricing/Price/RegularPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class RegularPrice extends AbstractPrice implements BasePriceProviderInterface
/**
* Get price value
*
* @return float|bool
* @return float
*/
public function getValue()
{
if ($this->value === null) {
$price = $this->product->getPrice();
$priceInCurrentCurrency = $this->priceCurrency->convertAndRound($price);
$this->value = $priceInCurrentCurrency ? floatval($priceInCurrentCurrency) : false;
$this->value = $priceInCurrentCurrency ? floatval($priceInCurrentCurrency) : 0;
}
return $this->value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
use Magento\Customer\Model\Session;
use Magento\Framework\App\Request\Http;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit_Framework_MockObject_Builder_InvocationMocker as InvocationMocker;
use PHPUnit_Framework_MockObject_Matcher_InvokedCount as InvokedCount;
use PHPUnit\Framework\MockObject\Builder\InvocationMocker as InvocationMocker;
use PHPUnit\Framework\MockObject\Matcher\InvokedCount as InvokedCount;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use Magento\Checkout\Helper\Data;
use Magento\Quote\Model\Quote;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ protected function setUp()

/**
* @param bool $hasBackendModel
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsGetBackendModel
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsCreate
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsGetValue
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetPath
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetScope
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetScopeId
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSetValue
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsAfterLoad
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsSerialize
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsGetBackendModel
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsCreate
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsGetValue
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSetPath
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSetScope
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSetScopeId
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSetValue
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsAfterLoad
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectsSerialize
* @param string $expectsValue
* @param string $className
* @param string $value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function testException()
}

/**
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $firstExpects
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $firstExpects
* @param bool $firstResult
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $secondExpects
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $secondExpects
* @param bool $secondResult
* @param bool $expectedResult
* @dataProvider visibilityDataProvider
Expand All @@ -74,9 +74,9 @@ public function testDisabled($firstExpects, $firstResult, $secondExpects, $secon
}

/**
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $firstExpects
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $firstExpects
* @param bool $firstResult
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $secondExpects
* @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $secondExpects
* @param bool $secondResult
* @param bool $expectedResult
* @dataProvider visibilityDataProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
/**
* @var string
*/
protected $_idFieldName = 'customer_group_id';

/**
* Resource initialization
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,62 @@
*/
namespace Magento\Customer\Model\ResourceModel\Group\Grid;

class Collection extends \Magento\Customer\Model\ResourceModel\Group\Collection
use Magento\Customer\Model\ResourceModel\Group\Collection as GroupCollection;
use Magento\Framework\Api\Search\SearchResultInterface;
use Magento\Framework\Search\AggregationInterface;

/**
* Collection for displaying grid of customer groups
*/
class Collection extends GroupCollection implements SearchResultInterface
{
/**
* @var AggregationInterface
*/
protected $aggregations;

/**
* @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param string $mainTable
* @param string $eventPrefix
* @param string $eventObject
* @param string $resourceModel
* @param string $model
* @param \Magento\Framework\DB\Adapter\AdapterInterface|string|null $connection
* @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
\Magento\Framework\Event\ManagerInterface $eventManager,
$mainTable,
$eventPrefix,
$eventObject,
$resourceModel,
$model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class,
$connection = null,
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
) {
parent::__construct(
$entityFactory,
$logger,
$fetchStrategy,
$eventManager,
$connection,
$resource
);
$this->_eventPrefix = $eventPrefix;
$this->_eventObject = $eventObject;
$this->_init($model, $resourceModel);
$this->setMainTable($mainTable);
}

/**
* Resource initialization
* @return $this
Expand All @@ -19,4 +73,78 @@ protected function _initSelect()
$this->addTaxClass();
return $this;
}

/**
* @return AggregationInterface
*/
public function getAggregations()
{
return $this->aggregations;
}

/**
* @param AggregationInterface $aggregations
* @return $this
*/
public function setAggregations($aggregations)
{
$this->aggregations = $aggregations;
return $this;
}

/**
* Get search criteria.
*
* @return \Magento\Framework\Api\SearchCriteriaInterface|null
*/
public function getSearchCriteria()
{
return null;
}

/**
* Set search criteria.
*
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
* @return $this
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null)
{
return $this;
}

/**
* Get total count.
*
* @return int
*/
public function getTotalCount()
{
return $this->getSize();
}

/**
* Set total count.
*
* @param int $totalCount
* @return $this
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function setTotalCount($totalCount)
{
return $this;
}

/**
* Set items list.
*
* @param \Magento\Framework\Api\ExtensibleDataInterface[] $items
* @return $this
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function setItems(array $items = null)
{
return $this;
}
}
Loading

0 comments on commit 0dfe22b

Please sign in to comment.