File tree Expand file tree Collapse file tree 8 files changed +18
-145
lines changed
app/code/Magento/Sales/Controller/Adminhtml/Order
dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order Expand file tree Collapse file tree 8 files changed +18
-145
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,14 @@ class CommentsHistory extends \Magento\Sales\Controller\Adminhtml\Order
16
16
public function execute ()
17
17
{
18
18
$ this ->_initOrder ();
19
- $ resultPage = $ this ->resultPageFactory ->create ();
20
- $ html = $ resultPage ->getLayout ()->createBlock ('Magento\Sales\Block\Adminhtml\Order\View\Tab\History ' )->toHtml ();
19
+ $ resultLayout = $ this ->resultLayoutFactory ->create ();
20
+ $ html = $ resultLayout ->getLayout ()
21
+ ->createBlock ('Magento\Sales\Block\Adminhtml\Order\View\Tab\History ' )
22
+ ->toHtml ();
21
23
$ this ->_translateInline ->processResponseBody ($ html );
22
24
/** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
23
25
$ resultRaw = $ this ->resultRawFactory ->create ();
24
26
$ resultRaw ->setContents ($ html );
25
-
26
27
return $ resultRaw ;
27
28
}
28
29
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public function execute()
20
20
{
21
21
$ fileName = 'orders.csv ' ;
22
22
/** @var \Magento\Backend\Block\Widget\Grid\ExportInterface $exportBlock */
23
- $ exportBlock = $ this ->resultLayoutFactory ->create ()
23
+ $ exportBlock = $ this ->resultPageFactory ->create ()
24
24
->getLayout ()
25
25
->getChildBlock ('sales.order.grid ' , 'grid.export ' );
26
26
return $ this ->_fileFactory ->create ($ fileName , $ exportBlock ->getCsvFile (), DirectoryList::VAR_DIR );
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public function execute()
20
20
{
21
21
$ fileName = 'orders.xml ' ;
22
22
/** @var \Magento\Backend\Block\Widget\Grid\ExportInterface $exportBlock */
23
- $ exportBlock = $ this ->resultLayoutFactory ->create ()
23
+ $ exportBlock = $ this ->resultPageFactory ->create ()
24
24
->getLayout ()
25
25
->getChildBlock ('sales.order.grid ' , 'grid.export ' );
26
26
return $ this ->_fileFactory ->create ($ fileName , $ exportBlock ->getExcelFile ($ fileName ), DirectoryList::VAR_DIR );
Original file line number Diff line number Diff line change 7
7
8
8
class Grid extends \Magento \Sales \Controller \Adminhtml \Order
9
9
{
10
- /**
11
- * @var \Magento\Framework\View\Result\LayoutFactory
12
- */
13
- protected $ resultLayoutFactory ;
14
-
15
- /**
16
- * @param \Magento\Backend\App\Action\Context $context
17
- * @param \Magento\Framework\Registry $coreRegistry
18
- * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
19
- * @param \Magento\Framework\Translate\InlineInterface $translateInline
20
- * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
21
- * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory
22
- * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
23
- */
24
- public function __construct (
25
- \Magento \Backend \App \Action \Context $ context ,
26
- \Magento \Framework \Registry $ coreRegistry ,
27
- \Magento \Framework \App \Response \Http \FileFactory $ fileFactory ,
28
- \Magento \Framework \Translate \InlineInterface $ translateInline ,
29
- \Magento \Framework \View \Result \PageFactory $ resultPageFactory ,
30
- \Magento \Backend \Model \View \Result \RedirectFactory $ resultRedirectFactory ,
31
- \Magento \Framework \View \Result \LayoutFactory $ resultLayoutFactory
32
- ) {
33
- $ this ->resultLayoutFactory = $ resultLayoutFactory ;
34
- parent ::__construct (
35
- $ context ,
36
- $ coreRegistry ,
37
- $ fileFactory ,
38
- $ translateInline ,
39
- $ resultPageFactory ,
40
- $ resultRedirectFactory
41
- );
42
- }
43
-
44
10
/**
45
11
* Order grid
46
12
*
Original file line number Diff line number Diff line change 7
7
8
8
class Invoices extends \Magento \Sales \Controller \Adminhtml \Order
9
9
{
10
- /**
11
- * @var \Magento\Framework\View\Result\LayoutFactory
12
- */
13
- protected $ resultLayoutFactory ;
14
-
15
- /**
16
- * @param \Magento\Backend\App\Action\Context $context
17
- * @param \Magento\Framework\Registry $coreRegistry
18
- * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
19
- * @param \Magento\Framework\Translate\InlineInterface $translateInline
20
- * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
21
- * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory
22
- * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
23
- */
24
- public function __construct (
25
- \Magento \Backend \App \Action \Context $ context ,
26
- \Magento \Framework \Registry $ coreRegistry ,
27
- \Magento \Framework \App \Response \Http \FileFactory $ fileFactory ,
28
- \Magento \Framework \Translate \InlineInterface $ translateInline ,
29
- \Magento \Framework \View \Result \PageFactory $ resultPageFactory ,
30
- \Magento \Backend \Model \View \Result \RedirectFactory $ resultRedirectFactory ,
31
- \Magento \Framework \View \Result \LayoutFactory $ resultLayoutFactory
32
- ) {
33
- $ this ->resultLayoutFactory = $ resultLayoutFactory ;
34
- parent ::__construct (
35
- $ context ,
36
- $ coreRegistry ,
37
- $ fileFactory ,
38
- $ translateInline ,
39
- $ resultPageFactory ,
40
- $ resultRedirectFactory
41
- );
42
- }
43
-
44
10
/**
45
11
* Generate invoices grid for ajax request
46
12
*
Original file line number Diff line number Diff line change 7
7
8
8
class Shipments extends \Magento \Sales \Controller \Adminhtml \Order
9
9
{
10
- /**
11
- * @var \Magento\Framework\View\Result\LayoutFactory
12
- */
13
- protected $ resultLayoutFactory ;
14
-
15
- /**
16
- * @param \Magento\Backend\App\Action\Context $context
17
- * @param \Magento\Framework\Registry $coreRegistry
18
- * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
19
- * @param \Magento\Framework\Translate\InlineInterface $translateInline
20
- * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
21
- * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory
22
- * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
23
- */
24
- public function __construct (
25
- \Magento \Backend \App \Action \Context $ context ,
26
- \Magento \Framework \Registry $ coreRegistry ,
27
- \Magento \Framework \App \Response \Http \FileFactory $ fileFactory ,
28
- \Magento \Framework \Translate \InlineInterface $ translateInline ,
29
- \Magento \Framework \View \Result \PageFactory $ resultPageFactory ,
30
- \Magento \Backend \Model \View \Result \RedirectFactory $ resultRedirectFactory ,
31
- \Magento \Framework \View \Result \LayoutFactory $ resultLayoutFactory
32
- ) {
33
- $ this ->resultLayoutFactory = $ resultLayoutFactory ;
34
- parent ::__construct (
35
- $ context ,
36
- $ coreRegistry ,
37
- $ fileFactory ,
38
- $ translateInline ,
39
- $ resultPageFactory ,
40
- $ resultRedirectFactory
41
- );
42
- }
43
-
44
10
/**
45
11
* Generate shipments grid for ajax request
46
12
*
Original file line number Diff line number Diff line change 9
9
10
10
class Transactions extends \Magento \Sales \Controller \Adminhtml \Order
11
11
{
12
- /**
13
- * @var \Magento\Framework\View\Result\LayoutFactory
14
- */
15
- protected $ resultLayoutFactory ;
16
-
17
- /**
18
- * @param \Magento\Backend\App\Action\Context $context
19
- * @param \Magento\Framework\Registry $coreRegistry
20
- * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
21
- * @param \Magento\Framework\Translate\InlineInterface $translateInline
22
- * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
23
- * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory
24
- * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
25
- */
26
- public function __construct (
27
- \Magento \Backend \App \Action \Context $ context ,
28
- \Magento \Framework \Registry $ coreRegistry ,
29
- \Magento \Framework \App \Response \Http \FileFactory $ fileFactory ,
30
- \Magento \Framework \Translate \InlineInterface $ translateInline ,
31
- \Magento \Framework \View \Result \PageFactory $ resultPageFactory ,
32
- \Magento \Backend \Model \View \Result \RedirectFactory $ resultRedirectFactory ,
33
- \Magento \Framework \View \Result \LayoutFactory $ resultLayoutFactory
34
- ) {
35
- $ this ->resultLayoutFactory = $ resultLayoutFactory ;
36
- parent ::__construct (
37
- $ context ,
38
- $ coreRegistry ,
39
- $ fileFactory ,
40
- $ translateInline ,
41
- $ resultPageFactory ,
42
- $ resultRedirectFactory
43
- );
44
- }
45
-
46
12
/**
47
13
* Order transactions grid ajax action
48
14
*
Original file line number Diff line number Diff line change @@ -193,9 +193,13 @@ public function testEmail()
193
193
->with ('You sent the order email. ' );
194
194
$ this ->resultRedirect ->expects ($ this ->once ())
195
195
->method ('setPath ' )
196
- ->with ('sales/order/view ' , ['order_id ' => $ orderId ]);
196
+ ->with ('sales/order/view ' , ['order_id ' => $ orderId ])
197
+ ->willReturnSelf ();
197
198
198
- $ this ->orderEmail ->execute ();
199
+ $ this ->assertInstanceOf (
200
+ 'Magento\Backend\Model\View\Result\Redirect ' ,
201
+ $ this ->orderEmail ->execute ()
202
+ );
199
203
$ this ->assertEquals ($ this ->response , $ this ->orderEmail ->getResponse ());
200
204
}
201
205
@@ -226,8 +230,12 @@ public function testEmailNoOrderId()
226
230
->will ($ this ->returnValue (true ));
227
231
$ this ->resultRedirect ->expects ($ this ->once ())
228
232
->method ('setPath ' )
229
- ->with ('sales/*/ ' );
233
+ ->with ('sales/*/ ' )
234
+ ->willReturnSelf ();
230
235
231
- $ this ->assertNull ($ this ->orderEmail ->execute ());
236
+ $ this ->assertInstanceOf (
237
+ 'Magento\Backend\Model\View\Result\Redirect ' ,
238
+ $ this ->orderEmail ->execute ()
239
+ );
232
240
}
233
241
}
You can’t perform that action at this time.
0 commit comments