Fixing failing tests.

This commit is contained in:
mark_story 2010-12-15 22:08:24 -05:00
parent 9e74283b90
commit a054695dca
4 changed files with 23 additions and 11 deletions

View file

@ -104,7 +104,11 @@ class PaginatorComponent extends Component {
if (!is_object($object)) { if (!is_object($object)) {
throw new MissingModelException($object); throw new MissingModelException($object);
} }
$options = array_merge($this->Controller->request->params, $this->Controller->params['url'], $this->Controller->passedArgs); $options = array_merge(
$this->Controller->request->params,
$this->Controller->request->query,
$this->Controller->passedArgs
);
if (isset($this->settings[$object->alias])) { if (isset($this->settings[$object->alias])) {
$defaults = $this->settings[$object->alias]; $defaults = $this->settings[$object->alias];

View file

@ -76,10 +76,11 @@ class ApiShellTest extends CakeTestCase {
'16. render($action = NULL, $layout = NULL, $file = NULL)', '16. render($action = NULL, $layout = NULL, $file = NULL)',
'17. set($one, $two = NULL)', '17. set($one, $two = NULL)',
'18. setAction($action)', '18. setAction($action)',
'19. shutdownProcess()', '19. setRequest($request)',
'20. startupProcess()', '20. shutdownProcess()',
'21. validate()', '21. startupProcess()',
'22. validateErrors()' '22. validate()',
'23. validateErrors()'
); );
$this->Shell->expects($this->at(2))->method('out')->with($expected); $this->Shell->expects($this->at(2))->method('out')->with($expected);

View file

@ -34,7 +34,8 @@ class CakeSocketTest extends CakeTestCase {
* @return void * @return void
*/ */
function setUp() { function setUp() {
$this->Socket = new CakeSocket(); parent::setUp();
$this->Socket = new CakeSocket(array('timeout' => 1));
} }
/** /**
@ -44,6 +45,7 @@ class CakeSocketTest extends CakeTestCase {
* @return void * @return void
*/ */
function tearDown() { function tearDown() {
parent::tearDown();
unset($this->Socket); unset($this->Socket);
} }
@ -54,7 +56,7 @@ class CakeSocketTest extends CakeTestCase {
* @return void * @return void
*/ */
function testConstruct() { function testConstruct() {
$this->Socket->__construct(); $this->Socket = new CakeSocket();
$config = $this->Socket->config; $config = $this->Socket->config;
$this->assertIdentical($config, array( $this->assertIdentical($config, array(
'persistent' => false, 'persistent' => false,
@ -108,8 +110,8 @@ class CakeSocketTest extends CakeTestCase {
*/ */
public static function invalidConnections() { public static function invalidConnections() {
return array( return array(
array(array('host' => 'invalid.host')), array(array('host' => 'invalid.host', 'timeout' => 1)),
array(array('host' => '127.0.0.1', 'port' => '70000')) array(array('host' => '127.0.0.1', 'port' => '70000', 'timeout' => 1))
); );
} }

View file

@ -1087,13 +1087,18 @@ HTMLBLOC;
$this->Controller->EmailTest->additionalParams = 'X-additional-header'; $this->Controller->EmailTest->additionalParams = 'X-additional-header';
$this->Controller->EmailTest->delivery = 'smtp'; $this->Controller->EmailTest->delivery = 'smtp';
$this->Controller->EmailTest->smtpOptions['host'] = 'blah'; $this->Controller->EmailTest->smtpOptions['host'] = 'blah';
$this->Controller->EmailTest->smtpOptions['timeout'] = 0.5; $this->Controller->EmailTest->smtpOptions['timeout'] = 0.2;
$this->Controller->EmailTest->attachments = array('attachment1', 'attachment2'); $this->Controller->EmailTest->attachments = array('attachment1', 'attachment2');
$this->Controller->EmailTest->textMessage = 'This is the body of the message'; $this->Controller->EmailTest->textMessage = 'This is the body of the message';
$this->Controller->EmailTest->htmlMessage = 'This is the body of the message'; $this->Controller->EmailTest->htmlMessage = 'This is the body of the message';
$this->Controller->EmailTest->messageId = false; $this->Controller->EmailTest->messageId = false;
$this->assertFalse($this->Controller->EmailTest->send('Should not work')); try {
$this->Controller->EmailTest->send('Should not work');
$this->fail('No exception');
} catch (SocketException $e) {
$this->assertTrue(true, 'SocketException raised');
}
$this->Controller->EmailTest->reset(); $this->Controller->EmailTest->reset();