Skip to content

Commit

Permalink
Fix failing test when tests are run with no network connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 22, 2014
1 parent 1232fd7 commit e51f4b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/TestCase/Network/SocketTest.php
@@ -1,7 +1,5 @@
<?php
/**
* SocketTest file
*
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
Expand All @@ -17,6 +15,7 @@
namespace Cake\Test\TestCase\Network;

use Cake\Network\Socket;
use Cake\Network\Error\SocketException;
use Cake\TestSuite\TestCase;

/**
Expand Down Expand Up @@ -383,8 +382,12 @@ public function testGetContext() {
'ssl' => array('capture_peer' => true)
)
);
try {
$this->Socket = new Socket($config);
$this->Socket->connect();
} catch (SocketException $e) {
$this->markTestSkipped('No network, skipping test.');
}
$result = $this->Socket->context();
$this->assertEquals($config['context'], $result);
}
Expand Down

0 comments on commit e51f4b3

Please sign in to comment.