Skip to content

Commit

Permalink
Skip test when unable to connect network
Browse files Browse the repository at this point in the history
  • Loading branch information
chinpei215 committed Oct 7, 2017
1 parent 0c34205 commit 4e5de59
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions tests/TestCase/Network/SocketTest.php
Expand Up @@ -260,7 +260,6 @@ public function testReset()
/**
* testEncrypt
*
* @expectedException \Cake\Network\Exception\SocketException
* @return void
*/
public function testEnableCryptoSocketExceptionNoSsl()
Expand All @@ -270,8 +269,21 @@ public function testEnableCryptoSocketExceptionNoSsl()

// testing exception on no ssl socket server for ssl and tls methods
$this->Socket = new Socket($configNoSslOrTls);
$this->Socket->connect();
$this->Socket->enableCrypto('sslv3', 'client');

try {
$this->Socket->connect();
} catch (SocketException $e) {
$this->markTestSkipped('Cannot test network, skipping.');
}

$e = null;
try {
$this->Socket->enableCrypto('sslv3', 'client');
} catch (SocketException $e) {
}

$this->assertNotNull($e);
$this->assertInstanceOf('Exception', $e->getPrevious());
}

/**
Expand All @@ -285,7 +297,12 @@ public function testEnableCryptoSocketExceptionNoTls()

// testing exception on no ssl socket server for ssl and tls methods
$this->Socket = new Socket($configNoSslOrTls);
$this->Socket->connect();

try {
$this->Socket->connect();
} catch (SocketException $e) {
$this->markTestSkipped('Cannot test network, skipping.');
}

$e = null;
try {
Expand Down

0 comments on commit 4e5de59

Please sign in to comment.