diff --git a/lib/classes/api/commands/class.Mysqls.php b/lib/classes/api/commands/class.Mysqls.php
index 080b3e1a..733b977a 100644
--- a/lib/classes/api/commands/class.Mysqls.php
+++ b/lib/classes/api/commands/class.Mysqls.php
@@ -139,11 +139,11 @@ class Mysqls extends ApiCommand implements ResourceEntity
$_mailerror = false;
try {
- $this->mail->Subject = $mail_subject;
- $this->mail->AltBody = $mail_body;
- $this->mail->MsgHTML(str_replace("\n", "
", $mail_body));
- $this->mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
- $this->mail->Send();
+ $this->mailer()->Subject = $mail_subject;
+ $this->mailer()->AltBody = $mail_body;
+ $this->mailer()->MsgHTML(str_replace("\n", "
", $mail_body));
+ $this->mailer()->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
+ $this->mailer()->Send();
} catch (phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
@@ -157,7 +157,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
standard_error('errorsendingmail', $userinfo['email'], true);
}
- $this->mail->ClearAddresses();
+ $this->mailer()->ClearAddresses();
}
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_WARNING, "[API] added mysql-database '" . $username . "'");
diff --git a/phpunit.xml b/phpunit.xml
index ceeb519c..1ffdbece 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -20,6 +20,7 @@
tests/Extras
tests/Backup
tests/DomainZones
+ tests/Mysqls
diff --git a/tests/Customers/CustomersTest.php b/tests/Customers/CustomersTest.php
index 7ca85690..d9ea0450 100644
--- a/tests/Customers/CustomersTest.php
+++ b/tests/Customers/CustomersTest.php
@@ -15,7 +15,7 @@ class CustomersTest extends TestCase
$data = [
'new_loginname' => 'test1',
- 'email' => 'test@froxlor.org',
+ 'email' => 'team@froxlor.org',
'firstname' => 'Test',
'name' => 'Testman',
'customernumber' => 1337,
@@ -46,7 +46,7 @@ class CustomersTest extends TestCase
$json_result = Customers::getLocal($admin_userdata, $data)->add();
$result = json_decode($json_result, true)['data'];
$this->assertEquals(1, $result['customerid']);
- $this->assertEquals('test@froxlor.org', $result['email']);
+ $this->assertEquals('team@froxlor.org', $result['email']);
$this->assertEquals(1337, $result['customernumber']);
$this->assertEquals(15, $result['subdomains']);
$this->assertEquals('secret', $result['custom_notes']);
@@ -147,7 +147,7 @@ class CustomersTest extends TestCase
$result = json_decode($json_result, true)['data'];
$this->assertEquals(1, $result['customerid']);
- $this->assertEquals('test@froxlor.org', $result['email']);
+ $this->assertEquals('team@froxlor.org', $result['email']);
$this->assertEquals(1337, $result['customernumber']);
$this->assertEquals(15, $result['subdomains']);
$this->assertEquals('Sparkle', $result['theme']);
diff --git a/tests/Mysqls/MysqlsTest.php b/tests/Mysqls/MysqlsTest.php
new file mode 100644
index 00000000..b4f78134
--- /dev/null
+++ b/tests/Mysqls/MysqlsTest.php
@@ -0,0 +1,33 @@
+ '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']);
+ }
+}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index fcf14947..1016c4f5 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -25,6 +25,10 @@ file_put_contents($userdata, $userdata_content);
// include autoloader / api / etc
require dirname(__DIR__) . '/lib/classes/api/api_includes.inc.php';
+Database::needRoot(true);
+Database::query("DROP DATABASE IF EXISTS `test1sql1`;");
+Database::needRoot(false);
+
// clear all tables
Database::query("TRUNCATE TABLE `" . TABLE_PANEL_CUSTOMERS . "`;");
Database::query("TRUNCATE TABLE `" . TABLE_PANEL_DOMAINS . "`;");