This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,62 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Backend\Controller\Adminhtml\Dashboard;
use Magento\TestFramework\TestCase\AbstractBackendController;
use Magento\Framework\App\Request\Http as HttpRequest;
/**
* @magentoAppArea adminhtml
*/
class AjaxBlockTest extends AbstractBackendController
{
/**
* Test execute to check render block
*
* @param string $block
* @param string $expectedResult
*
* @dataProvider ajaxBlockDataProvider
*/
public function testExecute($block, $expectedResult)
{
$this->getRequest()->setMethod(HttpRequest::METHOD_POST);
$this->getRequest()->setParam('block', $block);
$this->dispatch('backend/admin/dashboard/ajaxBlock/');
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode());
$actual = $this->getResponse()->getBody();
$this->assertStringContainsString($expectedResult, $actual);
}
/**
* Provides POST data and Expected Result
*
* @return array
*/
public function ajaxBlockDataProvider(): array
{
return [
[
'totals',
'dashboard_diagram_totals'
],
[
'',
''
],
[
'test_block',
''
]
];
}
}
@@ -0,0 +1,30 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Backend\Controller\Adminhtml\Dashboard;
/**
* Test product viewed backend controller.
*/
class ProductsViewedTest extends \Magento\TestFramework\TestCase\AbstractBackendController
{
/**
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Reports/_files/viewed_products.php
* @magentoConfigFixture default/reports/options/enabled 1
*/
public function testExecute()
{
$this->getRequest()->setMethod("POST");
$this->dispatch('backend/admin/dashboard/productsViewed/');
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode());
$actual = $this->getResponse()->getBody();
$this->assertStringContainsString('Simple Product', $actual);
}
}