Files
FOSSBilling/tests/integration/bb-modules/mod_servicehosting/Api_ClientTest.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

55 lines
1.4 KiB
PHP

<?php
#[\PHPUnit\Framework\Attributes\Group('Core')]
class Api_Client_ServiceHostingTest extends BBDbApiTestCase
{
protected $_initialSeedFile = 'services.xml';
public function testLists()
{
$array = $this->api_client->servicehosting_hp_get_pairs();
$this->assertIsArray($array);
}
public static function orders()
{
return array(
array(5),
array(6),
);
}
#[\PHPUnit\Framework\Attributes\DataProvider('orders')]
public function testServiceHosting($id)
{
$this->api_admin->order_renew(array('id'=>$id));
$data = array(
'order_id' => $id,
'password' => 'test',
'password_confirm' => 'test',
);
$bool = $this->_callOnService('change_password', $data);
$this->assertTrue($bool);
$data = array(
'order_id' => $id,
'username' => 'John',
);
$bool = $this->_callOnService('change_username', $data);
$this->assertTrue($bool);
$data = array(
'order_id' => $id,
'sld' => 'mynewdomain',
'tld' => '.com',
);
$bool = $this->_callOnService('change_domain', $data);
$this->assertTrue($bool);
}
protected function _callOnService($method, $data)
{
$m = "serviceHosting_".$method;
return $this->api_client->{$m}($data);
}
}