diff --git a/spec/INTER-Mediator-UnitTest/Core/IMUtil_Test.php b/spec/INTER-Mediator-UnitTest/Core/IMUtil_Test.php index f8b75b34b..d60854eb0 100755 --- a/spec/INTER-Mediator-UnitTest/Core/IMUtil_Test.php +++ b/spec/INTER-Mediator-UnitTest/Core/IMUtil_Test.php @@ -125,37 +125,35 @@ public function test_protectCSRF() public function test_checkHost() { - if (((float)phpversion()) >= 5.3) { - $reflectionMethod = new ReflectionMethod('\INTERMediator\IMUtil', 'checkHost'); - $reflectionMethod->setAccessible(true); + $reflectionMethod = new ReflectionMethod('\INTERMediator\IMUtil', 'checkHost'); + $reflectionMethod->setAccessible(true); - $result = $reflectionMethod->invokeArgs($this->util, array('www.inter-mediator.com', 'www.inter-mediator.com')); - $this->assertTrue($result); + $result = $reflectionMethod->invokeArgs($this->util, array('www.inter-mediator.com', 'www.inter-mediator.com')); + $this->assertTrue($result); - $result = $reflectionMethod->invokeArgs($this->util, array('www.inter-mediator.com', 'inter-mediator.com')); - $this->assertTrue($result); + $result = $reflectionMethod->invokeArgs($this->util, array('www.inter-mediator.com', 'inter-mediator.com')); + $this->assertTrue($result); - $result = $reflectionMethod->invokeArgs($this->util, array('WWW.inter-mediator.com', 'inter-mediator.com')); - $this->assertTrue($result); + $result = $reflectionMethod->invokeArgs($this->util, array('WWW.inter-mediator.com', 'inter-mediator.com')); + $this->assertTrue($result); - $result = $reflectionMethod->invokeArgs($this->util, array('inter-mediator.com', 'inter-mediator.com')); - $this->assertTrue($result); + $result = $reflectionMethod->invokeArgs($this->util, array('inter-mediator.com', 'inter-mediator.com')); + $this->assertTrue($result); - $_SERVER = array(); - $_SERVER['SERVER_ADDR'] = '192.168.56.101'; - $result = $reflectionMethod->invokeArgs($this->util, array('192.168.56.101', $_SERVER['SERVER_ADDR'])); - $this->assertTrue($result); + $_SERVER = array(); + $_SERVER['SERVER_ADDR'] = '192.168.56.101'; + $result = $reflectionMethod->invokeArgs($this->util, array('192.168.56.101', $_SERVER['SERVER_ADDR'])); + $this->assertTrue($result); - $result = $reflectionMethod->invokeArgs($this->util, array('www.inter-mediator.com', '')); - $this->assertFalse($result); + $result = $reflectionMethod->invokeArgs($this->util, array('www.inter-mediator.com', '')); + $this->assertFalse($result); - $result = $reflectionMethod->invokeArgs($this->util, array('www.inter-mediator.com', 'ww.inter-mediator.com')); - $this->assertFalse($result); + $result = $reflectionMethod->invokeArgs($this->util, array('www.inter-mediator.com', 'ww.inter-mediator.com')); + $this->assertFalse($result); - $_SERVER = array(); - $result = $reflectionMethod->invokeArgs($this->util, array('192.168.56.101', '56.101')); - $this->assertFalse($result); - } + $_SERVER = array(); + $result = $reflectionMethod->invokeArgs($this->util, array('192.168.56.101', '56.101')); + $this->assertFalse($result); } #[RunInSeparateProcess] @@ -317,7 +315,8 @@ public function test_UserNameHome() $this->assertNotNull($home, "IMUtil::getServerUserHome has to return any strings."); } - public function test_Profile() { + public function test_Profile() + { $tempDir = sys_get_temp_dir(); Params::setVar("profileRoot", $tempDir); $profileRoot = Params::getParameterValue("profileRoot", null); @@ -334,10 +333,14 @@ public function test_Profile() { "mysecret = 1234", "your-secret = 9876", "big_city = \t 1919", - "noone-knows = 4567", "", "", + "noone-knows = 4567", "", "", ]; - mkdir("$tempDir/.im"); - mkdir("$tempDir/.aws"); + if (!file_exists("$tempDir/.im")) { + mkdir("$tempDir/.im"); + } + if (!file_exists("$tempDir/.aws")) { + mkdir("$tempDir/.aws"); + } file_put_contents("$tempDir/.im/credentials", implode("\n", $fileContent)); file_put_contents("$tempDir/.aws/credentials", implode("\n", $fileContent)); diff --git a/spec/INTER-Mediator-UnitTest/phpunit.xml b/spec/INTER-Mediator-UnitTest/phpunit.xml index 8f1dd9039..2915808e3 100644 --- a/spec/INTER-Mediator-UnitTest/phpunit.xml +++ b/spec/INTER-Mediator-UnitTest/phpunit.xml @@ -1,4 +1,8 @@ - + Core @@ -31,4 +35,4 @@ Editors - \ No newline at end of file + \ No newline at end of file diff --git a/src/php/DB/Settings.php b/src/php/DB/Settings.php index a26a35f36..8a4069ca7 100644 --- a/src/php/DB/Settings.php +++ b/src/php/DB/Settings.php @@ -493,6 +493,10 @@ public function getAssociated(): ?array */ public function setSmtpConfiguration(?array $config): void { + if(is_null($config)) { + $this->smtpConfiguration = null; + return; + } $this->smtpConfiguration = [ "server" => $config["server"], "port" => $config["port"],