diff --git a/.gitignore b/.gitignore
index 7092a568ba2a2..f3784ee198240 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,8 @@ atlassian*
/package.json
/.php_cs
/.php_cs.cache
+/.php-cs-fixer.php
+/.php-cs-fixer.cache
/grunt-config.json
/pub/media/*.*
!/pub/media/.htaccess
diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php
similarity index 88%
rename from .php_cs.dist
rename to .php-cs-fixer.dist.php
index 4c1c9091d54ca..30fcfc86de059 100644
--- a/.php_cs.dist
+++ b/.php-cs-fixer.dist.php
@@ -21,8 +21,8 @@
->exclude('setup/vendor')
->exclude('var');
-return PhpCsFixer\Config::create()
- ->setFinder($finder)
+$config = new PhpCsFixer\Config();
+$config->setFinder($finder)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
@@ -30,11 +30,11 @@
'include' => true,
'new_with_braces' => true,
'no_empty_statement' => true,
- 'no_extra_consecutive_blank_lines' => true,
+ 'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_around_double_arrow' => true,
- 'no_multiline_whitespace_before_semicolons' => true,
+ 'multiline_whitespace_before_semicolons' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
@@ -44,3 +44,4 @@
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
]);
+return $config;
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/GoToWebSetupPageActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/GoToWebSetupPageActionGroup.xml
new file mode 100644
index 0000000000000..2d0e39c72aff3
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/GoToWebSetupPageActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ Go to the Web Setup Page
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLandingSectionActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLandingSectionActionGroup.xml
new file mode 100644
index 0000000000000..905ec666c79a2
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLandingSectionActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ Action for showing landing section and closing license section on Web Setup Page
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLicenseSectionActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLicenseSectionActionGroup.xml
new file mode 100644
index 0000000000000..e12c421c9078c
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLicenseSectionActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ Action for showing license section on Web Setup Page
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Page/WebSetup/WebSetupPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/WebSetup/WebSetupPage.xml
new file mode 100644
index 0000000000000..1524f3a552115
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/Page/WebSetup/WebSetupPage.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLandingSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLandingSection.xml
new file mode 100644
index 0000000000000..efeb5a8bf8034
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLandingSection.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLicenseSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLicenseSection.xml
new file mode 100644
index 0000000000000..b810e28dc5802
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLicenseSection.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/WebSetup/WebSetupPageTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/WebSetup/WebSetupPageTest.xml
new file mode 100644
index 0000000000000..4d338a5553065
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/Test/WebSetup/WebSetupPageTest.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php
index 7fd6806013efd..3af52a0fadf09 100644
--- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php
@@ -34,55 +34,55 @@
class SaveTest extends TestCase
{
/** @var Save */
- protected $controller;
+ private $controller;
/** @var Context|MockObject */
- protected $contextMock;
+ private $contextMock;
/** @var Registry|MockObject */
- protected $registryMock;
+ private $registryMock;
/** @var GroupRepositoryInterface|MockObject */
- protected $groupRepositoryMock;
+ private $groupRepositoryMock;
/** @var GroupInterfaceFactory|MockObject */
- protected $groupInterfaceFactoryMock;
+ private $groupInterfaceFactoryMock;
/** @var ForwardFactory|MockObject */
- protected $forwardFactoryMock;
+ private $forwardFactoryMock;
/** @var PageFactory|MockObject */
- protected $pageFactoryMock;
+ private $pageFactoryMock;
/** @var DataObjectProcessor|MockObject */
- protected $dataObjectProcessorMock;
+ private $dataObjectProcessorMock;
/** @var RequestInterface|MockObject */
- protected $request;
+ private $requestMock;
/** @var RedirectFactory|MockObject */
- protected $resultRedirectFactory;
+ private $resultRedirectFactoryMock;
/** @var Redirect|MockObject */
- protected $resultRedirect;
+ private $resultRedirectMock;
/** @var ManagerInterface|MockObject */
- protected $messageManager;
+ private $messageManagerMock;
/** @var Forward|MockObject */
- protected $resultForward;
+ private $resultForwardMock;
/** @var GroupInterface|MockObject */
- protected $group;
+ private $groupMock;
/** @var Session|MockObject */
- protected $session;
+ private $sessionMock;
- /** @var GroupExtensionInterfaceFactory $groupExtensionInterfaceFactory|MockObject */
- private $groupExtensionInterfaceFactory;
+ /** @var GroupExtensionInterfaceFactory|MockObject $groupExtensionFactoryMock */
+ private $groupExtensionFactoryMock;
- /** @var GroupExtension/MockObject */
- private $groupExtension;
+ /** @var GroupExtension|MockObject */
+ private $groupExtensionMock;
protected function setUp(): void
{
@@ -106,46 +106,47 @@ protected function setUp(): void
$this->dataObjectProcessorMock = $this->getMockBuilder(DataObjectProcessor::class)
->disableOriginalConstructor()
->getMock();
- $this->request = $this->getMockBuilder(RequestInterface::class)
+ $this->requestMock = $this->getMockBuilder(RequestInterface::class)
->getMockForAbstractClass();
- $this->resultRedirectFactory = $this->getMockBuilder(RedirectFactory::class)
+ $this->resultRedirectFactoryMock = $this->getMockBuilder(RedirectFactory::class)
->disableOriginalConstructor()
->getMock();
- $this->resultRedirect = $this->getMockBuilder(Redirect::class)
+ $this->resultRedirectMock = $this->getMockBuilder(Redirect::class)
->disableOriginalConstructor()
->getMock();
- $this->messageManager = $this->getMockBuilder(ManagerInterface::class)
+ $this->messageManagerMock = $this->getMockBuilder(ManagerInterface::class)
->getMockForAbstractClass();
- $this->resultForward = $this->getMockBuilder(Forward::class)
+ $this->resultForwardMock = $this->getMockBuilder(Forward::class)
->disableOriginalConstructor()
->getMock();
- $this->group = $this->getMockBuilder(GroupInterface::class)
+ $this->groupMock = $this->getMockBuilder(GroupInterface::class)
->setMethods(['setExtensionAttributes'])
->getMockForAbstractClass();
- $this->session = $this->getMockBuilder(Session::class)
+ $this->sessionMock = $this->getMockBuilder(Session::class)
->disableOriginalConstructor()
->setMethods(['setCustomerGroupData'])
->getMock();
- $this->groupExtensionInterfaceFactory = $this->getMockBuilder(GroupExtensionInterfaceFactory::class)
+ $this->groupExtensionFactoryMock = $this->getMockBuilder(GroupExtensionInterfaceFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->groupExtension = $this->getMockBuilder(GroupExtension::class)
+ $this->groupExtensionMock = $this->getMockBuilder(GroupExtension::class)
+ ->addMethods(['setExcludeWebsiteIds'])
->disableOriginalConstructor()
->getMock();
$this->contextMock->expects(self::once())
->method('getMessageManager')
- ->willReturn($this->messageManager);
+ ->willReturn($this->messageManagerMock);
$this->contextMock->expects(self::once())
->method('getRequest')
- ->willReturn($this->request);
+ ->willReturn($this->requestMock);
$this->contextMock->expects(self::once())
->method('getResultRedirectFactory')
- ->willReturn($this->resultRedirectFactory);
+ ->willReturn($this->resultRedirectFactoryMock);
$this->contextMock->expects(self::once())
->method('getSession')
- ->willReturn($this->session);
+ ->willReturn($this->sessionMock);
$this->controller = new Save(
$this->contextMock,
@@ -155,7 +156,7 @@ protected function setUp(): void
$this->forwardFactoryMock,
$this->pageFactoryMock,
$this->dataObjectProcessorMock,
- $this->groupExtensionInterfaceFactory
+ $this->groupExtensionFactoryMock
);
}
@@ -165,7 +166,7 @@ public function testExecuteWithTaxClassAndException(): void
$groupId = 0;
$code = 'NOT LOGGED IN';
- $this->request->method('getParam')
+ $this->requestMock->method('getParam')
->willReturnMap(
[
['tax_class', null, $taxClass],
@@ -174,73 +175,73 @@ public function testExecuteWithTaxClassAndException(): void
['customer_group_excluded_websites', null, '']
]
);
- $this->groupExtensionInterfaceFactory->expects(self::once())
+ $this->groupExtensionFactoryMock->expects(self::once())
->method('create')
- ->willReturn($this->groupExtension);
- $this->groupExtension->expects(self::once())
+ ->willReturn($this->groupExtensionMock);
+ $this->groupExtensionMock->expects(self::once())
->method('setExcludeWebsiteIds')
->with([])
->willReturnSelf();
- $this->group->expects(self::once())
+ $this->groupMock->expects(self::once())
->method('setExtensionAttributes')
- ->with($this->groupExtension)
+ ->with($this->groupExtensionMock)
->willReturnSelf();
- $this->resultRedirectFactory->expects($this->once())
+ $this->resultRedirectFactoryMock->expects($this->once())
->method('create')
- ->willReturn($this->resultRedirect);
+ ->willReturn($this->resultRedirectMock);
$this->groupRepositoryMock->expects($this->once())
->method('getById')
->with($groupId)
- ->willReturn($this->group);
- $this->group->expects(self::once())
+ ->willReturn($this->groupMock);
+ $this->groupMock->expects(self::once())
->method('getCode')
->willReturn($code);
- $this->group->expects(self::once())
+ $this->groupMock->expects(self::once())
->method('setCode')
->with($code);
- $this->group->expects(self::once())
+ $this->groupMock->expects(self::once())
->method('setTaxClassId')
->with($taxClass);
$this->groupRepositoryMock->expects(self::once())
->method('save')
- ->with($this->group);
- $this->messageManager->expects(self::once())
+ ->with($this->groupMock);
+ $this->messageManagerMock->expects(self::once())
->method('addSuccessMessage')
->with(__('You saved the customer group.'));
$exception = new \Exception('Exception');
- $this->resultRedirect->expects(self::at(0))
+ $this->resultRedirectMock->expects(self::at(0))
->method('setPath')
->with('customer/group')
->willThrowException($exception);
- $this->messageManager->expects(self::once())
+ $this->messageManagerMock->expects(self::once())
->method('addErrorMessage')
->with('Exception');
$this->dataObjectProcessorMock->expects(self::once())
->method('buildOutputDataArray')
- ->with($this->group, GroupInterface::class)
+ ->with($this->groupMock, GroupInterface::class)
->willReturn(['code' => $code]);
- $this->session->expects(self::once())
+ $this->sessionMock->expects(self::once())
->method('setCustomerGroupData')
->with(['customer_group_code' => $code]);
- $this->resultRedirect->expects(self::at(1))
+ $this->resultRedirectMock->expects(self::at(1))
->method('setPath')
->with('customer/group/edit', ['id' => $groupId]);
- self::assertSame($this->resultRedirect, $this->controller->execute());
+ self::assertSame($this->resultRedirectMock, $this->controller->execute());
}
public function testExecuteWithoutTaxClass(): void
{
- $this->request->expects(self::once())
+ $this->requestMock->expects(self::once())
->method('getParam')
->with('tax_class')
->willReturn(null);
$this->forwardFactoryMock->expects(self::once())
->method('create')
- ->willReturn($this->resultForward);
- $this->resultForward->expects(self::once())
+ ->willReturn($this->resultForwardMock);
+ $this->resultForwardMock->expects(self::once())
->method('forward')
->with('new')
->willReturnSelf();
- self::assertSame($this->resultForward, $this->controller->execute());
+ self::assertSame($this->resultForwardMock, $this->controller->execute());
}
}
diff --git a/app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php b/app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php
index b6c7cedbb4285..5c1743be83f4d 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php
@@ -10,14 +10,14 @@
use Magento\Catalog\Model\Indexer\Product\Price\Processor;
use Magento\Customer\Api\Data\GroupExtensionInterface;
use Magento\Customer\Api\Data\GroupInterface;
-use Magento\Customer\Api\GroupRepositoryInterface;
use Magento\Customer\Api\GroupExcludedWebsiteRepositoryInterface;
+use Magento\Customer\Api\GroupRepositoryInterface;
use Magento\Customer\Model\Data\GroupExcludedWebsite;
use Magento\Customer\Model\Data\GroupExcludedWebsiteFactory;
use Magento\Customer\Model\Plugin\SaveCustomerGroupExcludedWebsite;
-use Magento\Customer\Model\ResourceModel\GroupExcludedWebsite as GroupExcludedWebsiteResourceModel;
+use Magento\Framework\Exception\CouldNotSaveException;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Indexer\IndexerInterface;
-use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Store\Model\System\Store;
use Magento\Store\Model\Website;
use PHPUnit\Framework\MockObject\MockObject;
@@ -28,134 +28,125 @@ class SaveCustomerGroupExcludedWebsiteTest extends TestCase
/**
* @var GroupInterface|MockObject
*/
- private $groupInterface;
+ private $groupMock;
/**
* @var GroupExtensionInterface|MockObject
*/
- private $groupExtensionInterface;
+ private $groupExtensionMock;
/**
* @var GroupRepositoryInterface|MockObject
*/
- private $groupRepositoryInterface;
+ private $groupRepositoryMock;
/**
* @var GroupExcludedWebsiteFactory|MockObject
*/
- private $groupExcludedWebsiteFactory;
+ private $groupExcludedWebsiteFactoryMock;
/**
* @var GroupExcludedWebsite|MockObject
*/
- private $groupExcludedWebsite;
+ private $groupExcludedWebsiteMock;
/**
* @var GroupExcludedWebsiteRepositoryInterface|MockObject
*/
- private $groupExcludedWebsiteRepository;
-
- /**
- * @var GroupExcludedWebsiteResourceModel|MockObject
- */
- private $groupExcludedWebsiteResourceModel;
+ private $groupExcludedWebsiteRepositoryMock;
/**
* @var Store|MockObject
*/
- private $store;
+ private $storeMock;
/**
* @var Processor|MockObject
*/
- private $priceIndexProcessor;
+ private $priceIndexProcessorMock;
/**
* @var IndexerInterface
*/
- private $priceIndexer;
+ private $priceIndexerMock;
/**
- * @var SaveCustomerGroupExcludedWebsite
+ * @var SaveCustomerGroupExcludedWebsite
*/
private $plugin;
protected function setUp(): void
{
- $objectManagerHelper = new ObjectManager($this);
-
- $this->groupExcludedWebsiteFactory = $this->getMockBuilder(GroupExcludedWebsiteFactory::class)
+ $this->groupExcludedWebsiteFactoryMock = $this->getMockBuilder(GroupExcludedWebsiteFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();
- $this->groupExcludedWebsiteRepository = $this->getMockForAbstractClass(
+ $this->groupExcludedWebsiteRepositoryMock = $this->getMockForAbstractClass(
GroupExcludedWebsiteRepositoryInterface::class
);
- $this->groupExcludedWebsiteResourceModel = $this->createMock(GroupExcludedWebsiteResourceModel::class);
- $this->groupExcludedWebsite = $this->getMockBuilder(GroupExcludedWebsite::class)
+ $this->groupExcludedWebsiteMock = $this->getMockBuilder(GroupExcludedWebsite::class)
->disableOriginalConstructor()
->getMock();
- $this->groupRepositoryInterface = $this->getMockBuilder(GroupRepositoryInterface::class)
+ $this->groupRepositoryMock = $this->getMockBuilder(GroupRepositoryInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->groupInterface = $this->getMockBuilder(GroupInterface::class)
+ $this->groupMock = $this->getMockBuilder(GroupInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->groupExtensionInterface = $this->getMockBuilder(GroupExtensionInterface::class)
+ $this->groupExtensionMock = $this->getMockBuilder(GroupExtensionInterface::class)
+ ->addMethods(['getExcludeWebsiteIds'])
->disableOriginalConstructor()
->getMockForAbstractClass();
- $this->groupInterface->method('getExtensionAttributes')
- ->willReturn($this->groupExtensionInterface);
- $this->groupInterface->method('getId')->willReturn(1);
- $this->store = $this->createPartialMock(
+ $this->groupMock->method('getExtensionAttributes')
+ ->willReturn($this->groupExtensionMock);
+ $this->groupMock->method('getId')->willReturn(1);
+
+ $this->storeMock = $this->createPartialMock(
Store::class,
['getWebsiteCollection', 'getGroupCollection', 'getStoreCollection']
);
- $this->priceIndexProcessor = $this->getMockBuilder(Processor::class)
+ $this->priceIndexProcessorMock = $this->getMockBuilder(Processor::class)
->disableOriginalConstructor()
->getMock();
- $this->priceIndexer = $this->getMockBuilder(IndexerInterface::class)
+ $this->priceIndexerMock = $this->getMockBuilder(IndexerInterface::class)
->getMockForAbstractClass();
- $this->plugin = $objectManagerHelper->getObject(
- SaveCustomerGroupExcludedWebsite::class,
- [
- 'groupExcludedWebsiteFactory' => $this->groupExcludedWebsiteFactory,
- 'groupExcludedWebsiteRepository' => $this->groupExcludedWebsiteRepository,
- 'systemStore' => $this->store,
- 'priceIndexProcessor' => $this->priceIndexProcessor
- ]
+ $this->plugin = new SaveCustomerGroupExcludedWebsite(
+ $this->groupExcludedWebsiteFactoryMock,
+ $this->groupExcludedWebsiteRepositoryMock,
+ $this->storeMock,
+ $this->priceIndexProcessorMock
);
}
public function testAfterSaveWithoutExtensionAttributes(): void
{
- $this->groupExtensionInterface->method('getExcludeWebsiteIds')->willReturn(null);
- $this->groupInterface->expects(self::never())->method('getId');
+ $this->groupExtensionMock->method('getExcludeWebsiteIds')->willReturn(null);
+ $this->groupMock->expects(self::never())->method('getId');
- $this->plugin->afterSave($this->groupRepositoryInterface, $this->groupInterface, $this->groupInterface);
+ $this->plugin->afterSave($this->groupRepositoryMock, $this->groupMock, $this->groupMock);
}
/**
* @dataProvider dataProviderNoExcludedWebsitesChanged
* @param array $excludedWebsites
* @param array $websitesToExclude
- * @throws \Magento\Framework\Exception\CouldNotSaveException
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws CouldNotSaveException
+ * @throws LocalizedException
*/
public function testAfterSaveWithNoExcludedWebsitesChanged(array $excludedWebsites, array $websitesToExclude): void
{
$this->getAllWebsites();
- $this->groupExtensionInterface->method('getExcludeWebsiteIds')->willReturn($websitesToExclude);
- $this->groupExcludedWebsiteRepository->method('getCustomerGroupExcludedWebsites')
+ $this->groupExtensionMock->method('getExcludeWebsiteIds')->willReturn($websitesToExclude);
+ $this->groupExcludedWebsiteRepositoryMock->method('getCustomerGroupExcludedWebsites')
->with(1)->willReturn($excludedWebsites);
- $this->groupExcludedWebsiteRepository->expects(self::never())->method('delete');
- $this->groupExcludedWebsiteFactory->expects(self::never())->method('create');
+ $this->groupExcludedWebsiteRepositoryMock->expects(self::never())->method('delete');
+ $this->groupExcludedWebsiteFactoryMock->expects(self::never())->method('create');
- $this->plugin->afterSave($this->groupRepositoryInterface, $this->groupInterface, $this->groupInterface);
+ $this->plugin->afterSave($this->groupRepositoryMock, $this->groupMock, $this->groupMock);
}
/**
@@ -163,8 +154,8 @@ public function testAfterSaveWithNoExcludedWebsitesChanged(array $excludedWebsit
* @param array $excludedWebsites
* @param array $websitesToExclude
* @param int $times
- * @throws \Magento\Framework\Exception\CouldNotSaveException
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws CouldNotSaveException
+ * @throws LocalizedException
*/
public function testAfterSaveWithExcludedWebsitesChanged(
array $excludedWebsites,
@@ -173,28 +164,28 @@ public function testAfterSaveWithExcludedWebsitesChanged(
): void {
$this->getAllWebsites();
- $this->groupExtensionInterface->method('getExcludeWebsiteIds')->willReturn($websitesToExclude);
- $this->groupExcludedWebsiteRepository->method('getCustomerGroupExcludedWebsites')
+ $this->groupExtensionMock->method('getExcludeWebsiteIds')->willReturn($websitesToExclude);
+ $this->groupExcludedWebsiteRepositoryMock->method('getCustomerGroupExcludedWebsites')
->with(1)->willReturn($excludedWebsites);
- $this->groupExcludedWebsiteRepository->expects(self::once())->method('delete');
- $this->groupExcludedWebsiteFactory->expects(self::exactly($times))
- ->method('create')->willReturn($this->groupExcludedWebsite);
- $this->groupExcludedWebsite->expects(self::exactly($times))
+ $this->groupExcludedWebsiteRepositoryMock->expects(self::once())->method('delete');
+ $this->groupExcludedWebsiteFactoryMock->expects(self::exactly($times))
+ ->method('create')->willReturn($this->groupExcludedWebsiteMock);
+ $this->groupExcludedWebsiteMock->expects(self::exactly($times))
->method('setGroupId')
->with(1)
->willReturnSelf();
- $this->groupExcludedWebsite->expects(self::exactly($times))
+ $this->groupExcludedWebsiteMock->expects(self::exactly($times))
->method('setExcludedWebsiteId')->willReturnSelf();
- $this->groupExcludedWebsiteRepository->expects(self::exactly($times))
+ $this->groupExcludedWebsiteRepositoryMock->expects(self::exactly($times))
->method('save')
- ->willReturn($this->groupExcludedWebsiteResourceModel);
+ ->willReturn($this->groupExcludedWebsiteMock);
- $this->priceIndexProcessor->expects(self::once())->method('getIndexer')
- ->willReturn($this->priceIndexer);
- $this->priceIndexer->expects(self::once())->method('invalidate')
+ $this->priceIndexProcessorMock->expects(self::once())->method('getIndexer')
+ ->willReturn($this->priceIndexerMock);
+ $this->priceIndexerMock->expects(self::once())->method('invalidate')
->willReturnSelf();
- $this->plugin->afterSave($this->groupRepositoryInterface, $this->groupInterface, $this->groupInterface);
+ $this->plugin->afterSave($this->groupRepositoryMock, $this->groupMock, $this->groupMock);
}
private function getAllWebsites(): void
@@ -207,7 +198,7 @@ private function getAllWebsites(): void
->setMethods(['getWebsiteId'])
->disableOriginalConstructor()
->getMock();
- $this->store->expects(self::once())->method('getWebsiteCollection')
+ $this->storeMock->expects(self::once())->method('getWebsiteCollection')
->willReturn([$websiteMock1, $websiteMock2]);
$websiteMock1->method('getWebsiteId')->willReturn(1);
$websiteMock2->method('getWebsiteId')->willReturn(2);
@@ -222,7 +213,8 @@ public function dataProviderNoExcludedWebsitesChanged(): array
{
return [
[
- [], []
+ [],
+ []
],
[
['1', '2'],
diff --git a/app/code/Magento/Customer/Test/Unit/Observer/CatalogRule/AddCustomerGroupExcludedWebsiteTest.php b/app/code/Magento/Customer/Test/Unit/Observer/CatalogRule/AddCustomerGroupExcludedWebsiteTest.php
index 2d430975d1f13..77b7359d2d186 100644
--- a/app/code/Magento/Customer/Test/Unit/Observer/CatalogRule/AddCustomerGroupExcludedWebsiteTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Observer/CatalogRule/AddCustomerGroupExcludedWebsiteTest.php
@@ -19,59 +19,58 @@
class AddCustomerGroupExcludedWebsiteTest extends TestCase
{
/** @var GroupExcludedWebsiteRepositoryInterface|MockObject */
- private $groupExcludedWebsiteRepository;
+ private $groupExcludedWebsiteRepositoryMock;
/** @var Collection */
- private $ruleCollection;
+ private $ruleCollectionMock;
/** @var Rule */
- private $rule;
+ private $ruleMock;
/** @var RuleExtension */
- private $ruleExtension;
+ private $ruleExtensionMock;
/** @var Observer */
- private $observer;
+ private $observerMock;
/** @var AddCustomerGroupExcludedWebsite */
- protected $addCustomerGroupExcludedWebsiteObserver;
+ private $observer;
protected function setUp(): void
{
- $this->groupExcludedWebsiteRepository = $this->getMockBuilder(GroupExcludedWebsiteRepositoryInterface::class)
+ $this->groupExcludedWebsiteRepositoryMock = $this->getMockBuilder(GroupExcludedWebsiteRepositoryInterface::class)
->getMockForAbstractClass();
- $this->observer = $this->getMockBuilder(Observer::class)
+ $this->observerMock = $this->getMockBuilder(Observer::class)
->disableOriginalConstructor()
->getMock();
- $this->ruleCollection = $this->getMockBuilder(Collection::class)
+ $this->ruleCollectionMock = $this->getMockBuilder(Collection::class)
->disableOriginalConstructor()
->getMock();
- $this->rule = $this->getMockBuilder(Rule::class)
+ $this->ruleMock = $this->getMockBuilder(Rule::class)
->disableOriginalConstructor()
->getMock();
- $this->ruleExtension = $this->getMockBuilder(RuleExtension::class)
+ $this->ruleExtensionMock = $this->getMockBuilder(RuleExtension::class)
+ ->addMethods(['setExcludeWebsiteIds'])
->disableOriginalConstructor()
->getMock();
- $this->observer->expects(self::atLeastOnce())
+ $this->observerMock->expects(self::atLeastOnce())
->method('getData')
- ->willReturn($this->ruleCollection);
+ ->willReturn($this->ruleCollectionMock);
- $this->addCustomerGroupExcludedWebsiteObserver = new AddCustomerGroupExcludedWebsite(
- $this->groupExcludedWebsiteRepository
- );
+ $this->observer = new AddCustomerGroupExcludedWebsite($this->groupExcludedWebsiteRepositoryMock);
}
public function testExecuteWithoutCatalogRules(): void
{
- $this->ruleCollection->expects(self::once())
+ $this->ruleCollectionMock->expects(self::once())
->method('getItems')
->willReturn([]);
- $this->groupExcludedWebsiteRepository->expects(self::never())
+ $this->groupExcludedWebsiteRepositoryMock->expects(self::never())
->method('getAllExcludedWebsites')
->willReturn([]);
- $this->addCustomerGroupExcludedWebsiteObserver->execute($this->observer);
+ $this->observer->execute($this->observerMock);
}
public function testExecuteWithCustomerGroupExcludedWebsites(): void
@@ -80,33 +79,33 @@ public function testExecuteWithCustomerGroupExcludedWebsites(): void
1 => [2],
3 => [1]
];
- $this->ruleCollection->expects(self::once())
+ $this->ruleCollectionMock->expects(self::once())
->method('getItems')
- ->willReturn([$this->rule]);
+ ->willReturn([$this->ruleMock]);
- $this->groupExcludedWebsiteRepository->expects(self::once())
+ $this->groupExcludedWebsiteRepositoryMock->expects(self::once())
->method('getAllExcludedWebsites')
->willReturn($excludedWebsites);
- $this->rule->expects(self::once())
+ $this->ruleMock->expects(self::once())
->method('getIsActive')
->willReturn(true);
- $this->rule->expects(self::once())
+ $this->ruleMock->expects(self::once())
->method('getCustomerGroupIds')
->willReturn([1, 2, 3, 4]);
- $this->rule->expects(self::once())
+ $this->ruleMock->expects(self::once())
->method('getExtensionAttributes')
- ->willReturn($this->ruleExtension);
- $this->ruleExtension->expects(self::once())
+ ->willReturn($this->ruleExtensionMock);
+ $this->ruleExtensionMock->expects(self::once())
->method('setExcludeWebsiteIds')
->with($excludedWebsites)
->willReturnSelf();
- $this->rule->expects(self::once())
+ $this->ruleMock->expects(self::once())
->method('setExtensionAttributes')
- ->with($this->ruleExtension)
+ ->with($this->ruleExtensionMock)
->willReturnSelf();
- $this->addCustomerGroupExcludedWebsiteObserver->execute($this->observer);
+ $this->observer->execute($this->observerMock);
}
}
diff --git a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js
index 566125dd90921..3e8a2a1853ad4 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js
@@ -120,7 +120,7 @@ define([
storage.remove(sectionName);
sectionDataIds = $.cookieStorage.get('section_data_ids') || {};
_.each(sectionDataIds, function (data, name) {
- if (name != sectionName) { //eslint-disable-line eqeqeq
+ if (name !== sectionName) {
newSectionDataIds[name] = data;
}
});
@@ -266,7 +266,7 @@ define([
if (typeof sectionData === 'undefined' ||
typeof sectionData === 'object' &&
- cookieSectionTimestamp != sectionData['data_id'] //eslint-disable-line
+ cookieSectionTimestamp !== sectionData['data_id']
) {
expiredSectionNames.push(sectionName);
}
diff --git a/app/code/Magento/Customer/view/frontend/web/js/section-config.js b/app/code/Magento/Customer/view/frontend/web/js/section-config.js
index 107a177d0832f..5d3bbd279a201 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/section-config.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/section-config.js
@@ -32,7 +32,7 @@ define(['underscore'], function (_) {
/**
* Returns a list of sections which should be invalidated for given URL.
* @param {String} url - URL which was requested.
- * @return {Array} - List of sections to invalidate.
+ * @return {Object} - List of sections to invalidate.
*/
getAffectedSections: function (url) {
var route = canonize(url),
@@ -55,8 +55,8 @@ define(['underscore'], function (_) {
/**
* Filters the list of given sections to the ones defined as client side.
- * @param {Array} allSections - List of sections to check.
- * @return {Array} - List of filtered sections.
+ * @param {Object} allSections - List of sections to check.
+ * @return {Object} - List of filtered sections.
*/
filterClientSideSections: function (allSections) {
return _.difference(allSections, clientSideSections);
diff --git a/app/code/Magento/Developer/Model/Logger/Handler/Debug.php b/app/code/Magento/Developer/Model/Logger/Handler/Debug.php
index fc659c773c0af..4085744acf423 100644
--- a/app/code/Magento/Developer/Model/Logger/Handler/Debug.php
+++ b/app/code/Magento/Developer/Model/Logger/Handler/Debug.php
@@ -3,18 +3,23 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Developer\Model\Logger\Handler;
+use Exception;
use Magento\Config\Setup\ConfigOptionsList;
-use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\State;
+use Magento\Framework\Exception\FileSystemException;
+use Magento\Framework\Exception\RuntimeException;
use Magento\Framework\Filesystem\DriverInterface;
-use Magento\Framework\App\DeploymentConfig;
+use Magento\Framework\Logger\Handler\Debug as DebugHandler;
/**
* Enable/disable debug logging based on the store config setting
*/
-class Debug extends \Magento\Framework\Logger\Handler\Debug
+class Debug extends DebugHandler
{
/**
* @var State
@@ -30,14 +35,14 @@ class Debug extends \Magento\Framework\Logger\Handler\Debug
* @param DriverInterface $filesystem
* @param State $state
* @param DeploymentConfig $deploymentConfig
- * @param string $filePath
- * @throws \Exception
+ * @param string|null $filePath
+ * @throws Exception
*/
public function __construct(
DriverInterface $filesystem,
State $state,
DeploymentConfig $deploymentConfig,
- $filePath = null
+ ?string $filePath = null
) {
parent::__construct($filesystem, $filePath);
@@ -48,30 +53,34 @@ public function __construct(
/**
* @inheritdoc
*/
- public function isHandling(array $record)
+ public function isHandling(array $record): bool
{
if ($this->deploymentConfig->isAvailable()) {
- return
- parent::isHandling($record)
- && $this->isLoggingEnabled();
+ return parent::isHandling($record) && $this->isLoggingEnabled();
}
return parent::isHandling($record);
}
/**
- * Check that logging functionality is enabled.
+ * Check that logging functionality is enabled
*
* @return bool
+ * @throws FileSystemException
+ * @throws RuntimeException
*/
private function isLoggingEnabled(): bool
{
- $configValue = $this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_DEBUG_LOGGING);
+ $configValue = $this->deploymentConfig->get(
+ ConfigOptionsList::CONFIG_PATH_DEBUG_LOGGING
+ );
+
if ($configValue === null) {
$isEnabled = $this->state->getMode() !== State::MODE_PRODUCTION;
} else {
- $isEnabled = (bool)$configValue;
+ $isEnabled = (bool) $configValue;
}
+
return $isEnabled;
}
}
diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/Template/FilterTest.php
index a455852c94f42..f41988d0664a0 100644
--- a/app/code/Magento/Newsletter/Test/Unit/Model/Template/FilterTest.php
+++ b/app/code/Magento/Newsletter/Test/Unit/Model/Template/FilterTest.php
@@ -7,9 +7,13 @@
namespace Magento\Newsletter\Test\Unit\Model\Template;
+use Magento\Email\Model\Template\Css\Processor;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\State;
+use Magento\Framework\Css\PreProcessor\Adapter\CssInliner;
use Magento\Framework\Escaper;
+use Magento\Framework\Filesystem;
+use Magento\Framework\Filter\VariableResolverInterface;
use Magento\Framework\Stdlib\StringUtils;
use Magento\Framework\UrlInterface;
use Magento\Framework\View\Asset\Repository;
@@ -22,8 +26,8 @@
use Magento\Variable\Model\Source\Variables;
use Magento\Variable\Model\VariableFactory;
use Magento\Widget\Model\ResourceModel\Widget as WidgetResourceModel;
+use Magento\Widget\Model\Widget;
use Magento\Widget\Model\Widget as WidgetModel;
-use Pelago\Emogrifier;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
@@ -73,10 +77,13 @@ protected function setUp(): void
$coreVariableFactory = $this->createPartialMock(VariableFactory::class, ['create']);
$layoutFactory = $this->createPartialMock(LayoutFactory::class, ['create']);
$this->appStateMock = $this->createMock(State::class);
- $emogrifier = $this->createMock(Emogrifier::class);
$configVariables = $this->createMock(Variables::class);
$widgetResource = $this->createMock(WidgetResourceModel::class);
$widget = $this->createMock(WidgetModel::class);
+ $variableResolver = $this->createMock(VariableResolverInterface::class);
+ $cssProcessor = $this->createMock(Processor::class);
+ $pubDirectory = $this->createMock(Filesystem::class);
+ $cssInliner = $this->createMock(CssInliner::class);
$this->filter = new Filter(
$string,
@@ -90,8 +97,11 @@ protected function setUp(): void
$layoutFactory,
$this->appStateMock,
$urlModel,
- $emogrifier,
$configVariables,
+ $variableResolver,
+ $cssProcessor,
+ $pubDirectory,
+ $cssInliner,
$widgetResource,
$widget
);
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
index 7dcf0994ef56b..2d7ec9151d9b4 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
@@ -5,9 +5,10 @@
/* eslint-disable no-undef */
define([
'jquery',
+ 'underscore',
'Magento_Ui/js/grid/columns/column',
'Magento_Ui/js/lib/key-codes'
-], function ($, Column, keyCodes) {
+], function ($, _, Column, keyCodes) {
'use strict';
return Column.extend({
diff --git a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js
index 5f8916ac5ddb7..3c97b002c59e0 100644
--- a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js
+++ b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js
@@ -76,7 +76,7 @@ define([
* Internal method used to normalize argumnets passed
* to 'async' module methods.
*
- * @param {(String|Objetc)} selector
+ * @param {(String|Object)} selector
* @param {(HTMLElement|Object|String)} [ctx]
* @returns {Object}
*/
diff --git a/app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php b/app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php
index 15edec0dd6145..54258a0df9b86 100644
--- a/app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php
+++ b/app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php
@@ -28,17 +28,17 @@ class FixedProductTaxResolverTest extends TestCase
/**
* @var MockObject|ContextInterface
*/
- private $context;
+ private $contextMock;
/**
* @var MockObject|WeeeHelper
*/
- private $weeeHelper;
+ private $weeeHelperMock;
/**
* @var TaxHelper|MockObject
*/
- private $taxHelper;
+ private $taxHelperMock;
/**
* @var FixedProductTax
@@ -84,28 +84,58 @@ class FixedProductTaxResolverTest extends TestCase
]
];
+ /**
+ * @var ContextExtensionInterface|MockObject
+ */
+ private $contextExtensionAttributesMock;
+
+ /**
+ * @var StoreInterface|MockObject
+ */
+ private $storeMock;
+
+ /**
+ * @var CartItemInterface|MockObject
+ */
+ private $cartItemMock;
+
+ /**
+ * @var Field|MockObject
+ */
+ private $fieldMock;
+
+ /**
+ * @var ResolveInfo|MockObject
+ */
+ private $resolveInfoMock;
+
/**
* @inheritdoc
*/
protected function setUp(): void
{
- $this->context = $this->getMockBuilder(ContextInterface::class)
+ $this->contextMock = $this->getMockBuilder(ContextInterface::class)
->setMethods(['getExtensionAttributes'])
->getMockForAbstractClass();
- $this->weeeHelper = $this->getMockBuilder(WeeeHelper::class)
+ $this->weeeHelperMock = $this->getMockBuilder(WeeeHelper::class)
->disableOriginalConstructor()
->onlyMethods(['isEnabled', 'getApplied'])
->getMock();
- $this->taxHelper = $this->getMockBuilder(TaxHelper::class)
+ $this->taxHelperMock = $this->getMockBuilder(TaxHelper::class)
->disableOriginalConstructor()
->onlyMethods(['getPriceDisplayType'])
->getMock();
- $this->resolver = new FixedProductTax(
- $this->weeeHelper,
- $this->taxHelper,
- );
+ $this->contextExtensionAttributesMock = $this->getMockBuilder(ContextExtensionInterface::class)
+ ->addMethods(['getStore'])
+ ->getMock();
+ $this->storeMock = $this->createMock(StoreInterface::class);
+ $this->cartItemMock = $this->createMock(CartItemInterface::class);
+ $this->fieldMock = $this->createMock(Field::class);
+ $this->resolveInfoMock = $this->createMock(ResolveInfo::class);
+
+ $this->resolver = new FixedProductTax($this->weeeHelperMock, $this->taxHelperMock);
}
/**
@@ -116,11 +146,7 @@ public function testShouldThrowException(): void
$this->expectException(LocalizedException::class);
$this->expectExceptionMessageMatches('/value should be specified/');
- $this->resolver->resolve(
- $this->getFieldStub(),
- null,
- $this->getResolveInfoStub()
- );
+ $this->resolver->resolve($this->fieldMock, null, $this->resolveInfoMock);
}
/**
@@ -128,28 +154,25 @@ public function testShouldThrowException(): void
*/
public function testShouldReturnEmptyResult(): void
{
- $store = $this->createMock(StoreInterface::class);
- $cartItem = $this->createMock(CartItemInterface::class);
- $contextExtensionAttributes = $this->createMock(ContextExtensionInterface::class);
- $contextExtensionAttributes->method('getStore')
- ->willreturn($store);
- $this->context->method('getExtensionAttributes')
- ->willReturn($contextExtensionAttributes);
+ $this->contextExtensionAttributesMock->method('getStore')
+ ->willreturn($this->storeMock);
+ $this->contextMock->method('getExtensionAttributes')
+ ->willReturn($this->contextExtensionAttributesMock);
- $this->weeeHelper->method('isEnabled')
- ->with($store)
+ $this->weeeHelperMock->method('isEnabled')
+ ->with($this->storeMock)
->willReturn(false);
- $this->weeeHelper->expects($this->never())
+ $this->weeeHelperMock->expects($this->never())
->method('getApplied');
$this->assertEquals(
[],
$this->resolver->resolve(
- $this->getFieldStub(),
- $this->context,
- $this->getResolveInfoStub(),
- ['model' => $cartItem]
+ $this->fieldMock,
+ $this->contextMock,
+ $this->resolveInfoMock,
+ ['model' => $this->cartItemMock]
)
);
}
@@ -161,34 +184,31 @@ public function testShouldReturnEmptyResult(): void
*/
public function testShouldReturnResult(int $displayType, array $expected): void
{
- $store = $this->createMock(StoreInterface::class);
- $cartItem = $this->createMock(CartItemInterface::class);
- $contextExtensionAttributes = $this->createMock(ContextExtensionInterface::class);
- $contextExtensionAttributes->method('getStore')
- ->willreturn($store);
- $this->context->method('getExtensionAttributes')
- ->willReturn($contextExtensionAttributes);
+ $this->contextExtensionAttributesMock->method('getStore')
+ ->willreturn($this->storeMock);
+ $this->contextMock->method('getExtensionAttributes')
+ ->willReturn($this->contextExtensionAttributesMock);
- $this->weeeHelper->method('isEnabled')
- ->with($store)
+ $this->weeeHelperMock->method('isEnabled')
+ ->with($this->storeMock)
->willReturn(true);
- $this->weeeHelper->expects($this->once())
+ $this->weeeHelperMock->expects($this->once())
->method('getApplied')
->willReturn($this->fpts);
- $this->taxHelper->expects($this->once())
+ $this->taxHelperMock->expects($this->once())
->method('getPriceDisplayType')
->willReturn($displayType);
$this->assertEquals(
$expected,
$this->resolver->resolve(
- $this->getFieldStub(),
- $this->context,
- $this->getResolveInfoStub(),
+ $this->fieldMock,
+ $this->contextMock,
+ $this->resolveInfoMock,
[
- 'model' => $cartItem,
+ 'model' => $this->cartItemMock,
'price' => [
'currency' => 'USD'
]
@@ -257,28 +277,4 @@ public function shouldReturnResultDataProvider(): array
]
];
}
-
- /**
- * @return MockObject|Field
- */
- private function getFieldStub(): Field
- {
- /** @var MockObject|Field $fieldMock */
- $fieldMock = $this->getMockBuilder(Field::class)
- ->disableOriginalConstructor()
- ->getMock();
- return $fieldMock;
- }
-
- /**
- * @return MockObject|ResolveInfo
- */
- private function getResolveInfoStub(): ResolveInfo
- {
- /** @var MockObject|ResolveInfo $resolveInfoMock */
- $resolveInfoMock = $this->getMockBuilder(ResolveInfo::class)
- ->disableOriginalConstructor()
- ->getMock();
- return $resolveInfoMock;
- }
}
diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php
index 623ba8f266fa1..4e117320756ec 100644
--- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php
+++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php
@@ -18,12 +18,13 @@
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Data\Form\FormKey\Validator;
use Magento\Framework\DataObject;
+use Magento\Framework\Event\Manager as EventManager;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Logger\Monolog;
-use Magento\Framework\Message\Manager;
+use Magento\Framework\Message\Manager as MessageManager;
+use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\Url;
-use Magento\Wishlist\Controller\Index\Remove;
use Magento\Wishlist\Controller\Index\UpdateItemOptions;
use Magento\Wishlist\Controller\WishlistProvider;
use Magento\Wishlist\Helper\Data;
@@ -41,62 +42,62 @@ class UpdateItemOptionsTest extends TestCase
/**
* @var ProductRepository|MockObject
*/
- protected $productRepository;
+ private $productRepositoryMock;
/**
* @var WishlistProvider|MockObject
*/
- protected $wishlistProvider;
+ private $wishlistProviderMock;
/**
* @var Context|MockObject
*/
- protected $context;
+ private $contextMock;
/**
* @var Http|MockObject
*/
- protected $request;
+ private $requestMock;
/**
* @var ObjectManager|MockObject
*/
- protected $om;
+ private $objectManagerMock;
/**
- * @var Manager|MockObject
+ * @var MessageManager|MockObject
*/
- protected $messageManager;
+ private $messageManagerMock;
/**
* @var Url|MockObject
*/
- protected $url;
+ private $urlMock;
/**
* @var Session|MockObject
*/
- protected $customerSession;
+ private $customerSessionMock;
/**
- * @var \Magento\Framework\Event\Manager|MockObject
+ * @var EventManager|MockObject
*/
- protected $eventManager;
+ private $eventManagerMock;
/**
* @var ResultFactory|MockObject
*/
- protected $resultFactoryMock;
+ private $resultFactoryMock;
/**
* @var Redirect|MockObject
*/
- protected $resultRedirectMock;
+ private $resultRedirectMock;
/**
* @var Validator|MockObject
*/
- protected $formKeyValidator;
+ private $formKeyValidator;
/**
* SetUp method
@@ -105,30 +106,24 @@ class UpdateItemOptionsTest extends TestCase
*/
protected function setUp(): void
{
- $this->productRepository = $this->createMock(ProductRepository::class);
- $this->context = $this->createMock(Context::class);
- $this->request = $this->createMock(Http::class);
- $this->wishlistProvider = $this->createMock(WishlistProvider::class);
- $this->om = $this->createMock(ObjectManager::class);
- $this->messageManager = $this->createMock(Manager::class);
- $this->url = $this->createMock(Url::class);
- $this->customerSession = $this->createMock(Session::class);
- $this->eventManager = $this->createMock(\Magento\Framework\Event\Manager::class);
- $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class)
- ->disableOriginalConstructor()
- ->getMock();
- $this->resultRedirectMock = $this->getMockBuilder(Redirect::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->resultFactoryMock->expects($this->any())
+ $this->productRepositoryMock = $this->createMock(ProductRepository::class);
+ $this->contextMock = $this->createMock(Context::class);
+ $this->requestMock = $this->createMock(Http::class);
+ $this->wishlistProviderMock = $this->createMock(WishlistProvider::class);
+ $this->objectManagerMock = $this->createMock(ObjectManagerInterface::class);
+ $this->messageManagerMock = $this->createMock(MessageManager::class);
+ $this->urlMock = $this->createMock(Url::class);
+ $this->customerSessionMock = $this->createMock(Session::class);
+ $this->eventManagerMock = $this->createMock(EventManager::class);
+ $this->resultFactoryMock = $this->createMock(ResultFactory::class);
+ $this->resultRedirectMock = $this->createMock(Redirect::class);
+ $this->formKeyValidator = $this->createMock(Validator::class);
+
+ $this->resultFactoryMock
->method('create')
->with(ResultFactory::TYPE_REDIRECT, [])
->willReturn($this->resultRedirectMock);
- $this->formKeyValidator = $this->getMockBuilder(Validator::class)
- ->disableOriginalConstructor()
- ->getMock();
}
/**
@@ -139,14 +134,14 @@ protected function setUp(): void
protected function tearDown(): void
{
unset(
- $this->productRepository,
- $this->context,
- $this->request,
- $this->wishlistProvider,
- $this->om,
- $this->messageManager,
- $this->url,
- $this->eventManager
+ $this->productRepositoryMock,
+ $this->contextMock,
+ $this->requestMock,
+ $this->wishlistProviderMock,
+ $this->objectManagerMock,
+ $this->messageManagerMock,
+ $this->urlMock,
+ $this->eventManagerMock
);
}
@@ -155,35 +150,29 @@ protected function tearDown(): void
*
* @return void
*/
- public function prepareContext()
+ private function prepareContext(): void
{
$actionFlag = $this->createMock(ActionFlag::class);
- $this->context
- ->expects($this->any())
+ $this->contextMock
->method('getObjectManager')
- ->willReturn($this->om);
- $this->context
- ->expects($this->any())
+ ->willReturn($this->objectManagerMock);
+ $this->contextMock
->method('getRequest')
- ->willReturn($this->request);
- $this->context
- ->expects($this->any())
+ ->willReturn($this->requestMock);
+ $this->contextMock
->method('getEventManager')
- ->willReturn($this->eventManager);
- $this->context
- ->expects($this->any())
+ ->willReturn($this->eventManagerMock);
+ $this->contextMock
->method('getUrl')
- ->willReturn($this->url);
- $this->context
- ->expects($this->any())
+ ->willReturn($this->urlMock);
+ $this->contextMock
->method('getActionFlag')
->willReturn($actionFlag);
- $this->context
- ->expects($this->any())
+ $this->contextMock
->method('getMessageManager')
- ->willReturn($this->messageManager);
- $this->context->expects($this->any())
+ ->willReturn($this->messageManagerMock);
+ $this->contextMock
->method('getResultFactory')
->willReturn($this->resultFactoryMock);
}
@@ -191,47 +180,35 @@ public function prepareContext()
/**
* Get controller
*
+ * @param bool $formKeyValid
* @return UpdateItemOptions
*/
- protected function getController()
+ private function getController(bool $formKeyValid = true): UpdateItemOptions
{
$this->prepareContext();
$this->formKeyValidator->expects($this->once())
->method('validate')
- ->with($this->request)
- ->willReturn(true);
+ ->with($this->requestMock)
+ ->willReturn($formKeyValid);
return new UpdateItemOptions(
- $this->context,
- $this->customerSession,
- $this->wishlistProvider,
- $this->productRepository,
+ $this->contextMock,
+ $this->customerSessionMock,
+ $this->wishlistProviderMock,
+ $this->productRepositoryMock,
$this->formKeyValidator
);
}
- public function testExecuteWithInvalidFormKey()
+ public function testExecuteWithInvalidFormKey(): void
{
- $this->prepareContext();
-
- $this->formKeyValidator->expects($this->once())
- ->method('validate')
- ->with($this->request)
- ->willReturn(false);
-
$this->resultRedirectMock->expects($this->once())
->method('setPath')
->with('*/*/')
->willReturnSelf();
- $controller = new Remove(
- $this->context,
- $this->wishlistProvider,
- $this->formKeyValidator
- );
-
- $this->assertSame($this->resultRedirectMock, $controller->execute());
+ $this->assertSame($this->resultRedirectMock, $this->getController(false)->execute());
}
/**
@@ -239,9 +216,9 @@ public function testExecuteWithInvalidFormKey()
*
* @return void
*/
- public function testExecuteWithoutProductId()
+ public function testExecuteWithoutProductId(): void
{
- $this->request
+ $this->requestMock
->expects($this->once())
->method('getParam')
->with('product')
@@ -259,21 +236,21 @@ public function testExecuteWithoutProductId()
*
* @return void
*/
- public function testExecuteWithoutProduct()
+ public function testExecuteWithoutProduct(): void
{
- $this->request
+ $this->requestMock
->expects($this->once())
->method('getParam')
->with('product')
->willReturn(2);
- $this->productRepository
+ $this->productRepositoryMock
->expects($this->once())
->method('getById')
->with(2)
->willThrowException(new NoSuchEntityException());
- $this->messageManager
+ $this->messageManagerMock
->expects($this->once())
->method('addErrorMessage')
->with('We can\'t specify a product.')
@@ -291,7 +268,7 @@ public function testExecuteWithoutProduct()
*
* @return void
*/
- public function testExecuteWithoutWishList()
+ public function testExecuteWithoutWishList(): void
{
$product = $this->createMock(Product::class);
$item = $this->createMock(Item::class);
@@ -301,24 +278,24 @@ public function testExecuteWithoutWishList()
->method('isVisibleInCatalog')
->willReturn(true);
- $this->request
+ $this->requestMock
->expects($this->at(0))
->method('getParam')
->with('product', null)
->willReturn(2);
- $this->request
+ $this->requestMock
->expects($this->at(1))
->method('getParam')
->with('id', null)
->willReturn(3);
- $this->productRepository
+ $this->productRepositoryMock
->expects($this->once())
->method('getById')
->with(2)
->willReturn($product);
- $this->messageManager
+ $this->messageManagerMock
->expects($this->never())
->method('addErrorMessage')
->with('We can\'t specify a product.')
@@ -335,13 +312,13 @@ public function testExecuteWithoutWishList()
->with('getWishlistId')
->willReturn(12);
- $this->wishlistProvider
+ $this->wishlistProviderMock
->expects($this->once())
->method('getWishlist')
->with(12)
->willReturn(null);
- $this->om
+ $this->objectManagerMock
->expects($this->once())
->method('create')
->with(Item::class)
@@ -360,7 +337,7 @@ public function testExecuteWithoutWishList()
* @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
- public function testExecuteAddSuccessException()
+ public function testExecuteAddSuccessException(): void
{
$wishlist = $this->createMock(Wishlist::class);
$product = $this->createMock(Product::class);
@@ -400,18 +377,18 @@ public function testExecuteAddSuccessException()
->method('getName')
->willReturn('Test name');
- $this->request
+ $this->requestMock
->expects($this->at(0))
->method('getParam')
->with('product', null)
->willReturn(2);
- $this->request
+ $this->requestMock
->expects($this->at(1))
->method('getParam')
->with('id', null)
->willReturn(3);
- $this->productRepository
+ $this->productRepositoryMock
->expects($this->once())
->method('getById')
->with(2)
@@ -428,41 +405,41 @@ public function testExecuteAddSuccessException()
->with('getWishlistId')
->willReturn(12);
- $this->wishlistProvider
+ $this->wishlistProviderMock
->expects($this->once())
->method('getWishlist')
->with(12)
->willReturn($wishlist);
- $this->om
+ $this->objectManagerMock
->expects($this->once())
->method('create')
->with(Item::class)
->willReturn($item);
- $this->request
+ $this->requestMock
->expects($this->once())
->method('getParams')
->willReturn([]);
- $this->om
+ $this->objectManagerMock
->expects($this->exactly(2))
->method('get')
->with(Data::class)
->willReturn($helper);
- $this->eventManager
+ $this->eventManagerMock
->expects($this->once())
->method('dispatch')
->with('wishlist_update_item', ['wishlist' => $wishlist, 'product' => $product, 'item' => $item])
->willReturn(true);
- $this->messageManager
+ $this->messageManagerMock
->expects($this->once())
->method('addSuccessMessage')
->with('Test name has been updated in your Wish List.', null)
->willThrowException(new LocalizedException(__('error-message')));
- $this->messageManager
+ $this->messageManagerMock
->expects($this->once())
->method('addErrorMessage')
->with('error-message', null)
@@ -481,7 +458,7 @@ public function testExecuteAddSuccessException()
* @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
- public function testExecuteAddSuccessCriticalException()
+ public function testExecuteAddSuccessCriticalException(): void
{
$wishlist = $this->createMock(Wishlist::class);
$product = $this->createMock(Product::class);
@@ -493,8 +470,7 @@ public function testExecuteAddSuccessCriticalException()
$logger
->expects($this->once())
->method('critical')
- ->with($exception)
- ->willReturn(true);
+ ->with($exception);
$helper
->expects($this->exactly(2))
@@ -529,18 +505,18 @@ public function testExecuteAddSuccessCriticalException()
->method('getName')
->willReturn('Test name');
- $this->request
+ $this->requestMock
->expects($this->at(0))
->method('getParam')
->with('product', null)
->willReturn(2);
- $this->request
+ $this->requestMock
->expects($this->at(1))
->method('getParam')
->with('id', null)
->willReturn(3);
- $this->productRepository
+ $this->productRepositoryMock
->expects($this->once())
->method('getById')
->with(2)
@@ -557,51 +533,51 @@ public function testExecuteAddSuccessCriticalException()
->with('getWishlistId')
->willReturn(12);
- $this->wishlistProvider
+ $this->wishlistProviderMock
->expects($this->once())
->method('getWishlist')
->with(12)
->willReturn($wishlist);
- $this->om
+ $this->objectManagerMock
->expects($this->once())
->method('create')
->with(Item::class)
->willReturn($item);
- $this->request
+ $this->requestMock
->expects($this->once())
->method('getParams')
->willReturn([]);
- $this->om
+ $this->objectManagerMock
->expects($this->at(1))
->method('get')
->with(Data::class)
->willReturn($helper);
- $this->om
+ $this->objectManagerMock
->expects($this->at(2))
->method('get')
->with(Data::class)
->willReturn($helper);
- $this->om
+ $this->objectManagerMock
->expects($this->at(3))
->method('get')
->with(LoggerInterface::class)
->willReturn($logger);
- $this->eventManager
+ $this->eventManagerMock
->expects($this->once())
->method('dispatch')
->with('wishlist_update_item', ['wishlist' => $wishlist, 'product' => $product, 'item' => $item])
->willReturn(true);
- $this->messageManager
+ $this->messageManagerMock
->expects($this->once())
->method('addSuccessMessage')
->with('Test name has been updated in your Wish List.', null)
->willThrowException($exception);
- $this->messageManager
+ $this->messageManagerMock
->expects($this->once())
->method('addErrorMessage')
->with('We can\'t update your Wish List right now.', null)
diff --git a/composer.json b/composer.json
index 35429831d19b2..c36f93c7f75f6 100644
--- a/composer.json
+++ b/composer.json
@@ -63,7 +63,7 @@
"magento/composer": "1.7.0",
"magento/magento-composer-installer": ">=0.1.11",
"magento/zendframework1": "~1.14.2",
- "monolog/monolog": "^1.17",
+ "monolog/monolog": "^2.3",
"pelago/emogrifier": "^5.0.0",
"php-amqplib/php-amqplib": "~3.0.0",
"phpseclib/mcrypt_compat": "1.0.8",
@@ -81,7 +81,7 @@
"require-dev": {
"allure-framework/allure-phpunit": "~1.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
- "friendsofphp/php-cs-fixer": "~2.18.1",
+ "friendsofphp/php-cs-fixer": "~3.0.0",
"lusitanian/oauth": "~0.8.10",
"magento/magento-coding-standard": "*",
"magento/magento2-functional-testing-framework": "^3.0",
diff --git a/composer.lock b/composer.lock
index 3ec41c2164283..bf3fd98bbd49e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "ebdb58747a71078cfbcba5524b46599b",
+ "content-hash": "fb578a81f7a819082165f73582c28dc2",
"packages": [
{
"name": "aws/aws-sdk-php",
@@ -1797,16 +1797,16 @@
},
{
"name": "laminas/laminas-escaper",
- "version": "2.7.0",
+ "version": "2.8.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-escaper.git",
- "reference": "5e04bc5ae5990b17159d79d331055e2c645e5cc5"
+ "reference": "2d6dce99668b413610e9544183fa10392437f542"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/5e04bc5ae5990b17159d79d331055e2c645e5cc5",
- "reference": "5e04bc5ae5990b17159d79d331055e2c645e5cc5",
+ "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/2d6dce99668b413610e9544183fa10392437f542",
+ "reference": "2d6dce99668b413610e9544183fa10392437f542",
"shasum": ""
},
"require": {
@@ -1817,7 +1817,7 @@
"zendframework/zend-escaper": "^2.6.1"
},
"require-dev": {
- "laminas/laminas-coding-standard": "~1.0.0",
+ "laminas/laminas-coding-standard": "~2.3.0",
"phpunit/phpunit": "^9.3",
"psalm/plugin-phpunit": "^0.12.2",
"vimeo/psalm": "^3.16"
@@ -1856,7 +1856,7 @@
"type": "community_bridge"
}
],
- "time": "2020-11-17T21:26:43+00:00"
+ "time": "2021-06-26T14:26:08+00:00"
},
{
"name": "laminas/laminas-eventmanager",
@@ -3733,21 +3733,21 @@
},
{
"name": "monolog/monolog",
- "version": "1.26.1",
+ "version": "2.3.2",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5"
+ "reference": "71312564759a7db5b789296369c1a264efc43aad"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c6b00f05152ae2c9b04a448f99c7590beb6042f5",
- "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad",
+ "reference": "71312564759a7db5b789296369c1a264efc43aad",
"shasum": ""
},
"require": {
- "php": ">=5.3.0",
- "psr/log": "~1.0"
+ "php": ">=7.2",
+ "psr/log": "^1.0.1"
},
"provide": {
"psr/log-implementation": "1.0.0"
@@ -3755,29 +3755,39 @@
"require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev",
- "graylog2/gelf-php": "~1.0",
+ "elasticsearch/elasticsearch": "^7",
+ "graylog2/gelf-php": "^1.4.2",
+ "mongodb/mongodb": "^1.8",
"php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3",
- "phpstan/phpstan": "^0.12.59",
- "phpunit/phpunit": "~4.5",
- "ruflin/elastica": ">=0.90 <3.0",
- "sentry/sentry": "^0.13",
+ "phpspec/prophecy": "^1.6.1",
+ "phpstan/phpstan": "^0.12.91",
+ "phpunit/phpunit": "^8.5",
+ "predis/predis": "^1.1",
+ "rollbar/rollbar": "^1.3",
+ "ruflin/elastica": ">=0.90 <7.0.1",
"swiftmailer/swiftmailer": "^5.3|^6.0"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
+ "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
- "ext-mongo": "Allow sending log messages to a MongoDB server",
+ "ext-mbstring": "Allow to work properly with unicode symbols",
+ "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
- "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
+ "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"php-console/php-console": "Allow sending log messages to Google Chrome",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
- "ruflin/elastica": "Allow sending log messages to an Elastic Search server",
- "sentry/sentry": "Allow sending log messages to a Sentry server"
+ "ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.x-dev"
+ }
+ },
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
@@ -3791,11 +3801,11 @@
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
- "homepage": "http://seld.be"
+ "homepage": "https://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
- "homepage": "http://github.com/Seldaek/monolog",
+ "homepage": "https://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
@@ -3803,7 +3813,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
- "source": "https://github.com/Seldaek/monolog/tree/1.26.1"
+ "source": "https://github.com/Seldaek/monolog/tree/2.3.2"
},
"funding": [
{
@@ -3815,7 +3825,7 @@
"type": "tidelift"
}
],
- "time": "2021-05-28T08:32:12+00:00"
+ "time": "2021-07-23T07:42:52+00:00"
},
{
"name": "mtdowling/jmespath.php",
@@ -8781,57 +8791,54 @@
},
{
"name": "friendsofphp/php-cs-fixer",
- "version": "v2.18.7",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
- "reference": "b3281bbe07e8d45759e9e3e8032b4c5fa3463b21"
+ "reference": "990b979379502feb7f393d6c9aa36cc9b9765f24"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/b3281bbe07e8d45759e9e3e8032b4c5fa3463b21",
- "reference": "b3281bbe07e8d45759e9e3e8032b4c5fa3463b21",
+ "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/990b979379502feb7f393d6c9aa36cc9b9765f24",
+ "reference": "990b979379502feb7f393d6c9aa36cc9b9765f24",
"shasum": ""
},
"require": {
- "composer/semver": "^1.4 || ^2.0 || ^3.0",
- "composer/xdebug-handler": "^1.2 || ^2.0",
- "doctrine/annotations": "^1.2",
+ "composer/semver": "^3.2",
+ "composer/xdebug-handler": "^2.0",
+ "doctrine/annotations": "^1.12",
"ext-json": "*",
"ext-tokenizer": "*",
- "php": "^5.6 || ^7.0 || ^8.0",
- "php-cs-fixer/diff": "^1.3",
- "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0",
- "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0",
- "symfony/filesystem": "^3.0 || ^4.0 || ^5.0",
- "symfony/finder": "^3.0 || ^4.0 || ^5.0",
- "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0",
- "symfony/polyfill-php70": "^1.0",
- "symfony/polyfill-php72": "^1.4",
- "symfony/process": "^3.0 || ^4.0 || ^5.0",
- "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0"
- },
- "require-dev": {
- "justinrainbow/json-schema": "^5.0",
+ "php": "^7.1.3 || ^8.0",
+ "php-cs-fixer/diff": "^2.0",
+ "symfony/console": "^4.4.20 || ^5.1.3",
+ "symfony/event-dispatcher": "^4.4.20 || ^5.0",
+ "symfony/filesystem": "^4.4.20 || ^5.0",
+ "symfony/finder": "^4.4.20 || ^5.0",
+ "symfony/options-resolver": "^4.4.20 || ^5.0",
+ "symfony/polyfill-php72": "^1.22",
+ "symfony/process": "^4.4.20 || ^5.0",
+ "symfony/stopwatch": "^4.4.20 || ^5.0"
+ },
+ "require-dev": {
+ "justinrainbow/json-schema": "^5.2",
"keradus/cli-executor": "^1.4",
- "mikey179/vfsstream": "^1.6",
- "php-coveralls/php-coveralls": "^2.4.2",
- "php-cs-fixer/accessible-object": "^1.0",
+ "mikey179/vfsstream": "^1.6.8",
+ "php-coveralls/php-coveralls": "^2.4.3",
+ "php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1",
+ "phpspec/prophecy": "^1.10.3",
"phpspec/prophecy-phpunit": "^1.1 || ^2.0",
- "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.13 || ^9.5",
+ "phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5",
"phpunitgoodpractices/polyfill": "^1.5",
"phpunitgoodpractices/traits": "^1.9.1",
- "sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1",
- "symfony/phpunit-bridge": "^5.2.1",
- "symfony/yaml": "^3.0 || ^4.0 || ^5.0"
+ "symfony/phpunit-bridge": "^5.2.4",
+ "symfony/yaml": "^4.4.20 || ^5.0"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters.",
- "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.",
- "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.",
"symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible."
},
"bin": [
@@ -8841,20 +8848,7 @@
"autoload": {
"psr-4": {
"PhpCsFixer\\": "src/"
- },
- "classmap": [
- "tests/Test/AbstractFixerTestCase.php",
- "tests/Test/AbstractIntegrationCaseFactory.php",
- "tests/Test/AbstractIntegrationTestCase.php",
- "tests/Test/Assert/AssertTokensTrait.php",
- "tests/Test/IntegrationCase.php",
- "tests/Test/IntegrationCaseFactory.php",
- "tests/Test/IntegrationCaseFactoryInterface.php",
- "tests/Test/InternalIntegrationCaseFactory.php",
- "tests/Test/IsIdenticalConstraint.php",
- "tests/Test/TokensWithObservedTransformers.php",
- "tests/TestCase.php"
- ]
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -8873,7 +8867,7 @@
"description": "A tool to automatically fix PHP code style",
"support": {
"issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues",
- "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.7"
+ "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.0.2"
},
"funding": [
{
@@ -8881,7 +8875,7 @@
"type": "github"
}
],
- "time": "2021-05-03T21:36:45+00:00"
+ "time": "2021-08-04T19:28:19+00:00"
},
{
"name": "hoa/consistency",
@@ -9777,27 +9771,27 @@
},
{
"name": "magento/magento2-functional-testing-framework",
- "version": "3.5.1",
+ "version": "3.6.0",
"source": {
"type": "git",
"url": "https://github.com/magento/magento2-functional-testing-framework.git",
- "reference": "5a6bdf511182151a6c357b788eb0c3f2fd89954a"
+ "reference": "d0350979b7c02ca5329d61d1cce2760d14170e90"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/5a6bdf511182151a6c357b788eb0c3f2fd89954a",
- "reference": "5a6bdf511182151a6c357b788eb0c3f2fd89954a",
+ "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/d0350979b7c02ca5329d61d1cce2760d14170e90",
+ "reference": "d0350979b7c02ca5329d61d1cce2760d14170e90",
"shasum": ""
},
"require": {
- "allure-framework/allure-codeception": "~1.4.0||~1.5.0",
+ "allure-framework/allure-codeception": "^1.4",
"aws/aws-sdk-php": "^3.132",
- "codeception/codeception": "~4.1.4",
+ "codeception/codeception": "^4.1",
"codeception/module-asserts": "^1.1",
"codeception/module-sequence": "^1.0",
"codeception/module-webdriver": "^1.0",
"composer/composer": "^1.9||^2.0",
- "csharpru/vault-php": "^4.1.0",
+ "csharpru/vault-php": "^4.2.1",
"csharpru/vault-php-guzzle6-transport": "^2.0",
"ext-curl": "*",
"ext-dom": "*",
@@ -9805,11 +9799,11 @@
"ext-json": "*",
"ext-openssl": "*",
"hoa/console": "~3.0",
- "monolog/monolog": "^1.17",
+ "monolog/monolog": "^2.3",
"mustache/mustache": "~2.5",
- "nikic/php-parser": "~4.4.0",
+ "nikic/php-parser": "^4.4",
"php": "^7.3",
- "php-webdriver/webdriver": "^1.8.0",
+ "php-webdriver/webdriver": "^1.9.0",
"spomky-labs/otphp": "^10.0",
"symfony/console": "^4.4",
"symfony/finder": "^5.0",
@@ -9819,22 +9813,15 @@
"vlucas/phpdotenv": "^2.4",
"weew/helpers-array": "^1.3"
},
- "replace": {
- "facebook/webdriver": "^1.7.1"
- },
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.3.1",
"codacy/coverage": "^1.4",
"codeception/aspect-mock": "^3.0",
- "doctrine/cache": "<1.7.0",
- "goaop/framework": "~2.3.4",
- "php-coveralls/php-coveralls": "^1.0",
+ "php-coveralls/php-coveralls": "^1.0||^2.2",
"phpmd/phpmd": "^2.8.0",
"phpunit/phpunit": "^9.0",
- "rregeer/phpunit-coverage-check": "^0.1.4",
"sebastian/phpcpd": "~6.0.0",
- "squizlabs/php_codesniffer": "~3.5.4",
- "symfony/stopwatch": "~3.4.6"
+ "squizlabs/php_codesniffer": "~3.5.4"
},
"bin": [
"bin/mftf"
@@ -9867,9 +9854,9 @@
],
"support": {
"issues": "https://github.com/magento/magento2-functional-testing-framework/issues",
- "source": "https://github.com/magento/magento2-functional-testing-framework/tree/3.5.1"
+ "source": "https://github.com/magento/magento2-functional-testing-framework/tree/3.6.0"
},
- "time": "2021-05-05T15:01:30+00:00"
+ "time": "2021-07-23T16:10:15+00:00"
},
{
"name": "mustache/mustache",
@@ -10215,16 +10202,16 @@
},
{
"name": "php-cs-fixer/diff",
- "version": "v1.3.1",
+ "version": "v2.0.2",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/diff.git",
- "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759"
+ "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759",
- "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759",
+ "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/29dc0d507e838c4580d018bd8b5cb412474f7ec3",
+ "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3",
"shasum": ""
},
"require": {
@@ -10252,52 +10239,51 @@
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
- },
- {
- "name": "SpacePossum"
}
],
- "description": "sebastian/diff v2 backport support for PHP5.6",
+ "description": "sebastian/diff v3 backport support for PHP 5.6+",
"homepage": "https://github.com/PHP-CS-Fixer",
"keywords": [
"diff"
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/diff/issues",
- "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1"
+ "source": "https://github.com/PHP-CS-Fixer/diff/tree/v2.0.2"
},
- "time": "2020-10-14T08:39:05+00:00"
+ "time": "2020-10-14T08:32:19+00:00"
},
{
"name": "php-webdriver/webdriver",
- "version": "1.8.2",
+ "version": "1.11.1",
"source": {
"type": "git",
"url": "https://github.com/php-webdriver/php-webdriver.git",
- "reference": "3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab"
+ "reference": "da16e39968f8dd5cfb7d07eef91dc2b731c69880"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab",
- "reference": "3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab",
+ "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/da16e39968f8dd5cfb7d07eef91dc2b731c69880",
+ "reference": "da16e39968f8dd5cfb7d07eef91dc2b731c69880",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-zip": "*",
- "php": "^5.6 || ~7.0",
+ "php": "^5.6 || ~7.0 || ^8.0",
"symfony/polyfill-mbstring": "^1.12",
"symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0"
},
+ "replace": {
+ "facebook/webdriver": "*"
+ },
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
- "jakub-onderka/php-parallel-lint": "^1.0",
- "php-coveralls/php-coveralls": "^2.0",
- "php-mock/php-mock-phpunit": "^1.1",
- "phpunit/phpunit": "^5.7",
- "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0",
- "sminnee/phpunit-mock-objects": "^3.4",
+ "ondram/ci-detector": "^2.1 || ^3.5 || ^4.0",
+ "php-coveralls/php-coveralls": "^2.4",
+ "php-mock/php-mock-phpunit": "^1.1 || ^2.0",
+ "php-parallel-lint/php-parallel-lint": "^1.2",
+ "phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9",
"squizlabs/php_codesniffer": "^3.5",
"symfony/var-dumper": "^3.3 || ^4.0 || ^5.0"
},
@@ -10305,11 +10291,6 @@
"ext-SimpleXML": "For Firefox profile creation"
},
"type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.8.x-dev"
- }
- },
"autoload": {
"psr-4": {
"Facebook\\WebDriver\\": "lib/"
@@ -10333,9 +10314,9 @@
],
"support": {
"issues": "https://github.com/php-webdriver/php-webdriver/issues",
- "source": "https://github.com/php-webdriver/php-webdriver/tree/1.8.2"
+ "source": "https://github.com/php-webdriver/php-webdriver/tree/1.11.1"
},
- "time": "2020-03-04T14:40:12+00:00"
+ "time": "2021-05-21T15:12:49+00:00"
},
{
"name": "phpcompatibility/php-compatibility",
@@ -12534,74 +12515,6 @@
],
"time": "2021-05-26T17:43:10+00:00"
},
- {
- "name": "symfony/polyfill-php70",
- "version": "v1.20.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-php70.git",
- "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644",
- "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644",
- "shasum": ""
- },
- "require": {
- "php": ">=7.1"
- },
- "type": "metapackage",
- "extra": {
- "branch-alias": {
- "dev-main": "1.20-dev"
- },
- "thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "polyfill",
- "portable",
- "shim"
- ],
- "support": {
- "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0"
- },
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "time": "2020-10-23T14:02:19+00:00"
- },
{
"name": "symfony/stopwatch",
"version": "v5.3.0",
diff --git a/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/Logger.php b/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/Logger.php
index 88f08a1ee4103..dc7ad37426150 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/Logger.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/Logger.php
@@ -3,11 +3,14 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\TestFramework\ErrorLog;
+use Magento\Framework\Logger\Monolog;
use Monolog\Handler\HandlerInterface;
-class Logger extends \Magento\Framework\Logger\Monolog
+class Logger extends Monolog
{
/**
* @var array
@@ -16,27 +19,33 @@ class Logger extends \Magento\Framework\Logger\Monolog
/**
* Minimum error level to log message
- * Possible values: -1 ignore all errors, and level constants form http://tools.ietf.org/html/rfc5424 standard
+ * Possible values: -1 ignore all errors,
+ * and level constants form http://tools.ietf.org/html/rfc5424 standard
*
* @var int
*/
protected $minimumErrorLevel;
/**
- * @param string $name The logging channel
- * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc
- * @param callable[] $processors Optional array of processors
+ * @param string $name The logging channel
+ * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc
+ * @param callable[] $processors Optional array of processors
*/
- public function __construct($name, array $handlers = [], array $processors = [])
- {
- $this->minimumErrorLevel = defined('TESTS_ERROR_LOG_LISTENER_LEVEL') ? TESTS_ERROR_LOG_LISTENER_LEVEL : -1;
+ public function __construct(
+ string $name,
+ array $handlers = [],
+ array $processors = []
+ ) {
+ $this->minimumErrorLevel = defined('TESTS_ERROR_LOG_LISTENER_LEVEL')
+ ? TESTS_ERROR_LOG_LISTENER_LEVEL
+ : -1;
parent::__construct($name, $handlers, $processors);
}
/**
* @return void
*/
- public function clearMessages()
+ public function clearMessages(): void
{
$this->messages = [];
}
@@ -44,21 +53,24 @@ public function clearMessages()
/**
* @return array
*/
- public function getMessages()
+ public function getMessages(): array
{
return $this->messages;
}
/**
- * @{inheritDoc}
+ * @inheritdoc
*
- * @param integer $level The logging level
- * @param string $message The log message
- * @param array $context The log context
- * @return Boolean Whether the record has been processed
+ * @param int $level The logging level
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return bool Whether the record has been processed
*/
- public function addRecord($level, $message, array $context = [])
- {
+ public function addRecord(
+ int $level,
+ string $message,
+ array $context = []
+ ): bool {
if ($level <= $this->minimumErrorLevel) {
$this->messages[] = [
'level' => $this->getLevelName($level),
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php
index c2f571097f8e9..ddcae97e5d6d5 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php
@@ -124,10 +124,31 @@ public function testImportExport(array $fixtures, array $skus, array $skippedAtt
$csvFile = $this->executeExportTest($skus, $skippedAttributes);
$this->executeImportReplaceTest($skus, $skippedAttributes, false, $csvFile);
- $this->executeImportReplaceTest($skus, $skippedAttributes, true, $csvFile);
$this->executeImportDeleteTest($skus, $csvFile);
}
+ /**
+ * Run import/export test with pagination.
+ *
+ * @magentoAppArea adminhtml
+ * @magentoDbIsolation disabled
+ * @magentoAppIsolation enabled
+ *
+ * @param array $fixtures
+ * @param string[] $skus
+ * @param string[] $skippedAttributes
+ * @dataProvider exportImportDataProvider
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
+ */
+ public function testImportExportWithPagination(array $fixtures, array $skus, array $skippedAttributes = [])
+ {
+ $this->fixtures = $fixtures;
+ $this->executeFixtures($fixtures);
+ $this->modifyData($skus);
+ $skippedAttributes = array_merge(self::$skippedAttributes, $skippedAttributes);
+ $this->executeImportReplaceTest($skus, $skippedAttributes, true);
+ }
+
/**
* Provide data for import/export.
*
diff --git a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php
index 861be98c13e72..4f9fbfe61e032 100644
--- a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php
+++ b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php
@@ -49,6 +49,25 @@ public function testImportExport(array $fixtures, array $skus, array $skippedAtt
parent::testImportExport($fixtures, $skus, $skippedAttributes);
}
+ /**
+ * Run import/export test with pagination.
+ *
+ * @magentoAppArea adminhtml
+ * @magentoDbIsolation disabled
+ * @magentoAppIsolation enabled
+ *
+ * @param array $fixtures
+ * @param string[] $skus
+ * @param string[] $skippedAttributes
+ * @dataProvider exportImportDataProvider
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function testImportExportWithPagination(array $fixtures, array $skus, array $skippedAttributes = [])
+ {
+ $skippedAttributes = array_merge(self::$skippedAttributes, ['downloadable_links']);
+ parent::testImportExportWithPagination($fixtures, $skus, $skippedAttributes);
+ }
+
/**
* @inheritdoc
*/
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js
index 952ade30969d5..e516c3f19d64a 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js
@@ -3,17 +3,17 @@
* See COPYING.txt for license details.
*/
-/* global _ */
/* eslint max-nested-callbacks: 0 */
/* jscs:disable jsDoc*/
define([
+ 'underscore',
'squire',
'jquery',
'Magento_Customer/js/section-config',
'Magento_Customer/js/customer-data',
'jquery/jquery-storageapi'
-], function (Squire, $, sectionConfig, customerData) {
+], function (_, Squire, $, sectionConfig, customerData) {
'use strict';
var injector = new Squire(),
@@ -98,9 +98,6 @@ define([
}
describe('Magento_Customer/js/customer-data', function () {
-
- var _;
-
beforeAll(function () {
clearLocalStorage();
});
@@ -401,7 +398,6 @@ define([
}
};
};
-
expect(parameters).toEqual(jasmine.objectContaining({
sections: 'section'
}));
@@ -410,7 +406,6 @@ define([
});
result = obj.reload(['section'], true);
-
expect(result).toEqual(jasmine.objectContaining({
responseJSON: {
section: {}
@@ -422,7 +417,6 @@ define([
var result;
spyOn(sectionConfig, 'filterClientSideSections').and.returnValue(['cart,customer,messages']);
-
$.getJSON = jasmine.createSpy().and.callFake(function (url, parameters) {
var deferred = $.Deferred();
@@ -448,7 +442,6 @@ define([
});
result = obj.reload(['cart', 'customer', 'messages'], true);
-
expect(result).toEqual(jasmine.objectContaining({
responseJSON: {
cart: {},
@@ -457,7 +450,7 @@ define([
}
}));
});
- //
+
it('Check it returns all sections when passed wildcard string', function () {
var result;
@@ -486,7 +479,6 @@ define([
});
result = obj.reload('*', true);
-
expect($.getJSON).toHaveBeenCalled();
expect(result).toEqual(jasmine.objectContaining({
responseJSON: {
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js
index de38e929b7ce2..2b05f089b6e47 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js
@@ -2,6 +2,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+/* eslint-disable max-nested-callbacks */
define([
'ko',
@@ -19,7 +20,6 @@ define([
config;
beforeEach(function () {
- jasmine.clock().install();
element = $('');
observable = ko.observable();
@@ -40,7 +40,6 @@ define([
});
afterEach(function () {
- jasmine.clock().uninstall();
element.remove();
});
@@ -57,26 +56,27 @@ define([
expect(todayDate).toEqual(result);
});
- it('update picked date\'s value after update observable value', function () {
+ it('update picked date\'s value after update observable value', function (done) {
var date = '06/21/2019',
inputFormat = 'M/d/yy',
expectedDate;
expectedDate = moment(date, utils.convertToMomentFormat(inputFormat)).toDate();
observable(date);
-
- jasmine.clock().tick(100);
-
- expect(expectedDate.valueOf()).toEqual(element.datepicker('getDate').valueOf());
+ setTimeout(function () {
+ expect(expectedDate.valueOf()).toEqual(element.datepicker('getDate').valueOf());
+ done();
+ }, 100);
});
- it('clear picked date\'s value after clear observable value', function () {
+ it('clear picked date\'s value after clear observable value', function (done) {
element.datepicker('setTimezoneDate').trigger('blur').trigger('change');
observable('');
- jasmine.clock().tick(100);
-
- expect(null).toEqual(element.datepicker('getDate'));
+ setTimeout(function () {
+ expect(null).toEqual(element.datepicker('getDate'));
+ done();
+ }, 100);
});
});
});
diff --git a/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php b/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php
index 00a6e49d4e31d..7192eeccf731b 100644
--- a/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php
+++ b/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php
@@ -32,6 +32,9 @@ public function apply(AbstractNode $node)
return;
}
try {
+ if (!class_exists($node->getFullQualifiedName(), true)) {
+ return;
+ }
$impl = class_implements($node->getFullQualifiedName(), true);
} catch (\Throwable $exception) {
//Couldn't load a class.
diff --git a/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php b/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php
index d03253bd166dc..2d0525391fbf2 100644
--- a/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php
+++ b/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php
@@ -110,7 +110,11 @@ private function isControllerPlugin(\ReflectionClass $class): bool
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
if (preg_match('/^(after|around|before).+/i', $method->getName())) {
try {
- $argument = $this->getParameterClass($method->getParameters()[0]);
+ $parameters = $method->getParameters();
+ if (count($parameters) === 0) {
+ continue;
+ }
+ $argument = $this->getParameterClass($parameters[0]);
} catch (\Throwable $exception) {
//Non-existing class (autogenerated perhaps) or doesn't have an argument.
continue;
@@ -139,7 +143,11 @@ private function isBlockPlugin(\ReflectionClass $class): bool
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
if (preg_match('/^(after|around|before).+/i', $method->getName())) {
try {
- $argument = $this->getParameterClass($method->getParameters()[0]);
+ $parameters = $method->getParameters();
+ if (count($parameters) === 0) {
+ continue;
+ }
+ $argument = $this->getParameterClass($parameters[0]);
} catch (\Throwable $exception) {
//Non-existing class (autogenerated perhaps) or doesn't have an argument.
continue;
diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist
index c89de486be0e4..333753048ed6d 100644
--- a/dev/tests/unit/phpunit.xml.dist
+++ b/dev/tests/unit/phpunit.xml.dist
@@ -28,6 +28,7 @@
+
diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php
index dae830dd889dc..dae5d99960f0f 100644
--- a/lib/internal/Magento/Framework/Escaper.php
+++ b/lib/internal/Magento/Framework/Escaper.php
@@ -291,7 +291,7 @@ public function escapeUrl($string)
*/
public function encodeUrlParam($string)
{
- return $this->getEscaper()->escapeUrl($string);
+ return $this->getEscaper()->escapeUrl((string)$string);
}
/**
@@ -330,7 +330,7 @@ function ($matches) {
*/
public function escapeCss($string)
{
- return $this->getEscaper()->escapeCss($string);
+ return $this->getEscaper()->escapeCss((string)$string);
}
/**
diff --git a/lib/internal/Magento/Framework/Logger/Handler/Base.php b/lib/internal/Magento/Framework/Logger/Handler/Base.php
index 07dfd3f0963ab..d93825bcd0248 100644
--- a/lib/internal/Magento/Framework/Logger/Handler/Base.php
+++ b/lib/internal/Magento/Framework/Logger/Handler/Base.php
@@ -3,9 +3,11 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
namespace Magento\Framework\Logger\Handler;
+use InvalidArgumentException;
use Magento\Framework\Filesystem\DriverInterface;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler;
@@ -33,19 +35,20 @@ class Base extends StreamHandler
/**
* @param DriverInterface $filesystem
- * @param string $filePath
- * @param string $fileName
- * @throws \Exception
+ * @param string|null $filePath
+ * @param string|null $fileName
*/
public function __construct(
DriverInterface $filesystem,
- $filePath = null,
- $fileName = null
+ ?string $filePath = null,
+ ?string $fileName = null
) {
$this->filesystem = $filesystem;
+
if (!empty($fileName)) {
$this->fileName = $this->sanitizeFileName($fileName);
}
+
parent::__construct(
$filePath ? $filePath . $this->fileName : BP . DIRECTORY_SEPARATOR . $this->fileName,
$this->loggerType
@@ -59,14 +62,9 @@ public function __construct(
*
* @param string $fileName
* @return string
- * @throws \InvalidArgumentException
*/
- private function sanitizeFileName($fileName)
+ private function sanitizeFileName(string $fileName): string
{
- if (!is_string($fileName)) {
- throw new \InvalidArgumentException('Filename expected to be a string');
- }
-
$parts = explode('/', $fileName);
$parts = array_filter($parts, function ($value) {
return !in_array($value, ['', '.', '..']);
@@ -78,9 +76,10 @@ private function sanitizeFileName($fileName)
/**
* @inheritDoc
*/
- protected function write(array $record)
+ protected function write(array $record): void
{
$logDir = $this->filesystem->getParentDirectory($this->url);
+
if (!$this->filesystem->isDirectory($logDir)) {
$this->filesystem->createDirectory($logDir);
}
diff --git a/lib/internal/Magento/Framework/Logger/Handler/System.php b/lib/internal/Magento/Framework/Logger/Handler/System.php
index c519e320a254d..ff57ae872c713 100644
--- a/lib/internal/Magento/Framework/Logger/Handler/System.php
+++ b/lib/internal/Magento/Framework/Logger/Handler/System.php
@@ -3,10 +3,13 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
namespace Magento\Framework\Logger\Handler;
+use Exception;
use Magento\Framework\Filesystem\DriverInterface;
+use Magento\Framework\Logger\Handler\Exception as ExceptionHandler;
use Monolog\Logger;
/**
@@ -25,38 +28,38 @@ class System extends Base
protected $loggerType = Logger::INFO;
/**
- * @var Exception
+ * @var ExceptionHandler
*/
protected $exceptionHandler;
/**
* @param DriverInterface $filesystem
- * @param Exception $exceptionHandler
- * @param string $filePath
+ * @param ExceptionHandler $exceptionHandler
+ * @param string|null $filePath
+ * @throws Exception
*/
public function __construct(
DriverInterface $filesystem,
- Exception $exceptionHandler,
- $filePath = null
+ ExceptionHandler $exceptionHandler,
+ ?string $filePath = null
) {
$this->exceptionHandler = $exceptionHandler;
parent::__construct($filesystem, $filePath);
}
/**
- * Writes formatted record through the handler.
+ * Writes formatted record through the handler
*
* @param array $record The record metadata
* @return void
*/
- public function write(array $record)
+ public function write(array $record): void
{
if (isset($record['context']['exception'])) {
$this->exceptionHandler->handle($record);
return;
}
-
$record['formatted'] = $this->getFormatter()->format($record);
parent::write($record);
diff --git a/lib/internal/Magento/Framework/Logger/Monolog.php b/lib/internal/Magento/Framework/Logger/Monolog.php
index 05ef4cf262d77..105acffc5355f 100644
--- a/lib/internal/Magento/Framework/Logger/Monolog.php
+++ b/lib/internal/Magento/Framework/Logger/Monolog.php
@@ -3,48 +3,32 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
namespace Magento\Framework\Logger;
+use DateTimeZone;
use Monolog\Logger;
+/**
+ * Monolog Logger
+ */
class Monolog extends Logger
{
/**
* @inheritdoc
*/
- public function __construct($name, array $handlers = [], array $processors = [])
- {
+ public function __construct(
+ string $name,
+ array $handlers = [],
+ array $processors = [],
+ ?DateTimeZone $timezone = null
+ ) {
/**
* TODO: This should be eliminated with MAGETWO-53989
*/
$handlers = array_values($handlers);
- parent::__construct($name, $handlers, $processors);
- }
-
- /**
- * Adds a log record.
- *
- * @param integer $level The logging level
- * @param string $message The log message
- * @param array $context The log context
- * @return bool Whether the record has been processed
- */
- public function addRecord($level, $message, array $context = [])
- {
- /**
- * To preserve compatibility with Exception messages.
- * And support PSR-3 context standard.
- *
- * @link http://www.php-fig.org/psr/psr-3/#context PSR-3 context standard
- */
- if ($message instanceof \Exception && !isset($context['exception'])) {
- $context['exception'] = $message;
- }
-
- $message = $message instanceof \Exception ? $message->getMessage() : $message;
-
- return parent::addRecord($level, $message, $context);
+ parent::__construct($name, $handlers, $processors, $timezone);
}
}
diff --git a/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/BaseTest.php b/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/BaseTest.php
index 47169fd2bc0be..f6f9b537c4fd2 100644
--- a/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/BaseTest.php
+++ b/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/BaseTest.php
@@ -61,11 +61,4 @@ public function testSanitizeParentLevelFolder()
$this->sanitizeMethod->invokeArgs($this->model, ['../../../var/hack/custom.log'])
);
}
-
- public function testSanitizeFileException()
- {
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage('Filename expected to be a string');
- $this->sanitizeMethod->invokeArgs($this->model, [['filename' => 'notValid']]);
- }
}
diff --git a/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/SystemTest.php b/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/SystemTest.php
index e9b0bb1cfd359..39dec8935c73d 100644
--- a/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/SystemTest.php
+++ b/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/SystemTest.php
@@ -7,8 +7,10 @@
namespace Magento\Framework\Logger\Test\Unit\Handler;
+use DateTime;
+use Exception;
use Magento\Framework\Filesystem\DriverInterface;
-use Magento\Framework\Logger\Handler\Exception;
+use Magento\Framework\Logger\Handler\Exception as ExceptionHandler;
use Magento\Framework\Logger\Handler\System;
use Monolog\Logger;
use PHPUnit\Framework\MockObject\MockObject as Mock;
@@ -27,20 +29,22 @@ class SystemTest extends TestCase
private $filesystemMock;
/**
- * @var Exception|Mock
+ * @var ExceptionHandler|Mock
*/
private $exceptionHandlerMock;
/**
* @inheritdoc
+ *
+ * @throws Exception
*/
protected function setUp(): void
{
$this->filesystemMock = $this->getMockBuilder(DriverInterface::class)
->getMockForAbstractClass();
- $this->exceptionHandlerMock = $this->getMockBuilder(Exception::class)
- ->disableOriginalConstructor()
- ->getMock();
+ $this->exceptionHandlerMock = $this->getMockBuilder(
+ ExceptionHandler::class
+ )->disableOriginalConstructor()->getMock();
$this->model = new System(
$this->filesystemMock,
@@ -62,7 +66,7 @@ public function testWrite()
public function testWriteException()
{
$record = $this->getRecord();
- $record['context']['exception'] = new \Exception('Some exception');
+ $record['context']['exception'] = new Exception('Some exception');
$this->exceptionHandlerMock->expects($this->once())
->method('handle')
@@ -79,15 +83,21 @@ public function testWriteException()
* @param array $context
* @return array
*/
- private function getRecord($level = Logger::WARNING, $message = 'test', $context = [])
- {
+ private function getRecord(
+ int $level = Logger::WARNING,
+ string $message = 'test',
+ array $context = []
+ ): array {
return [
'message' => $message,
'context' => $context,
'level' => $level,
'level_name' => Logger::getLevelName($level),
'channel' => 'test',
- 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))),
+ 'datetime' => DateTime::createFromFormat(
+ 'U.u',
+ sprintf('%.6F', microtime(true))
+ ),
'extra' => [],
];
}
diff --git a/lib/internal/Magento/Framework/Logger/Test/Unit/MonologTest.php b/lib/internal/Magento/Framework/Logger/Test/Unit/MonologTest.php
index 9173b47a4b6f3..d11b552e9dbe1 100644
--- a/lib/internal/Magento/Framework/Logger/Test/Unit/MonologTest.php
+++ b/lib/internal/Magento/Framework/Logger/Test/Unit/MonologTest.php
@@ -7,8 +7,10 @@
namespace Magento\Framework\Logger\Test\Unit;
+use Exception;
use Magento\Framework\Logger\Monolog;
use Monolog\Handler\TestHandler;
+use Monolog\Logger;
use PHPUnit\Framework\TestCase;
class MonologTest extends TestCase
@@ -20,23 +22,9 @@ public function testAddRecord()
$logger->pushHandler($handler);
- $logger->addError('test');
+ $logger->addRecord(Logger::ERROR, 'test');
list($record) = $handler->getRecords();
$this->assertSame('test', $record['message']);
}
-
- public function testAddRecordAsException()
- {
- $logger = new Monolog(__METHOD__);
- $handler = new TestHandler();
-
- $logger->pushHandler($handler);
-
- $logger->addError(new \Exception('Some exception'));
- list($record) = $handler->getRecords();
-
- $this->assertInstanceOf(\Exception::class, $record['context']['exception']);
- $this->assertSame('Some exception', $record['message']);
- }
}
diff --git a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php
index 67dac40863ad4..91cc99d09c6a3 100644
--- a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php
+++ b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php
@@ -364,6 +364,76 @@ public function testEscapeUrl(string $data, string $expected): void
$this->assertEquals($expected, $this->escaper->escapeUrl($expected));
}
+ /**
+ * @covers \Magento\Framework\Escaper::escapeCss
+ *
+ * @param string $data
+ * @param string $expected
+ * @return void
+ *
+ * @dataProvider escapeCssDataProvider
+ */
+ public function testEscapeCss($data, string $expected): void
+ {
+ $this->assertEquals($expected, $this->escaper->escapeCss($data));
+ }
+
+ /**
+ * @return array
+ */
+ public function escapeCssDataProvider(): array
+ {
+ return [
+ [
+ 'data' => 1,
+ 'expected' => '1',
+ ],
+ [
+ 'data' => '*%string{foo}%::',
+ 'expected' => '\2A \25 string\7B foo\7D \25 \3A \3A ',
+ ]
+ ];
+ }
+
+ /**
+ * @covers \Magento\Framework\Escaper::encodeUrlParam
+ *
+ * @param string $data
+ * @param string $expected
+ * @return void
+ *
+ * @dataProvider encodeUrlParamDataProvider
+ */
+ public function testEncodeUrlParam($data, string $expected): void
+ {
+ $this->assertEquals($expected, $this->escaper->encodeUrlParam($data));
+ }
+
+ /**
+ * @return array
+ */
+ public function encodeUrlParamDataProvider(): array
+ {
+ return [
+ [
+ 'data' => "a3==",
+ 'expected' => "a3%3D%3D",
+ ],
+ [
+ 'data' => "example string",
+ 'expected' => "example%20string",
+ ],
+ [
+ 'data' => 1,
+ 'expected' => "1",
+ ],
+ [
+ 'data' => null,
+ 'expected' => "",
+ ]
+ ];
+ }
+
/**
* @return array
*/
diff --git a/lib/internal/Magento/Framework/Url/RouteParamsResolver.php b/lib/internal/Magento/Framework/Url/RouteParamsResolver.php
index eac9005e68548..3d5b559e97843 100644
--- a/lib/internal/Magento/Framework/Url/RouteParamsResolver.php
+++ b/lib/internal/Magento/Framework/Url/RouteParamsResolver.php
@@ -112,7 +112,7 @@ public function setRouteParams(array $data, $unsetOldParams = true)
} else {
$this->setRouteParam(
$this->getEscaper()->encodeUrlParam($key),
- $this->getEscaper()->encodeUrlParam($value)
+ $this->getEscaper()->encodeUrlParam((string)$value)
);
}
}
diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json
index e81c83ab28378..49b04b058f565 100644
--- a/lib/internal/Magento/Framework/composer.json
+++ b/lib/internal/Magento/Framework/composer.json
@@ -35,7 +35,7 @@
"laminas/laminas-uri": "^2.5.1",
"laminas/laminas-validator": "^2.6.0",
"magento/zendframework1": "~1.14.2",
- "monolog/monolog": "^1.17",
+ "monolog/monolog": "^2.3",
"ramsey/uuid": "~4.1.0",
"symfony/console": "~4.4.0",
"symfony/process": "~4.4.0",
diff --git a/lib/web/legacy-build.min.js b/lib/web/legacy-build.min.js
index 455d1e591ddae..cff6ea5ce84b4 100644
--- a/lib/web/legacy-build.min.js
+++ b/lib/web/legacy-build.min.js
@@ -1,4 +1,4 @@
-var Prototype={Version:"1.7.3",Browser:(function(){var d=navigator.userAgent;var b=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!b,Opera:b,WebKit:d.indexOf("AppleWebKit/")>-1,Gecko:d.indexOf("Gecko")>-1&&d.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(d)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var b=window.Element||window.HTMLElement;return !!(b&&b.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var e=document.createElement("div"),d=document.createElement("form"),b=false;if(e.__proto__&&(e.__proto__!==d.__proto__)){b=true}e=d=null;return b})()},ScriptFragment:"
+
+
+
+
+
+
+
-
- Version = htmlspecialchars($this->version, ENT_COMPAT) ?>
+
+ Version = htmlspecialchars($version, ENT_COMPAT) ?>
Welcome to Magento Admin, your online store headquarters.
@@ -22,7 +56,7 @@
- = nl2br(htmlspecialchars($this->license, ENT_COMPAT)) ?>
+ = nl2br(htmlspecialchars($license, ENT_COMPAT)) ?>