Merge branch '2.8' of github.com:cakephp/cakephp into 2.8

This commit is contained in:
mark_story 2015-09-27 11:13:12 -04:00
commit ae83e197dc
6 changed files with 26 additions and 9 deletions

View file

@ -222,6 +222,7 @@ class TestShell extends Shell {
$options = array();
$params = $this->params;
unset($params['help']);
unset($params['quiet']);
if (!empty($params['no-colors'])) {
unset($params['no-colors'], $params['colors']);

View file

@ -89,7 +89,7 @@ class DatabaseSession implements CakeSessionHandlerInterface {
*/
public function read($id) {
$row = $this->_model->find('first', array(
'conditions' => array($this->_model->primaryKey => $id)
'conditions' => array($this->_model->alias . '.' . $this->_model->primaryKey => $id)
));
if (empty($row[$this->_model->alias]['data'])) {

View file

@ -3076,7 +3076,7 @@ class Model extends Object implements CakeEventListener {
$query['order'] = $this->order;
}
$query['order'] = array($query['order']);
$query['order'] = (array)$query['order'];
if ($query['callbacks'] === true || $query['callbacks'] === 'before') {
$event = new CakeEvent('Model.beforeFind', $this, array($query));

View file

@ -341,4 +341,22 @@ class TestShellTest extends CakeTestCase {
);
$this->Shell->main();
}
/**
* Tests that the 'quiet' parameter gets swallowed before calling PHPUnit
*
* @return void
*/
public function testRunnerOptionsQuiet() {
$this->Shell->startup();
$this->Shell->args = array('core', 'Basics');
$this->Shell->params = array('quiet' => true);
$this->Shell->expects($this->once())->method('_run')
->with(
array('app' => false, 'plugin' => null, 'core' => true, 'output' => 'text', 'case' => 'Basics'),
array('--colors')
);
$this->Shell->main();
}
}

View file

@ -361,13 +361,13 @@ class PaginatorComponentTest extends CakeTestCase {
$Controller->request->params['named'] = array('sort' => 'NotExisting.field', 'direction' => 'desc', 'limit' => 2);
$Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']);
$this->assertEquals(array(), $Controller->PaginatorControllerPost->lastQueries[1]['order'][0], 'no order should be set.');
$this->assertEquals(array(), $Controller->PaginatorControllerPost->lastQueries[1]['order'], 'no order should be set.');
$Controller->request->params['named'] = array(
'sort' => 'PaginatorControllerPost.author_id', 'direction' => 'allYourBase'
);
$results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEquals(array('PaginatorControllerPost.author_id' => 'asc'), $Controller->PaginatorControllerPost->lastQueries[0]['order'][0]);
$this->assertEquals(array('PaginatorControllerPost.author_id' => 'asc'), $Controller->PaginatorControllerPost->lastQueries[0]['order']);
$this->assertEquals(array(1, 3, 2), $results);
$Controller->request->params['named'] = array();

View file

@ -6309,9 +6309,7 @@ class ModelReadTest extends BaseModelTest {
'joins' => array(),
'limit' => null,
'offset' => null,
'order' => array(
0 => null
),
'order' => array(),
'page' => 1,
'group' => null,
'callbacks' => true,
@ -8079,8 +8077,8 @@ class ModelReadTest extends BaseModelTest {
/**
* test after find callback on related model
*
* @return void
*
* @return void
*/
public function testRelatedAfterFindCallback() {
$this->loadFixtures('Something', 'SomethingElse', 'JoinThing');