From f2a1ec91f7092f2ec36ac8dcc03f8098c065e40e Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 26 Feb 2016 12:01:00 +0100 Subject: [PATCH] test/php: allow to skip tests with db-dependency --- .../Director/IcingaConfig/AssignRendererTest.php | 2 +- .../library/Director/Objects/IcingaHostTest.php | 14 ++++++++++---- .../Objects/IcingaTimePeriodRangesTest.php | 6 +++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/test/php/library/Director/IcingaConfig/AssignRendererTest.php b/test/php/library/Director/IcingaConfig/AssignRendererTest.php index b54f6378..70aa45c1 100644 --- a/test/php/library/Director/IcingaConfig/AssignRendererTest.php +++ b/test/php/library/Director/IcingaConfig/AssignRendererTest.php @@ -1,6 +1,6 @@ skipForMissingDb()) { + return; + } + $db = $this->getDb(); $this->host()->store($db); $host = IcingaHost::load($this->testHostName, $db); @@ -166,9 +170,11 @@ class IcingaHostTest extends BaseTestCase public function tearDown() { - $db = $this->getDb(); - if (IcingaHost::exists($this->testHostName, $db)) { - IcingaHost::load($this->testHostName, $db)->delete(); + if ($this->hasDb()) { + $db = $this->getDb(); + if (IcingaHost::exists($this->testHostName, $db)) { + IcingaHost::load($this->testHostName, $db)->delete(); + } } } } diff --git a/test/php/library/Director/Objects/IcingaTimePeriodRangesTest.php b/test/php/library/Director/Objects/IcingaTimePeriodRangesTest.php index 37ed0ff7..a62bc77b 100644 --- a/test/php/library/Director/Objects/IcingaTimePeriodRangesTest.php +++ b/test/php/library/Director/Objects/IcingaTimePeriodRangesTest.php @@ -1,6 +1,6 @@ skipForMissingDb()) { + return; + } + $period = $this->createTestPeriod(); $newRanges = array(