mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.8' of github.com:cakephp/cakephp into 2.8
This commit is contained in:
commit
ae83e197dc
6 changed files with 26 additions and 9 deletions
|
@ -222,6 +222,7 @@ class TestShell extends Shell {
|
||||||
$options = array();
|
$options = array();
|
||||||
$params = $this->params;
|
$params = $this->params;
|
||||||
unset($params['help']);
|
unset($params['help']);
|
||||||
|
unset($params['quiet']);
|
||||||
|
|
||||||
if (!empty($params['no-colors'])) {
|
if (!empty($params['no-colors'])) {
|
||||||
unset($params['no-colors'], $params['colors']);
|
unset($params['no-colors'], $params['colors']);
|
||||||
|
|
|
@ -89,7 +89,7 @@ class DatabaseSession implements CakeSessionHandlerInterface {
|
||||||
*/
|
*/
|
||||||
public function read($id) {
|
public function read($id) {
|
||||||
$row = $this->_model->find('first', array(
|
$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'])) {
|
if (empty($row[$this->_model->alias]['data'])) {
|
||||||
|
|
|
@ -3076,7 +3076,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
$query['order'] = $this->order;
|
$query['order'] = $this->order;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query['order'] = array($query['order']);
|
$query['order'] = (array)$query['order'];
|
||||||
|
|
||||||
if ($query['callbacks'] === true || $query['callbacks'] === 'before') {
|
if ($query['callbacks'] === true || $query['callbacks'] === 'before') {
|
||||||
$event = new CakeEvent('Model.beforeFind', $this, array($query));
|
$event = new CakeEvent('Model.beforeFind', $this, array($query));
|
||||||
|
|
|
@ -341,4 +341,22 @@ class TestShellTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->Shell->main();
|
$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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,13 +361,13 @@ class PaginatorComponentTest extends CakeTestCase {
|
||||||
$Controller->request->params['named'] = array('sort' => 'NotExisting.field', 'direction' => 'desc', 'limit' => 2);
|
$Controller->request->params['named'] = array('sort' => 'NotExisting.field', 'direction' => 'desc', 'limit' => 2);
|
||||||
$Controller->Paginator->paginate('PaginatorControllerPost');
|
$Controller->Paginator->paginate('PaginatorControllerPost');
|
||||||
$this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']);
|
$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(
|
$Controller->request->params['named'] = array(
|
||||||
'sort' => 'PaginatorControllerPost.author_id', 'direction' => 'allYourBase'
|
'sort' => 'PaginatorControllerPost.author_id', 'direction' => 'allYourBase'
|
||||||
);
|
);
|
||||||
$results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
|
$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);
|
$this->assertEquals(array(1, 3, 2), $results);
|
||||||
|
|
||||||
$Controller->request->params['named'] = array();
|
$Controller->request->params['named'] = array();
|
||||||
|
|
|
@ -6309,9 +6309,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'joins' => array(),
|
'joins' => array(),
|
||||||
'limit' => null,
|
'limit' => null,
|
||||||
'offset' => null,
|
'offset' => null,
|
||||||
'order' => array(
|
'order' => array(),
|
||||||
0 => null
|
|
||||||
),
|
|
||||||
'page' => 1,
|
'page' => 1,
|
||||||
'group' => null,
|
'group' => null,
|
||||||
'callbacks' => true,
|
'callbacks' => true,
|
||||||
|
@ -8079,8 +8077,8 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test after find callback on related model
|
* test after find callback on related model
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testRelatedAfterFindCallback() {
|
public function testRelatedAfterFindCallback() {
|
||||||
$this->loadFixtures('Something', 'SomethingElse', 'JoinThing');
|
$this->loadFixtures('Something', 'SomethingElse', 'JoinThing');
|
||||||
|
|
Loading…
Reference in a new issue