diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000000..17aa66c919eb5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,33 @@ +--- +name: Bug report +about: Technical issue with the Magento 2 core components + +--- + + + +### Preconditions + +1. +2. + +### Steps to reproduce + +1. +2. + +### Expected result + +1. [Screenshots, logs or description] +2. + +### Actual result + +1. [Screenshots, logs or description] +2. diff --git a/.github/ISSUE_TEMPLATE/developer-experience-issue.md b/.github/ISSUE_TEMPLATE/developer-experience-issue.md new file mode 100644 index 0000000000000..a66b0c62ef8e2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/developer-experience-issue.md @@ -0,0 +1,18 @@ +--- +name: Developer experience issue +about: Issues related to customization, extensibility, modularity + +--- + + + +### Summary + + +### Examples + + +### Proposed solution + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000000..de85da43b70fa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Please consider reporting directly to https://github.com/magento/community-features + +--- + + + +### Description + + +### Expected behavior + + +### Benefits + + +### Additional information + diff --git a/CHANGELOG.md b/CHANGELOG.md index 078b93bd7199c..cc722b6d61b33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +2.3.0 +============= +To get detailed information about changes in Magento 2.3.0, see the [Release Notes](https://devdocs.magento.com/guides/v2.3/release-notes/bk-release-notes.html) + 2.1.0 ============= To get detailed information about changes in Magento 2.1.0, please visit [Magento Community Edition (CE) Release Notes](http://devdocs.magento.com/guides/v2.1/release-notes/ReleaseNotes2.1.0CE.html "Magento Community Edition (CE) Release Notes") diff --git a/README.md b/README.md index 6b2ac458eb403..50a20b55d4eb2 100644 --- a/README.md +++ b/README.md @@ -41,20 +41,8 @@ Magento is thankful for any contribution that can improve our code base, documen

Labels applied by the Magento team

