mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Merge branch '1.3-bake' of dev@code.cakephp.org:cakephp into 1.3-bake
This commit is contained in:
commit
77f371d1e1
5 changed files with 37 additions and 10 deletions
|
@ -80,11 +80,7 @@ class ControllerTask extends Shell {
|
|||
}
|
||||
|
||||
$controller = Inflector::camelize($this->args[0]);
|
||||
$actions = null;
|
||||
if (!isset($this->args[1])) {
|
||||
$actions = 'scaffold';
|
||||
}
|
||||
|
||||
$actions = 'scaffold';
|
||||
|
||||
if (!empty($this->args[1]) && ($this->args[1] == 'public' || $this->args[1] == 'scaffold')) {
|
||||
$this->out(__('Baking basic crud methods for ', true) . $controller);
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
* @since CakePHP(tm) v 1.2
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
App::import('Model', 'ConnectionManager');
|
||||
|
||||
/**
|
||||
* Task class for creating and updating model files.
|
||||
*
|
||||
|
@ -82,7 +80,7 @@ class ModelTask extends Shell {
|
|||
* @return void
|
||||
**/
|
||||
function startup() {
|
||||
App::import('Core', 'Model');
|
||||
App::import('Core', 'Model', false, App::core('models'));
|
||||
parent::startup();
|
||||
}
|
||||
|
||||
|
@ -405,7 +403,7 @@ class ModelTask extends Shell {
|
|||
} elseif ($metaData['type'] == 'integer') {
|
||||
$guess = $methods['numeric'];
|
||||
} elseif ($metaData['type'] == 'boolean') {
|
||||
$guess = $methods['numeric'];
|
||||
$guess = $methods['boolean'];
|
||||
} elseif ($metaData['type'] == 'datetime' || $metaData['type'] == 'date') {
|
||||
$guess = $methods['date'];
|
||||
} elseif ($metaData['type'] == 'time') {
|
||||
|
|
|
@ -449,10 +449,11 @@ class Inflector extends Object {
|
|||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/ß/' => 'ss',
|
||||
'/[^\w\s]/' => ' ',
|
||||
'/[^\s\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]/mu' => ' ',
|
||||
'/\\s+/' => $replacement,
|
||||
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
|
||||
);
|
||||
|
||||
$map = array_merge($default, $map);
|
||||
return preg_replace(array_keys($map), array_values($map), $string);
|
||||
}
|
||||
|
|
|
@ -208,6 +208,18 @@ class InflectorTest extends CakeTestCase {
|
|||
$result = Inflector::slug('#this melts your face1#2#3', '-');
|
||||
$expected = 'this-melts-your-face1-2-3';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = Inflector::slug('controller/action/りんご/1');
|
||||
$expected = 'controller_action_りんご_1';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = Inflector::slug('の話が出たので大丈夫かなあと');
|
||||
$expected = 'の話が出たので大丈夫かなあと';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = Inflector::slug('posts/view/한국어/page:1/sort:asc');
|
||||
$expected = 'posts_view_한국어_page_1_sort_asc';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -152,6 +152,26 @@ class CacheHelperTest extends CakeTestCase {
|
|||
@unlink($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* test cache parsing with non-latin characters in current route
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testCacheNonLatinCharactersInRoute() {
|
||||
$this->Controller->cache_parsing();
|
||||
$this->Controller->cacheAction = 21600;
|
||||
$this->Controller->here = '/posts/view/風街ろまん';
|
||||
$this->Controller->action = 'view';
|
||||
|
||||
$View = new View($this->Controller);
|
||||
$result = $View->render('index');
|
||||
|
||||
$filename = CACHE . 'views' . DS . 'posts_view_風街ろまん.php';
|
||||
$this->assertTrue(file_exists($filename));
|
||||
|
||||
@unlink($filename);
|
||||
}
|
||||
/**
|
||||
* Test cache parsing with cake:nocache tags in view file.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue