Skip to content

Commit 67b44ad

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

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed

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

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

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

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

3131
/**
3232
* @param DesignLoader $designLoader

app/code/Magento/Theme/Test/Unit/Plugin/LoadDesignPluginTest.php

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

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

1617
class LoadDesignPluginTest extends TestCase
1718
{
18-
public function testBeforeExecute()
19+
/**
20+
* @return void
21+
* @throws Exception
22+
*/
23+
public function testBeforeExecute(): void
1924
{
2025
/** @var MockObject|ActionInterface $actionMock */
2126
$actionMock = $this->createMock(Action::class);
@@ -31,4 +36,32 @@ public function testBeforeExecute()
3136
$designLoaderMock->expects($this->once())->method('load');
3237
$plugin->beforeExecute($actionMock);
3338
}
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+
}
3467
}

0 commit comments

Comments
 (0)