Files
FOSSBilling/tests/modules/Cron/Api/AdminTest.php
T
Belle Aerni 50043e6211 Run Rector against our tests (#1761)
* Update rector config to include tests

* Run Rector against the tests

* Delete test-results

* Update .gitignore

* Correctly set the PHP min to 8.1, split the configs

* Corrected PHPDoc

* Deleted tests we can't really get to pass

PHPunit is hard-coded to fail when a class has a return type of `never`, which is the correct return type of our redirect function (and rightfully so).

No way to disable the exception as far as we can tell
2023-11-11 18:41:09 +00:00

44 lines
1.2 KiB
PHP

<?php
namespace Box\Mod\Cron\Api;
class AdminTest extends \BBTestCase {
public function testgetDi()
{
$di = new \Pimple\Container();
$api_admin = new \Box\Mod\Cron\Api\Admin();
$api_admin->setDi($di);
$getDi = $api_admin->getDi();
$this->assertEquals($di, $getDi);
}
public function testinfo()
{
$serviceMock = $this->getMockBuilder('\\' . \Box\Mod\Cron\Service::class)->getMock();
$serviceMock->expects($this->atLeastOnce())->method('getCronInfo')->will($this->returnValue(array()));
$api_admin = new \Box\Mod\Cron\Api\Admin();
$api_admin->setService($serviceMock);
$result = $api_admin->info(array());
$this->assertIsArray($result);
}
public function testrun()
{
$serviceMock = $this->getMockBuilder('\\' . \Box\Mod\Cron\Service::class)->getMock();
$serviceMock->expects($this->atLeastOnce())->method('runCrons')->will($this->returnValue(true));
$api_admin = new \Box\Mod\Cron\Api\Admin();
$api_admin->setService($serviceMock);
$result = $api_admin->run(array());
$this->assertIsBool($result);
}
}