Skip to content

Commit

Permalink
Moving tests around in the AllTests suite and making the CakeSocket t…
Browse files Browse the repository at this point in the history
…ests pass again
  • Loading branch information
lorenzo committed Apr 23, 2011
1 parent 97b57e9 commit 682ec29
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/Cake/tests/Case/AllTestsTest.php
Expand Up @@ -35,6 +35,7 @@ public static function suite() {

$path = CORE_TEST_CASES . DS;

$suite->addTestFile($path . 'BasicsTest.php');
$suite->addTestFile($path . 'AllConsoleTest.php');
$suite->addTestFile($path . 'AllBehaviorsTest.php');
$suite->addTestFile($path . 'AllCacheTest.php');
Expand Down
2 changes: 0 additions & 2 deletions lib/Cake/tests/Case/AllUtilityTest.php
Expand Up @@ -33,8 +33,6 @@ class AllUtilityTest extends PHPUnit_Framework_TestSuite {
*/
public static function suite() {
$suite = new CakeTestSuite('All Utility class tests');

$suite->addTestFile(CORE_TEST_CASES . DS . 'BasicsTest.php');
$suite->addTestDirectory(CORE_TEST_CASES . DS . 'Utility');
return $suite;
}
Expand Down
19 changes: 14 additions & 5 deletions lib/Cake/tests/Case/Network/CakeSocketTest.php
Expand Up @@ -170,17 +170,26 @@ function testSocketReading() {
$this->Socket->connect();
$this->assertEqual($this->Socket->read(26), null);

$config = array('host' => '127.0.0.1', 'timeout' => 0.5);
$config = array('host' => 'google.com', 'port' => 80, 'timeout' => 1);
$this->Socket = new CakeSocket($config);
$this->assertTrue($this->Socket->connect());
$this->assertFalse($this->Socket->read(1024 * 1024));
$this->assertEqual($this->Socket->read(26), null);
$this->assertEqual($this->Socket->lastError(), '2: ' . __d('cake_dev', 'Connection timed out'));
}

$config = array('host' => 'cakephp.org', 'port' => 80, 'timeout' => 20);
/**
* testTimeOutConnection method
*
* @return void
*/
function testTimeOutConnection() {
$config = array('host' => '127.0.0.1', 'timeout' => 0.5);
$this->Socket = new CakeSocket($config);
$this->assertTrue($this->Socket->connect());
$this->assertEqual($this->Socket->read(26), null);
$this->assertEqual($this->Socket->lastError(), null);

$config = array('host' => '127.0.0.1', 'timeout' => 0.00001);
$this->assertFalse($this->Socket->read(1024 * 1024));
$this->assertEqual($this->Socket->lastError(), '2: ' . __d('cake_dev', 'Connection timed out'));
}

/**
Expand Down

0 comments on commit 682ec29

Please sign in to comment.