added first test for Mysqls-ApiCommand

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-03-25 12:38:57 +02:00
parent c149cbacf7
commit 6006b16c95
5 changed files with 47 additions and 9 deletions

View File

@@ -0,0 +1,33 @@
<?php
use PHPUnit\Framework\TestCase;
/**
*
* @covers ApiCommand
* @covers ApiParameter
* @covers Mysqls
*/
class MysqlsTest extends TestCase
{
public function testCustomerMysqlsAdd()
{
global $admin_userdata;
// get customer
$json_result = Customers::getLocal($admin_userdata, array(
'loginname' => 'test1'
))->get();
$customer_userdata = json_decode($json_result, true)['data'];
$data = [
'mysql_password' => generatePassword(),
'description' => 'testdb',
'sendinfomail' => true
];
$json_result = Mysqls::getLocal($customer_userdata, $data)->add();
$result = json_decode($json_result, true)['data'];
$this->assertEquals('testdb', $result['description']);
$this->assertEquals(0, $result['dbserver']);
}
}