Skip to content

Commit deb6d24

Browse files
committed
ACP2E-3541: "Something went wrong" error on checkout for inactive company
1 parent 67b44ad commit deb6d24

File tree

5 files changed

+13
-45
lines changed

5 files changed

+13
-45
lines changed

app/code/Magento/Theme/Plugin/LoadDesignPlugin.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2024 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66

77
namespace Magento\Theme\Plugin;
@@ -21,12 +21,12 @@ class LoadDesignPlugin
2121
/**
2222
* @var DesignLoader
2323
*/
24-
private DesignLoader $designLoader;
24+
private $designLoader;
2525

2626
/**
2727
* @var MessageManagerInterface
2828
*/
29-
private MessageManagerInterface $messageManager;
29+
private $messageManager;
3030

3131
/**
3232
* @param DesignLoader $designLoader
@@ -59,8 +59,6 @@ public function beforeExecute(ActionInterface $subject)
5959
->setText($e->getMessage());
6060
$this->messageManager->addUniqueMessages([$message]);
6161
}
62-
} catch (\InvalidArgumentException $e) {
63-
$this->messageManager->addErrorMessage($e->getMessage());
6462
}
6563
}
6664
}
Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2024 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66
namespace Magento\Theme\Test\Unit\Plugin;
77

@@ -10,17 +10,12 @@
1010
use Magento\Framework\Message\ManagerInterface;
1111
use Magento\Framework\View\DesignLoader;
1212
use Magento\Theme\Plugin\LoadDesignPlugin;
13-
use PHPUnit\Framework\MockObject\Exception;
1413
use PHPUnit\Framework\MockObject\MockObject;
1514
use PHPUnit\Framework\TestCase;
1615

1716
class LoadDesignPluginTest extends TestCase
1817
{
19-
/**
20-
* @return void
21-
* @throws Exception
22-
*/
23-
public function testBeforeExecute(): void
18+
public function testBeforeExecute()
2419
{
2520
/** @var MockObject|ActionInterface $actionMock */
2621
$actionMock = $this->createMock(Action::class);
@@ -36,32 +31,4 @@ public function testBeforeExecute(): void
3631
$designLoaderMock->expects($this->once())->method('load');
3732
$plugin->beforeExecute($actionMock);
3833
}
39-
40-
/**
41-
* @return void
42-
* @throws Exception
43-
*/
44-
public function testBeforeExecuteNotThrowException(): void
45-
{
46-
/** @var MockObject|ActionInterface $actionMock */
47-
$actionMock = $this->createMock(Action::class);
48-
49-
/** @var MockObject|DesignLoader $designLoaderMock */
50-
$designLoaderMock = $this->createMock(DesignLoader::class);
51-
52-
/** @var MockObject|ManagerInterface $messageManagerMock */
53-
$messageManagerMock = $this->createMock(ManagerInterface::class);
54-
55-
$plugin = new LoadDesignPlugin($designLoaderMock, $messageManagerMock);
56-
57-
$exceptionMessage = 'test message';
58-
$designLoaderMock->expects($this->once())
59-
->method('load')
60-
->willThrowException(new \InvalidArgumentException($exceptionMessage));
61-
$messageManagerMock->expects($this->once())
62-
->method('addErrorMessage')
63-
->with($exceptionMessage);
64-
65-
$plugin->beforeExecute($actionMock);
66-
}
6734
}

app/code/Magento/Theme/etc/adminhtml/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@
3737
<plugin name="validate_design_config"
3838
type="Magento\Theme\Plugin\DesignProcessorFacade"/>
3939
</type>
40+
<type name="Magento\Framework\App\ActionInterface">
41+
<plugin name="designLoader" type="Magento\Theme\Plugin\LoadDesignPlugin"/>
42+
</type>
4043
</config>

app/code/Magento/Theme/etc/di.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@
106106
<argument name="scope" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument>
107107
</arguments>
108108
</virtualType>
109-
<type name="Magento\Framework\App\ActionInterface">
110-
<plugin name="designLoader" type="Magento\Theme\Plugin\LoadDesignPlugin"/>
111-
</type>
112109
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
113110
<arguments>
114111
<argument name="collections" xsi:type="array">

app/code/Magento/Theme/etc/frontend/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,7 @@
3535
<argument name="filePath" xsi:type="string">css/critical.css</argument>
3636
</arguments>
3737
</type>
38+
<type name="Magento\Framework\App\ActionInterface">
39+
<plugin name="designLoader" type="Magento\Theme\Plugin\LoadDesignPlugin"/>
40+
</type>
3841
</config>

0 commit comments

Comments
 (0)