Files
FOSSBilling/tests/integration/bb-modules/mod_example/ServiceTest.php
T
Belle Aerni 9faa981c58 Replace usage of array_get (#989)
* Replace usage of array_get

* Fixes

* And a few more

* Remove remaining references

* Update Service.php

* Few more fixes

* Fix.. I think?

* Fix Client / Invoice updates

* Fix stats

* Fix issues noticed during code review

* More fixes

* And some more fixes :)
2023-03-27 23:44:30 -07:00

60 lines
1.6 KiB
PHP

<?php
/**
* @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(array());
$this->assertTrue($result);
}
public function testGetSearchQuery()
{
$service = new Box\Mod\Example\Service();
$di = new \Box_Di();
$service->setDi($di);
$data = array(
'client_id' => 1
);
list($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 = array(
'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 = array(
'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);
}
}