- -| Label | Description | -| ------------- |-------------| -| ![DOC](http://devdocs.magento.com/common/images/github_DOC.png) | Affects Documentation domain. | -| ![PROD](http://devdocs.magento.com/common/images/github_PROD.png) | Affects the Product team (mostly feature requests or business logic change). | -| ![TECH](http://devdocs.magento.com/common/images/github_TECH.png) | Affects Architect Group (mostly to make decisions around technology changes). | -| ![accept](http://devdocs.magento.com/common/images/github_accept.png) | The pull request has been accepted and will be merged into mainline code. | -| ![reject](http://devdocs.magento.com/common/images/github_reject.png) | The pull request has been rejected and will not be merged into mainline code. Possible reasons can include but are not limited to: issue has already been fixed in another code contribution, or there is an issue with the code contribution. | -| ![bug report](http://devdocs.magento.com/common/images/github_bug.png) | The Magento Team has confirmed that this issue contains the minimum required information to reproduce. | -| ![acknowledged](http://devdocs.magento.com/common/images/gitHub_acknowledged.png) | The Magento Team has validated the issue and an internal ticket has been created. | -| ![in progress](http://devdocs.magento.com/common/images/github_inProgress.png) | The internal ticket is currently in progress, fix is scheduled to be delivered. | -| ![needs update](http://devdocs.magento.com/common/images/github_needsUpdate.png) | The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. | - -To learn more about issue gate labels click [here](https://github.com/magento/magento2/wiki/Magento-Issue-Gates) +We apply labels to public Pull Requests and Issues to help other participants retrieve additional information about current progress, component assignments, Magento release lines, and much more. +Please review the Code Contributions guide for detailed information on labels used in Magento 2 repositories.

Reporting security issues

diff --git a/app/bootstrap.php b/app/bootstrap.php index ba62b296bd49c..8e901cac9bfb8 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -31,8 +31,6 @@ // Sets default autoload mappings, may be overridden in Bootstrap::create \Magento\Framework\App\Bootstrap::populateAutoloader(BP, []); -require_once BP . '/app/functions.php'; - /* Custom umask value may be provided in optional mage_umask file in root */ $umaskFile = BP . '/magento_umask'; $mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002; @@ -54,8 +52,16 @@ && isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false ) { - \Magento\Framework\Profiler::applyConfig( - (isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER'])) ? $_SERVER['MAGE_PROFILER'] : trim(file_get_contents(BP . '/var/profiler.flag')), + $profilerConfig = isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER']) + ? $_SERVER['MAGE_PROFILER'] + : trim(file_get_contents(BP . '/var/profiler.flag')); + + if ($profilerConfig) { + $profilerConfig = json_decode($profilerConfig, true) ?: $profilerConfig; + } + + Magento\Framework\Profiler::applyConfig( + $profilerConfig, BP, !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ); diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Index.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Index.php index 125dba405b108..22eb3b30722f4 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Index.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Index.php @@ -6,7 +6,9 @@ */ namespace Magento\AdminNotification\Controller\Adminhtml\Notification; -class Index extends \Magento\AdminNotification\Controller\Adminhtml\Notification +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class Index extends \Magento\AdminNotification\Controller\Adminhtml\Notification implements HttpGetActionInterface { /** * @return void diff --git a/app/code/Magento/AdminNotification/Observer/PredispatchAdminActionControllerObserver.php b/app/code/Magento/AdminNotification/Observer/PredispatchAdminActionControllerObserver.php index 3275de2a82fb7..24ef712c0f61f 100644 --- a/app/code/Magento/AdminNotification/Observer/PredispatchAdminActionControllerObserver.php +++ b/app/code/Magento/AdminNotification/Observer/PredispatchAdminActionControllerObserver.php @@ -37,7 +37,7 @@ public function __construct( } /** - * Predispath admin action controller + * Predispatch admin action controller * * @param \Magento\Framework\Event\Observer $observer * @return void diff --git a/app/code/Magento/AdminNotification/etc/adminhtml/menu.xml b/app/code/Magento/AdminNotification/etc/adminhtml/menu.xml index fbed5c0960b73..04d700b9f90ce 100644 --- a/app/code/Magento/AdminNotification/etc/adminhtml/menu.xml +++ b/app/code/Magento/AdminNotification/etc/adminhtml/menu.xml @@ -7,6 +7,6 @@ --> - + diff --git a/app/code/Magento/AdminNotification/etc/db_schema_whitelist.json b/app/code/Magento/AdminNotification/etc/db_schema_whitelist.json index df5e14e066636..b068ffffe9219 100644 --- a/app/code/Magento/AdminNotification/etc/db_schema_whitelist.json +++ b/app/code/Magento/AdminNotification/etc/db_schema_whitelist.json @@ -1,32 +1,32 @@ { - "adminnotification_inbox": { - "column": { - "notification_id": true, - "severity": true, - "date_added": true, - "title": true, - "description": true, - "url": true, - "is_read": true, - "is_remove": true + "adminnotification_inbox": { + "column": { + "notification_id": true, + "severity": true, + "date_added": true, + "title": true, + "description": true, + "url": true, + "is_read": true, + "is_remove": true + }, + "index": { + "ADMINNOTIFICATION_INBOX_SEVERITY": true, + "ADMINNOTIFICATION_INBOX_IS_READ": true, + "ADMINNOTIFICATION_INBOX_IS_REMOVE": true + }, + "constraint": { + "PRIMARY": true + } }, - "index": { - "ADMINNOTIFICATION_INBOX_SEVERITY": true, - "ADMINNOTIFICATION_INBOX_IS_READ": true, - "ADMINNOTIFICATION_INBOX_IS_REMOVE": true - }, - "constraint": { - "PRIMARY": true - } - }, - "admin_system_messages": { - "column": { - "identity": true, - "severity": true, - "created_at": true - }, - "constraint": { - "PRIMARY": true + "admin_system_messages": { + "column": { + "identity": true, + "severity": true, + "created_at": true + }, + "constraint": { + "PRIMARY": true + } } - } } \ No newline at end of file diff --git a/app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php b/app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php index 02413a1899cd7..d78266ab75311 100644 --- a/app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php +++ b/app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php @@ -5,12 +5,14 @@ */ namespace Magento\AdvancedPricingImportExport\Controller\Adminhtml\Export; +use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; use Magento\ImportExport\Controller\Adminhtml\Export as ExportController; use Magento\Framework\Controller\ResultFactory; use Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing as ExportAdvancedPricing; use Magento\Catalog\Model\Product as CatalogProduct; -class GetFilter extends ExportController +class GetFilter extends ExportController implements HttpGetActionInterface, HttpPostActionInterface { /** * Get grid-filter of entity attributes action. @@ -37,10 +39,10 @@ public function execute() ); return $resultLayout; } catch (\Exception $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } } else { - $this->messageManager->addError(__('Please correct the data sent.')); + $this->messageManager->addErrorMessage(__('Please correct the data sent.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); diff --git a/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php b/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php index c2379e9dff062..b20872da2f8e7 100644 --- a/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php +++ b/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php @@ -6,18 +6,23 @@ namespace Magento\AdvancedSearch\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Search\Request\IndexScopeResolverInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\Model\ResourceModel\Db\Context; use Magento\Framework\EntityManager\MetadataPool; use Magento\Catalog\Api\Data\CategoryInterface; use Magento\Framework\App\ObjectManager; -use Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver as TableResolver; use Magento\Framework\Search\Request\Dimension; use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction; +use Magento\Framework\Search\Request\IndexScopeResolverInterface as TableResolver; +use Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory; +use Magento\Store\Model\Indexer\WebsiteDimensionProvider; /** * @api * @since 100.1.0 + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Index extends AbstractDb { @@ -38,25 +43,39 @@ class Index extends AbstractDb */ private $tableResolver; + /** + * @var DimensionCollectionFactory|null + */ + private $dimensionCollectionFactory; + + /** + * @var int|null + */ + private $websiteId; + /** * Index constructor. * @param Context $context * @param StoreManagerInterface $storeManager * @param MetadataPool $metadataPool - * @param null $connectionName + * @param string|null $connectionName * @param TableResolver|null $tableResolver + * @param DimensionCollectionFactory|null $dimensionCollectionFactory */ public function __construct( Context $context, StoreManagerInterface $storeManager, MetadataPool $metadataPool, $connectionName = null, - TableResolver $tableResolver = null + TableResolver $tableResolver = null, + DimensionCollectionFactory $dimensionCollectionFactory = null ) { parent::__construct($context, $connectionName); $this->storeManager = $storeManager; $this->metadataPool = $metadataPool; - $this->tableResolver = $tableResolver ?: ObjectManager::getInstance()->get(TableResolver::class); + $this->tableResolver = $tableResolver ?: ObjectManager::getInstance()->get(IndexScopeResolverInterface::class); + $this->dimensionCollectionFactory = $dimensionCollectionFactory + ?: ObjectManager::getInstance()->get(DimensionCollectionFactory::class); } /** @@ -78,18 +97,27 @@ protected function _construct() protected function _getCatalogProductPriceData($productIds = null) { $connection = $this->getConnection(); - - $select = $connection->select()->from( - $this->getTable('catalog_product_index_price'), - ['entity_id', 'customer_group_id', 'website_id', 'min_price'] - ); - - if ($productIds) { - $select->where('entity_id IN (?)', $productIds); + $catalogProductIndexPriceSelect = []; + + foreach ($this->dimensionCollectionFactory->create() as $dimensions) { + if (!isset($dimensions[WebsiteDimensionProvider::DIMENSION_NAME]) || + $this->websiteId === null || + $dimensions[WebsiteDimensionProvider::DIMENSION_NAME]->getValue() === $this->websiteId) { + $select = $connection->select()->from( + $this->tableResolver->resolve('catalog_product_index_price', $dimensions), + ['entity_id', 'customer_group_id', 'website_id', 'min_price'] + ); + if ($productIds) { + $select->where('entity_id IN (?)', $productIds); + } + $catalogProductIndexPriceSelect[] = $select; + } } + $catalogProductIndexPriceUnionSelect = $connection->select()->union($catalogProductIndexPriceSelect); + $result = []; - foreach ($connection->fetchAll($select) as $row) { + foreach ($connection->fetchAll($catalogProductIndexPriceUnionSelect) as $row) { $result[$row['website_id']][$row['entity_id']][$row['customer_group_id']] = round($row['min_price'], 2); } @@ -106,9 +134,12 @@ protected function _getCatalogProductPriceData($productIds = null) */ public function getPriceIndexData($productIds, $storeId) { + $websiteId = $this->storeManager->getStore($storeId)->getWebsiteId(); + + $this->websiteId = $websiteId; $priceProductsIndexData = $this->_getCatalogProductPriceData($productIds); + $this->websiteId = null; - $websiteId = $this->storeManager->getStore($storeId)->getWebsiteId(); if (!isset($priceProductsIndexData[$websiteId])) { return []; } diff --git a/app/code/Magento/AdvancedSearch/Test/Unit/Model/ResourceModel/IndexTest.php b/app/code/Magento/AdvancedSearch/Test/Unit/Model/ResourceModel/IndexTest.php index 185e932406e5b..1f37e40842f54 100644 --- a/app/code/Magento/AdvancedSearch/Test/Unit/Model/ResourceModel/IndexTest.php +++ b/app/code/Magento/AdvancedSearch/Test/Unit/Model/ResourceModel/IndexTest.php @@ -15,6 +15,9 @@ use Magento\Framework\App\ResourceConnection; use Magento\Framework\DB\Select; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class IndexTest extends \PHPUnit\Framework\TestCase { /** @@ -59,10 +62,24 @@ protected function setUp() $this->resourceConnectionMock->expects($this->any())->method('getConnection')->willReturn($this->adapterMock); $this->metadataPoolMock = $this->createMock(MetadataPool::class); + $indexScopeResolverMock = $this->createMock( + \Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver::class + ); + $traversableMock = $this->createMock(\Traversable::class); + $dimensionsMock = $this->createMock(\Magento\Framework\Indexer\MultiDimensionProvider::class); + $dimensionsMock->method('getIterator')->willReturn($traversableMock); + $dimensionFactoryMock = $this->createMock( + \Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory::class + ); + $dimensionFactoryMock->method('create')->willReturn($dimensionsMock); + $this->model = new Index( $this->resourceContextMock, $this->storeManagerMock, - $this->metadataPoolMock + $this->metadataPoolMock, + 'connectionName', + $indexScopeResolverMock, + $dimensionFactoryMock ); } @@ -71,11 +88,13 @@ public function testGetPriceIndexDataUsesFrontendPriceIndexerTable() $storeId = 1; $storeMock = $this->createMock(StoreInterface::class); $storeMock->expects($this->any())->method('getId')->willReturn($storeId); + $storeMock->method('getWebsiteId')->willReturn(1); $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId)->willReturn($storeMock); $selectMock = $this->createMock(Select::class); $selectMock->expects($this->any())->method('from')->willReturnSelf(); $selectMock->expects($this->any())->method('where')->willReturnSelf(); + $selectMock->expects($this->any())->method('union')->willReturnSelf(); $this->adapterMock->expects($this->once())->method('select')->willReturn($selectMock); $this->adapterMock->expects($this->once())->method('fetchAll')->with($selectMock)->willReturn([]); diff --git a/app/code/Magento/AdvancedSearch/etc/db_schema_whitelist.json b/app/code/Magento/AdvancedSearch/etc/db_schema_whitelist.json index eaf7f3d616736..8addf187744fd 100644 --- a/app/code/Magento/AdvancedSearch/etc/db_schema_whitelist.json +++ b/app/code/Magento/AdvancedSearch/etc/db_schema_whitelist.json @@ -1,14 +1,14 @@ { - "catalogsearch_recommendations": { - "column": { - "id": true, - "query_id": true, - "relation_id": true - }, - "constraint": { - "PRIMARY": true, - "CATALOGSEARCH_RECOMMENDATIONS_QUERY_ID_SEARCH_QUERY_QUERY_ID": true, - "CATALOGSEARCH_RECOMMENDATIONS_RELATION_ID_SEARCH_QUERY_QUERY_ID": true + "catalogsearch_recommendations": { + "column": { + "id": true, + "query_id": true, + "relation_id": true + }, + "constraint": { + "PRIMARY": true, + "CATALOGSEARCH_RECOMMENDATIONS_QUERY_ID_SEARCH_QUERY_QUERY_ID": true, + "CATALOGSEARCH_RECOMMENDATIONS_RELATION_ID_SEARCH_QUERY_QUERY_ID": true + } } - } } \ No newline at end of file diff --git a/app/code/Magento/AdvancedSearch/etc/di.xml b/app/code/Magento/AdvancedSearch/etc/di.xml index 9ec75f56bbf7b..21e19fd58825b 100644 --- a/app/code/Magento/AdvancedSearch/etc/di.xml +++ b/app/code/Magento/AdvancedSearch/etc/di.xml @@ -19,6 +19,12 @@ Did you mean + + + Magento\CatalogSearch\Model\ResourceModel\EngineInterface::CONFIG_ENGINE_PATH + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + + @@ -26,5 +32,12 @@ + + + + Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver + + + diff --git a/app/code/Magento/Analytics/Controller/Adminhtml/BIEssentials/SignUp.php b/app/code/Magento/Analytics/Controller/Adminhtml/BIEssentials/SignUp.php index ff9126a83d59f..87666cb880e54 100644 --- a/app/code/Magento/Analytics/Controller/Adminhtml/BIEssentials/SignUp.php +++ b/app/code/Magento/Analytics/Controller/Adminhtml/BIEssentials/SignUp.php @@ -5,6 +5,7 @@ */ namespace Magento\Analytics\Controller\Adminhtml\BIEssentials; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -12,7 +13,7 @@ /** * Provides link to BI Essentials signup */ -class SignUp extends Action +class SignUp extends Action implements HttpGetActionInterface { /** * Path to config value with URL to BI Essentials sign-up page. diff --git a/app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php b/app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php index cec09377770b0..9068654fa944f 100644 --- a/app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php +++ b/app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php @@ -5,6 +5,7 @@ */ namespace Magento\Analytics\Controller\Adminhtml\Reports; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Analytics\Model\Exception\State\SubscriptionUpdateException; use Magento\Analytics\Model\ReportUrlProvider; use Magento\Backend\App\Action; @@ -16,7 +17,7 @@ /** * Provide redirect to resource with reports. */ -class Show extends Action +class Show extends Action implements HttpGetActionInterface { /** * @var ReportUrlProvider diff --git a/app/code/Magento/Analytics/Model/Connector/Http/ConverterInterface.php b/app/code/Magento/Analytics/Model/Connector/Http/ConverterInterface.php index 474398fd34e26..ddd9fcba21109 100644 --- a/app/code/Magento/Analytics/Model/Connector/Http/ConverterInterface.php +++ b/app/code/Magento/Analytics/Model/Connector/Http/ConverterInterface.php @@ -30,4 +30,9 @@ public function toBody(array $data); * @return string */ public function getContentTypeHeader(); + + /** + * @return string + */ + public function getContentMediaType(): string; } diff --git a/app/code/Magento/Analytics/Model/Connector/Http/JsonConverter.php b/app/code/Magento/Analytics/Model/Connector/Http/JsonConverter.php index 44c54f67da759..059dab554bd92 100644 --- a/app/code/Magento/Analytics/Model/Connector/Http/JsonConverter.php +++ b/app/code/Magento/Analytics/Model/Connector/Http/JsonConverter.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Analytics\Model\Connector\Http; use Magento\Framework\Serialize\Serializer\Json; @@ -14,9 +16,16 @@ class JsonConverter implements ConverterInterface { /** * Content-Type HTTP header for json. + * @deprecated + * @see CONTENT_MEDIA_TYPE */ const CONTENT_TYPE_HEADER = 'Content-Type: application/json'; + /** + * Media-Type corresponding to this converter. + */ + const CONTENT_MEDIA_TYPE = 'application/json'; + /** * @var Json */ @@ -56,6 +65,14 @@ public function toBody(array $data) */ public function getContentTypeHeader() { - return self::CONTENT_TYPE_HEADER; + return sprintf('Content-Type: %s', self::CONTENT_MEDIA_TYPE); + } + + /** + * @inheritdoc + */ + public function getContentMediaType(): string + { + return self::CONTENT_MEDIA_TYPE; } } diff --git a/app/code/Magento/Analytics/Model/Connector/Http/ResponseResolver.php b/app/code/Magento/Analytics/Model/Connector/Http/ResponseResolver.php index ec198e4a3c40b..57b61c1b5562a 100644 --- a/app/code/Magento/Analytics/Model/Connector/Http/ResponseResolver.php +++ b/app/code/Magento/Analytics/Model/Connector/Http/ResponseResolver.php @@ -38,7 +38,15 @@ public function __construct(ConverterInterface $converter, array $responseHandle public function getResult(\Zend_Http_Response $response) { $result = false; - $responseBody = $this->converter->fromBody($response->getBody()); + $converterMediaType = $this->converter->getContentMediaType(); + + /** Content-Type header may not only contain media-type declaration */ + if ($response->getBody() && is_int(strripos($response->getHeader('Content-Type'), $converterMediaType))) { + $responseBody = $this->converter->fromBody($response->getBody()); + } else { + $responseBody = []; + } + if (array_key_exists($response->getStatus(), $this->responseHandlers)) { $result = $this->responseHandlers[$response->getStatus()]->handleResponse($responseBody); } diff --git a/app/code/Magento/Analytics/Model/Connector/OTPRequest.php b/app/code/Magento/Analytics/Model/Connector/OTPRequest.php index dfa283e10d070..c05357400d075 100644 --- a/app/code/Magento/Analytics/Model/Connector/OTPRequest.php +++ b/app/code/Magento/Analytics/Model/Connector/OTPRequest.php @@ -103,8 +103,9 @@ public function call() if (!$result) { $this->logger->warning( sprintf( - 'Obtaining of an OTP from the MBI service has been failed: %s', - !empty($response->getBody()) ? $response->getBody() : 'Response body is empty.' + 'Obtaining of an OTP from the MBI service has been failed: %s. Content-Type: %s', + !empty($response->getBody()) ? $response->getBody() : 'Response body is empty', + $response->getHeader('Content-Type') ) ); } diff --git a/app/code/Magento/Analytics/Model/Connector/SignUpCommand.php b/app/code/Magento/Analytics/Model/Connector/SignUpCommand.php index c1f8152f3134e..e35c9bb42bc43 100644 --- a/app/code/Magento/Analytics/Model/Connector/SignUpCommand.php +++ b/app/code/Magento/Analytics/Model/Connector/SignUpCommand.php @@ -110,8 +110,10 @@ public function execute() if (!$result) { $this->logger->warning( sprintf( - 'Subscription for MBI service has been failed. An error occurred during token exchange: %s', - !empty($response->getBody()) ? $response->getBody() : 'Response body is empty.' + 'Subscription for MBI service has been failed. An error occurred during token exchange: %s.' + . ' Content-Type: %s', + !empty($response->getBody()) ? $response->getBody() : 'Response body is empty', + $response->getHeader('Content-Type') ) ); } diff --git a/app/code/Magento/Analytics/Model/Connector/UpdateCommand.php b/app/code/Magento/Analytics/Model/Connector/UpdateCommand.php index 7b4e452a7b451..59878ff9c0814 100644 --- a/app/code/Magento/Analytics/Model/Connector/UpdateCommand.php +++ b/app/code/Magento/Analytics/Model/Connector/UpdateCommand.php @@ -101,8 +101,9 @@ public function execute() if (!$result) { $this->logger->warning( sprintf( - 'Update of the subscription for MBI service has been failed: %s', - !empty($response->getBody()) ? $response->getBody() : 'Response body is empty.' + 'Update of the subscription for MBI service has been failed: %s. Content-Type: %s', + !empty($response->getBody()) ? $response->getBody() : 'Response body is empty', + $response->getHeader('Content-Type') ) ); } diff --git a/app/code/Magento/Analytics/ReportXml/ReportProvider.php b/app/code/Magento/Analytics/ReportXml/ReportProvider.php index 60e722930c244..8966d018dc6b9 100644 --- a/app/code/Magento/Analytics/ReportXml/ReportProvider.php +++ b/app/code/Magento/Analytics/ReportXml/ReportProvider.php @@ -55,7 +55,7 @@ public function __construct( private function getIteratorName(Query $query) { $config = $query->getConfig(); - return isset($config['iterator']) ? $config['iterator'] : null; + return $config['iterator'] ?? null; } /** diff --git a/app/code/Magento/Analytics/Test/Mftf/Data/UserData.xml b/app/code/Magento/Analytics/Test/Mftf/Data/UserData.xml index 8324ad5ba995a..f6e5b955816e2 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Data/UserData.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Data/UserData.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> noreport No diff --git a/app/code/Magento/Analytics/Test/Mftf/Data/UserRoleData.xml b/app/code/Magento/Analytics/Test/Mftf/Data/UserRoleData.xml index 71d8bdcd5994b..099cc71321b84 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Data/UserRoleData.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Data/UserRoleData.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> noreport 123123q diff --git a/app/code/Magento/Analytics/Test/Mftf/Metadata/user-meta.xml b/app/code/Magento/Analytics/Test/Mftf/Metadata/user-meta.xml index 06186d2d10402..2e1e5f6f5a97d 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Metadata/user-meta.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Metadata/user-meta.xml @@ -6,7 +6,7 @@ */ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> application/x-www-form-urlencoded diff --git a/app/code/Magento/Analytics/Test/Mftf/Metadata/user_role-meta.xml b/app/code/Magento/Analytics/Test/Mftf/Metadata/user_role-meta.xml index f52468807928e..9d0132453c798 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Metadata/user_role-meta.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Metadata/user_role-meta.xml @@ -6,7 +6,7 @@ */ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> application/x-www-form-urlencoded diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationBlankIndustryTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationBlankIndustryTest.xml index fefb7874ef736..ff89ca9b663ee 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationBlankIndustryTest.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationBlankIndustryTest.xml @@ -6,7 +6,7 @@ */ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationEnableDisableAnalyticsTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationEnableDisableAnalyticsTest.xml index 15c9727cc8c79..d9617209dcdff 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationEnableDisableAnalyticsTest.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationEnableDisableAnalyticsTest.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml index d4f30737bae3e..2d5594a43b1a7 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml index b3ccd3afd1bf7..d8aed1250d82a 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml index fc1ff7d18b51e..3f17df108b50b 100644 --- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml +++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> diff --git a/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/Client/CurlTest.php b/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/Client/CurlTest.php index 5ee59a7913a61..92f79c2bf6dee 100644 --- a/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/Client/CurlTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/Client/CurlTest.php @@ -12,6 +12,7 @@ /** * A unit test for testing of the CURL HTTP client. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class CurlTest extends \PHPUnit\Framework\TestCase { @@ -97,7 +98,6 @@ public function getTestData() 'version' => '1.1', 'body'=> ['name' => 'value'], 'url' => 'http://www.mystore.com', - 'headers' => [JsonConverter::CONTENT_TYPE_HEADER], 'method' => \Magento\Framework\HTTP\ZendClient::POST, ] ] @@ -105,7 +105,9 @@ public function getTestData() } /** + * @param array $data * @return void + * @throws \Zend_Http_Exception * @dataProvider getTestData */ public function testRequestSuccess(array $data) @@ -118,7 +120,7 @@ public function testRequestSuccess(array $data) $data['method'], $data['url'], $data['version'], - $data['headers'], + [$this->converterMock->getContentTypeHeader()], json_encode($data['body']) ); $this->curlAdapterMock->expects($this->once()) @@ -139,14 +141,16 @@ public function testRequestSuccess(array $data) $data['method'], $data['url'], $data['body'], - $data['headers'], + [$this->converterMock->getContentTypeHeader()], $data['version'] ) ); } /** + * @param array $data * @return void + * @throws \Zend_Http_Exception * @dataProvider getTestData */ public function testRequestError(array $data) @@ -158,7 +162,7 @@ public function testRequestError(array $data) $data['method'], $data['url'], $data['version'], - $data['headers'], + [$this->converterMock->getContentTypeHeader()], json_encode($data['body']) ); $this->curlAdapterMock->expects($this->once()) @@ -184,7 +188,7 @@ public function testRequestError(array $data) $data['method'], $data['url'], $data['body'], - $data['headers'], + [$this->converterMock->getContentTypeHeader()], $data['version'] ) ); @@ -195,14 +199,13 @@ public function testRequestError(array $data) */ private function createJsonConverter() { - $converterMock = $this->getMockBuilder(ConverterInterface::class) - ->getMockForAbstractClass(); + $converterMock = $this->getMockBuilder(JsonConverter::class) + ->setMethodsExcept(['getContentTypeHeader']) + ->disableOriginalConstructor() + ->getMock(); $converterMock->expects($this->any())->method('toBody')->willReturnCallback(function ($value) { return json_encode($value); }); - $converterMock->expects($this->any()) - ->method('getContentTypeHeader') - ->willReturn(JsonConverter::CONTENT_TYPE_HEADER); return $converterMock; } } diff --git a/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/JsonConverterTest.php b/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/JsonConverterTest.php index 251f0d1474083..d3258c8ae9caa 100644 --- a/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/JsonConverterTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/JsonConverterTest.php @@ -25,6 +25,9 @@ class JsonConverterTest extends \PHPUnit\Framework\TestCase */ private $converter; + /** + * @return void + */ protected function setUp() { $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -37,9 +40,15 @@ protected function setUp() ); } + /** + * @return void + */ public function testConverterContainsHeader() { - $this->assertEquals(JsonConverter::CONTENT_TYPE_HEADER, $this->converter->getContentTypeHeader()); + $this->assertEquals( + 'Content-Type: ' . JsonConverter::CONTENT_MEDIA_TYPE, + $this->converter->getContentTypeHeader() + ); } /** @@ -66,6 +75,9 @@ public function convertBodyDataProvider() ]; } + /** + * return void + */ public function testConvertData() { $this->serializerMock->expects($this->once()) diff --git a/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/ResponseResolverTest.php b/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/ResponseResolverTest.php index 3d4c90bcd07f7..2564240c4fa11 100644 --- a/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/ResponseResolverTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/ResponseResolverTest.php @@ -3,49 +3,115 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Analytics\Test\Unit\Model\Connector\Http; -use Magento\Analytics\Model\Connector\Http\JsonConverter; +use Magento\Analytics\Model\Connector\Http\ConverterInterface; use Magento\Analytics\Model\Connector\Http\ResponseHandlerInterface; use Magento\Analytics\Model\Connector\Http\ResponseResolver; -use Magento\Framework\Serialize\Serializer\Json; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; class ResponseResolverTest extends \PHPUnit\Framework\TestCase { - public function testGetResultHandleResponseSuccess() + /** + * @var ObjectManagerHelper + */ + private $objectManagerHelper; + + /** + * @var ConverterInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $converterMock; + + /** + * @var ResponseHandlerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $successResponseHandlerMock; + + /** + * @var ResponseHandlerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $notFoundResponseHandlerMock; + + /** + * @var ResponseResolver + */ + private $responseResolver; + + /** + * @return void + */ + protected function setUp() { - $expectedBody = ['test' => 'testValue']; - $response = new \Zend_Http_Response(201, [], json_encode($expectedBody)); - $responseHandlerMock = $this->getMockBuilder(ResponseHandlerInterface::class) - ->getMockForAbstractClass(); - $responseHandlerMock->expects($this->once()) - ->method('handleResponse') - ->with($expectedBody) - ->willReturn(true); - $notFoundResponseHandlerMock = $this->getMockBuilder(ResponseHandlerInterface::class) - ->getMockForAbstractClass(); - $notFoundResponseHandlerMock->expects($this->never())->method('handleResponse'); - $serializerMock = $this->getMockBuilder(Json::class) + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->converterMock = $this->getMockBuilder(ConverterInterface::class) ->disableOriginalConstructor() ->getMock(); - $serializerMock->expects($this->once()) - ->method('unserialize') - ->willReturn($expectedBody); - $objectManager = new ObjectManager($this); - $responseResolver = $objectManager->getObject( + $this->successResponseHandlerMock = $this->getMockBuilder(ResponseHandlerInterface::class) + ->getMockForAbstractClass(); + $this->notFoundResponseHandlerMock = $this->getMockBuilder(ResponseHandlerInterface::class) + ->getMockForAbstractClass(); + $this->responseResolver = $this->objectManagerHelper->getObject( ResponseResolver::class, [ - 'converter' => $objectManager->getObject( - JsonConverter::class, - ['serializer' => $serializerMock] - ), + 'converter' => $this->converterMock, 'responseHandlers' => [ - 201 => $responseHandlerMock, - 404 => $notFoundResponseHandlerMock, + 201 => $this->successResponseHandlerMock, + 404 => $this->notFoundResponseHandlerMock, ] ] ); - $this->assertTrue($responseResolver->getResult($response)); + } + + /** + * @return void + * @throws \Zend_Http_Exception + */ + public function testGetResultHandleResponseSuccess() + { + $expectedBody = ['test' => 'testValue']; + $response = new \Zend_Http_Response(201, ['Content-Type' => 'application/json'], json_encode($expectedBody)); + $this->converterMock + ->method('getContentMediaType') + ->willReturn('application/json'); + + $this->successResponseHandlerMock + ->expects($this->once()) + ->method('handleResponse') + ->with($expectedBody) + ->willReturn(true); + $this->notFoundResponseHandlerMock + ->expects($this->never()) + ->method('handleResponse'); + $this->converterMock + ->method('fromBody') + ->willReturn($expectedBody); + $this->assertTrue($this->responseResolver->getResult($response)); + } + + /** + * @return void + * @throws \Zend_Http_Exception + */ + public function testGetResultHandleResponseUnexpectedContentType() + { + $expectedBody = 'testString'; + $response = new \Zend_Http_Response(201, ['Content-Type' => 'plain/text'], $expectedBody); + $this->converterMock + ->method('getContentMediaType') + ->willReturn('application/json'); + $this->converterMock + ->expects($this->never()) + ->method('fromBody'); + $this->successResponseHandlerMock + ->expects($this->once()) + ->method('handleResponse') + ->with([]) + ->willReturn(false); + $this->notFoundResponseHandlerMock + ->expects($this->never()) + ->method('handleResponse'); + $this->assertFalse($this->responseResolver->getResult($response)); } } diff --git a/app/code/Magento/Analytics/Test/Unit/Model/Connector/SignUpCommandTest.php b/app/code/Magento/Analytics/Test/Unit/Model/Connector/SignUpCommandTest.php index db6cda7153c1a..c113b2dc275dd 100644 --- a/app/code/Magento/Analytics/Test/Unit/Model/Connector/SignUpCommandTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Model/Connector/SignUpCommandTest.php @@ -57,6 +57,9 @@ class SignUpCommandTest extends \PHPUnit\Framework\TestCase */ private $responseResolverMock; + /** + * @return void + */ protected function setUp() { $this->analyticsTokenMock = $this->getMockBuilder(AnalyticsToken::class) @@ -91,6 +94,10 @@ protected function setUp() ); } + /** + * @throws \Zend_Http_Exception + * @return void + */ public function testExecuteSuccess() { $this->integrationManagerMock->expects($this->once()) @@ -124,6 +131,9 @@ public function testExecuteSuccess() $this->assertTrue($this->signUpCommand->execute()); } + /** + * @return void + */ public function testExecuteFailureCannotGenerateToken() { $this->integrationManagerMock->expects($this->once()) @@ -134,6 +144,10 @@ public function testExecuteFailureCannotGenerateToken() $this->assertFalse($this->signUpCommand->execute()); } + /** + * @throws \Zend_Http_Exception + * @return void + */ public function testExecuteFailureResponseIsEmpty() { $this->integrationManagerMock->expects($this->once()) @@ -163,7 +177,6 @@ private function getTestData() 'url' => 'http://www.mystore.com', 'access-token' => 'thisisaccesstoken', 'integration-token' => 'thisisintegrationtoken', - 'headers' => [JsonConverter::CONTENT_TYPE_HEADER], 'method' => \Magento\Framework\HTTP\ZendClient::POST, 'body'=> ['token' => 'thisisintegrationtoken','url' => 'http://www.mystore.com'], ]; diff --git a/app/code/Magento/AsynchronousOperations/etc/db_schema_whitelist.json b/app/code/Magento/AsynchronousOperations/etc/db_schema_whitelist.json index 396e443355d8f..d62f16ffca8cd 100644 --- a/app/code/Magento/AsynchronousOperations/etc/db_schema_whitelist.json +++ b/app/code/Magento/AsynchronousOperations/etc/db_schema_whitelist.json @@ -1,47 +1,47 @@ { - "magento_bulk": { - "column": { - "id": true, - "uuid": true, - "user_id": true, - "description": true, - "operation_count": true, - "start_time": true + "magento_bulk": { + "column": { + "id": true, + "uuid": true, + "user_id": true, + "description": true, + "operation_count": true, + "start_time": true + }, + "constraint": { + "PRIMARY": true, + "MAGENTO_BULK_USER_ID_ADMIN_USER_USER_ID": true, + "MAGENTO_BULK_UUID": true + } }, - "constraint": { - "PRIMARY": true, - "MAGENTO_BULK_USER_ID_ADMIN_USER_USER_ID": true, - "MAGENTO_BULK_UUID": true - } - }, - "magento_operation": { - "column": { - "id": true, - "bulk_uuid": true, - "topic_name": true, - "serialized_data": true, - "result_serialized_data": true, - "status": true, - "error_code": true, - "result_message": true - }, - "index": { - "MAGENTO_OPERATION_BULK_UUID_ERROR_CODE": true - }, - "constraint": { - "PRIMARY": true, - "MAGENTO_OPERATION_BULK_UUID_MAGENTO_BULK_UUID": true - } - }, - "magento_acknowledged_bulk": { - "column": { - "id": true, - "bulk_uuid": true + "magento_operation": { + "column": { + "id": true, + "bulk_uuid": true, + "topic_name": true, + "serialized_data": true, + "result_serialized_data": true, + "status": true, + "error_code": true, + "result_message": true + }, + "index": { + "MAGENTO_OPERATION_BULK_UUID_ERROR_CODE": true + }, + "constraint": { + "PRIMARY": true, + "MAGENTO_OPERATION_BULK_UUID_MAGENTO_BULK_UUID": true + } }, - "constraint": { - "PRIMARY": true, - "MAGENTO_ACKNOWLEDGED_BULK_BULK_UUID_MAGENTO_BULK_UUID": true, - "MAGENTO_ACKNOWLEDGED_BULK_BULK_UUID": true + "magento_acknowledged_bulk": { + "column": { + "id": true, + "bulk_uuid": true + }, + "constraint": { + "PRIMARY": true, + "MAGENTO_ACKNOWLEDGED_BULK_BULK_UUID_MAGENTO_BULK_UUID": true, + "MAGENTO_ACKNOWLEDGED_BULK_BULK_UUID": true + } } - } } \ No newline at end of file diff --git a/app/code/Magento/Authorization/etc/db_schema_whitelist.json b/app/code/Magento/Authorization/etc/db_schema_whitelist.json index eb9256e415593..8c416d2a8b42c 100644 --- a/app/code/Magento/Authorization/etc/db_schema_whitelist.json +++ b/app/code/Magento/Authorization/etc/db_schema_whitelist.json @@ -1,38 +1,38 @@ { - "authorization_role": { - "column": { - "role_id": true, - "parent_id": true, - "tree_level": true, - "sort_order": true, - "role_type": true, - "user_id": true, - "user_type": true, - "role_name": true + "authorization_role": { + "column": { + "role_id": true, + "parent_id": true, + "tree_level": true, + "sort_order": true, + "role_type": true, + "user_id": true, + "user_type": true, + "role_name": true + }, + "index": { + "AUTHORIZATION_ROLE_PARENT_ID_SORT_ORDER": true, + "AUTHORIZATION_ROLE_TREE_LEVEL": true + }, + "constraint": { + "PRIMARY": true + } }, - "index": { - "AUTHORIZATION_ROLE_PARENT_ID_SORT_ORDER": true, - "AUTHORIZATION_ROLE_TREE_LEVEL": true - }, - "constraint": { - "PRIMARY": true - } - }, - "authorization_rule": { - "column": { - "rule_id": true, - "role_id": true, - "resource_id": true, - "privileges": true, - "permission": true - }, - "index": { - "AUTHORIZATION_RULE_RESOURCE_ID_ROLE_ID": true, - "AUTHORIZATION_RULE_ROLE_ID_RESOURCE_ID": true - }, - "constraint": { - "PRIMARY": true, - "AUTHORIZATION_RULE_ROLE_ID_AUTHORIZATION_ROLE_ROLE_ID": true + "authorization_rule": { + "column": { + "rule_id": true, + "role_id": true, + "resource_id": true, + "privileges": true, + "permission": true + }, + "index": { + "AUTHORIZATION_RULE_RESOURCE_ID_ROLE_ID": true, + "AUTHORIZATION_RULE_ROLE_ID_RESOURCE_ID": true + }, + "constraint": { + "PRIMARY": true, + "AUTHORIZATION_RULE_ROLE_ID_AUTHORIZATION_ROLE_ROLE_ID": true + } } - } } \ No newline at end of file diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/BackendResponse.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/BackendResponse.php index 3ad9f470909bf..70565ea8ac65f 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/BackendResponse.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/BackendResponse.php @@ -10,12 +10,15 @@ use Magento\Authorizenet\Model\Directpost; use Magento\Authorizenet\Model\DirectpostFactory; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\CsrfAwareActionInterface; +use Magento\Framework\App\Request\InvalidRequestException; +use Magento\Framework\App\RequestInterface; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Registry; use Psr\Log\LoggerInterface; -class BackendResponse extends \Magento\Authorizenet\Controller\Directpost\Payment +class BackendResponse extends \Magento\Authorizenet\Controller\Directpost\Payment implements CsrfAwareActionInterface { /** * @var LoggerInterface @@ -48,6 +51,23 @@ public function __construct( $this->logger = $logger ?: $this->_objectManager->get(LoggerInterface::class); } + /** + * @inheritDoc + */ + public function createCsrfValidationException( + RequestInterface $request + ): ?InvalidRequestException { + return null; + } + + /** + * @inheritDoc + */ + public function validateForCsrf(RequestInterface $request): ?bool + { + return true; + } + /** * Response action. * Action for Authorize.net SIM Relay Request. diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php index 92957481b9290..3c1cb90e0c0a5 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php @@ -6,6 +6,7 @@ namespace Magento\Authorizenet\Controller\Directpost\Payment; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; use Magento\Authorizenet\Controller\Directpost\Payment; use Magento\Authorizenet\Helper\DataFactory; use Magento\Checkout\Model\Type\Onepage; @@ -25,7 +26,7 @@ * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Place extends Payment +class Place extends Payment implements HttpPostActionInterface { /** * @var \Magento\Quote\Api\CartManagementInterface diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Response.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Response.php index d88e77d6c4e28..d562df9fb24a9 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Response.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Response.php @@ -6,8 +6,29 @@ */ namespace Magento\Authorizenet\Controller\Directpost\Payment; -class Response extends \Magento\Authorizenet\Controller\Directpost\Payment +use Magento\Framework\App\CsrfAwareActionInterface; +use Magento\Framework\App\Request\InvalidRequestException; +use Magento\Framework\App\RequestInterface; + +class Response extends \Magento\Authorizenet\Controller\Directpost\Payment implements CsrfAwareActionInterface { + /** + * @inheritDoc + */ + public function createCsrfValidationException( + RequestInterface $request + ): ?InvalidRequestException { + return null; + } + + /** + * @inheritDoc + */ + public function validateForCsrf(RequestInterface $request): ?bool + { + return true; + } + /** * Response action. * Action for Authorize.net SIM Relay Request. diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Request.php b/app/code/Magento/Authorizenet/Model/Directpost/Request.php index d9a403e5c991e..fc78d836b6080 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Request.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Request.php @@ -112,50 +112,50 @@ public function setDataFromOrder( sprintf('%.2F', $order->getBaseShippingAmount()) ); - //need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript, + //need to use (string) because NULL values IE6-8 decodes as "null" in JSON in JavaScript, //but we need "" for null values. $billing = $order->getBillingAddress(); if (!empty($billing)) { - $this->setXFirstName(strval($billing->getFirstname())) - ->setXLastName(strval($billing->getLastname())) - ->setXCompany(strval($billing->getCompany())) - ->setXAddress(strval($billing->getStreetLine(1))) - ->setXCity(strval($billing->getCity())) - ->setXState(strval($billing->getRegion())) - ->setXZip(strval($billing->getPostcode())) - ->setXCountry(strval($billing->getCountryId())) - ->setXPhone(strval($billing->getTelephone())) - ->setXFax(strval($billing->getFax())) - ->setXCustId(strval($billing->getCustomerId())) - ->setXCustomerIp(strval($order->getRemoteIp())) - ->setXCustomerTaxId(strval($billing->getTaxId())) - ->setXEmail(strval($order->getCustomerEmail())) - ->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer'))) - ->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email'))); + $this->setXFirstName((string)$billing->getFirstname()) + ->setXLastName((string)$billing->getLastname()) + ->setXCompany((string)$billing->getCompany()) + ->setXAddress((string)$billing->getStreetLine(1)) + ->setXCity((string)$billing->getCity()) + ->setXState((string)$billing->getRegion()) + ->setXZip((string)$billing->getPostcode()) + ->setXCountry((string)$billing->getCountryId()) + ->setXPhone((string)$billing->getTelephone()) + ->setXFax((string)$billing->getFax()) + ->setXCustId((string)$billing->getCustomerId()) + ->setXCustomerIp((string)$order->getRemoteIp()) + ->setXCustomerTaxId((string)$billing->getTaxId()) + ->setXEmail((string)$order->getCustomerEmail()) + ->setXEmailCustomer((string)$paymentMethod->getConfigData('email_customer')) + ->setXMerchantEmail((string)$paymentMethod->getConfigData('merchant_email')); } $shipping = $order->getShippingAddress(); if (!empty($shipping)) { $this->setXShipToFirstName( - strval($shipping->getFirstname()) + (string)$shipping->getFirstname() )->setXShipToLastName( - strval($shipping->getLastname()) + (string)$shipping->getLastname() )->setXShipToCompany( - strval($shipping->getCompany()) + (string)$shipping->getCompany() )->setXShipToAddress( - strval($shipping->getStreetLine(1)) + (string)$shipping->getStreetLine(1) )->setXShipToCity( - strval($shipping->getCity()) + (string)$shipping->getCity() )->setXShipToState( - strval($shipping->getRegion()) + (string)$shipping->getRegion() )->setXShipToZip( - strval($shipping->getPostcode()) + (string)$shipping->getPostcode() )->setXShipToCountry( - strval($shipping->getCountryId()) + (string)$shipping->getCountryId() ); } - $this->setXPoNum(strval($payment->getPoNumber())); + $this->setXPoNum((string)$payment->getPoNumber()); return $this; } diff --git a/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js b/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js index 8edc38dce6f60..2b57e5cc2fb0d 100644 --- a/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js +++ b/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js @@ -6,7 +6,7 @@ var config = { map: { '*': { - transparent: 'Magento_Payment/transparent' + transparent: 'Magento_Payment/js/transparent' } } }; diff --git a/app/code/Magento/Backend/App/Action/Plugin/Authentication.php b/app/code/Magento/Backend/App/Action/Plugin/Authentication.php index 68506a521c1cf..4b25e9921e404 100644 --- a/app/code/Magento/Backend/App/Action/Plugin/Authentication.php +++ b/app/code/Magento/Backend/App/Action/Plugin/Authentication.php @@ -160,7 +160,7 @@ protected function _processNotLoggedInUser(\Magento\Framework\App\RequestInterfa } else { $this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true); $this->_response->setRedirect($this->_url->getCurrentUrl()); - $this->messageManager->addError(__('Invalid Form Key. Please refresh the page.')); + $this->messageManager->addErrorMessage(__('Invalid Form Key. Please refresh the page.')); $isRedirectNeeded = true; } } @@ -205,7 +205,7 @@ protected function _performLogin(\Magento\Framework\App\RequestInterface $reques $this->_auth->login($username, $password); } catch (AuthenticationException $e) { if (!$request->getParam('messageSent')) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); $request->setParam('messageSent', true); $outputValue = false; } diff --git a/app/code/Magento/Backend/App/DefaultPath.php b/app/code/Magento/Backend/App/DefaultPath.php index df8b718389741..b790a2edc3fab 100644 --- a/app/code/Magento/Backend/App/DefaultPath.php +++ b/app/code/Magento/Backend/App/DefaultPath.php @@ -42,6 +42,6 @@ public function __construct(\Magento\Backend\App\ConfigInterface $config) */ public function getPart($code) { - return isset($this->_parts[$code]) ? $this->_parts[$code] : null; + return $this->_parts[$code] ?? null; } } diff --git a/app/code/Magento/Backend/Block/Media/Uploader.php b/app/code/Magento/Backend/Block/Media/Uploader.php index 5bad74d8a8be5..eb98808dd644b 100644 --- a/app/code/Magento/Backend/Block/Media/Uploader.php +++ b/app/code/Magento/Backend/Block/Media/Uploader.php @@ -3,10 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Backend\Block\Media; use Magento\Framework\App\ObjectManager; use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Image\Adapter\UploadConfigInterface; /** * Adminhtml media library uploader @@ -35,24 +38,35 @@ class Uploader extends \Magento\Backend\Block\Widget */ private $jsonEncoder; + /** + * @var UploadConfigInterface + */ + private $imageConfig; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\File\Size $fileSize * @param array $data * @param Json $jsonEncoder + * @param UploadConfigInterface $imageConfig */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\File\Size $fileSize, array $data = [], - Json $jsonEncoder = null + Json $jsonEncoder = null, + UploadConfigInterface $imageConfig = null ) { $this->_fileSizeService = $fileSize; $this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class); + $this->imageConfig = $imageConfig ?: ObjectManager::getInstance()->get(UploadConfigInterface::class); + parent::__construct($context, $data); } /** + * Initialize block. + * * @return void */ protected function _construct() @@ -90,6 +104,26 @@ public function getFileSizeService() return $this->_fileSizeService; } + /** + * Get Image Upload Maximum Width Config. + * + * @return int + */ + public function getImageUploadMaxWidth() + { + return $this->imageConfig->getMaxWidth(); + } + + /** + * Get Image Upload Maximum Height Config. + * + * @return int + */ + public function getImageUploadMaxHeight() + { + return $this->imageConfig->getMaxHeight(); + } + /** * Prepares layout and set element renderer * diff --git a/app/code/Magento/Backend/Block/Menu.php b/app/code/Magento/Backend/Block/Menu.php index 7d86497288a69..744c4d06a0d17 100644 --- a/app/code/Magento/Backend/Block/Menu.php +++ b/app/code/Magento/Backend/Block/Menu.php @@ -74,6 +74,11 @@ class Menu extends \Magento\Backend\Block\Template */ private $anchorRenderer; + /** + * @var ConfigInterface + */ + private $routeConfig; + /** * @param Template\Context $context * @param \Magento\Backend\Model\UrlInterface $url @@ -81,9 +86,11 @@ class Menu extends \Magento\Backend\Block\Template * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Backend\Model\Menu\Config $menuConfig * @param \Magento\Framework\Locale\ResolverInterface $localeResolver + * @param \Magento\Framework\App\Route\ConfigInterface $routeConfig * @param array $data * @param MenuItemChecker|null $menuItemChecker * @param AnchorRenderer|null $anchorRenderer + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, @@ -94,7 +101,8 @@ public function __construct( \Magento\Framework\Locale\ResolverInterface $localeResolver, array $data = [], MenuItemChecker $menuItemChecker = null, - AnchorRenderer $anchorRenderer = null + AnchorRenderer $anchorRenderer = null, + \Magento\Framework\App\Route\ConfigInterface $routeConfig = null ) { $this->_url = $url; $this->_iteratorFactory = $iteratorFactory; @@ -103,6 +111,9 @@ public function __construct( $this->_localeResolver = $localeResolver; $this->menuItemChecker = $menuItemChecker; $this->anchorRenderer = $anchorRenderer; + $this->routeConfig = $routeConfig ?: + \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\App\Route\ConfigInterface::class); parent::__construct($context, $data); } @@ -203,8 +214,9 @@ protected function _afterToHtml($html) */ protected function _callbackSecretKey($match) { + $routeId = $this->routeConfig->getRouteByFrontName($match[1]); return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey( - $match[1], + $routeId, $match[2], $match[3] ); diff --git a/app/code/Magento/Backend/Block/System/Store/Delete/Group.php b/app/code/Magento/Backend/Block/System/Store/Delete/Group.php index ae80b56066a6d..e95f3bbf9f8c1 100644 --- a/app/code/Magento/Backend/Block/System/Store/Delete/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete/Group.php @@ -19,7 +19,7 @@ protected function _prepareLayout() { $itemId = $this->getRequest()->getParam('group_id'); - $this->setTemplate('system/store/delete_group.phtml'); + $this->setTemplate('Magento_Backend::system/store/delete_group.phtml'); $this->setAction($this->getUrl('adminhtml/*/deleteGroupPost', ['group_id' => $itemId])); $this->addChild( 'confirm_deletion_button', diff --git a/app/code/Magento/Backend/Block/System/Store/Delete/Website.php b/app/code/Magento/Backend/Block/System/Store/Delete/Website.php index da28a471130cc..82cbb780137b8 100644 --- a/app/code/Magento/Backend/Block/System/Store/Delete/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete/Website.php @@ -19,7 +19,7 @@ protected function _prepareLayout() { $itemId = $this->getRequest()->getParam('website_id'); - $this->setTemplate('system/store/delete_website.phtml'); + $this->setTemplate('Magento_Backend::system/store/delete_website.phtml'); $this->setAction($this->getUrl('adminhtml/*/deleteWebsitePost', ['website_id' => $itemId])); $this->addChild( 'confirm_deletion_button', diff --git a/app/code/Magento/Backend/Block/Widget/Button/ButtonList.php b/app/code/Magento/Backend/Block/Widget/Button/ButtonList.php index 94af9a1d7578f..5a792ddb39132 100644 --- a/app/code/Magento/Backend/Block/Widget/Button/ButtonList.php +++ b/app/code/Magento/Backend/Block/Widget/Button/ButtonList.php @@ -7,6 +7,8 @@ namespace Magento\Backend\Block\Widget\Button; /** + * Button list widget + * * @api * @since 100.0.2 */ @@ -127,12 +129,6 @@ public function getItems() */ public function sortButtons(Item $itemA, Item $itemB) { - $sortOrderA = intval($itemA->getSortOrder()); - $sortOrderB = intval($itemB->getSortOrder()); - - if ($sortOrderA == $sortOrderB) { - return 0; - } - return ($sortOrderA < $sortOrderB) ? -1 : 1; + return (int)$itemA->getSortOrder() <=> (int)$itemB->getSortOrder(); } } diff --git a/app/code/Magento/Backend/Block/Widget/Form/Container.php b/app/code/Magento/Backend/Block/Widget/Form/Container.php index 8b7babc1bb9b6..97116de6db79b 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Container.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Container.php @@ -93,7 +93,7 @@ protected function _construct() 'class' => 'delete', 'onclick' => 'deleteConfirm(\'' . __( 'Are you sure you want to do this?' - ) . '\', \'' . $this->getDeleteUrl() . '\')' + ) . '\', \'' . $this->getDeleteUrl() . '\', {data: {}})' ] ); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php index b3f467ce37c88..03566bce3fc34 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php @@ -82,7 +82,7 @@ public function render(\Magento\Framework\DataObject $row) { if ($data = (string)$this->_getValue($row)) { $currency_code = $this->_getCurrencyCode($row); - $data = floatval($data) * $this->_getRate($row); + $data = (float)$data * $this->_getRate($row); $sign = (bool)(int)$this->getColumn()->getShowNumberSign() && $data > 0 ? '+' : ''; $data = sprintf("%f", $data); $data = $this->_localeCurrency->getCurrency($currency_code)->toCurrency($data); @@ -118,10 +118,10 @@ protected function _getCurrencyCode($row) protected function _getRate($row) { if ($rate = $this->getColumn()->getRate()) { - return floatval($rate); + return (float)$rate; } if ($rate = $row->getData($this->getColumn()->getRateField())) { - return floatval($rate); + return (float)$rate; } return $this->_defaultBaseCurrency->getRate($this->_getCurrencyCode($row)); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php index e4300c63485f5..9da23af83f036 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Price.php @@ -60,7 +60,7 @@ public function render(\Magento\Framework\DataObject $row) return $data; } - $data = floatval($data) * $this->_getRate($row); + $data = (float)$data * $this->_getRate($row); $data = sprintf("%f", $data); $data = $this->_localeCurrency->getCurrency($currencyCode)->toCurrency($data); return $data; @@ -94,10 +94,10 @@ protected function _getCurrencyCode($row) protected function _getRate($row) { if ($rate = $this->getColumn()->getRate()) { - return floatval($rate); + return (float)$rate; } if ($rate = $row->getData($this->getColumn()->getRateField())) { - return floatval($rate); + return (float)$rate; } return 1; } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Auth/DeniedJson.php b/app/code/Magento/Backend/Controller/Adminhtml/Auth/DeniedJson.php index ad4546097768a..23731e29f0df4 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Auth/DeniedJson.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Auth/DeniedJson.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\Auth; -class DeniedJson extends \Magento\Backend\Controller\Adminhtml\Auth +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class DeniedJson extends \Magento\Backend\Controller\Adminhtml\Auth implements HttpGetActionInterface { /** * @var \Magento\Framework\Controller\Result\JsonFactory diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php b/app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php index e1ea57f63035e..1de77c810f316 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php @@ -6,11 +6,14 @@ */ namespace Magento\Backend\Controller\Adminhtml\Auth; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGet; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPost; + /** * @api * @since 100.0.2 */ -class Login extends \Magento\Backend\Controller\Adminhtml\Auth +class Login extends \Magento\Backend\Controller\Adminhtml\Auth implements HttpGet, HttpPost { /** * @var \Magento\Framework\View\Result\PageFactory diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php b/app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php index 41e32c929287a..d7ad080395e29 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Auth/Logout.php @@ -6,7 +6,10 @@ */ namespace Magento\Backend\Controller\Adminhtml\Auth; -class Logout extends \Magento\Backend\Controller\Adminhtml\Auth +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGet; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPost; + +class Logout extends \Magento\Backend\Controller\Adminhtml\Auth implements HttpGet, HttpPost { /** * Administrator logout action @@ -16,7 +19,7 @@ class Logout extends \Magento\Backend\Controller\Adminhtml\Auth public function execute() { $this->_auth->logout(); - $this->messageManager->addSuccess(__('You have logged out.')); + $this->messageManager->addSuccessMessage(__('You have logged out.')); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php index 7a926b1c09c3e..79bc19256d270 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanImages.php @@ -6,10 +6,11 @@ */ namespace Magento\Backend\Controller\Adminhtml\Cache; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Controller\ResultFactory; -class CleanImages extends \Magento\Backend\Controller\Adminhtml\Cache +class CleanImages extends \Magento\Backend\Controller\Adminhtml\Cache implements HttpGetActionInterface { /** * Authorization level of a basic admin session @@ -28,11 +29,11 @@ public function execute() try { $this->_objectManager->create(\Magento\Catalog\Model\Product\Image::class)->clearCache(); $this->_eventManager->dispatch('clean_catalog_images_cache_after'); - $this->messageManager->addSuccess(__('The image cache was cleaned.')); + $this->messageManager->addSuccessMessage(__('The image cache was cleaned.')); } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while clearing the image cache.')); + $this->messageManager->addExceptionMessage($e, __('An error occurred while clearing the image cache.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php index 72f23ab65cf8a..36aca1afcc480 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanMedia.php @@ -6,10 +6,11 @@ */ namespace Magento\Backend\Controller\Adminhtml\Cache; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Controller\ResultFactory; -class CleanMedia extends \Magento\Backend\Controller\Adminhtml\Cache +class CleanMedia extends \Magento\Backend\Controller\Adminhtml\Cache implements HttpGetActionInterface { /** * Authorization level of a basic admin session @@ -28,11 +29,12 @@ public function execute() try { $this->_objectManager->get(\Magento\Framework\View\Asset\MergeService::class)->cleanMergedJsCss(); $this->_eventManager->dispatch('clean_media_cache_after'); - $this->messageManager->addSuccess(__('The JavaScript/CSS cache has been cleaned.')); + $this->messageManager->addSuccessMessage(__('The JavaScript/CSS cache has been cleaned.')); } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while clearing the JavaScript/CSS cache.')); + $this->messageManager + ->addExceptionMessage($e, __('An error occurred while clearing the JavaScript/CSS cache.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php index 27ae2fc31e150..a3a26c5cf6242 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/CleanStaticFiles.php @@ -6,9 +6,10 @@ */ namespace Magento\Backend\Controller\Adminhtml\Cache; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Framework\Controller\ResultFactory; -class CleanStaticFiles extends \Magento\Backend\Controller\Adminhtml\Cache +class CleanStaticFiles extends \Magento\Backend\Controller\Adminhtml\Cache implements HttpGetActionInterface { /** * Authorization level of a basic admin session @@ -26,7 +27,7 @@ public function execute() { $this->_objectManager->get(\Magento\Framework\App\State\CleanupFiles::class)->clearMaterializedViewFiles(); $this->_eventManager->dispatch('clean_static_files_cache_after'); - $this->messageManager->addSuccess(__('The static files cache has been cleaned.')); + $this->messageManager->addSuccessMessage(__('The static files cache has been cleaned.')); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php index ca89ea58fa6f3..daf424d14c55b 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushAll.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\Cache; -class FlushAll extends \Magento\Backend\Controller\Adminhtml\Cache +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class FlushAll extends \Magento\Backend\Controller\Adminhtml\Cache implements HttpGetActionInterface { /** * Authorization level of a basic admin session @@ -27,7 +29,7 @@ public function execute() foreach ($this->_cacheFrontendPool as $cacheFrontend) { $cacheFrontend->getBackend()->clean(); } - $this->messageManager->addSuccess(__("You flushed the cache storage.")); + $this->messageManager->addSuccessMessage(__("You flushed the cache storage.")); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); return $resultRedirect->setPath('adminhtml/*'); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php index f0fed159e0f22..f3474bf43872b 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/FlushSystem.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\Cache; -class FlushSystem extends \Magento\Backend\Controller\Adminhtml\Cache +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class FlushSystem extends \Magento\Backend\Controller\Adminhtml\Cache implements HttpGetActionInterface { /** * Authorization level of a basic admin session @@ -27,7 +29,7 @@ public function execute() $cacheFrontend->clean(); } $this->_eventManager->dispatch('adminhtml_cache_flush_system'); - $this->messageManager->addSuccess(__("The Magento cache storage has been flushed.")); + $this->messageManager->addSuccessMessage(__("The Magento cache storage has been flushed.")); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); return $resultRedirect->setPath('adminhtml/*'); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/Index.php index 05bd309ca620e..f1e908bb842ee 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/Index.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\Cache; -class Index extends \Magento\Backend\Controller\Adminhtml\Cache +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class Index extends \Magento\Backend\Controller\Adminhtml\Cache implements HttpGetActionInterface { /** * Display cache management grid diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php index 2bfa937b06b77..03b88ca1d3f47 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php @@ -67,12 +67,12 @@ private function disableCache() } if ($updatedTypes > 0) { $this->_cacheState->persist(); - $this->messageManager->addSuccess(__("%1 cache type(s) disabled.", $updatedTypes)); + $this->messageManager->addSuccessMessage(__("%1 cache type(s) disabled.", $updatedTypes)); } } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while disabling cache.')); + $this->messageManager->addExceptionMessage($e, __('An error occurred while disabling cache.')); } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php index 113e0f2d8961b..1b98a00d4bf35 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassEnable.php @@ -66,12 +66,12 @@ private function enableCache() } if ($updatedTypes > 0) { $this->_cacheState->persist(); - $this->messageManager->addSuccess(__("%1 cache type(s) enabled.", $updatedTypes)); + $this->messageManager->addSuccessMessage(__("%1 cache type(s) enabled.", $updatedTypes)); } } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while enabling cache.')); + $this->messageManager->addExceptionMessage($e, __('An error occurred while enabling cache.')); } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php index 3843b030afb3d..bde211debcf72 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php @@ -37,12 +37,12 @@ public function execute() $updatedTypes++; } if ($updatedTypes > 0) { - $this->messageManager->addSuccess(__("%1 cache type(s) refreshed.", $updatedTypes)); + $this->messageManager->addSuccessMessage(__("%1 cache type(s) refreshed.", $updatedTypes)); } } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('An error occurred while refreshing cache.')); + $this->messageManager->addExceptionMessage($e, __('An error occurred while refreshing cache.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/Index.php index d8c52f6c50bba..decca6837fa00 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/Index.php @@ -6,7 +6,11 @@ */ namespace Magento\Backend\Controller\Adminhtml\Dashboard; -class Index extends \Magento\Backend\Controller\Adminhtml\Dashboard +use Magento\Backend\Controller\Adminhtml\Dashboard as DashboardAction; +use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\App\Action\HttpPostActionInterface; + +class Index extends DashboardAction implements HttpGetActionInterface, HttpPostActionInterface { /** * @var \Magento\Framework\View\Result\PageFactory diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/RefreshStatistics.php b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/RefreshStatistics.php index f831fa67f4bb0..c10d1a77997b7 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/RefreshStatistics.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Dashboard/RefreshStatistics.php @@ -34,9 +34,9 @@ public function execute() foreach ($collectionsNames as $collectionName) { $this->_objectManager->create($collectionName)->aggregate(); } - $this->messageManager->addSuccess(__('We updated lifetime statistic.')); + $this->messageManager->addSuccessMessage(__('We updated lifetime statistic.')); } catch (\Exception $e) { - $this->messageManager->addError(__('We can\'t refresh lifetime statistics.')); + $this->messageManager->addErrorMessage(__('We can\'t refresh lifetime statistics.')); $this->logger->critical($e); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index/GlobalSearch.php b/app/code/Magento/Backend/Controller/Adminhtml/Index/GlobalSearch.php index 9ca4021d08356..37f3064aeaa38 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Index/GlobalSearch.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Index/GlobalSearch.php @@ -6,11 +6,15 @@ */ namespace Magento\Backend\Controller\Adminhtml\Index; +use Magento\Backend\Controller\Adminhtml\Index as IndexAction; +use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; + /** * @api * @since 100.0.2 */ -class GlobalSearch extends \Magento\Backend\Controller\Adminhtml\Index +class GlobalSearch extends IndexAction implements HttpGetActionInterface, HttpPostActionInterface { /** * @var \Magento\Framework\Controller\Result\JsonFactory diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Index/Index.php index a5c71fb2dbc5c..afb1b4573271d 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Index/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Index/Index.php @@ -6,7 +6,10 @@ */ namespace Magento\Backend\Controller\Adminhtml\Index; -class Index extends \Magento\Backend\Controller\Adminhtml\Index +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGet; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPost; + +class Index extends \Magento\Backend\Controller\Adminhtml\Index implements HttpGet, HttpPost { /** * Admin area entry point diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php index ce59d2fd48e5a..e84987d8e1d70 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php @@ -6,6 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\Noroute; +/** + * @SuppressWarnings(PHPMD.AllPurposeAction) + */ class Index extends \Magento\Backend\App\Action { /** diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Index.php index 54771bfdc1a7d..648f1be86f56c 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Index.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\System\Account; -class Index extends \Magento\Backend\Controller\Adminhtml\System\Account +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class Index extends \Magento\Backend\Controller\Adminhtml\System\Account implements HttpGetActionInterface { /** * @var \Magento\Framework\View\Result\PageFactory diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php index 1b10c151a9d21..d95b0541c2c76 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php @@ -76,12 +76,12 @@ public function execute() $errors = $user->validate(); if ($errors !== true && !empty($errors)) { foreach ($errors as $error) { - $this->messageManager->addError($error); + $this->messageManager->addErrorMessage($error); } } else { $user->save(); $user->sendNotificationEmailsIfRequired(); - $this->messageManager->addSuccess(__('You saved the account.')); + $this->messageManager->addSuccessMessage(__('You saved the account.')); } } catch (UserLockedException $e) { $this->_auth->logout(); @@ -91,12 +91,12 @@ public function execute() } catch (ValidatorException $e) { $this->messageManager->addMessages($e->getMessages()); if ($e->getMessage()) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } } catch (LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addError(__('An error occurred while saving account.')); + $this->messageManager->addErrorMessage(__('An error occurred while saving account.')); } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php index 76402169f269e..21f28188cf874 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php @@ -19,11 +19,11 @@ public function execute() try { $design->delete(); - $this->messageManager->addSuccess(__('You deleted the design change.')); + $this->messageManager->addSuccessMessage(__('You deleted the design change.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __("You can't delete the design change.")); + $this->messageManager->addExceptionMessage($e, __("You can't delete the design change.")); } } /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Index.php index 30b26f2294193..c6a05b5a71d0c 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Index.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\System\Design; -class Index extends \Magento\Backend\Controller\Adminhtml\System\Design +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class Index extends \Magento\Backend\Controller\Adminhtml\System\Design implements HttpGetActionInterface { /** * @return \Magento\Backend\Model\View\Result\Page diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php index 1f478604ced7d..0228b48f7f11e 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php @@ -50,9 +50,9 @@ public function execute() try { $design->save(); $this->_eventManager->dispatch('theme_save_after'); - $this->messageManager->addSuccess(__('You saved the design change.')); + $this->messageManager->addSuccessMessage(__('You saved the design change.')); } catch (\Exception $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); $this->_objectManager->get(\Magento\Backend\Model\Session::class)->setDesignData($data); return $resultRedirect->setPath('adminhtml/*/', ['id' => $design->getId()]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index 4fbae6abb423a..0beeb5168b6d1 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -103,12 +103,12 @@ protected function _backupDatabase() ->setType('db') ->setPath($filesystem->getDirectoryRead(DirectoryList::VAR_DIR)->getAbsolutePath('backups')); $backupDb->createBackup($backup); - $this->messageManager->addSuccess(__('The database was backed up.')); + $this->messageManager->addSuccessMessage(__('The database was backed up.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); return false; } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __('We can\'t create a backup right now. Please try again later.') ); @@ -125,7 +125,7 @@ protected function _backupDatabase() */ protected function _addDeletionNotice($typeTitle) { - $this->messageManager->addNotice( + $this->messageManager->addNoticeMessage( __( 'Deleting a %1 will not delete the information associated with the %1 (e.g. categories, products, etc.)' . ', but the %1 will not be able to be restored. It is suggested that you create a database backup ' diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroup.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroup.php index 925ae4c69ee8e..4e323be709ae1 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroup.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroup.php @@ -15,13 +15,13 @@ public function execute() { $itemId = $this->getRequest()->getParam('item_id', null); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Group::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This store cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This store cannot be deleted.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/editGroup', ['group_id' => $itemId]); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php index b6fbd88c7669c..49c327060dae5 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php @@ -1,16 +1,20 @@ resultFactory->create(ResultFactory::TYPE_REDIRECT); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Group::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This store cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This store cannot be deleted.')); return $redirectResult->setPath('adminhtml/*/editGroup', ['group_id' => $model->getId()]); } @@ -35,12 +39,12 @@ public function execute() try { $model->delete(); - $this->messageManager->addSuccess(__('You deleted the store.')); + $this->messageManager->addSuccessMessage(__('You deleted the store.')); return $redirectResult->setPath('adminhtml/*/'); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('Unable to delete the store. Please try again later.')); + $this->messageManager->addExceptionMessage($e, __('Unable to delete the store. Please try again later.')); } return $redirectResult->setPath('adminhtml/*/editGroup', ['group_id' => $itemId]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php index b31de6cacc5ff..c340b1ec53aa5 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStore.php @@ -15,13 +15,13 @@ public function execute() { $itemId = $this->getRequest()->getParam('item_id', null); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Store::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This store view cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This store view cannot be deleted.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/editStore', ['store_id' => $itemId]); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php index 13b104c5ec4c0..7999012b43594 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php @@ -1,14 +1,17 @@ resultFactory->create(ResultFactory::TYPE_REDIRECT); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Store::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This store view cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This store view cannot be deleted.')); return $redirectResult->setPath('adminhtml/*/editStore', ['store_id' => $model->getId()]); } @@ -37,12 +40,13 @@ public function execute() try { $model->delete(); - $this->messageManager->addSuccess(__('You deleted the store view.')); + $this->messageManager->addSuccessMessage(__('You deleted the store view.')); return $redirectResult->setPath('adminhtml/*/'); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('Unable to delete the store view. Please try again later.')); + $this->messageManager + ->addExceptionMessage($e, __('Unable to delete the store view. Please try again later.')); } return $redirectResult->setPath('adminhtml/*/editStore', ['store_id' => $itemId]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsite.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsite.php index 1f2ec4b2ba4b1..9e8664b8ecd11 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsite.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsite.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\System\Store; -class DeleteWebsite extends \Magento\Backend\Controller\Adminhtml\System\Store +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class DeleteWebsite extends \Magento\Backend\Controller\Adminhtml\System\Store implements HttpGetActionInterface { /** * @return \Magento\Framework\Controller\ResultInterface @@ -15,13 +17,13 @@ public function execute() { $itemId = $this->getRequest()->getParam('item_id', null); if (!($model = $this->_objectManager->create(\Magento\Store\Model\Website::class)->load($itemId))) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This website cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This website cannot be deleted.')); /** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */ $redirectResult = $this->resultRedirectFactory->create(); return $redirectResult->setPath('adminhtml/*/editWebsite', ['website_id' => $itemId]); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php index c2d24b8c41a8c..3fee1a25c9fe4 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php @@ -6,11 +6,16 @@ */ namespace Magento\Backend\Controller\Adminhtml\System\Store; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; use Magento\Framework\Controller\ResultFactory; -class DeleteWebsitePost extends \Magento\Backend\Controller\Adminhtml\System\Store +/** + * Delete website. + */ +class DeleteWebsitePost extends \Magento\Backend\Controller\Adminhtml\System\Store implements HttpPostActionInterface { /** + * @inheritDoc * @return \Magento\Backend\Model\View\Result\Redirect */ public function execute() @@ -23,11 +28,11 @@ public function execute() $redirectResult = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); if (!$model) { - $this->messageManager->addError(__('Something went wrong. Please try again.')); + $this->messageManager->addErrorMessage(__('Something went wrong. Please try again.')); return $redirectResult->setPath('adminhtml/*/'); } if (!$model->isCanDelete()) { - $this->messageManager->addError(__('This website cannot be deleted.')); + $this->messageManager->addErrorMessage(__('This website cannot be deleted.')); return $redirectResult->setPath('adminhtml/*/editWebsite', ['website_id' => $model->getId()]); } @@ -37,12 +42,12 @@ public function execute() try { $model->delete(); - $this->messageManager->addSuccess(__('You deleted the website.')); + $this->messageManager->addSuccessMessage(__('You deleted the website.')); return $redirectResult->setPath('adminhtml/*/'); } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addException($e, __('Unable to delete the website. Please try again later.')); + $this->messageManager->addExceptionMessage($e, __('Unable to delete the website. Please try again later.')); } return $redirectResult->setPath('*/*/editWebsite', ['website_id' => $itemId]); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditStore.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditStore.php index cbc068a480865..e5cd43b521fd1 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditStore.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditStore.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\System\Store; -class EditStore extends \Magento\Backend\Controller\Adminhtml\System\Store +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class EditStore extends \Magento\Backend\Controller\Adminhtml\System\Store implements HttpGetActionInterface { /** * @return \Magento\Framework\Controller\ResultInterface @@ -57,7 +59,7 @@ public function execute() if ($model->getId() || $this->_coreRegistry->registry('store_action') == 'add') { $this->_coreRegistry->register('store_data', $model); if ($this->_coreRegistry->registry('store_action') == 'edit' && $codeBase && !$model->isReadOnly()) { - $this->messageManager->addNotice($codeBase); + $this->messageManager->addNoticeMessage($codeBase); } $resultPage = $this->createPage(); if ($this->_coreRegistry->registry('store_action') == 'add') { @@ -71,7 +73,7 @@ public function execute() )); return $resultPage; } else { - $this->messageManager->addError($notExists); + $this->messageManager->addErrorMessage($notExists); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); return $resultRedirect->setPath('adminhtml/*/'); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditWebsite.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditWebsite.php index bfdf7cdbeb8fb..74ed7951e6214 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditWebsite.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/EditWebsite.php @@ -6,7 +6,9 @@ */ namespace Magento\Backend\Controller\Adminhtml\System\Store; -class EditWebsite extends \Magento\Backend\Controller\Adminhtml\System\Store +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class EditWebsite extends \Magento\Backend\Controller\Adminhtml\System\Store implements HttpGetActionInterface { /** * @return \Magento\Backend\Model\View\Result\Forward diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Index.php index b104704f41bdb..54da065c4af91 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Index.php @@ -6,12 +6,13 @@ */ namespace Magento\Backend\Controller\Adminhtml\System\Store; +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Framework\Controller\ResultFactory; /** * Class Index returns Stores page */ -class Index extends \Magento\Backend\Controller\Adminhtml\System\Store +class Index extends \Magento\Backend\Controller\Adminhtml\System\Store implements HttpGetActionInterface { /** * Returns Stores page diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php index 8ca783f887ec4..b67f1f23f16ba 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php @@ -6,12 +6,14 @@ */ namespace Magento\Backend\Controller\Adminhtml\System\Store; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; + /** * Class Save * * Save controller for system entities such as: Store, StoreGroup, Website */ -class Save extends \Magento\Backend\Controller\Adminhtml\System\Store +class Save extends \Magento\Backend\Controller\Adminhtml\System\Store implements HttpPostActionInterface { /** * Process Website model save @@ -32,7 +34,7 @@ private function processWebsiteSave($postData) } $websiteModel->save(); - $this->messageManager->addSuccess(__('You saved the website.')); + $this->messageManager->addSuccessMessage(__('You saved the website.')); return $postData; } @@ -68,7 +70,7 @@ private function processStoreSave($postData) ); } $storeModel->save(); - $this->messageManager->addSuccess(__('You saved the store view.')); + $this->messageManager->addSuccessMessage(__('You saved the store view.')); return $postData; } @@ -98,7 +100,7 @@ private function processGroupSave($postData) ); } $groupModel->save(); - $this->messageManager->addSuccess(__('You saved the store.')); + $this->messageManager->addSuccessMessage(__('You saved the store.')); return $postData; } @@ -134,10 +136,10 @@ public function execute() $redirectResult->setPath('adminhtml/*/'); return $redirectResult; } catch (\Magento\Framework\Exception\LocalizedException $e) { - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); $this->_getSession()->setPostData($postData); } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __('Something went wrong while saving. Please review the error log.') ); diff --git a/app/code/Magento/Backend/Helper/Dashboard/Order.php b/app/code/Magento/Backend/Helper/Dashboard/Order.php index 9fc2c2cdb4e6f..c19c28b6e33eb 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/Order.php +++ b/app/code/Magento/Backend/Helper/Dashboard/Order.php @@ -13,7 +13,7 @@ * @api * @since 100.0.2 */ -class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard +class Order extends AbstractDashboard { /** * @var \Magento\Reports\Model\ResourceModel\Order\Collection @@ -29,32 +29,25 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Framework\App\Helper\Context $context, - \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection + \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection, + \Magento\Store\Model\StoreManagerInterface $storeManager = null ) { $this->_orderCollection = $orderCollection; - parent::__construct($context); - } + $this->_storeManager = $storeManager ?: ObjectManager::getInstance() + ->get(\Magento\Store\Model\StoreManagerInterface::class); - /** - * The getter function to get the new StoreManager dependency - * - * @return \Magento\Store\Model\StoreManagerInterface - * - * @deprecated 100.1.0 - */ - private function getStoreManager() - { - if ($this->_storeManager === null) { - $this->_storeManager = ObjectManager::getInstance()->get(\Magento\Store\Model\StoreManagerInterface::class); - } - return $this->_storeManager; + parent::__construct($context); } /** * @return void + * + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException */ protected function _initCollection() { @@ -65,15 +58,15 @@ protected function _initCollection() if ($this->getParam('store')) { $this->_collection->addFieldToFilter('store_id', $this->getParam('store')); } elseif ($this->getParam('website')) { - $storeIds = $this->getStoreManager()->getWebsite($this->getParam('website'))->getStoreIds(); + $storeIds = $this->_storeManager->getWebsite($this->getParam('website'))->getStoreIds(); $this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]); } elseif ($this->getParam('group')) { - $storeIds = $this->getStoreManager()->getGroup($this->getParam('group'))->getStoreIds(); + $storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds(); $this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]); } elseif (!$this->_collection->isLive()) { $this->_collection->addFieldToFilter( 'store_id', - ['eq' => $this->getStoreManager()->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()] + ['eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()] ); } $this->_collection->load(); diff --git a/app/code/Magento/Backend/Model/Menu.php b/app/code/Magento/Backend/Model/Menu.php index 22110cf52de2b..0246346ec4d97 100644 --- a/app/code/Magento/Backend/Model/Menu.php +++ b/app/code/Magento/Backend/Model/Menu.php @@ -83,7 +83,7 @@ public function add(Item $item, $parentId = null, $index = null) } $parentItem->getChildren()->add($item, null, $index); } else { - $index = intval($index); + $index = (int) $index; if (!isset($this[$index])) { $this->offsetSet($index, $item); $this->_logger->info( diff --git a/app/code/Magento/Backend/Model/Menu/Builder.php b/app/code/Magento/Backend/Model/Menu/Builder.php index ae572deab53d9..1c6e900bc5cfc 100644 --- a/app/code/Magento/Backend/Model/Menu/Builder.php +++ b/app/code/Magento/Backend/Model/Menu/Builder.php @@ -102,6 +102,6 @@ public function getResult(\Magento\Backend\Model\Menu $menu) */ protected function _getParam($params, $paramName, $defaultValue = null) { - return isset($params[$paramName]) ? $params[$paramName] : $defaultValue; + return $params[$paramName] ?? $defaultValue; } } diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml index bcff329d79dad..9ba4430bafe35 100644 --- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml index 8a24ab2a2f185..a7ef237a232b8 100644 --- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml index cdaf231e9dda0..a4d922086df34 100644 --- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/SecondaryGridActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/SecondaryGridActionGroup.xml index 9fe5f54f1db3c..6f27b03e4df30 100644 --- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/SecondaryGridActionGroup.xml +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/SecondaryGridActionGroup.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/SortByIdDescendingActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/SortByIdDescendingActionGroup.xml index b7b63c5d9a62e..fd353964bae9a 100644 --- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/SortByIdDescendingActionGroup.xml +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/SortByIdDescendingActionGroup.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/app/code/Magento/Backend/Test/Mftf/Data/BackenedData.xml b/app/code/Magento/Backend/Test/Mftf/Data/BackenedData.xml index 286685315a7bc..016e936977cd0 100644 --- a/app/code/Magento/Backend/Test/Mftf/Data/BackenedData.xml +++ b/app/code/Magento/Backend/Test/Mftf/Data/BackenedData.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> data diff --git a/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationStoresPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationStoresPage.xml index a53938d534644..d1bf3c2cb2ed6 100644 --- a/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationStoresPage.xml +++ b/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationStoresPage.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Page/AdminDashboardPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/AdminDashboardPage.xml new file mode 100644 index 0000000000000..8c258accdf06c --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Page/AdminDashboardPage.xml @@ -0,0 +1,14 @@ + + + + + +
+ + diff --git a/app/code/Magento/Backend/Test/Mftf/Page/AdminLoginPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/AdminLoginPage.xml index ca0797f7ded26..b68b9914186f6 100644 --- a/app/code/Magento/Backend/Test/Mftf/Page/AdminLoginPage.xml +++ b/app/code/Magento/Backend/Test/Mftf/Page/AdminLoginPage.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Page/AdminLogoutPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/AdminLogoutPage.xml index 75ef114ec64b6..713199771e824 100644 --- a/app/code/Magento/Backend/Test/Mftf/Page/AdminLogoutPage.xml +++ b/app/code/Magento/Backend/Test/Mftf/Page/AdminLogoutPage.xml @@ -7,6 +7,6 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminConfirmationModalSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminConfirmationModalSection.xml index dc512e66528ac..2ec25da461908 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminConfirmationModalSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminConfirmationModalSection.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminGridTableSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminGridTableSection.xml index 3e8f8a8f2e412..cc92e530cf3d4 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminGridTableSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminGridTableSection.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml index 92b06878ab87f..441ce886f117b 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminLoginFormSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminLoginFormSection.xml index b65a969e334c4..3b10fac7bb9dc 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminLoginFormSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminLoginFormSection.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml index f8d259cc8e490..cb164d43a49ff 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminMenuSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminMenuSection.xml new file mode 100644 index 0000000000000..9d3182b6236a4 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminMenuSection.xml @@ -0,0 +1,19 @@ + + + + +
+ + + + + + +
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml index ff5e02397cbff..b1350d5dcc1d7 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminSecondaryGridSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminSecondaryGridSection.xml index ea84ce7ea0c4f..9051eb747a7a6 100644 --- a/app/code/Magento/Backend/Test/Mftf/Section/AdminSecondaryGridSection.xml +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminSecondaryGridSection.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml index 99d0f6654738a..7f0194b7dc347 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanMediaTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanMediaTest.php index b1911da024227..ac0f4a2f467c8 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanMediaTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanMediaTest.php @@ -38,7 +38,7 @@ public function testExecute() $messageManagerParams = $helper->getConstructArguments(\Magento\Framework\Message\Manager::class); $messageManagerParams['exceptionMessageFactory'] = $exceptionMessageFactory; $messageManager = $this->getMockBuilder(\Magento\Framework\Message\Manager::class) - ->setMethods(['addSuccess']) + ->setMethods(['addSuccessMessage']) ->setConstructorArgs($messageManagerParams) ->getMock(); @@ -86,7 +86,7 @@ public function testExecute() $mergeService->expects($this->once())->method('cleanMergedJsCss'); $messageManager->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with('The JavaScript/CSS cache has been cleaned.'); $valueMap = [ diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanStaticFilesTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanStaticFilesTest.php index 40d9ca1aa8996..fc457cd9681e6 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanStaticFilesTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/CleanStaticFilesTest.php @@ -76,7 +76,7 @@ public function testExecute() ->with('clean_static_files_cache_after'); $this->messageManagerMock->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with('The static files cache has been cleaned.'); $resultRedirect = $this->getMockBuilder(\Magento\Backend\Model\View\Result\Redirect::class) diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php index 197b46acc61bc..a8b248c611e07 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php @@ -156,7 +156,7 @@ public function testExecuteInvalidTypeCache() ->willReturn(['someCache']); $this->messageManagerMock->expects($this->once()) - ->method('addError') + ->method('addErrorMessage') ->with('These cache type(s) don\'t exist: someCache') ->willReturnSelf(); @@ -176,7 +176,7 @@ public function testExecuteWithException() ->willThrowException($exception); $this->messageManagerMock->expects($this->once()) - ->method('addException') + ->method('addExceptionMessage') ->with($exception, 'An error occurred while disabling cache.') ->willReturnSelf(); @@ -216,7 +216,7 @@ public function testExecuteSuccess() ->method('persist'); $this->messageManagerMock->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with('1 cache type(s) disabled.') ->willReturnSelf(); diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php index 9b3640193154a..6eac44a564f6d 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php @@ -156,7 +156,7 @@ public function testExecuteInvalidTypeCache() ->willReturn(['someCache']); $this->messageManagerMock->expects($this->once()) - ->method('addError') + ->method('addErrorMessage') ->with('These cache type(s) don\'t exist: someCache') ->willReturnSelf(); @@ -176,7 +176,7 @@ public function testExecuteWithException() ->willThrowException($exception); $this->messageManagerMock->expects($this->once()) - ->method('addException') + ->method('addExceptionMessage') ->with($exception, 'An error occurred while enabling cache.') ->willReturnSelf(); @@ -216,7 +216,7 @@ public function testExecuteSuccess() ->method('persist'); $this->messageManagerMock->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with('1 cache type(s) enabled.') ->willReturnSelf(); diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/RefreshStatisticsTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/RefreshStatisticsTest.php index e8dcc00345fc6..a985681919f0b 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/RefreshStatisticsTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/RefreshStatisticsTest.php @@ -107,7 +107,7 @@ public function testExecute() $this->resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirect); $this->messageManager->expects($this->once()) - ->method('addSuccess') + ->method('addSuccessMessage') ->with(__('We updated lifetime statistic.')); $this->objectManager->expects($this->any()) diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php index 844a821df1c20..a8490d6ba2e58 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php @@ -71,7 +71,7 @@ protected function setUp() ->getMock(); $this->_messagesMock = $this->getMockBuilder(\Magento\Framework\Message\Manager::class) ->disableOriginalConstructor() - ->setMethods(['addSuccess']) + ->setMethods(['addSuccessMessage']) ->getMockForAbstractClass(); $this->_authSessionMock = $this->getMockBuilder(\Magento\Backend\Model\Auth\Session::class) @@ -221,7 +221,7 @@ public function testSaveAction() $this->_requestMock->setParams($requestParams); - $this->_messagesMock->expects($this->once())->method('addSuccess')->with($this->equalTo($testedMessage)); + $this->_messagesMock->expects($this->once())->method('addSuccessMessage')->with($this->equalTo($testedMessage)); $this->_controller->execute(); } diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index d8e9674d2b4cb..3384384343fe9 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -14,8 +14,6 @@ - Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT @@ -169,4 +167,5 @@ Magento\Backend\Block\Template + diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index be1b836d64802..e061455acbe6b 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -197,7 +197,7 @@ - + Magento\Config\Model\Config\Source\Image\Adapter Magento\Config\Model\Config\Backend\Image\Adapter @@ -234,6 +234,7 @@ Magento\Directory\Model\Config\Source\Country + 1 @@ -314,11 +315,11 @@ Magento\Config\Model\Config\Source\Yesno - + For Windows server only. - + For Windows server only. @@ -335,6 +336,19 @@ + + + + + validate-greater-than-zero validate-number required-entry + Maximum allowed width for uploaded image. + + + + validate-greater-than-zero validate-number required-entry + Maximum allowed height for uploaded image. + +
@@ -435,7 +449,7 @@ Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).]]> - + Magento\Config\Model\Config\Source\Web\Redirect I.e. redirect from http://example.com/store/ to http://www.example.com/store/ @@ -448,7 +462,7 @@ Magento\Config\Model\Config\Source\Yesno - + Any of the fields allow fully qualified URLs that end with '/' (slash) e.g. http://example.com/magento/ @@ -456,7 +470,7 @@ Magento\Config\Model\Config\Backend\Baseurl Specify URL or {{base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May start with {{unsecure_base_url}} placeholder. @@ -466,13 +480,13 @@ Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{unsecure_base_url}} placeholder. - + Any of the fields allow fully qualified URLs that end with '/' (slash) e.g. https://example.com/magento/ @@ -480,7 +494,7 @@ Magento\Config\Model\Config\Backend\Baseurl Specify URL or {{base_url}}, or {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May start with {{secure_base_url}} or {{unsecure_base_url}} placeholder. @@ -490,24 +504,24 @@ Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure Enter https protocol to use Secure URLs on Storefront. - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure Enter https protocol to use Secure URLs in Admin. - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure @@ -517,7 +531,7 @@ 1 - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure diff --git a/app/code/Magento/Backend/etc/config.xml b/app/code/Magento/Backend/etc/config.xml index b7aaf8bf20dba..45d283ad3ff22 100644 --- a/app/code/Magento/Backend/etc/config.xml +++ b/app/code/Magento/Backend/etc/config.xml @@ -28,6 +28,10 @@ 1 + + 1920 + 1200 + diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 6d1691a0e5603..3a5cd8226753d 100644 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index 1e14dd837634a..966372773f295 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -13,8 +13,8 @@ data-mage-init='{ "Magento_Backend/js/media-uploader" : { "maxFileSize": getFileSizeService()->getMaxFileSize() ?>, - "maxWidth": , - "maxHeight": + "maxWidth":getImageUploadMaxWidth() ?> , + "maxHeight": getImageUploadMaxHeight() ?> } }' > diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index c665c1095a549..fad8f5968009f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -107,7 +107,7 @@ $numColumns = !is_null($block->getColumns()) ? sizeof($block->getColumns()) : 0; ' . $block->getCollection()->getLastPageNumber() . '') ?> -