Browse Source

Fix failing test when tests are run with no network connection.

mark_story 12 years ago
parent
commit
e51f4b3f12
1 changed files with 5 additions and 2 deletions
  1. 5 2
      tests/TestCase/Network/SocketTest.php

+ 5 - 2
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)
  *
@@ -17,6 +15,7 @@
 namespace Cake\Test\TestCase\Network;
 
 use Cake\Network\Socket;
+use Cake\Network\Error\SocketException;
 use Cake\TestSuite\TestCase;
 
 /**
@@ -383,8 +382,12 @@ class SocketTest extends TestCase {
 				'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);
 	}