Permalink
Browse files

Changing order of expectations to get more correct results

  • Loading branch information...
1 parent ff1611e commit f0e73e11582899e34d3b91a1aae00fdc3fc8ebfd @lorenzo lorenzo committed Feb 28, 2010
Showing with 7 additions and 10 deletions.
  1. +7 −10 cake/tests/cases/libs/controller/controller.test.php
View
17 cake/tests/cases/libs/controller/controller.test.php
@@ -1339,17 +1339,16 @@ function testControllerHttpCodes() {
* @return void
*/
function testStartupProcess() {
- Mock::generatePartial('AnotherTestController','MockedController', array('beforeFilter'));
+ Mock::generatePartial('AnotherTestController','MockedController', array('beforeFilter', 'afterFilter'));
Mock::generate('TestComponent', 'MockTestComponent', array('startup', 'initialize'));
$MockedController =& new MockedController();
$MockedController->components = array('MockTest');
$MockedController->Component =& new Component();
$MockedController->Component->init($MockedController);
- $MockedController->startupProcess();
-
$MockedController->expectCallCount('beforeFilter', 1);
- $MockedController->MockTest->expectOnce('initialize', array($MockedController));
- $MockedController->MockTest->expectOnce('startup', array($MockedController));
+ $MockedController->MockTest->expectCallCount('initialize', 1);
+ $MockedController->MockTest->expectCallCount('startup', 1);
+ $MockedController->startupProcess();
}
/**
* Tests that the shutdown process calls the correct functions
@@ -1358,16 +1357,14 @@ function testStartupProcess() {
* @return void
*/
function testShutdownProcess() {
- Mock::generatePartial('AnotherTestController','MockedController2', array('afterFilter'));
Mock::generate('TestComponent', 'MockTestComponent', array('shutdown'));
- $MockedController =& new MockedController2();
+ $MockedController =& new MockedController();
$MockedController->components = array('MockTest');
$MockedController->Component =& new Component();
$MockedController->Component->init($MockedController);
- $MockedController->shutdownProcess();
-
$MockedController->expectCallCount('afterFilter', 1);
- $MockedController->MockTest->expectOnce('shutdown', array($MockedController));
+ $MockedController->MockTest->expectCallCount('shutdown', 1);
+ $MockedController->shutdownProcess();
}
}
?>

0 comments on commit f0e73e1

Please sign in to comment.