Skip to content

Commit 841fdc0

Browse files
committed
Skip DNS tests if DNS sub-system is turned off.
1 parent 0d63abf commit 841fdc0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/DnsTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@ class DnsTest extends TestCase
88
*/
99
private static $_webspace;
1010

11+
/**
12+
* @var bool
13+
*/
14+
private static $_isDnsSupported;
15+
1116
public static function setUpBeforeClass()
1217
{
1318
parent::setUpBeforeClass();
19+
20+
$serviceStates = static::$_client->server()->getServiceStates();
21+
static::$_isDnsSupported = $serviceStates['dns'] && ('running' == $serviceStates['dns']['state']);
22+
1423
static::$_webspace = static::_createWebspace('example.dom');
1524
}
1625

@@ -20,6 +29,15 @@ public static function tearDownAfterClass()
2029
static::$_client->webspace()->delete('id', static::$_webspace->id);
2130
}
2231

32+
protected function setUp()
33+
{
34+
parent::setUp();
35+
36+
if (!static::$_isDnsSupported) {
37+
$this->markTestSkipped('DNS system is not supported.');
38+
}
39+
}
40+
2341
public function testCreate()
2442
{
2543
$dns = static::$_client->dns()->create([

0 commit comments

Comments
 (0)