8
8
namespace Magento \Email \Test \Unit \Block \Adminhtml \Template ;
9
9
10
10
use Magento \Backend \Block \Template \Context ;
11
+ use Magento \Backend \Block \Widget \Button \ButtonList ;
12
+ use Magento \Backend \Block \Widget \Button \ToolbarInterface ;
11
13
use Magento \Backend \Model \Menu \Item \Factory ;
12
14
use Magento \Backend \Helper \Data ;
13
15
use Magento \Backend \Model \Menu ;
14
16
use Magento \Backend \Model \Menu \Config ;
15
17
use Magento \Backend \Model \Menu \Item ;
16
- use Magento \Backend \Model \Url ;
17
18
use Magento \Config \Model \Config \Structure ;
18
19
use Magento \Config \Model \Config \Structure \Element \Field ;
19
20
use Magento \Config \Model \Config \Structure \Element \Group ;
23
24
use Magento \Framework \App \Filesystem \DirectoryList ;
24
25
use Magento \Framework \Filesystem ;
25
26
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 ;
26
30
use Magento \Framework \Serialize \SerializerInterface ;
27
- use Magento \Framework \TestFramework \ Unit \ Helper \ ObjectManager ;
31
+ use Magento \Framework \UrlInterface ;
28
32
use Magento \Framework \View \FileSystem as FilesystemView ;
29
33
use Magento \Framework \View \Layout ;
30
34
use Magento \Store \Model \StoreManagerInterface ;
@@ -73,7 +77,6 @@ class EditTest extends TestCase
73
77
74
78
protected function setUp (): void
75
79
{
76
- $ objectManager = new ObjectManager ($ this );
77
80
$ layoutMock = $ this ->getMockBuilder (Layout::class)
78
81
->addMethods (['helper ' ])
79
82
->disableOriginalConstructor ()
@@ -90,7 +93,6 @@ protected function setUp(): void
90
93
]
91
94
)->getMock ();
92
95
$ menuItemMock = $ this ->createMock (Item::class);
93
- $ urlBuilder = $ this ->createMock (Url::class);
94
96
$ this ->_configStructureMock = $ this ->createMock (Structure::class);
95
97
$ this ->_emailConfigMock = $ this ->createMock (\Magento \Email \Model \Template \Config::class);
96
98
@@ -114,21 +116,8 @@ protected function setUp(): void
114
116
$ this ->context = $ this ->createMock (Context::class);
115
117
$ this ->context ->expects ($ this ->any ())->method ('getStoreManager ' )
116
118
->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 );
132
121
133
122
$ urlBuilder ->expects ($ this ->any ())->method ('getUrl ' )->willReturnArgument (0 );
134
123
$ menuConfigMock ->expects ($ this ->any ())->method ('getMenu ' )->willReturn ($ menuMock );
@@ -137,7 +126,23 @@ protected function setUp(): void
137
126
138
127
$ layoutMock ->expects ($ this ->any ())->method ('helper ' )->willReturn ($ helperMock );
139
128
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
+ );
141
146
}
142
147
143
148
/**
0 commit comments