first unittest for mysql-users and their password, refs #758

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-11-17 13:42:35 +01:00
parent d5df4dd7a4
commit 605d2340d1

View File

@@ -12,6 +12,8 @@ use Froxlor\Api\Commands\Mysqls;
* @covers \Froxlor\Api\Commands\Mysqls
* @covers \Froxlor\Api\Commands\Customers
* @covers \Froxlor\Api\Commands\Admins
* @covers \Froxlor\Database\DbManager
* @covers \Froxlor\Database\Manager\DbManagerMySQL
*/
class MysqlsTest extends TestCase
{
@@ -36,7 +38,7 @@ class MysqlsTest extends TestCase
$result = json_decode($json_result, true)['data'];
$this->assertEquals('testdb', $result['description']);
$this->assertEquals(0, $result['dbserver']);
// test connection
try {
$test_conn = new \PDO("mysql:host=127.0.0.1", 'test1sql1', $newPwd);
@@ -166,4 +168,18 @@ class MysqlsTest extends TestCase
$result = json_decode($json_result, true)['data'];
$this->assertEquals('test1sql1', $result['databasename']);
}
/**
*
* @depends testCustomerMysqlsAdd
*/
public function testGetAllSqlUsers()
{
\Froxlor\Database\Database::needRoot(true);
$dbm = new \Froxlor\Database\DbManager(\Froxlor\FroxlorLogger::getInstanceOf());
$users = $dbm->getManager()->getAllSqlUsers(false);
foreach ($users as $user => $data) {
$this->assertNotEmpty($data['password'], 'No password for user "' . $user . '"');
}
}
}