@@ -18,11 +18,6 @@ class SaveTest extends \PHPUnit_Framework_TestCase
18
18
*/
19
19
private $ resultRedirectFactoryMock ;
20
20
21
- /**
22
- * @var \Magento\Framework\Controller\Result\RawFactory|\PHPUnit_Framework_MockObject_MockObject
23
- */
24
- private $ resultRawFactoryMock ;
25
-
26
21
/**
27
22
* @var \Magento\Framework\Controller\Result\JsonFactory|\PHPUnit_Framework_MockObject_MockObject
28
23
*/
@@ -33,16 +28,6 @@ class SaveTest extends \PHPUnit_Framework_TestCase
33
28
*/
34
29
private $ layoutFactoryMock ;
35
30
36
- /**
37
- * @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject
38
- */
39
- private $ contextMock ;
40
-
41
- /**
42
- * @var \Magento\Framework\View\Page\Title|\PHPUnit_Framework_MockObject_MockObject
43
- */
44
- private $ titleMock ;
45
-
46
31
/**
47
32
* @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
48
33
*/
@@ -58,11 +43,6 @@ class SaveTest extends \PHPUnit_Framework_TestCase
58
43
*/
59
44
private $ eventManagerMock ;
60
45
61
- /**
62
- * @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject
63
- */
64
- private $ responseMock ;
65
-
66
46
/**
67
47
* @var \Magento\Framework\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
68
48
*/
@@ -87,36 +67,13 @@ class SaveTest extends \PHPUnit_Framework_TestCase
87
67
protected function setUp ()
88
68
{
89
69
$ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
90
-
91
- $ this ->contextMock = $ this ->getMock (
92
- \Magento \Backend \App \Action \Context::class,
93
- [
94
- 'getTitle ' ,
95
- 'getRequest ' ,
96
- 'getObjectManager ' ,
97
- 'getEventManager ' ,
98
- 'getResponse ' ,
99
- 'getMessageManager ' ,
100
- 'getResultRedirectFactory '
101
- ],
102
- [],
103
- '' ,
104
- false
105
- );
106
70
$ this ->resultRedirectFactoryMock = $ this ->getMock (
107
71
\Magento \Backend \Model \View \Result \RedirectFactory::class,
108
72
['create ' ],
109
73
[],
110
74
'' ,
111
75
false
112
76
);
113
- $ this ->resultRawFactoryMock = $ this ->getMock (
114
- \Magento \Framework \Controller \Result \RawFactory::class,
115
- [],
116
- [],
117
- '' ,
118
- false
119
- );
120
77
$ this ->resultJsonFactoryMock = $ this ->getMock (
121
78
\Magento \Framework \Controller \Result \JsonFactory::class,
122
79
['create ' ],
@@ -152,12 +109,6 @@ protected function setUp()
152
109
true ,
153
110
['dispatch ' ]
154
111
);
155
- $ this ->responseMock = $ this ->getMockForAbstractClass (
156
- \Magento \Framework \App \ResponseInterface::class,
157
- [],
158
- '' ,
159
- false
160
- );
161
112
$ this ->messageManagerMock = $ this ->getMockForAbstractClass (
162
113
\Magento \Framework \Message \ManagerInterface::class,
163
114
[],
@@ -168,23 +119,15 @@ protected function setUp()
168
119
['addSuccess ' , 'getMessages ' ]
169
120
);
170
121
171
- $ this ->contextMock ->expects ($ this ->any ())->method ('getTitle ' )->willReturn ($ this ->titleMock );
172
- $ this ->contextMock ->expects ($ this ->any ())->method ('getRequest ' )->willReturn ($ this ->requestMock );
173
- $ this ->contextMock ->expects ($ this ->any ())->method ('getObjectManager ' )->willReturn ($ this ->objectManagerMock );
174
- $ this ->contextMock ->expects ($ this ->any ())->method ('getEventManager ' )->willReturn ($ this ->eventManagerMock );
175
- $ this ->contextMock ->expects ($ this ->any ())->method ('getResponse ' )->willReturn ($ this ->responseMock );
176
- $ this ->contextMock ->expects ($ this ->any ())->method ('getMessageManager ' )->willReturn ($ this ->messageManagerMock );
177
- $ this ->contextMock ->expects ($ this ->any ())
178
- ->method ('getResultRedirectFactory ' )
179
- ->willReturn ($ this ->resultRedirectFactoryMock );
180
-
181
122
$ this ->save = $ this ->objectManager ->getObject (
182
123
\Magento \Catalog \Controller \Adminhtml \Category \Save::class,
183
124
[
184
- 'context ' => $ this ->contextMock ,
185
- 'resultRawFactory ' => $ this ->resultRawFactoryMock ,
125
+ 'request ' => $ this ->requestMock ,
126
+ 'eventManager ' => $ this ->eventManagerMock ,
127
+ 'messageManager ' => $ this ->messageManagerMock ,
186
128
'resultJsonFactory ' => $ this ->resultJsonFactoryMock ,
187
- 'layoutFactory ' => $ this ->layoutFactoryMock
129
+ 'layoutFactory ' => $ this ->layoutFactoryMock ,
130
+ 'resultRedirectFactory ' => $ this ->resultRedirectFactoryMock
188
131
]
189
132
);
190
133
}
0 commit comments