Files
FOSSBilling/tests-legacy/integration/bb-modules/mod_example/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

61 lines
1.7 KiB
PHP

<?php
#[\PHPUnit\Framework\Attributes\Group('Core')]
class ServiceTest extends BBDbApiTestCase
{
protected $_initialSeedFile = 'example.xml';
public function testUninstall()
{
$service = new Box\Mod\Example\Service();
$result = $service->uninstall();
$this->assertTrue($result);
}
public function testUpdate()
{
$service = new Box\Mod\Example\Service();
$result = $service->update([]);
$this->assertTrue($result);
}
public function testGetSearchQuery()
{
$service = new Box\Mod\Example\Service();
$di = new Pimple\Container();
$service->setDi($di);
$data = [
'client_id' => 1,
];
[$sql, $params] = $service->getSearchQuery($data);
$this->assertIsString($sql);
$this->assertIsArray($params);
$this->assertArrayHasKey(':client_id', $params);
$this->assertEquals($params[':client_id'], $data['client_id']);
}
public function testEvents()
{
$service = new Box\Mod\Example\Service();
$params = [
'ip' => '123.123.123.123',
];
$event = new Box_Event(null, 'name', $params, $this->api_admin, $this->api_guest);
$event->setDi($this->di);
$result = $service->onEventClientLoginFailed($event);
$this->assertNull($result);
$params = [
'client_id' => 1,
'id' => 1,
];
$event = new Box_Event(null, 'name', $params, $this->api_admin, $this->api_guest);
$event->setDi($this->di);
$result = $service->onAfterClientOrderCreate($event);
$this->assertNull($result);
}
}