removing more ticket-stuff; update all unit-tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
<?php
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use Froxlor\Api\Commands\Admins;
|
||||
use Froxlor\Api\Commands\Customers;
|
||||
use Froxlor\Api\Commands\Mysqls;
|
||||
|
||||
/**
|
||||
*
|
||||
* @covers ApiCommand
|
||||
* @covers ApiParameter
|
||||
* @covers Mysqls
|
||||
* @covers Customers
|
||||
* @covers Admins
|
||||
* @covers \Froxlor\Api\ApiCommand
|
||||
* @covers \Froxlor\Api\ApiParameter
|
||||
* @covers \Froxlor\Api\Commands\Mysqls
|
||||
* @covers \Froxlor\Api\Commands\Customers
|
||||
* @covers \Froxlor\Api\Commands\Admins
|
||||
*/
|
||||
class MysqlsTest extends TestCase
|
||||
{
|
||||
@@ -15,13 +19,13 @@ 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',
|
||||
@@ -32,24 +36,26 @@ class MysqlsTest extends TestCase
|
||||
$this->assertEquals('testdb', $result['description']);
|
||||
$this->assertEquals(0, $result['dbserver']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @depends testCustomerMysqlsAdd
|
||||
*/
|
||||
public function testAdminMysqlsGet()
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
|
||||
$json_result = Mysqls::getLocal($admin_userdata, array(
|
||||
'dbname' => 'test1sql1'
|
||||
))->get();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
|
||||
$this->assertEquals('test1sql1', $result['databasename']);
|
||||
$this->assertEquals('testdb', $result['description']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @depends testCustomerMysqlsAdd
|
||||
*/
|
||||
public function testResellerMysqlsGet()
|
||||
@@ -68,17 +74,17 @@ class MysqlsTest extends TestCase
|
||||
$this->assertEquals('test1sql1', $result['databasename']);
|
||||
$this->assertEquals('testdb', $result['description']);
|
||||
}
|
||||
|
||||
|
||||
public function testCustomerMysqlsGetUnknown()
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
|
||||
// get customer
|
||||
$json_result = Customers::getLocal($admin_userdata, array(
|
||||
'loginname' => 'test1'
|
||||
))->get();
|
||||
$customer_userdata = json_decode($json_result, true)['data'];
|
||||
|
||||
|
||||
$data = [
|
||||
'dbname' => 'test1sql5'
|
||||
];
|
||||
@@ -86,19 +92,15 @@ class MysqlsTest extends TestCase
|
||||
$this->expectExceptionMessage("MySQL database with dbname 'test1sql5' could not be found");
|
||||
Mysqls::getLocal($customer_userdata, $data)->get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @depends testCustomerMysqlsAdd
|
||||
*/
|
||||
public function testAdminMysqlsUpdate()
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
$json_result = Mysqls::getLocal($admin_userdata, array(
|
||||
'dbname' => 'test1sql1'
|
||||
))->get();
|
||||
$old_db = json_decode($json_result, true)['data'];
|
||||
|
||||
|
||||
$data = [
|
||||
'dbname' => 'test1sql1',
|
||||
'mysql_password' => generatePassword(),
|
||||
@@ -109,14 +111,15 @@ class MysqlsTest extends TestCase
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals('testdb-upd', $result['description']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @depends testCustomerMysqlsAdd
|
||||
*/
|
||||
public function testCustomerMysqlsList()
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
|
||||
// get customer
|
||||
$json_result = Customers::getLocal($admin_userdata, array(
|
||||
'loginname' => 'test1'
|
||||
@@ -128,20 +131,21 @@ class MysqlsTest extends TestCase
|
||||
$this->assertEquals(1, $result['count']);
|
||||
$this->assertEquals('test1sql1', $result['list'][0]['databasename']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @depends testCustomerMysqlsList
|
||||
*/
|
||||
public function testCustomerMysqlsDelete()
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
|
||||
// get customer
|
||||
$json_result = Customers::getLocal($admin_userdata, array(
|
||||
'loginname' => 'test1'
|
||||
))->get();
|
||||
$customer_userdata = json_decode($json_result, true)['data'];
|
||||
|
||||
|
||||
$data = [
|
||||
'dbname' => 'test1sql1'
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user