Removing dependancy on Object from CakeSocket. Making tests less dependant on having a network connection.

This commit is contained in:
Mark Story 2010-04-23 21:41:20 -07:00
parent e8b6d45850
commit 9ddbd6f686
2 changed files with 3 additions and 5 deletions

View file

@ -27,7 +27,7 @@ App::import('Core', 'Validation');
* @package cake
* @subpackage cake.cake.libs
*/
class CakeSocket extends Object {
class CakeSocket {
/**
* Object description
@ -90,8 +90,6 @@ class CakeSocket extends Object {
* @see CakeSocket::$_baseConfig
*/
function __construct($config = array()) {
parent::__construct();
$this->config = array_merge($this->_baseConfig, $config);
if (!is_numeric($this->config['protocol'])) {
$this->config['protocol'] = getprotobyname($this->config['protocol']);

View file

@ -145,13 +145,13 @@ class CakeSocketTest extends CakeTestCase {
$this->Socket->connect();
$this->assertEqual($this->Socket->read(26), null);
$config = array('host' => 'www.cakephp.org', 'timeout' => 1);
$config = array('host' => '127.0.0.1', 'timeout' => 1);
$this->Socket = new CakeSocket($config);
$this->assertTrue($this->Socket->connect());
$this->assertFalse($this->Socket->read(1024 * 1024));
$this->assertEqual($this->Socket->lastError(), '2: ' . __('Connection timed out'));
$config = array('host' => 'www.cakephp.org', 'timeout' => 30);
$config = array('host' => 'localhost', 'timeout' => 30);
$this->Socket = new CakeSocket($config);
$this->assertTrue($this->Socket->connect());
$this->assertEqual($this->Socket->read(26), null);