diff --git a/test/SP/Services/Install/DbTestUtilTrait.php b/test/SP/Services/Install/DbTestUtilTrait.php
index 5a7ba622..62cca7a7 100644
--- a/test/SP/Services/Install/DbTestUtilTrait.php
+++ b/test/SP/Services/Install/DbTestUtilTrait.php
@@ -68,8 +68,11 @@ trait DbTestUtilTrait
*/
private function createUser($user, $pass, $database)
{
- $this->getConnection()
- ->query(sprintf('GRANT ALL PRIVILEGES ON `%s`.* TO \'%s\'@\'%s\' IDENTIFIED BY \'%s\'', $database, $user, SELF_IP_ADDRESS, $pass));
+ $query = 'GRANT ALL PRIVILEGES ON `%s`.* TO \'%s\'@\'%s\' IDENTIFIED BY \'%s\'';
+
+ $conn = $this->getConnection();
+ $conn->query(sprintf($query, $database, $user, SELF_IP_ADDRESS, $pass));
+ $conn->query(sprintf($query, $database, $user, SELF_HOSTNAME, $pass));
}
/**
@@ -81,7 +84,7 @@ trait DbTestUtilTrait
private function dropUser($user, $host)
{
$this->getConnection()
- ->query(sprintf('DROP USER \'%s\'@\'%s\'', $user, $host));
+ ->query(sprintf('DROP USER IF EXISTS \'%s\'@\'%s\'', $user, $host));
}
/**
diff --git a/test/SP/Services/Install/InstallerTest.php b/test/SP/Services/Install/InstallerTest.php
index 34641271..18d5b21c 100644
--- a/test/SP/Services/Install/InstallerTest.php
+++ b/test/SP/Services/Install/InstallerTest.php
@@ -33,6 +33,7 @@ use SP\Services\Install\InstallData;
use SP\Services\Install\Installer;
use SP\Storage\Database\DBUtil;
use SP\Storage\Database\MySQLHandler;
+use SP\Util\Util;
use function SP\Test\getResource;
use function SP\Test\saveResource;
use function SP\Test\setupContext;
@@ -111,8 +112,12 @@ class InstallerTest extends TestCase
$this->assertTrue(self::$dic->get(MasterPassService::class)->checkMasterPassword($params->getMasterPassword()));
$this->dropDatabase(self::DB_NAME);
- $this->dropUser($configData->getDbUser(), SELF_IP_ADDRESS);
- $this->dropUser($configData->getDbUser(), SELF_HOSTNAME);
+
+ $this->dropUser($configData->getDbUser(), $params->getDbAuthHost());
+
+ if ($params->getDbAuthHostDns()) {
+ $this->dropUser($configData->getDbUser(), $params->getDbAuthHostDns());
+ }
}
/**
@@ -259,12 +264,15 @@ class InstallerTest extends TestCase
*/
public function testHostingMode()
{
+ $pass = Util::randomPassword();
+
+ $this->dropDatabase(self::DB_NAME);
$this->createDatabase(self::DB_NAME);
- $this->createUser('syspass_user', '123456', self::DB_NAME);
+ $this->createUser('syspass_user', $pass, self::DB_NAME);
$params = new InstallData();
$params->setDbAdminUser('syspass_user');
- $params->setDbAdminPass('123456');
+ $params->setDbAdminPass($pass);
$params->setDbName(self::DB_NAME);
$params->setDbHost(getenv('DB_SERVER'));
$params->setAdminLogin('admin');
@@ -290,6 +298,7 @@ class InstallerTest extends TestCase
$this->dropDatabase(self::DB_NAME);
$this->dropUser('syspass_user', SELF_IP_ADDRESS);
+ $this->dropUser('syspass_user', SELF_HOSTNAME);
}
protected function tearDown()
diff --git a/test/SP/Services/Install/MySQLTest.php b/test/SP/Services/Install/MySQLTest.php
index 9a0f88a0..2a708dd9 100644
--- a/test/SP/Services/Install/MySQLTest.php
+++ b/test/SP/Services/Install/MySQLTest.php
@@ -56,21 +56,6 @@ class MySQLTest extends TestCase
$this->assertFalse($mysql->checkDatabaseExist());
}
- /**
- * @throws \SP\Storage\Database\DatabaseException
- * @throws \SP\Core\Exceptions\SPException
- */
- public function testCheckDatabaseExist()
- {
- $this->createDatabase(self::DB_NAME);
-
- $mysql = new MySQL($this->getParams(), new ConfigData());
-
- $this->assertTrue($mysql->checkDatabaseExist());
-
- $this->dropDatabase(self::DB_NAME);
- }
-
/**
* @return InstallData
*/
@@ -91,6 +76,21 @@ class MySQLTest extends TestCase
return $params;
}
+ /**
+ * @throws \SP\Storage\Database\DatabaseException
+ * @throws \SP\Core\Exceptions\SPException
+ */
+ public function testCheckDatabaseExist()
+ {
+ $this->createDatabase(self::DB_NAME);
+
+ $mysql = new MySQL($this->getParams(), new ConfigData());
+
+ $this->assertTrue($mysql->checkDatabaseExist());
+
+ $this->dropDatabase(self::DB_NAME);
+ }
+
/**
* @throws \SP\Core\Exceptions\SPException
*/
diff --git a/test/SP/Storage/FileHandlerTest.php b/test/SP/Storage/FileHandlerTest.php
index 53ccd117..ffe5da27 100644
--- a/test/SP/Storage/FileHandlerTest.php
+++ b/test/SP/Storage/FileHandlerTest.php
@@ -151,10 +151,6 @@ class FileHandlerTest extends TestCase
(new FileHandler(self::$validFile))
->clearCache()
->checkIsReadable();
-
- (new FileHandler(self::$immutableFile))
- ->clearCache()
- ->checkIsReadable();
}
/**
diff --git a/test/res/config/config.xml b/test/res/config/config.xml
index 0debbb4c..ac956218 100644
--- a/test/res/config/config.xml
+++ b/test/res/config/config.xml
@@ -9,11 +9,11 @@
1
1
- 7073a41c8032d93be23cda9eea07f9c3527f54da
+ e4ec7e7979447922d90ef4280172177256c162b8
0
0
- 1532375214
- a4658216020fa81739ab6f100a0d96170a0e5f90
+ 1532379104
+ 5819af570a83290a50935bb1e8397d24c74b87aa
@@ -32,7 +32,7 @@
0
- 7768216134c3c60d24989d670ed6e26d3006347a
+ 25cdc5c691636d478367f88a5e9bb3fc043097d2
- PDF
- JPG