From a054695dca6d955fa3290117b23ce1cbaab74c9f Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 15 Dec 2010 22:08:24 -0500 Subject: [PATCH] Fixing failing tests. --- cake/libs/controller/components/paginator.php | 6 +++++- cake/tests/cases/console/shells/api.test.php | 9 +++++---- cake/tests/cases/libs/cake_socket.test.php | 10 ++++++---- .../cases/libs/controller/components/email.test.php | 9 +++++++-- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/cake/libs/controller/components/paginator.php b/cake/libs/controller/components/paginator.php index cb1bf7f0e..9bf89f991 100644 --- a/cake/libs/controller/components/paginator.php +++ b/cake/libs/controller/components/paginator.php @@ -104,7 +104,11 @@ class PaginatorComponent extends Component { if (!is_object($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])) { $defaults = $this->settings[$object->alias]; diff --git a/cake/tests/cases/console/shells/api.test.php b/cake/tests/cases/console/shells/api.test.php index 82f134552..7ed9b85a3 100644 --- a/cake/tests/cases/console/shells/api.test.php +++ b/cake/tests/cases/console/shells/api.test.php @@ -76,10 +76,11 @@ class ApiShellTest extends CakeTestCase { '16. render($action = NULL, $layout = NULL, $file = NULL)', '17. set($one, $two = NULL)', '18. setAction($action)', - '19. shutdownProcess()', - '20. startupProcess()', - '21. validate()', - '22. validateErrors()' + '19. setRequest($request)', + '20. shutdownProcess()', + '21. startupProcess()', + '22. validate()', + '23. validateErrors()' ); $this->Shell->expects($this->at(2))->method('out')->with($expected); diff --git a/cake/tests/cases/libs/cake_socket.test.php b/cake/tests/cases/libs/cake_socket.test.php index 8359db3bb..ce84dedfb 100644 --- a/cake/tests/cases/libs/cake_socket.test.php +++ b/cake/tests/cases/libs/cake_socket.test.php @@ -34,7 +34,8 @@ class CakeSocketTest extends CakeTestCase { * @return void */ 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 */ function tearDown() { + parent::tearDown(); unset($this->Socket); } @@ -54,7 +56,7 @@ class CakeSocketTest extends CakeTestCase { * @return void */ function testConstruct() { - $this->Socket->__construct(); + $this->Socket = new CakeSocket(); $config = $this->Socket->config; $this->assertIdentical($config, array( 'persistent' => false, @@ -108,8 +110,8 @@ class CakeSocketTest extends CakeTestCase { */ public static function invalidConnections() { return array( - array(array('host' => 'invalid.host')), - array(array('host' => '127.0.0.1', 'port' => '70000')) + array(array('host' => 'invalid.host', 'timeout' => 1)), + array(array('host' => '127.0.0.1', 'port' => '70000', 'timeout' => 1)) ); } diff --git a/cake/tests/cases/libs/controller/components/email.test.php b/cake/tests/cases/libs/controller/components/email.test.php index e853d4a7e..ea2d86b29 100755 --- a/cake/tests/cases/libs/controller/components/email.test.php +++ b/cake/tests/cases/libs/controller/components/email.test.php @@ -1087,13 +1087,18 @@ HTMLBLOC; $this->Controller->EmailTest->additionalParams = 'X-additional-header'; $this->Controller->EmailTest->delivery = 'smtp'; $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->textMessage = 'This is the body of the message'; $this->Controller->EmailTest->htmlMessage = 'This is the body of the message'; $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();