Skip to content

Commit ca3a45a

Browse files
ENGCOM-6454: [Backend] Cover action admin/dashboard/ajaxBlock by Integration Test #26004
2 parents f260b78 + 0dcdab2 commit ca3a45a

File tree

1 file changed

+69
-0
lines changed
  • dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
/**
3+
*
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace Magento\Backend\Controller\Adminhtml\Dashboard;
11+
12+
use Magento\TestFramework\TestCase\AbstractBackendController;
13+
use Magento\Framework\App\Request\Http as HttpRequest;
14+
15+
/**
16+
* @magentoAppArea adminhtml
17+
*/
18+
class AjaxBlockTest extends AbstractBackendController
19+
{
20+
/**
21+
* Test execute to check render block
22+
*
23+
* @dataProvider ajaxBlockDataProvider
24+
*/
25+
public function testExecute($block, $expectedResult)
26+
{
27+
$this->getRequest()->setMethod(HttpRequest::METHOD_POST);
28+
$this->getRequest()->setParam('block', $block);
29+
30+
$this->dispatch('backend/admin/dashboard/ajaxBlock/');
31+
32+
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode());
33+
34+
$actual = $this->getResponse()->getBody();
35+
36+
$this->assertContains($expectedResult, $actual);
37+
}
38+
39+
/**
40+
* Provides POST data and Expected Result
41+
*
42+
* @return array
43+
*/
44+
public function ajaxBlockDataProvider()
45+
{
46+
return [
47+
[
48+
'tab_orders',
49+
'order_orders_period'
50+
],
51+
[
52+
'tab_amounts',
53+
'order_amounts_period'
54+
],
55+
[
56+
'totals',
57+
'dashboard_diagram_totals'
58+
],
59+
[
60+
'',
61+
''
62+
],
63+
[
64+
'test_block',
65+
''
66+
]
67+
];
68+
}
69+
}

0 commit comments

Comments
 (0)