Moving tests around in the AllTests suite and making the CakeSocket tests pass again

This commit is contained in:
Jose Lorenzo Rodriguez 2011-04-22 19:53:38 -04:30
parent 97b57e9249
commit 682ec29b9b
3 changed files with 18 additions and 10 deletions

View file

@ -35,6 +35,7 @@ class AllTests extends PHPUnit_Framework_TestSuite {
$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');

View file

@ -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;
}

View file

@ -170,17 +170,26 @@ class CakeSocketTest extends CakeTestCase {
$this->Socket->connect();
$this->assertEqual($this->Socket->read(26), null);
$config = array('host' => '127.0.0.1', 'timeout' => 0.5);
$this->Socket = new CakeSocket($config);
$this->assertTrue($this->Socket->connect());
$this->assertFalse($this->Socket->read(1024 * 1024));
$this->assertEqual($this->Socket->lastError(), '2: ' . __d('cake_dev', 'Connection timed out'));
$config = array('host' => 'cakephp.org', 'port' => 80, 'timeout' => 20);
$config = array('host' => 'google.com', 'port' => 80, 'timeout' => 1);
$this->Socket = new CakeSocket($config);
$this->assertTrue($this->Socket->connect());
$this->assertEqual($this->Socket->read(26), null);
$this->assertEqual($this->Socket->lastError(), null);
$this->assertEqual($this->Socket->lastError(), '2: ' . __d('cake_dev', 'Connection timed out'));
}
/**
* 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());
$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'));
}
/**