diff --git a/app/code/Magento/Analytics/Test/Unit/ReportXml/DB/ReportValidatorTest.php b/app/code/Magento/Analytics/Test/Unit/ReportXml/DB/ReportValidatorTest.php
index d7dcf50620550..ac141fae4be66 100644
--- a/app/code/Magento/Analytics/Test/Unit/ReportXml/DB/ReportValidatorTest.php
+++ b/app/code/Magento/Analytics/Test/Unit/ReportXml/DB/ReportValidatorTest.php
@@ -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())
diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml
index 86a2f3b772d2a..be1b836d64802 100644
--- a/app/code/Magento/Backend/etc/adminhtml/system.xml
+++ b/app/code/Magento/Backend/etc/adminhtml/system.xml
@@ -432,7 +432,7 @@
Magento\Config\Model\Config\Source\YesnoMagento\Config\Model\Config\Backend\Store
- Warning! 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.).]]>
+ Warning! 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.).]]>
diff --git a/app/code/Magento/Backend/i18n/en_US.csv b/app/code/Magento/Backend/i18n/en_US.csv
index f9f44f547e25b..bfedd56b14313 100644
--- a/app/code/Magento/Backend/i18n/en_US.csv
+++ b/app/code/Magento/Backend/i18n/en_US.csv
@@ -405,9 +405,9 @@ Web,Web
"Url Options","Url Options"
"Add Store Code to Urls","Add Store Code to Urls"
"
- Warning! 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.).
+ Warning! 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.).
","
- Warning! 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.).
+ Warning! 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"
@@ -447,7 +447,7 @@ Tags,Tags
"
404 Error
Page not found.
","
404 Error
Page not found.
"
"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"
diff --git a/app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml
index 19a4ab1388006..46902363f1fd7 100644
--- a/app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml
+++ b/app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml
@@ -12,7 +12,7 @@
- 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.texttheme_theme_id
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php
index 00a836309e58e..dfddcf7e92b97 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Save.php
@@ -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
{
/**
@@ -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);
}
/**
@@ -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) {
@@ -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);
}
diff --git a/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php b/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php
index 609255d852da3..1397ceb6bf71c 100644
--- a/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php
+++ b/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php
@@ -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;
}
diff --git a/app/code/Magento/Checkout/Test/Unit/Controller/Index/IndexTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Index/IndexTest.php
index 04723c5894f8f..b7ff79fc3c200 100644
--- a/app/code/Magento/Checkout/Test/Unit/Controller/Index/IndexTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Controller/Index/IndexTest.php
@@ -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;
diff --git a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigShow/ValueProcessorTest.php b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigShow/ValueProcessorTest.php
index cf758553e876d..07dcc65493a85 100644
--- a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigShow/ValueProcessorTest.php
+++ b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigShow/ValueProcessorTest.php
@@ -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
diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibilityCompositeTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibilityCompositeTest.php
index b779c29c93155..d2a89a8abc7fa 100644
--- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibilityCompositeTest.php
+++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibilityCompositeTest.php
@@ -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
@@ -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
diff --git a/app/code/Magento/Customer/Model/ResourceModel/Group/Collection.php b/app/code/Magento/Customer/Model/ResourceModel/Group/Collection.php
index 48710c46a5f1d..6e93210d04c3c 100644
--- a/app/code/Magento/Customer/Model/ResourceModel/Group/Collection.php
+++ b/app/code/Magento/Customer/Model/ResourceModel/Group/Collection.php
@@ -12,6 +12,11 @@
*/
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
+ /**
+ * @var string
+ */
+ protected $_idFieldName = 'customer_group_id';
+
/**
* Resource initialization
*
diff --git a/app/code/Magento/Customer/Model/ResourceModel/Group/Grid/Collection.php b/app/code/Magento/Customer/Model/ResourceModel/Group/Grid/Collection.php
index bf3400c3a2f68..f264245b30c4a 100644
--- a/app/code/Magento/Customer/Model/ResourceModel/Group/Grid/Collection.php
+++ b/app/code/Magento/Customer/Model/ResourceModel/Group/Grid/Collection.php
@@ -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
@@ -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;
+ }
}
diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Group/Grid/CollectionTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Group/Grid/CollectionTest.php
new file mode 100644
index 0000000000000..fc4f762afb0bb
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Group/Grid/CollectionTest.php
@@ -0,0 +1,136 @@
+entityFactoryMock = $this->getMockBuilder(EntityFactoryInterface::class)
+ ->getMockForAbstractClass();
+ $this->loggerMock = $this->getMockBuilder(LoggerInterface::class)
+ ->getMockForAbstractClass();
+ $this->fetchStrategyMock = $this->getMockBuilder(FetchStrategyInterface::class)
+ ->getMockForAbstractClass();
+ $this->eventManagerMock = $this->getMockBuilder(ManagerInterface::class)
+ ->getMockForAbstractClass();
+ $this->resourceMock = $this->getMockBuilder(AbstractDb::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->aggregationsMock = $this->getMockBuilder(AggregationInterface::class)
+ ->getMockForAbstractClass();
+ $this->connectionMock = $this->getMockBuilder(AdapterInterface::class)
+ ->getMockForAbstractClass();
+ $this->selectMock = $this->getMockBuilder(Select::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->resourceMock->expects($this->any())
+ ->method('getConnection')
+ ->willReturn($this->connectionMock);
+ $this->connectionMock->expects($this->once())
+ ->method('select')
+ ->willReturn($this->selectMock);
+
+ $this->model = (new ObjectManager($this))->getObject(Collection::class, [
+ 'entityFactory' => $this->entityFactoryMock,
+ 'logger' => $this->loggerMock,
+ 'fetchStrategy' => $this->fetchStrategyMock,
+ 'eventManager' => $this->eventManagerMock,
+ 'mainTable' => null,
+ 'eventPrefix' => 'test_event_prefix',
+ 'eventObject' => 'test_event_object',
+ 'resourceModel' => null,
+ 'resource' => $this->resourceMock,
+ ]);
+ }
+
+ /**
+ * @covers \Magento\Customer\Model\ResourceModel\Group\Grid\Collection::setSearchCriteria
+ * @covers \Magento\Customer\Model\ResourceModel\Group\Grid\Collection::getAggregations
+ */
+ public function testSetGetAggregations()
+ {
+ $this->model->setAggregations($this->aggregationsMock);
+ $this->assertInstanceOf(AggregationInterface::class, $this->model->getAggregations());
+ }
+
+ /**
+ * @covers \Magento\Customer\Model\ResourceModel\Group\Grid\Collection::setSearchCriteria
+ */
+ public function testSetSearchCriteria()
+ {
+ $this->assertEquals($this->model, $this->model->setSearchCriteria());
+ }
+}
diff --git a/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php
new file mode 100644
index 0000000000000..fdd841ea88cf8
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/Column/GroupActionsTest.php
@@ -0,0 +1,141 @@
+createMock(ContextInterface::class);
+
+ $processor = $this->getMockBuilder(Processor::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $context->expects(static::never())
+ ->method('getProcessor')
+ ->willReturn($processor);
+
+ $this->urlBuilder = $this->createMock(UrlInterface::class);
+
+ $this->escaper = $this->getMockBuilder(Escaper::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['escapeHtml'])
+ ->getMock();
+
+ $this->groupActions = $objectManager->getObject(GroupActions::class, [
+ 'context' => $context,
+ 'urlBuilder' => $this->urlBuilder,
+ 'escaper' => $this->escaper,
+ ]);
+ }
+
+ /**
+ * @covers \Magento\Customer\Ui\Component\Listing\Column\GroupActions::prepareDataSource
+ */
+ public function testPrepareDataSource()
+ {
+ $groupId = 1;
+ $groupCode = 'group code';
+ $items = [
+ 'data' => [
+ 'items' => [
+ [
+ 'customer_group_id' => $groupId,
+ 'customer_group_code' => $groupCode
+ ]
+ ]
+ ]
+ ];
+ $name = 'item_name';
+ $expectedItems = [
+ [
+ 'customer_group_id' => $groupId,
+ 'customer_group_code' => $groupCode,
+ $name => [
+ 'edit' => [
+ 'href' => 'test/url/edit',
+ 'label' => __('Edit'),
+ ],
+ 'delete' => [
+ 'href' => 'test/url/delete',
+ 'label' => __('Delete'),
+ 'confirm' => [
+ 'title' => __('Delete %1', $groupCode),
+ 'message' => __('Are you sure you want to delete a %1 record?', $groupCode)
+ ],
+ ]
+ ],
+ ]
+ ];
+
+ $this->escaper->expects(static::once())
+ ->method('escapeHtml')
+ ->with($groupCode)
+ ->willReturn($groupCode);
+
+ $this->urlBuilder->expects(static::exactly(2))
+ ->method('getUrl')
+ ->willReturnMap(
+ [
+ [
+ GroupActions::URL_PATH_EDIT,
+ [
+ 'id' => $groupId
+ ],
+ 'test/url/edit',
+ ],
+ [
+ GroupActions::URL_PATH_DELETE,
+ [
+ 'id' => $groupId
+ ],
+ 'test/url/delete',
+ ],
+ ]
+ );
+
+ $this->groupActions->setData('name', $name);
+
+ $actual = $this->groupActions->prepareDataSource($items);
+ static::assertEquals($expectedItems, $actual['data']['items']);
+ }
+}
diff --git a/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php b/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php
new file mode 100644
index 0000000000000..a8a3429ebadb0
--- /dev/null
+++ b/app/code/Magento/Customer/Ui/Component/Listing/Column/GroupActions.php
@@ -0,0 +1,109 @@
+urlBuilder = $urlBuilder;
+ $this->escaper = $escaper;
+ parent::__construct($context, $uiComponentFactory, $components, $data);
+ }
+
+ /**
+ * Prepare Data Source
+ *
+ * @param array $dataSource
+ * @return array
+ */
+ public function prepareDataSource(array $dataSource)
+ {
+ if (isset($dataSource['data']['items'])) {
+ foreach ($dataSource['data']['items'] as & $item) {
+ if (isset($item['customer_group_id'])) {
+ $title = $this->escaper->escapeHtml($item['customer_group_code']);
+ $item[$this->getData('name')] = [
+ 'edit' => [
+ 'href' => $this->urlBuilder->getUrl(
+ static::URL_PATH_EDIT,
+ [
+ 'id' => $item['customer_group_id']
+ ]
+ ),
+ 'label' => __('Edit'),
+ ],
+ ];
+
+ // hide delete action for 'NOT LOGGED IN' group
+ if ($item['customer_group_id'] == 0 && $item['customer_group_code']) {
+ continue;
+ }
+
+ $item[$this->getData('name')]['delete'] = [
+ 'href' => $this->urlBuilder->getUrl(
+ static::URL_PATH_DELETE,
+ [
+ 'id' => $item['customer_group_id']
+ ]
+ ),
+ 'label' => __('Delete'),
+ 'confirm' => [
+ 'title' => __('Delete %1', $title),
+ 'message' => __('Are you sure you want to delete a %1 record?', $title)
+ ]
+ ];
+ }
+ }
+ }
+
+ return $dataSource;
+ }
+}
diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml
index 86ed633790491..717b2b6c67e20 100644
--- a/app/code/Magento/Customer/etc/di.xml
+++ b/app/code/Magento/Customer/etc/di.xml
@@ -215,6 +215,7 @@
Magento\Customer\Model\ResourceModel\Grid\CollectionMagento\Customer\Model\ResourceModel\Online\Grid\Collection
+ Magento\Customer\Model\ResourceModel\Group\Grid\Collection
@@ -433,6 +434,14 @@
+
+
+ customer_group
+ customer_group_grid_collection
+ customer_group_collection
+ Magento\Customer\Model\ResourceModel\Group
+
+
diff --git a/app/code/Magento/Customer/etc/frontend/page_types.xml b/app/code/Magento/Customer/etc/frontend/page_types.xml
index 2c0feeac532a1..a49d735b4467e 100644
--- a/app/code/Magento/Customer/etc/frontend/page_types.xml
+++ b/app/code/Magento/Customer/etc/frontend/page_types.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/app/code/Magento/Customer/i18n/en_US.csv b/app/code/Magento/Customer/i18n/en_US.csv
index 5d7d8b2bf30a4..bf73d6361d4c7 100644
--- a/app/code/Magento/Customer/i18n/en_US.csv
+++ b/app/code/Magento/Customer/i18n/en_US.csv
@@ -531,10 +531,8 @@ Type,Type
"Send Welcome Email From","Send Welcome Email From"
"Are you sure you want to delete this item?","Are you sure you want to delete this item?"
Addresses,Addresses
-"Account Dashboard","Account Dashboard"
"Edit Account Information","Edit Account Information"
"Password forgotten","Password forgotten"
-"My Dashboard","My Dashboard"
"You are signed out","You are signed out"
"Associate to Website","Associate to Website"
"Prefix","Prefix"
diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml
index ecb64711bdb94..a65ef3cd395d0 100644
--- a/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml
+++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml
@@ -8,48 +8,7 @@
-
-
-
- customerGroupGrid
- Magento\Customer\Model\ResourceModel\Group\Grid\ServiceCollection
- type
- asc
- 1
-
-
-
-
- customer/*/edit
-
- getId
-
-
-
-
-
- ID
- id
- id
- col-id
- col-id
-
-
-
-
- Group
- code
-
-
-
-
- Tax Class
- tax_class_name
-
-
-
-
-
+
diff --git a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_group_listing.xml b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_group_listing.xml
new file mode 100644
index 0000000000000..0787e0713aa9f
--- /dev/null
+++ b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_group_listing.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+ customer_group_listing.customer_group_listing_data_source
+
+
+
+
+
+
+ customer_group_columns
+
+ customer_group_listing.customer_group_listing_data_source
+
+
+
+
+
+ customer_group_id
+
+
+
+ Magento_Customer::group
+
+
+ id
+ customer_group_id
+
+
+
+
+
+
+
+
+
+
+
+
+ textRange
+
+ asc
+
+
+
+
+ text
+
+
+
+
+
+
+ select
+ select
+
+
+
+
+
+ customer_group_id
+
+
+
+
diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
index 4224e84972f88..a2a15a4166b73 100644
--- a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
+++ b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml
@@ -22,7 +22,7 @@
- Account Dashboard
+ My Accountcustomer/account250
diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml
index 6384ee9c6562c..4494a5dd67103 100644
--- a/app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml
+++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml
@@ -10,7 +10,7 @@
- My Dashboard
+ My Account
diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php
index 862cdc336b803..dcd79cc0521a0 100644
--- a/app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php
+++ b/app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php
@@ -4,50 +4,101 @@
* See COPYING.txt for license details.
*/
-namespace Magento\Developer\Test\Unit\Console\Command;
+// @codingStandardsIgnoreStart
-use Magento\Developer\Console\Command\DevTestsRunCommand;
-use Symfony\Component\Console\Tester\CommandTester;
+namespace Magento\Developer\Console\Command {
+ use Symfony\Component\Console\Tester\CommandTester;
-/**
- * Class DevTestsRunCommandTest
- *
- * Tests dev:tests:run command. Only tests error case because DevTestsRunCommand calls phpunit with
- * passthru, so there is no good way to mock out running the tests.
- */
-class DevTestsRunCommandTest extends \PHPUnit\Framework\TestCase
-{
+ $devTestsRunCommandTestPassthruReturnVar = null;
/**
- * @var DevTestsRunCommand
+ * Mock for PHP builtin passthtru function
+ *
+ * @param string $command
+ * @param int|null $return_var
+ * @return void
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
- private $command;
-
- protected function setUp()
+ function passthru($command, &$return_var = null)
{
- $this->command = new DevTestsRunCommand();
+ global $devTestsRunCommandTestPassthruReturnVar;
+ $return_var = $devTestsRunCommandTestPassthruReturnVar;
}
- public function testExecuteBadType()
+ /**
+ * Class DevTestsRunCommandTest
+ *
+ * Tests dev:tests:run command. Only tests error case because DevTestsRunCommand calls phpunit with
+ * passthru, so there is no good way to mock out running the tests.
+ */
+ class DevTestsRunCommandTest extends \PHPUnit\Framework\TestCase
{
- $commandTester = new CommandTester($this->command);
- $commandTester->execute([DevTestsRunCommand::INPUT_ARG_TYPE => 'bad']);
- $this->assertContains('Invalid type: "bad"', $commandTester->getDisplay());
- }
- public function testPassArgumentsToPHPUnit()
- {
- $commandTester = new CommandTester($this->command);
- $commandTester->execute(
- [
- DevTestsRunCommand::INPUT_ARG_TYPE => 'unit',
- '-' . DevTestsRunCommand::INPUT_OPT_COMMAND_ARGUMENTS_SHORT => '--list-suites',
- ]
- );
- $this->assertContains(
- 'phpunit --list-suites',
- $commandTester->getDisplay(),
- 'Parameters should be passed to PHPUnit'
- );
+ /**
+ * @var DevTestsRunCommand
+ */
+ private $command;
+
+ protected function setUp()
+ {
+ $this->command = new DevTestsRunCommand();
+ }
+
+ public function testExecuteBadType()
+ {
+ $commandTester = new CommandTester($this->command);
+ $commandTester->execute([DevTestsRunCommand::INPUT_ARG_TYPE => 'bad']);
+ $this->assertContains('Invalid type: "bad"', $commandTester->getDisplay());
+ }
+
+ public function testPassArgumentsToPHPUnit()
+ {
+ global $devTestsRunCommandTestPassthruReturnVar;
+
+ $devTestsRunCommandTestPassthruReturnVar = 0;
+
+ $commandTester = new CommandTester($this->command);
+ $commandTester->execute(
+ [
+ DevTestsRunCommand::INPUT_ARG_TYPE => 'unit',
+ '-' . DevTestsRunCommand::INPUT_OPT_COMMAND_ARGUMENTS_SHORT => '--list-suites',
+ ]
+ );
+ $this->assertContains(
+ 'phpunit --list-suites',
+ $commandTester->getDisplay(),
+ 'Parameters should be passed to PHPUnit'
+ );
+ $this->assertContains(
+ 'PASSED (',
+ $commandTester->getDisplay(),
+ 'PHPUnit runs should have passed'
+ );
+ }
+
+ public function testPassArgumentsToPHPUnitNegative()
+ {
+ global $devTestsRunCommandTestPassthruReturnVar;
+
+ $devTestsRunCommandTestPassthruReturnVar = 255;
+
+ $commandTester = new CommandTester($this->command);
+ $commandTester->execute(
+ [
+ DevTestsRunCommand::INPUT_ARG_TYPE => 'unit',
+ '-' . DevTestsRunCommand::INPUT_OPT_COMMAND_ARGUMENTS_SHORT => '--list-suites',
+ ]
+ );
+ $this->assertContains(
+ 'phpunit --list-suites',
+ $commandTester->getDisplay(),
+ 'Parameters should be passed to PHPUnit'
+ );
+ $this->assertContains(
+ 'FAILED - ',
+ $commandTester->getDisplay(),
+ 'PHPUnit runs should have passed'
+ );
+ }
}
}
diff --git a/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/Data/LinksTest.php b/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/Data/LinksTest.php
index dd8e8ff38e931..93e691c931603 100644
--- a/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/Data/LinksTest.php
+++ b/app/code/Magento/Downloadable/Test/Unit/Ui/DataProvider/Product/Form/Modifier/Data/LinksTest.php
@@ -98,8 +98,8 @@ protected function setUp()
/**
* @param int|null $id
* @param string $typeId
- * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectedGetTitle
- * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectedGetValue
+ * @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectedGetTitle
+ * @param \PHPUnit\Framework\MockObject\Matcher\InvokedCount $expectedGetValue
* @return void
* @dataProvider getLinksTitleDataProvider
*/
diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/billing.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/billing.phtml
index d8514ca77f9c2..da553b7823da9 100644
--- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/billing.phtml
+++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/billing.phtml
@@ -79,7 +79,7 @@
if (isset($methodsForms[$code])) {
$block->setMethodFormTemplate($code, $methodsForms[$code]);
}
- ?>
+ ?>