Files
FOSSBilling/tests-legacy/modules/Cron/Api/GuestTest.php
T
Adam DaleyandCopilot a0b3158b30 PHPUnit test-legacy refactor and cleanup (#3144)
* 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>
2026-01-13 17:32:09 +00:00

46 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Box\Mod\Cron\Api;
use PHPUnit\Framework\Attributes\Group;
#[Group('Core')]
final class GuestTest extends \BBTestCase
{
public function testGetDi(): void
{
$di = $this->getDi();
$api = new Guest();
$api->setDi($di);
$getDi = $api->getDi();
$this->assertEquals($di, $getDi);
}
public function testSettings(): void
{
$modMock = $this->getMockBuilder('\\' . \FOSSBilling\Module::class)->disableOriginalConstructor()->getMock();
$modMock->expects($this->atLeastOnce())->method('getConfig')->willReturn([]);
$api = new Guest();
$api->setMod($modMock);
$result = $api->settings();
$this->assertIsArray($result);
}
public function testIsLate(): void
{
$serviceMock = $this->createMock(\Box\Mod\Cron\Service::class);
$serviceMock->expects($this->atLeastOnce())->method('isLate')->willReturn(true);
$api = new Guest();
$api->setService($serviceMock);
$result = $api->is_late();
$this->assertIsBool($result);
$this->assertTrue($result);
}
}