Skip to content

Commit 96bc1d7

Browse files
committed
ACP2E-3998: [Cloud]Magento OOTB code - Email Template Setup issue
1 parent a8d8440 commit 96bc1d7

File tree

4 files changed

+28
-23
lines changed

4 files changed

+28
-23
lines changed

app/code/Magento/Email/Block/Adminhtml/Template/Edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function __construct(
100100
$this->_emailConfig = $emailConfig;
101101
$this->buttonList = $buttonList;
102102
$this->toolbar = $toolbar;
103-
parent::__construct($context, $data);
103+
parent::__construct($context, $data, $jsonHelper);
104104
}
105105

106106
/**

app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
namespace Magento\Email\Test\Unit\Block\Adminhtml\Template;
99

1010
use Magento\Backend\Block\Template\Context;
11+
use Magento\Backend\Block\Widget\Button\ButtonList;
12+
use Magento\Backend\Block\Widget\Button\ToolbarInterface;
1113
use Magento\Backend\Model\Menu\Item\Factory;
1214
use Magento\Backend\Helper\Data;
1315
use Magento\Backend\Model\Menu;
1416
use Magento\Backend\Model\Menu\Config;
1517
use Magento\Backend\Model\Menu\Item;
16-
use Magento\Backend\Model\Url;
1718
use Magento\Config\Model\Config\Structure;
1819
use Magento\Config\Model\Config\Structure\Element\Field;
1920
use Magento\Config\Model\Config\Structure\Element\Group;
@@ -23,8 +24,11 @@
2324
use Magento\Framework\App\Filesystem\DirectoryList;
2425
use Magento\Framework\Filesystem;
2526
use Magento\Framework\Filesystem\Directory\Read;
27+
use Magento\Framework\Json\EncoderInterface;
28+
use Magento\Framework\Json\Helper\Data as JsonHelper;
29+
use Magento\Framework\Registry;
2630
use Magento\Framework\Serialize\SerializerInterface;
27-
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
31+
use Magento\Framework\UrlInterface;
2832
use Magento\Framework\View\FileSystem as FilesystemView;
2933
use Magento\Framework\View\Layout;
3034
use Magento\Store\Model\StoreManagerInterface;
@@ -73,7 +77,6 @@ class EditTest extends TestCase
7377

7478
protected function setUp(): void
7579
{
76-
$objectManager = new ObjectManager($this);
7780
$layoutMock = $this->getMockBuilder(Layout::class)
7881
->addMethods(['helper'])
7982
->disableOriginalConstructor()
@@ -90,7 +93,6 @@ protected function setUp(): void
9093
]
9194
)->getMock();
9295
$menuItemMock = $this->createMock(Item::class);
93-
$urlBuilder = $this->createMock(Url::class);
9496
$this->_configStructureMock = $this->createMock(Structure::class);
9597
$this->_emailConfigMock = $this->createMock(\Magento\Email\Model\Template\Config::class);
9698

@@ -114,21 +116,8 @@ protected function setUp(): void
114116
$this->context = $this->createMock(Context::class);
115117
$this->context->expects($this->any())->method('getStoreManager')
116118
->willReturn($this->createMock(StoreManagerInterface::class));
117-
118-
$params = [
119-
'urlBuilder' => $urlBuilder,
120-
'layout' => $layoutMock,
121-
'menuConfig' => $menuConfigMock,
122-
'configStructure' => $this->_configStructureMock,
123-
'emailConfig' => $this->_emailConfigMock,
124-
'filesystem' => $this->filesystemMock,
125-
'viewFileSystem' => $viewFilesystem,
126-
'context' => $this->context
127-
];
128-
$arguments = $objectManager->getConstructArguments(
129-
Edit::class,
130-
$params
131-
);
119+
$urlBuilder = $this->createMock(UrlInterface::class);
120+
$this->context->expects($this->any())->method('getUrlBuilder')->willReturn($urlBuilder);
132121

133122
$urlBuilder->expects($this->any())->method('getUrl')->willReturnArgument(0);
134123
$menuConfigMock->expects($this->any())->method('getMenu')->willReturn($menuMock);
@@ -137,7 +126,23 @@ protected function setUp(): void
137126

138127
$layoutMock->expects($this->any())->method('helper')->willReturn($helperMock);
139128

140-
$this->_block = $objectManager->getObject(Edit::class, $arguments);
129+
$encoder = $this->createMock(EncoderInterface::class);
130+
$registry = $this->createMock(Registry::class);
131+
$structure = $this->createMock(Structure::class);
132+
$jsonHelper = $this->createMock(JsonHelper::class);
133+
$buttonList = $this->createMock(ButtonList::class);
134+
$toolbar = $this->createMock(ToolbarInterface::class);
135+
$this->_block = new Edit(
136+
$this->context,
137+
$encoder,
138+
$registry,
139+
$menuConfigMock,
140+
$structure,
141+
$this->_emailConfigMock,
142+
$jsonHelper,
143+
$buttonList,
144+
$toolbar
145+
);
141146
}
142147

143148
/**

app/code/Magento/Theme/Test/Unit/Block/Html/TopmenuTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function testGetCacheKeyInfo(): void
213213
->onlyMethods(['getCode'])
214214
->getMock();
215215
$store->expects($this->once())->method('getCode')->willReturn('321');
216-
$this->storeManager->expects($this->once())->method('getStore')->willReturn($store);
216+
$this->storeManager->expects($this->exactly(2))->method('getStore')->willReturn($store);
217217

218218
$this->assertEquals(
219219
['BLOCK_TPL', '321', null, 'base_url' => 'baseUrl', 'template' => null],

lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ protected function setUp(): void
130130

131131
public function testGetTemplateFile()
132132
{
133-
$params = ['module' => 'Fixture_Module', 'area' => 'frontend'];
133+
$params = ['module' => 'Fixture_Module', 'area' => 'frontend', 'store_id' => null];
134134
$this->resolver->expects($this->once())->method('getTemplateFileName')->with('template.phtml', $params);
135135
$this->block->getTemplateFile();
136136
}

0 commit comments

Comments
 (0)