Skip to content

Commit 682ec29

Browse files
committed
Moving tests around in the AllTests suite and making the CakeSocket tests pass again
1 parent 97b57e9 commit 682ec29

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

lib/Cake/tests/Case/AllTestsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static function suite() {
3535

3636
$path = CORE_TEST_CASES . DS;
3737

38+
$suite->addTestFile($path . 'BasicsTest.php');
3839
$suite->addTestFile($path . 'AllConsoleTest.php');
3940
$suite->addTestFile($path . 'AllBehaviorsTest.php');
4041
$suite->addTestFile($path . 'AllCacheTest.php');

lib/Cake/tests/Case/AllUtilityTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ class AllUtilityTest extends PHPUnit_Framework_TestSuite {
3333
*/
3434
public static function suite() {
3535
$suite = new CakeTestSuite('All Utility class tests');
36-
37-
$suite->addTestFile(CORE_TEST_CASES . DS . 'BasicsTest.php');
3836
$suite->addTestDirectory(CORE_TEST_CASES . DS . 'Utility');
3937
return $suite;
4038
}

lib/Cake/tests/Case/Network/CakeSocketTest.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,26 @@ function testSocketReading() {
170170
$this->Socket->connect();
171171
$this->assertEqual($this->Socket->read(26), null);
172172

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

179-
$config = array('host' => 'cakephp.org', 'port' => 80, 'timeout' => 20);
180+
/**
181+
* testTimeOutConnection method
182+
*
183+
* @return void
184+
*/
185+
function testTimeOutConnection() {
186+
$config = array('host' => '127.0.0.1', 'timeout' => 0.5);
180187
$this->Socket = new CakeSocket($config);
181188
$this->assertTrue($this->Socket->connect());
182-
$this->assertEqual($this->Socket->read(26), null);
183-
$this->assertEqual($this->Socket->lastError(), null);
189+
190+
$config = array('host' => '127.0.0.1', 'timeout' => 0.00001);
191+
$this->assertFalse($this->Socket->read(1024 * 1024));
192+
$this->assertEqual($this->Socket->lastError(), '2: ' . __d('cake_dev', 'Connection timed out'));
184193
}
185194

186195
/**

0 commit comments

Comments
 (0)