diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php
index 254d893d24584..17318d4207841 100644
--- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php
@@ -7,13 +7,16 @@
namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier;
-use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection;
-use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories;
+use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
+use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection;
use Magento\Framework\AuthorizationInterface;
use Magento\Framework\DB\Helper as DbHelper;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\Store;
+use Magento\Backend\Model\Auth\Session;
+use Magento\Authorization\Model\Role;
+use Magento\User\Model\User;
use PHPUnit\Framework\MockObject\MockObject;
/**
@@ -51,6 +54,11 @@ class CategoriesTest extends AbstractModifierTest
*/
private $authorizationMock;
+ /**
+ * @var Session|MockObject
+ */
+ private $sessionMock;
+
protected function setUp(): void
{
parent::setUp();
@@ -72,7 +80,10 @@ protected function setUp(): void
$this->authorizationMock = $this->getMockBuilder(AuthorizationInterface::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
-
+ $this->sessionMock = $this->getMockBuilder(Session::class)
+ ->setMethods(['getUser'])
+ ->disableOriginalConstructor()
+ ->getMock();
$this->categoryCollectionFactoryMock->expects($this->any())
->method('create')
->willReturn($this->categoryCollectionMock);
@@ -88,6 +99,26 @@ protected function setUp(): void
$this->categoryCollectionMock->expects($this->any())
->method('getIterator')
->willReturn(new \ArrayIterator([]));
+
+ $roleAdmin = $this->getMockBuilder(Role::class)
+ ->setMethods(['getId'])
+ ->disableOriginalConstructor()
+ ->getMock();
+ $roleAdmin->expects($this->any())
+ ->method('getId')
+ ->willReturn(0);
+
+ $userAdmin = $this->getMockBuilder(User::class)
+ ->setMethods(['getRole'])
+ ->disableOriginalConstructor()
+ ->getMock();
+ $userAdmin->expects($this->any())
+ ->method('getRole')
+ ->willReturn($roleAdmin);
+
+ $this->sessionMock->expects($this->any())
+ ->method('getUser')
+ ->willReturn($userAdmin);
}
/**
@@ -101,11 +132,28 @@ protected function createModel()
'locator' => $this->locatorMock,
'categoryCollectionFactory' => $this->categoryCollectionFactoryMock,
'arrayManager' => $this->arrayManagerMock,
- 'authorization' => $this->authorizationMock
+ 'authorization' => $this->authorizationMock,
+ 'session' => $this->sessionMock
]
);
}
+ /**
+ * @param object $object
+ * @param string $method
+ * @param array $args
+ * @return mixed
+ * @throws \ReflectionException
+ */
+ private function invokeMethod($object, $method, $args = [])
+ {
+ $class = new \ReflectionClass(Categories::class);
+ $method = $class->getMethod($method);
+ $method->setAccessible(true);
+
+ return $method->invokeArgs($object, $args);
+ }
+
public function testModifyData()
{
$this->assertSame([], $this->getModel()->modifyData([]));
@@ -176,4 +224,44 @@ public function modifyMetaLockedDataProvider()
{
return [[true], [false]];
}
+
+ /**
+ * Asserts that a user with an ACL role ID of 0 and a user with an ACL role ID of 1 do not have the same cache IDs
+ * Assumes a store ID of 0
+ *
+ * @throws \ReflectionException
+ */
+ public function testAclCacheIds()
+ {
+ $categoriesAdmin = $this->createModel();
+ $cacheIdAdmin = $this->invokeMethod($categoriesAdmin, 'getCategoriesTreeCacheId', [0]);
+
+ $roleAclUser = $this->getMockBuilder(Role::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $roleAclUser->expects($this->any())
+ ->method('getId')
+ ->willReturn(1);
+
+ $userAclUser = $this->getMockBuilder(User::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $userAclUser->expects($this->any())
+ ->method('getRole')
+ ->will($this->returnValue($roleAclUser));
+
+ $this->sessionMock = $this->getMockBuilder(Session::class)
+ ->setMethods(['getUser'])
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->sessionMock->expects($this->any())
+ ->method('getUser')
+ ->will($this->returnValue($userAclUser));
+
+ $categoriesAclUser = $this->createModel();
+ $cacheIdAclUser = $this->invokeMethod($categoriesAclUser, 'getCategoriesTreeCacheId', [0]);
+
+ $this->assertNotEquals($cacheIdAdmin, $cacheIdAclUser);
+ }
}
diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php
index 7608173c8edfc..c0d5f0a1af3b8 100644
--- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php
+++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php
@@ -18,12 +18,14 @@
use Magento\Framework\UrlInterface;
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Framework\AuthorizationInterface;
+use Magento\Backend\Model\Auth\Session;
/**
* Data provider for categories field of product page
*
* @api
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @since 101.0.0
*/
class Categories extends AbstractModifier
@@ -86,6 +88,11 @@ class Categories extends AbstractModifier
*/
private $authorization;
+ /**
+ * @var Session
+ */
+ private $session;
+
/**
* @param LocatorInterface $locator
* @param CategoryCollectionFactory $categoryCollectionFactory
@@ -94,6 +101,7 @@ class Categories extends AbstractModifier
* @param ArrayManager $arrayManager
* @param SerializerInterface $serializer
* @param AuthorizationInterface $authorization
+ * @param Session $session
*/
public function __construct(
LocatorInterface $locator,
@@ -102,7 +110,8 @@ public function __construct(
UrlInterface $urlBuilder,
ArrayManager $arrayManager,
SerializerInterface $serializer = null,
- AuthorizationInterface $authorization = null
+ AuthorizationInterface $authorization = null,
+ Session $session = null
) {
$this->locator = $locator;
$this->categoryCollectionFactory = $categoryCollectionFactory;
@@ -111,6 +120,7 @@ public function __construct(
$this->arrayManager = $arrayManager;
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
$this->authorization = $authorization ?: ObjectManager::getInstance()->get(AuthorizationInterface::class);
+ $this->session = $session ?: ObjectManager::getInstance()->get(Session::class);
}
/**
@@ -370,10 +380,16 @@ protected function getCategoriesTree($filter = null)
* @param string $filter
* @return string
*/
- private function getCategoriesTreeCacheId(int $storeId, string $filter = '') : string
+ private function getCategoriesTreeCacheId(int $storeId, string $filter = ''): string
{
+ if ($this->session->getUser() !== null) {
+ return self::CATEGORY_TREE_ID
+ . '_' . (string)$storeId
+ . '_' . $this->session->getUser()->getAclRole()
+ . '_' . $filter;
+ }
return self::CATEGORY_TREE_ID
- . '_' . (string) $storeId
+ . '_' . (string)$storeId
. '_' . $filter;
}
diff --git a/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/Store/View.php b/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/Store/View.php
index 257f8ba9bfe53..9e360481e8eb3 100644
--- a/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/Store/View.php
+++ b/app/code/Magento/CmsUrlRewrite/Plugin/Cms/Model/Store/View.php
@@ -7,6 +7,7 @@
namespace Magento\CmsUrlRewrite\Plugin\Cms\Model\Store;
+use Magento\Cms\Api\Data\PageInterface;
use Magento\Cms\Api\PageRepositoryInterface;
use Magento\CmsUrlRewrite\Model\CmsPageUrlRewriteGenerator;
use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -21,6 +22,8 @@
*/
class View
{
+ private const ALL_STORE_VIEWS = '0';
+
/**
* @var UrlPersistInterface
*/
@@ -89,9 +92,8 @@ private function generateCmsPagesUrls(int $storeId): array
{
$rewrites = [];
$urls = [];
- $searchCriteria = $this->searchCriteriaBuilder->create();
- $cmsPagesCollection = $this->pageRepository->getList($searchCriteria)->getItems();
- foreach ($cmsPagesCollection as $page) {
+
+ foreach ($this->getCmsPageItems() as $page) {
$page->setStoreId($storeId);
$rewrites[] = $this->cmsPageUrlRewriteGenerator->generate($page);
}
@@ -99,4 +101,18 @@ private function generateCmsPagesUrls(int $storeId): array
return $urls;
}
+
+ /**
+ * Return cms page items for all store view
+ *
+ * @return PageInterface[]
+ */
+ private function getCmsPageItems(): array
+ {
+ $searchCriteria = $this->searchCriteriaBuilder->addFilter('store_id', self::ALL_STORE_VIEWS)
+ ->create();
+ $list = $this->pageRepository->getList($searchCriteria);
+
+ return $list->getItems();
+ }
}
diff --git a/app/code/Magento/Developer/Console/Command/patch_template.php.dist b/app/code/Magento/Developer/Console/Command/patch_template.php.dist
index f4fc25abcb29a..8e14b24bdc933 100644
--- a/app/code/Magento/Developer/Console/Command/patch_template.php.dist
+++ b/app/code/Magento/Developer/Console/Command/patch_template.php.dist
@@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
namespace %moduleName%\Setup\Patch\%patchType%;
@@ -36,7 +37,7 @@ class %class% implements %implementsInterfaces%
}
%revertFunction%
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getAliases()
{
@@ -44,12 +45,10 @@ class %class% implements %implementsInterfaces%
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public static function getDependencies()
{
- return [
-
- ];
+ return [];
}
}
diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php
index 09b17371ae4e8..f5b62df9aea2c 100644
--- a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php
+++ b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php
@@ -54,6 +54,19 @@ public function destruct()
{
if (is_object($this->_fileHandler)) {
$this->_fileHandler->close();
+ $this->resolveDestination();
+ }
+ }
+
+ /**
+ * Remove temporary destination
+ *
+ * @return void
+ */
+ private function resolveDestination(): void
+ {
+ // only temporary file located directly in var folder
+ if (strpos($this->_destination, '/') === false) {
$this->_directoryHandle->delete($this->_destination);
}
}
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
index 253dbd43fa580..6ddbce49829eb 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
@@ -80,11 +80,9 @@ public function draw()
$lines = [];
// draw Product name
- $lines[0] = [
- [
+ $lines[0][] = [
'text' => $this->string->split($this->prepareText((string)$item->getName()), 35, true, true),
'feed' => 35
- ]
];
// draw SKU
diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml
index 5bd8f6e2349fc..2da9e91e1fddd 100644
--- a/app/code/Magento/Store/etc/di.xml
+++ b/app/code/Magento/Store/etc/di.xml
@@ -65,7 +65,6 @@
-
diff --git a/lib/internal/Magento/Framework/App/Action/Plugin/LoadDesignPlugin.php b/app/code/Magento/Theme/Plugin/LoadDesignPlugin.php
similarity index 88%
rename from lib/internal/Magento/Framework/App/Action/Plugin/LoadDesignPlugin.php
rename to app/code/Magento/Theme/Plugin/LoadDesignPlugin.php
index 2cda49c43c2ce..c4f8d3a905d0f 100644
--- a/lib/internal/Magento/Framework/App/Action/Plugin/LoadDesignPlugin.php
+++ b/app/code/Magento/Theme/Plugin/LoadDesignPlugin.php
@@ -4,7 +4,7 @@
* See COPYING.txt for license details.
*/
-namespace Magento\Framework\App\Action\Plugin;
+namespace Magento\Theme\Plugin;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\Config\Dom\ValidationException;
@@ -21,12 +21,12 @@ class LoadDesignPlugin
/**
* @var DesignLoader
*/
- protected $_designLoader;
+ private $designLoader;
/**
* @var MessageManagerInterface
*/
- protected $messageManager;
+ private $messageManager;
/**
* @param DesignLoader $designLoader
@@ -36,7 +36,7 @@ public function __construct(
DesignLoader $designLoader,
MessageManagerInterface $messageManager
) {
- $this->_designLoader = $designLoader;
+ $this->designLoader = $designLoader;
$this->messageManager = $messageManager;
}
@@ -50,7 +50,7 @@ public function __construct(
public function beforeExecute(ActionInterface $subject)
{
try {
- $this->_designLoader->load();
+ $this->designLoader->load();
} catch (LocalizedException $e) {
if ($e->getPrevious() instanceof ValidationException) {
/** @var MessageInterface $message */
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/LoadDesignPluginTest.php b/app/code/Magento/Theme/Test/Unit/Plugin/LoadDesignPluginTest.php
similarity index 80%
rename from lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/LoadDesignPluginTest.php
rename to app/code/Magento/Theme/Test/Unit/Plugin/LoadDesignPluginTest.php
index 549d45a986cf0..4efcc584986d1 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/LoadDesignPluginTest.php
+++ b/app/code/Magento/Theme/Test/Unit/Plugin/LoadDesignPluginTest.php
@@ -3,15 +3,13 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-declare(strict_types=1);
-
-namespace Magento\Framework\App\Test\Unit\Action\Plugin;
+namespace Magento\Theme\Test\Unit\Plugin;
use Magento\Framework\App\Action\Action;
-use Magento\Framework\App\Action\Plugin\LoadDesignPlugin;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\Message\ManagerInterface;
use Magento\Framework\View\DesignLoader;
+use Magento\Theme\Plugin\LoadDesignPlugin;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
@@ -26,7 +24,7 @@ public function testBeforeExecute()
$designLoaderMock = $this->createMock(DesignLoader::class);
/** @var MockObject|ManagerInterface $messageManagerMock */
- $messageManagerMock = $this->getMockForAbstractClass(ManagerInterface::class);
+ $messageManagerMock = $this->createMock(ManagerInterface::class);
$plugin = new LoadDesignPlugin($designLoaderMock, $messageManagerMock);
diff --git a/app/code/Magento/Theme/etc/di.xml b/app/code/Magento/Theme/etc/di.xml
index c4da1f860870e..15107adb931c9 100644
--- a/app/code/Magento/Theme/etc/di.xml
+++ b/app/code/Magento/Theme/etc/di.xml
@@ -105,6 +105,9 @@
Magento\Store\Model\ScopeInterface::SCOPE_STORE
+
+
+
diff --git a/dev/tests/integration/testsuite/Magento/CmsUrlRewrite/Plugin/Cms/Model/Store/ViewTest.php b/dev/tests/integration/testsuite/Magento/CmsUrlRewrite/Plugin/Cms/Model/Store/ViewTest.php
index 8aad6049125a8..660d59f3264ec 100644
--- a/dev/tests/integration/testsuite/Magento/CmsUrlRewrite/Plugin/Cms/Model/Store/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/CmsUrlRewrite/Plugin/Cms/Model/Store/ViewTest.php
@@ -25,7 +25,7 @@
use PHPUnit\Framework\TestCase;
/**
- * Test for plugin which is listening store resource model and on save replace cms page url rewrites
+ * Test for plugin which is listening store resource model and on save replace cms page url rewrites.
*
* @magentoAppArea adminhtml
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -84,9 +84,10 @@ protected function setUp(): void
/**
* Test of replacing cms page url rewrites on create and delete store
*
+ * @magentoDataFixture Magento/Cms/_files/two_cms_page_with_same_url_for_different_stores.php
* @magentoDataFixture Magento/Cms/_files/pages.php
*/
- public function testUrlRewritesChangesAfterStoreSave()
+ public function testUrlRewritesChangesAfterStoreSave(): void
{
$storeId = $this->createStore();
$this->assertUrlRewritesCount($storeId, 'page100', 1);
@@ -98,16 +99,16 @@ public function testUrlRewritesChangesAfterStoreSave()
}
/**
- * Assert url rewrites count by store id
+ * Assert url rewrites count by store id and request path
*
* @param int $storeId
- * @param string $pageIdentifier
+ * @param string $requestPath
* @param int $expectedCount
*/
- private function assertUrlRewritesCount(int $storeId, string $pageIdentifier, int $expectedCount): void
+ private function assertUrlRewritesCount(int $storeId, string $requestPath, int $expectedCount): void
{
$data = [
- UrlRewrite::REQUEST_PATH => $pageIdentifier,
+ UrlRewrite::REQUEST_PATH => $requestPath,
UrlRewrite::STORE_ID => $storeId
];
$urlRewrites = $this->urlFinder->findAllByData($data);
@@ -116,8 +117,6 @@ private function assertUrlRewritesCount(int $storeId, string $pageIdentifier, in
/**
* Create test store
- *
- * @return int
*/
private function createStore(): int
{
@@ -134,7 +133,6 @@ private function createStore(): int
* Delete test store
*
* @param int $storeId
- * @return void
*/
private function deleteStore(int $storeId): void
{
diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php
index 9d83b3d2ece98..1bd41b047163a 100644
--- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php
+++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Adapter/CsvTest.php
@@ -9,6 +9,7 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Filesystem;
+use Magento\ImportExport\Model\Import;
use Magento\Framework\ObjectManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
use PHPUnit\Framework\TestCase;
@@ -28,43 +29,53 @@ class CsvTest extends TestCase
*/
private $objectManager;
- /**
- * @var Csv
- */
- private $csv;
-
/**
* @inheritdoc
*/
protected function setUp(): void
{
- parent::setUp();
-
$this->objectManager = Bootstrap::getObjectManager();
- $this->csv = $this->objectManager->create(
- Csv::class,
- ['destination' => $this->destination]
- );
}
/**
* Test to destruct export adapter
+ *
+ * @dataProvider destructDataProvider
+ *
+ * @param string $destination
+ * @param bool $shouldBeDeleted
+ * @return void
*/
- public function testDestruct(): void
+ public function testDestruct(string $destination, bool $shouldBeDeleted): void
{
+ $csv = $this->objectManager->create(Csv::class, ['destination' => $destination]);
/** @var Filesystem $fileSystem */
$fileSystem = $this->objectManager->get(Filesystem::class);
$directoryHandle = $fileSystem->getDirectoryRead(DirectoryList::VAR_DIR);
/** Assert that the destination file is present after construct */
$this->assertFileExists(
- $directoryHandle->getAbsolutePath($this->destination),
+ $directoryHandle->getAbsolutePath($destination),
'The destination file was\'t created after construct'
);
- /** Assert that the destination file was removed after destruct */
- $this->csv = null;
- $this->assertFileNotExists(
- $directoryHandle->getAbsolutePath($this->destination),
- 'The destination file was\'t removed after destruct'
- );
+ unset($csv);
+
+ if ($shouldBeDeleted) {
+ $this->assertFileDoesNotExist($directoryHandle->getAbsolutePath($destination));
+ } else {
+ $this->assertFileExists($directoryHandle->getAbsolutePath($destination));
+ }
+ }
+
+ /**
+ * DataProvider for testDestruct
+ *
+ * @return array
+ */
+ public function destructDataProvider(): array
+ {
+ return [
+ 'temporary file' => [$this->destination, true],
+ 'import history file' => [Import::IMPORT_HISTORY_DIR . $this->destination, false],
+ ];
}
}
diff --git a/lib/web/mage/adminhtml/browser.js b/lib/web/mage/adminhtml/browser.js
index 604680e0bf8d5..74984024b74a0 100644
--- a/lib/web/mage/adminhtml/browser.js
+++ b/lib/web/mage/adminhtml/browser.js
@@ -376,7 +376,7 @@ define([
* @param {*} folderName
*/
confirm: function (folderName) {
- return $.ajax({
+ $.ajax({
url: self.options.newFolderUrl,
dataType: 'json',
data: {
@@ -399,6 +399,8 @@ define([
);
}
}, this));
+
+ return true;
}
}
});
diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php
index 061416fcfd9ea..fe1cac3f076fd 100644
--- a/setup/src/Magento/Setup/Model/Installer.php
+++ b/setup/src/Magento/Setup/Model/Installer.php
@@ -46,6 +46,7 @@
use Magento\Setup\Module\SetupFactory;
use Magento\Setup\Validator\DbValidator;
use Magento\Store\Model\Store;
+use Magento\Framework\App\Cache\Manager;
/**
* Class Installer contains the logic to install Magento application.
@@ -1311,8 +1312,8 @@ public function uninstall()
*/
private function updateCaches($isEnabled, $types = [])
{
- /** @var \Magento\Framework\App\Cache\Manager $cacheManager */
- $cacheManager = $this->objectManagerProvider->get()->create(\Magento\Framework\App\Cache\Manager::class);
+ /** @var Manager $cacheManager */
+ $cacheManager = $this->objectManagerProvider->get()->create(Manager::class);
$availableTypes = $cacheManager->getAvailableTypes();
$types = empty($types) ? $availableTypes : array_intersect($availableTypes, $types);
@@ -1331,8 +1332,9 @@ function (string $key) use ($types) {
);
$this->log->log('Current status:');
- // phpcs:ignore Magento2.Functions.DiscouragedFunction
- $this->log->log(print_r($cacheStatus, true));
+ foreach ($cacheStatus as $cache => $status) {
+ $this->log->log(sprintf('%s: %d', $cache, $status));
+ }
}
/**
@@ -1344,8 +1346,8 @@ function (string $key) use ($types) {
*/
private function cleanCaches()
{
- /** @var \Magento\Framework\App\Cache\Manager $cacheManager */
- $cacheManager = $this->objectManagerProvider->get()->get(\Magento\Framework\App\Cache\Manager::class);
+ /** @var Manager $cacheManager */
+ $cacheManager = $this->objectManagerProvider->get()->get(Manager::class);
$types = $cacheManager->getAvailableTypes();
$cacheManager->clean($types);
$this->log->log('Cache cleared successfully');
diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php
index 0d12a73434355..8446486c2f104 100644
--- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php
@@ -450,12 +450,12 @@ public function installDataProvider()
['Installing user configuration...'],
['Enabling caches:'],
['Current status:'],
- [print_r(['foo' => 1, 'bar' => 1], true)],
+ ['foo: 1'],
+ ['bar: 1'],
['Installing data...'],
['Data install/update:'],
['Disabling caches:'],
['Current status:'],
- [print_r([], true)],
['Module \'Foo_One\':'],
['Module \'Bar_Two\':'],
['Data post-updates:'],
@@ -463,7 +463,6 @@ public function installDataProvider()
['Module \'Bar_Two\':'],
['Enabling caches:'],
['Current status:'],
- [print_r([], true)],
['Caches clearing:'],
['Cache cleared successfully'],
['Disabling Maintenance Mode:'],
@@ -502,12 +501,12 @@ public function installDataProvider()
['Installing user configuration...'],
['Enabling caches:'],
['Current status:'],
- [print_r(['foo' => 1, 'bar' => 1], true)],
+ ['foo: 1'],
+ ['bar: 1'],
['Installing data...'],
['Data install/update:'],
['Disabling caches:'],
['Current status:'],
- [print_r([], true)],
['Module \'Foo_One\':'],
['Module \'Bar_Two\':'],
['Data post-updates:'],
@@ -515,7 +514,6 @@ public function installDataProvider()
['Module \'Bar_Two\':'],
['Enabling caches:'],
['Current status:'],
- [print_r([], true)],
['Installing admin user...'],
['Caches clearing:'],
['Cache cleared successfully'],