mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-01 04:40:45 +09:00
* PHPUnit test-legacy cleanup Refactor and cleanup the legacy PHPUnit tests. * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Box\Mod\Email\Controller;
|
|
|
|
use PHPUnit\Framework\Attributes\Group;
|
|
|
|
#[Group('Core')]
|
|
final class AdminTest extends \BBTestCase
|
|
{
|
|
public function testDi(): void
|
|
{
|
|
$controller = new Admin();
|
|
|
|
$di = $this->getDi();
|
|
$db = $this->createMock('Box_Database');
|
|
|
|
$di['db'] = $db;
|
|
$controller->setDi($di);
|
|
$result = $controller->getDi();
|
|
$this->assertEquals($di, $result);
|
|
}
|
|
|
|
public function testRegister(): void
|
|
{
|
|
$boxAppMock = $this->getMockBuilder('\Box_App')->disableOriginalConstructor()->getMock();
|
|
$boxAppMock->expects($this->exactly(5))
|
|
->method('get');
|
|
|
|
$controllerAdmin = new Admin();
|
|
$controllerAdmin->register($boxAppMock);
|
|
}
|
|
|
|
public function testGetIndex(): void
|
|
{
|
|
$boxAppMock = $this->getMockBuilder('\Box_App')->disableOriginalConstructor()->getMock();
|
|
$boxAppMock->expects($this->atLeastOnce())
|
|
->method('render')
|
|
->with('mod_email_history');
|
|
|
|
$controllerAdmin = new Admin();
|
|
$di = $this->getDi();
|
|
$di['is_admin_logged'] = true;
|
|
|
|
$controllerAdmin->setDi($di);
|
|
|
|
$controllerAdmin->get_history($boxAppMock);
|
|
}
|
|
}
|