Skip to content

Commit

Permalink
Adding testcase for ticket #219
Browse files Browse the repository at this point in the history
  • Loading branch information
C. James Callaway authored and markstory committed Oct 24, 2010
1 parent d3e0ddb commit a429287
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion cake/tests/cases/libs/controller/controller.test.php
Expand Up @@ -695,6 +695,44 @@ function testPaginateExtraParams() {
$this->assertEqual($Controller->ControllerPaginateModel->extraCount, $expected);
}

/**
* testPaginateFieldsDouble method
*
* @return void
* @access public
*/
function testPaginateFieldsDouble(){
$Controller =& new Controller();
$Controller->uses = array('ControllerPost');
$Controller->params['url'] = array();
$Controller->constructClasses();

$Controller->paginate = array(
'fields' => array(
'ControllerPost.id',
'1.2 as floatvalue'
),
'order' => array('ControllerPost.created'=>'DESC'),
'limit' => 1,
'page' => 1,
'recursive' => -1
);
$conditions = array();
$result = $Controller->paginate('ControllerPost',$conditions);
$expected = array(
0=>array(
'ControllerPost'=>array(
'id'=>3,
),
0=>array(
'floatvalue'=>1.2,
),
),
);
$this->assertEqual($result, $expected);
}


/**
* testPaginatePassedArgs method
*
Expand Down Expand Up @@ -1453,4 +1491,4 @@ function testShutdownProcess() {
$MockedController->MockTest->expectCallCount('shutdown', 1);
$MockedController->shutdownProcess();
}
}
}

0 comments on commit a429287

Please sign in to comment.