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; $path = CORE_TEST_CASES . DS;
$suite->addTestFile($path . 'BasicsTest.php');
$suite->addTestFile($path . 'AllConsoleTest.php'); $suite->addTestFile($path . 'AllConsoleTest.php');
$suite->addTestFile($path . 'AllBehaviorsTest.php'); $suite->addTestFile($path . 'AllBehaviorsTest.php');
$suite->addTestFile($path . 'AllCacheTest.php'); $suite->addTestFile($path . 'AllCacheTest.php');

View file

@ -33,8 +33,6 @@ class AllUtilityTest extends PHPUnit_Framework_TestSuite {
*/ */
public static function suite() { public static function suite() {
$suite = new CakeTestSuite('All Utility class tests'); $suite = new CakeTestSuite('All Utility class tests');
$suite->addTestFile(CORE_TEST_CASES . DS . 'BasicsTest.php');
$suite->addTestDirectory(CORE_TEST_CASES . DS . 'Utility'); $suite->addTestDirectory(CORE_TEST_CASES . DS . 'Utility');
return $suite; return $suite;
} }

View file

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