Skip to content

#27962 Migrate Plugin out of Framework (to Theme module) #27965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/code/Magento/Store/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
<preference for="Magento\Framework\App\Router\PathConfigInterface" type="Magento\Store\Model\PathConfig" />
<type name="Magento\Framework\App\ActionInterface">
<plugin name="storeCheck" type="Magento\Store\App\Action\Plugin\StoreCheck"/>
<plugin name="designLoader" type="Magento\Framework\App\Action\Plugin\LoadDesignPlugin"/>
<plugin name="eventDispatch" type="Magento\Framework\App\Action\Plugin\EventDispatchPlugin"/>
<plugin name="actionFlagNoDispatch" type="Magento\Framework\App\Action\Plugin\ActionFlagNoDispatchPlugin"/>
</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,12 +21,12 @@ class LoadDesignPlugin
/**
* @var DesignLoader
*/
protected $_designLoader;
private $designLoader;

/**
* @var MessageManagerInterface
*/
protected $messageManager;
private $messageManager;

/**
* @param DesignLoader $designLoader
Expand All @@ -36,7 +36,7 @@ public function __construct(
DesignLoader $designLoader,
MessageManagerInterface $messageManager
) {
$this->_designLoader = $designLoader;
$this->designLoader = $designLoader;
$this->messageManager = $messageManager;
}

Expand All @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Theme/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
<argument name="scope" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument>
</arguments>
</virtualType>
<type name="Magento\Framework\App\ActionInterface">
<plugin name="designLoader" type="Magento\Theme\Plugin\LoadDesignPlugin"/>
</type>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
Expand Down