mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.5
Conflicts: lib/Cake/Model/Datasource/DboSource.php
This commit is contained in:
commit
2c5d96e916
21 changed files with 67 additions and 45 deletions
|
@ -328,7 +328,7 @@ class ConsoleShell extends AppShell {
|
||||||
$command = str_replace($this->badCommandChars, "", $command);
|
$command = str_replace($this->badCommandChars, "", $command);
|
||||||
|
|
||||||
// Do we have a valid model?
|
// Do we have a valid model?
|
||||||
list($modelToCheck, $tmp) = explode('->', $command);
|
list($modelToCheck) = explode('->', $command);
|
||||||
|
|
||||||
if ($this->_isValidModel($modelToCheck)) {
|
if ($this->_isValidModel($modelToCheck)) {
|
||||||
$findCommand = "\$data = \$this->$command;";
|
$findCommand = "\$data = \$this->$command;";
|
||||||
|
@ -389,7 +389,7 @@ class ConsoleShell extends AppShell {
|
||||||
// Validate the model we're trying to save here
|
// Validate the model we're trying to save here
|
||||||
$command = strip_tags($command);
|
$command = strip_tags($command);
|
||||||
$command = str_replace($this->badCommandChars, "", $command);
|
$command = str_replace($this->badCommandChars, "", $command);
|
||||||
list($modelToSave, $tmp) = explode("->", $command);
|
list($modelToSave) = explode("->", $command);
|
||||||
|
|
||||||
if ($this->_isValidModel($modelToSave)) {
|
if ($this->_isValidModel($modelToSave)) {
|
||||||
// Extract the array of data we are trying to build
|
// Extract the array of data we are trying to build
|
||||||
|
|
|
@ -279,7 +279,13 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
*/
|
*/
|
||||||
public function afterFind(Model $Model, $results, $primary = false) {
|
public function afterFind(Model $Model, $results, $primary = false) {
|
||||||
$Model->virtualFields = $this->runtime[$Model->alias]['virtualFields'];
|
$Model->virtualFields = $this->runtime[$Model->alias]['virtualFields'];
|
||||||
|
|
||||||
$this->runtime[$Model->alias]['virtualFields'] = $this->runtime[$Model->alias]['fields'] = array();
|
$this->runtime[$Model->alias]['virtualFields'] = $this->runtime[$Model->alias]['fields'] = array();
|
||||||
|
if (!empty($this->runtime[$Model->alias]['restoreFields'])) {
|
||||||
|
$this->runtime[$Model->alias]['fields'] = $this->runtime[$Model->alias]['restoreFields'];
|
||||||
|
unset($this->runtime[$Model->alias]['restoreFields']);
|
||||||
|
}
|
||||||
|
|
||||||
$locale = $this->_getLocale($Model);
|
$locale = $this->_getLocale($Model);
|
||||||
|
|
||||||
if (empty($locale) || empty($results) || empty($this->runtime[$Model->alias]['beforeFind'])) {
|
if (empty($locale) || empty($results) || empty($this->runtime[$Model->alias]['beforeFind'])) {
|
||||||
|
@ -577,7 +583,10 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
}
|
}
|
||||||
$associations = array();
|
$associations = array();
|
||||||
$RuntimeModel = $this->translateModel($Model);
|
$RuntimeModel = $this->translateModel($Model);
|
||||||
$default = array('className' => $RuntimeModel->alias, 'foreignKey' => 'foreign_key');
|
$default = array(
|
||||||
|
'className' => $RuntimeModel->alias,
|
||||||
|
'foreignKey' => 'foreign_key'
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($fields as $key => $value) {
|
foreach ($fields as $key => $value) {
|
||||||
if (is_numeric($key)) {
|
if (is_numeric($key)) {
|
||||||
|
@ -592,7 +601,6 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
__d('cake_dev', 'You cannot bind a translation named "name".')
|
__d('cake_dev', 'You cannot bind a translation named "name".')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_removeField($Model, $field);
|
$this->_removeField($Model, $field);
|
||||||
|
|
||||||
if ($association === null) {
|
if ($association === null) {
|
||||||
|
@ -604,6 +612,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
} else {
|
} else {
|
||||||
if ($reset) {
|
if ($reset) {
|
||||||
$this->runtime[$Model->alias]['fields'][$field] = $association;
|
$this->runtime[$Model->alias]['fields'][$field] = $association;
|
||||||
|
$this->runtime[$Model->alias]['restoreFields'][] = $field;
|
||||||
} else {
|
} else {
|
||||||
$this->settings[$Model->alias][$field] = $association;
|
$this->settings[$Model->alias][$field] = $association;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,6 @@ class CakeSession {
|
||||||
*/
|
*/
|
||||||
public static function init($base = null) {
|
public static function init($base = null) {
|
||||||
self::$time = time();
|
self::$time = time();
|
||||||
$checkAgent = Configure::read('Session.checkAgent');
|
|
||||||
|
|
||||||
if (env('HTTP_USER_AGENT')) {
|
if (env('HTTP_USER_AGENT')) {
|
||||||
self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
|
self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
|
||||||
|
|
|
@ -671,7 +671,6 @@ class Postgres extends DboSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
$col = str_replace(')', '', $real);
|
$col = str_replace(')', '', $real);
|
||||||
$limit = null;
|
|
||||||
|
|
||||||
if (strpos($col, '(') !== false) {
|
if (strpos($col, '(') !== false) {
|
||||||
list($col, $limit) = explode('(', $col);
|
list($col, $limit) = explode('(', $col);
|
||||||
|
|
|
@ -252,9 +252,8 @@ class Sqlite extends DboSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
$col = strtolower(str_replace(')', '', $real));
|
$col = strtolower(str_replace(')', '', $real));
|
||||||
$limit = null;
|
|
||||||
if (strpos($col, '(') !== false) {
|
if (strpos($col, '(') !== false) {
|
||||||
list($col, $limit) = explode('(', $col);
|
list($col) = explode('(', $col);
|
||||||
}
|
}
|
||||||
|
|
||||||
$standard = array(
|
$standard = array(
|
||||||
|
|
|
@ -2926,7 +2926,7 @@ class DboSource extends DataSource {
|
||||||
$key = '(' . $this->_quoteFields($Model->getVirtualField($key)) . ')';
|
$key = '(' . $this->_quoteFields($Model->getVirtualField($key)) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
list($alias, ) = pluginSplit($key);
|
list($alias) = pluginSplit($key);
|
||||||
|
|
||||||
if ($alias !== $Model->alias && is_object($Model->{$alias}) && $Model->{$alias}->isVirtualField($key)) {
|
if ($alias !== $Model->alias && is_object($Model->{$alias}) && $Model->{$alias}->isVirtualField($key)) {
|
||||||
$key = '(' . $this->_quoteFields($Model->{$alias}->getVirtualField($key)) . ')';
|
$key = '(' . $this->_quoteFields($Model->{$alias}->getVirtualField($key)) . ')';
|
||||||
|
@ -3037,7 +3037,7 @@ class DboSource extends DataSource {
|
||||||
'int' => 1, 'tinyint' => 1, 'smallint' => 1, 'mediumint' => 1, 'integer' => 1, 'bigint' => 1
|
'int' => 1, 'tinyint' => 1, 'smallint' => 1, 'mediumint' => 1, 'integer' => 1, 'bigint' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
list($real, $type, $length, $offset, $sign, $zerofill) = $result;
|
list($real, $type, $length, $offset, $sign) = $result;
|
||||||
$typeArr = $type;
|
$typeArr = $type;
|
||||||
$type = $type[0];
|
$type = $type[0];
|
||||||
$length = $length[0];
|
$length = $length[0];
|
||||||
|
@ -3449,13 +3449,12 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
$isAllFloat = $isAllInt = true;
|
$isAllFloat = $isAllInt = true;
|
||||||
$containsFloat = $containsInt = $containsString = false;
|
$containsInt = $containsString = false;
|
||||||
foreach ($value as $valElement) {
|
foreach ($value as $valElement) {
|
||||||
$valElement = trim($valElement);
|
$valElement = trim($valElement);
|
||||||
if (!is_float($valElement) && !preg_match('/^[\d]+\.[\d]+$/', $valElement)) {
|
if (!is_float($valElement) && !preg_match('/^[\d]+\.[\d]+$/', $valElement)) {
|
||||||
$isAllFloat = false;
|
$isAllFloat = false;
|
||||||
} else {
|
} else {
|
||||||
$containsFloat = true;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!is_int($valElement) && !preg_match('/^[\d]+$/', $valElement)) {
|
if (!is_int($valElement) && !preg_match('/^[\d]+$/', $valElement)) {
|
||||||
|
|
|
@ -196,9 +196,9 @@ class FileEngineTest extends CakeTestCase {
|
||||||
Cache::config('file_test', array('engine' => 'File', 'duration' => 1));
|
Cache::config('file_test', array('engine' => 'File', 'duration' => 1));
|
||||||
|
|
||||||
$data = 'this is a test of the emergency broadcasting system';
|
$data = 'this is a test of the emergency broadcasting system';
|
||||||
$write = Cache::write('serialize_test1', $data, 'file_test');
|
Cache::write('serialize_test1', $data, 'file_test');
|
||||||
$write = Cache::write('serialize_test2', $data, 'file_test');
|
Cache::write('serialize_test2', $data, 'file_test');
|
||||||
$write = Cache::write('serialize_test3', $data, 'file_test');
|
Cache::write('serialize_test3', $data, 'file_test');
|
||||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
|
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
|
||||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
|
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
|
||||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
|
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
|
||||||
|
@ -210,9 +210,9 @@ class FileEngineTest extends CakeTestCase {
|
||||||
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));
|
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));
|
||||||
|
|
||||||
$data = 'this is a test of the emergency broadcasting system';
|
$data = 'this is a test of the emergency broadcasting system';
|
||||||
$write = Cache::write('serialize_test1', $data, 'file_test');
|
Cache::write('serialize_test1', $data, 'file_test');
|
||||||
$write = Cache::write('serialize_test2', $data, 'file_test');
|
Cache::write('serialize_test2', $data, 'file_test');
|
||||||
$write = Cache::write('serialize_test3', $data, 'file_test');
|
Cache::write('serialize_test3', $data, 'file_test');
|
||||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
|
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
|
||||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
|
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
|
||||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
|
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
|
||||||
|
@ -413,7 +413,7 @@ class FileEngineTest extends CakeTestCase {
|
||||||
Cache::drop('mask_test');
|
Cache::drop('mask_test');
|
||||||
|
|
||||||
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0666, 'path' => TMP . 'tests'));
|
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0666, 'path' => TMP . 'tests'));
|
||||||
$write = Cache::write('masking_test', $data, 'mask_test');
|
Cache::write('masking_test', $data, 'mask_test');
|
||||||
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
|
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
|
||||||
$expected = '0666';
|
$expected = '0666';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
@ -421,7 +421,7 @@ class FileEngineTest extends CakeTestCase {
|
||||||
Cache::drop('mask_test');
|
Cache::drop('mask_test');
|
||||||
|
|
||||||
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0644, 'path' => TMP . 'tests'));
|
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0644, 'path' => TMP . 'tests'));
|
||||||
$write = Cache::write('masking_test', $data, 'mask_test');
|
Cache::write('masking_test', $data, 'mask_test');
|
||||||
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
|
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
|
||||||
$expected = '0644';
|
$expected = '0644';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
@ -429,7 +429,7 @@ class FileEngineTest extends CakeTestCase {
|
||||||
Cache::drop('mask_test');
|
Cache::drop('mask_test');
|
||||||
|
|
||||||
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0640, 'path' => TMP . 'tests'));
|
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0640, 'path' => TMP . 'tests'));
|
||||||
$write = Cache::write('masking_test', $data, 'mask_test');
|
Cache::write('masking_test', $data, 'mask_test');
|
||||||
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
|
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
|
||||||
$expected = '0640';
|
$expected = '0640';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
|
@ -550,7 +550,7 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
$this->Shell->expects($this->any())
|
$this->Shell->expects($this->any())
|
||||||
->method('in')
|
->method('in')
|
||||||
->will($this->returnValue('y'));
|
->will($this->returnValue('y'));
|
||||||
$r = $this->Shell->expects($this->once())
|
$this->Shell->expects($this->once())
|
||||||
->method('_run')
|
->method('_run')
|
||||||
->with($this->arrayHasKey('newone'), 'update', $this->isInstanceOf('CakeSchema'));
|
->with($this->arrayHasKey('newone'), 'update', $this->isInstanceOf('CakeSchema'));
|
||||||
|
|
||||||
|
|
|
@ -427,9 +427,8 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->expects($this->at(1))->method('createFile')
|
$this->Task->expects($this->at(1))->method('createFile')
|
||||||
->with($filename, $this->stringContains('<?php'));
|
->with($filename, $this->stringContains('<?php'));
|
||||||
|
|
||||||
$result = $this->Task->generateFixtureFile('Article', array());
|
$this->Task->generateFixtureFile('Article', array());
|
||||||
|
$this->Task->generateFixtureFile('Article', array());
|
||||||
$result = $this->Task->generateFixtureFile('Article', array());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -609,8 +609,8 @@ class PaginatorComponentTest extends CakeTestCase {
|
||||||
$this->assertEmpty($result['order']);
|
$this->assertEmpty($result['order']);
|
||||||
|
|
||||||
$Controller->PaginatorControllerPost->order = 'PaginatorControllerPost.id';
|
$Controller->PaginatorControllerPost->order = 'PaginatorControllerPost.id';
|
||||||
$results = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array());
|
$result = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array());
|
||||||
$this->assertEmpty($result['order']);
|
$this->assertArrayNotHasKey('order', $result);
|
||||||
|
|
||||||
$Controller->PaginatorControllerPost->order = array(
|
$Controller->PaginatorControllerPost->order = array(
|
||||||
'PaginatorControllerPost.id',
|
'PaginatorControllerPost.id',
|
||||||
|
@ -1124,26 +1124,26 @@ class PaginatorComponentTest extends CakeTestCase {
|
||||||
$Controller->request->params['named'] = array(
|
$Controller->request->params['named'] = array(
|
||||||
'contain' => array('ControllerComment'), 'limit' => '1000'
|
'contain' => array('ControllerComment'), 'limit' => '1000'
|
||||||
);
|
);
|
||||||
$result = $Controller->paginate('PaginatorControllerPost');
|
$Controller->paginate('PaginatorControllerPost');
|
||||||
$this->assertEquals(100, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
$this->assertEquals(100, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
||||||
|
|
||||||
$Controller->request->params['named'] = array(
|
$Controller->request->params['named'] = array(
|
||||||
'contain' => array('ControllerComment'), 'limit' => '1000', 'maxLimit' => 1000
|
'contain' => array('ControllerComment'), 'limit' => '1000', 'maxLimit' => 1000
|
||||||
);
|
);
|
||||||
$result = $Controller->paginate('PaginatorControllerPost');
|
$Controller->paginate('PaginatorControllerPost');
|
||||||
$this->assertEquals(100, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
$this->assertEquals(100, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
||||||
|
|
||||||
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '10');
|
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '10');
|
||||||
$result = $Controller->paginate('PaginatorControllerPost');
|
$Controller->paginate('PaginatorControllerPost');
|
||||||
$this->assertEquals(10, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
$this->assertEquals(10, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
||||||
|
|
||||||
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '1000');
|
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '1000');
|
||||||
$Controller->paginate = array('maxLimit' => 2000, 'paramType' => 'named');
|
$Controller->paginate = array('maxLimit' => 2000, 'paramType' => 'named');
|
||||||
$result = $Controller->paginate('PaginatorControllerPost');
|
$Controller->paginate('PaginatorControllerPost');
|
||||||
$this->assertEquals(1000, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
$this->assertEquals(1000, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
||||||
|
|
||||||
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '5000');
|
$Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '5000');
|
||||||
$result = $Controller->paginate('PaginatorControllerPost');
|
$Controller->paginate('PaginatorControllerPost');
|
||||||
$this->assertEquals(2000, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
$this->assertEquals(2000, $Controller->params['paging']['PaginatorControllerPost']['options']['limit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,7 @@ class SecurityComponentTest extends CakeTestCase {
|
||||||
$fields = '69f493434187b867ea14b901fdf58b55d27c935d%3A';
|
$fields = '69f493434187b867ea14b901fdf58b55d27c935d%3A';
|
||||||
$unlocked = '';
|
$unlocked = '';
|
||||||
|
|
||||||
$this->Controller->request->data = $data = array(
|
$this->Controller->request->data = array(
|
||||||
'Model' => array('username' => '', 'password' => ''),
|
'Model' => array('username' => '', 'password' => ''),
|
||||||
'_Token' => compact('key', 'fields', 'unlocked')
|
'_Token' => compact('key', 'fields', 'unlocked')
|
||||||
);
|
);
|
||||||
|
|
|
@ -243,7 +243,6 @@ class ControllerMergeVarsTest extends CakeTestCase {
|
||||||
public function testMergeVarsModelClass() {
|
public function testMergeVarsModelClass() {
|
||||||
$Controller = new MergeVariablescontroller();
|
$Controller = new MergeVariablescontroller();
|
||||||
$Controller->uses = array('Test', 'TestAlias');
|
$Controller->uses = array('Test', 'TestAlias');
|
||||||
$lastModel = end($Controller->uses);
|
|
||||||
$Controller->constructClasses();
|
$Controller->constructClasses();
|
||||||
$this->assertEquals($Controller->uses[0], $Controller->modelClass);
|
$this->assertEquals($Controller->uses[0], $Controller->modelClass);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1057,6 +1057,29 @@ class TranslateBehaviorTest extends CakeTestCase {
|
||||||
$this->assertFalse(empty($result));
|
$this->assertFalse(empty($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test restoring fields after temporary binds method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testFieldsRestoreAfterBind() {
|
||||||
|
$this->loadFixtures('Translate', 'TranslatedItem');
|
||||||
|
|
||||||
|
$TestModel = new TranslatedItem();
|
||||||
|
|
||||||
|
$translations = array('title' => 'Title');
|
||||||
|
$TestModel->bindTranslation($translations);
|
||||||
|
|
||||||
|
$result = $TestModel->find('first');
|
||||||
|
$this->assertArrayHasKey('Title', $result);
|
||||||
|
$this->assertArrayHasKey('content', $result['Title'][0]);
|
||||||
|
$this->assertArrayNotHasKey('title', $result);
|
||||||
|
|
||||||
|
$result = $TestModel->find('first');
|
||||||
|
$this->assertArrayNotHasKey('Title', $result);
|
||||||
|
$this->assertEquals('Title #1', $result['TranslatedItem']['title']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testAttachDetach method
|
* testAttachDetach method
|
||||||
*
|
*
|
||||||
|
|
|
@ -2294,14 +2294,12 @@ class RouterTest extends CakeTestCase {
|
||||||
$this->assertEquals(array_merge($url, array('plugin' => null)), $route->defaults);
|
$this->assertEquals(array_merge($url, array('plugin' => null)), $route->defaults);
|
||||||
|
|
||||||
// test that the first route is matched
|
// test that the first route is matched
|
||||||
$newUrl = array('controller' => 'products', 'action' => 'display', 6);
|
|
||||||
Router::connect('/government', $url);
|
Router::connect('/government', $url);
|
||||||
Router::parse('/government');
|
Router::parse('/government');
|
||||||
$route = Router::requestRoute();
|
$route = Router::requestRoute();
|
||||||
$this->assertEquals(array_merge($url, array('plugin' => null)), $route->defaults);
|
$this->assertEquals(array_merge($url, array('plugin' => null)), $route->defaults);
|
||||||
|
|
||||||
// test that an unmatched route does not change the current route
|
// test that an unmatched route does not change the current route
|
||||||
$newUrl = array('controller' => 'products', 'action' => 'display', 6);
|
|
||||||
Router::connect('/actor', $url);
|
Router::connect('/actor', $url);
|
||||||
Router::parse('/government');
|
Router::parse('/government');
|
||||||
$route = Router::requestRoute();
|
$route = Router::requestRoute();
|
||||||
|
|
|
@ -2386,9 +2386,11 @@ class ValidationTest extends CakeTestCase {
|
||||||
public function testUploadError() {
|
public function testUploadError() {
|
||||||
$this->assertTrue(Validation::uploadError(0));
|
$this->assertTrue(Validation::uploadError(0));
|
||||||
$this->assertTrue(Validation::uploadError(array('error' => 0)));
|
$this->assertTrue(Validation::uploadError(array('error' => 0)));
|
||||||
|
$this->assertTrue(Validation::uploadError(array('error' => '0')));
|
||||||
|
|
||||||
$this->assertFalse(Validation::uploadError(2));
|
$this->assertFalse(Validation::uploadError(2));
|
||||||
$this->assertFalse(Validation::uploadError(array('error' => 2)));
|
$this->assertFalse(Validation::uploadError(array('error' => 2)));
|
||||||
|
$this->assertFalse(Validation::uploadError(array('error' => '2')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -201,7 +201,7 @@ HTML;
|
||||||
*/
|
*/
|
||||||
public function coverageHeader($filename, $percent) {
|
public function coverageHeader($filename, $percent) {
|
||||||
$filename = basename($filename);
|
$filename = basename($filename);
|
||||||
list($file, $ext) = explode('.', $filename);
|
list($file) = explode('.', $filename);
|
||||||
$display = in_array($file, $this->_testNames) ? 'block' : 'none';
|
$display = in_array($file, $this->_testNames) ? 'block' : 'none';
|
||||||
$primary = $display === 'block' ? 'primary' : '';
|
$primary = $display === 'block' ? 'primary' : '';
|
||||||
return <<<HTML
|
return <<<HTML
|
||||||
|
|
|
@ -150,13 +150,10 @@ class CakeTextReporter extends CakeBaseReporter {
|
||||||
$plugin = $this->params['plugin'];
|
$plugin = $this->params['plugin'];
|
||||||
|
|
||||||
$buffer = "Core Test Cases:\n";
|
$buffer = "Core Test Cases:\n";
|
||||||
$urlExtra = '';
|
|
||||||
if ($app) {
|
if ($app) {
|
||||||
$buffer = "App Test Cases:\n";
|
$buffer = "App Test Cases:\n";
|
||||||
$urlExtra = '&app=true';
|
|
||||||
} elseif ($plugin) {
|
} elseif ($plugin) {
|
||||||
$buffer = Inflector::humanize($plugin) . " Test Cases:\n";
|
$buffer = Inflector::humanize($plugin) . " Test Cases:\n";
|
||||||
$urlExtra = '&plugin=' . $plugin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($testCases) < 1) {
|
if (count($testCases) < 1) {
|
||||||
|
|
|
@ -537,9 +537,8 @@ class Debugger {
|
||||||
$var = $replace + $var;
|
$var = $replace + $var;
|
||||||
|
|
||||||
$out = "array(";
|
$out = "array(";
|
||||||
$n = $break = $end = null;
|
$break = $end = null;
|
||||||
if (!empty($var)) {
|
if (!empty($var)) {
|
||||||
$n = "\n";
|
|
||||||
$break = "\n" . str_repeat("\t", $indent);
|
$break = "\n" . str_repeat("\t", $indent);
|
||||||
$end = "\n" . str_repeat("\t", $indent - 1);
|
$end = "\n" . str_repeat("\t", $indent - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -558,7 +558,7 @@ class File {
|
||||||
if (!$finfo) {
|
if (!$finfo) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
list($type, $charset) = explode(';', $finfo);
|
list($type) = explode(';', $finfo);
|
||||||
return $type;
|
return $type;
|
||||||
}
|
}
|
||||||
if (function_exists('mime_content_type')) {
|
if (function_exists('mime_content_type')) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Security {
|
||||||
* you ensuring that each hashed password will have a *unique* salt.
|
* you ensuring that each hashed password will have a *unique* salt.
|
||||||
* - Comparing Hashes: Simply pass the originally hashed password as the salt.
|
* - Comparing Hashes: Simply pass the originally hashed password as the salt.
|
||||||
* The salt is prepended to the hash and php handles the parsing automagically.
|
* The salt is prepended to the hash and php handles the parsing automagically.
|
||||||
* For convenience the BlowfishAuthenticate adapter is available for use with
|
* For convenience the `BlowfishPasswordHasher` class is available for use with
|
||||||
* the AuthComponent.
|
* the AuthComponent.
|
||||||
* - Do NOT use a constant salt for blowfish!
|
* - Do NOT use a constant salt for blowfish!
|
||||||
*
|
*
|
||||||
|
|
|
@ -979,7 +979,7 @@ class Validation {
|
||||||
$check = $check['error'];
|
$check = $check['error'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $check === UPLOAD_ERR_OK;
|
return (int)$check === UPLOAD_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue