From f266bb05c99c29b37a0a05491e9ed1aa9b7a459e Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 6 Jun 2019 13:04:43 +0200 Subject: [PATCH] testing \Froxlor\Settings\FroxlorVhostSettings Signed-off-by: Michael Kaufmann --- tests/Froxlor/SettingsTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/Froxlor/SettingsTest.php b/tests/Froxlor/SettingsTest.php index c4afbb31..343eadf7 100644 --- a/tests/Froxlor/SettingsTest.php +++ b/tests/Froxlor/SettingsTest.php @@ -4,6 +4,7 @@ use PHPUnit\Framework\TestCase; /** * * @covers \Froxlor\Settings + * @covers \Froxlor\Settings\FroxlorVhostSettings */ class SettingsTest extends TestCase { @@ -92,4 +93,21 @@ class SettingsTest extends TestCase $result = \Froxlor\Settings::IsInList("system.mysql_access_host", "my-super-domain.de"); $this->assertFalse($result); } + + public function testFroxlorVhostSettings() + { + // bootstrap.php adds two IPs, one ssl one non-ssl both with vhostcontainer = 1 + $result = \Froxlor\Settings\FroxlorVhostSettings::hasVhostContainerEnabled(false); + $this->assertTrue($result); + $result = \Froxlor\Settings\FroxlorVhostSettings::hasVhostContainerEnabled(true); + $this->assertTrue($result); + // now disable both + \Froxlor\Database\Database::query("UPDATE `". TABLE_PANEL_IPSANDPORTS . "` SET `vhostcontainer` = '0'"); + $result = \Froxlor\Settings\FroxlorVhostSettings::hasVhostContainerEnabled(false); + $this->assertFalse($result); + $result = \Froxlor\Settings\FroxlorVhostSettings::hasVhostContainerEnabled(true); + $this->assertFalse($result); + // and change back + \Froxlor\Database\Database::query("UPDATE `". TABLE_PANEL_IPSANDPORTS . "` SET `vhostcontainer` = '1'"); + } }