Skip to content

Commit 360c386

Browse files
committed
Skip mail tests if mail system is not supported.
1 parent a548ab9 commit 360c386

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/MailTest.php

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

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

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

33+
protected function setUp()
34+
{
35+
parent::setUp();
36+
37+
if (!static::$_isMailSupported) {
38+
$this->markTestSkipped('Mail system is not supported.');
39+
}
40+
}
41+
2442
public function testCreate()
2543
{
2644
$mailname = static::$_client->mail()->create('test', static::$_webspace->id, true, 'secret');

0 commit comments

Comments
 (0)