Files
FOSSBilling/tests/modules/Cron/Api/GuestTest.php
T
Belle Aerni 59027a10f4 Add a configurable cron API guest endpoint (#1909)
* Add a configurable cron API guest endpoint

* PHPDoc changes

* Fix the test, added a last run check
2023-12-02 18:44:13 -08:00

44 lines
1.1 KiB
PHP

<?php
namespace Box\Mod\Cron\Api;
class GuestTest extends \BBTestCase {
public function testgetDi()
{
$di = new \Pimple\Container();
$api = new \Box\Mod\Cron\Api\Guest();
$api->setDi($di);
$getDi = $api->getDi();
$this->assertEquals($di, $getDi);
}
public function testsettings()
{
$modMock = $this->getMockBuilder('\Box_Mod')->disableOriginalConstructor()->getMock();
$modMock->expects($this->atLeastOnce())->method('getConfig')->will($this->returnValue(array()));
$api = new \Box\Mod\Cron\Api\Guest();
$api->setMod($modMock);
$result = $api->settings();
$this->assertIsArray($result);
}
public function testis_late()
{
$serviceMock = $this->getMockBuilder('\\' . \Box\Mod\Cron\Service::class)->getMock();
$serviceMock->expects($this->atLeastOnce())->method('isLate')->will($this->returnValue(true));
$api = new \Box\Mod\Cron\Api\Guest();
$api->setService($serviceMock);
$result = $api->is_late();
$this->assertIsBool($result);
$this->assertTrue($result);
}
}