File tree Expand file tree Collapse file tree 1 file changed +69
-0
lines changed
dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard Expand file tree Collapse file tree 1 file changed +69
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments