Files
FOSSBilling/tests-legacy/modules/Api/ServiceTest.php
T
Belle Aerni ccc97a3ec9 Initial implementation of CI against a live FOSSBilling Install (#2067)
* Rename tests to tests-legacy

* Groundwork for live tests

* Somewhat working tests on a live instance

* Hmmmmmm

* Fix

* Fixed the other bug

* Added a handful of various tests

* Typos, all these are admin endpoints

* Bypass this check for testing envs

* Disable it for now

* Mini cleanup

* Cleanup from debugging, ran PHP-CS-Fixer
2024-01-14 22:51:32 -08:00

47 lines
1.0 KiB
PHP

<?php
namespace Box\Mod\Api;
class ServiceTest extends \BBTestCase
{
/**
* @var Service
*/
protected $service;
public function setup(): void
{
$this->service = new Service();
}
public function testgetDi()
{
$di = new \Pimple\Container();
$this->service->setDi($di);
$getDi = $this->service->getDi();
$this->assertEquals($di, $getDi);
}
public function testgetRequestCount()
{
$since = 674_690_401; // timestamp == '1991-05-20 00:00:01';
$ip = '1.2.3.4';
$requestNumber = 11;
$dbMock = $this->getMockBuilder('\Box_Database')->getMock();
$dbMock->expects($this->atLeastOnce())
->method('getCell')
->willReturn($requestNumber);
$di = new \Pimple\Container();
$di['db'] = $dbMock;
$this->service->setDi($di);
$result = $this->service->getRequestCount($since, $ip);
$this->assertIsInt($result);
$this->assertEquals($requestNumber, $result);
}
}