Skip to content

Commit

Permalink
Merge branch '1.3' into 1.3-bake
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 30, 2009
2 parents f6d6272 + aab4dc2 commit 6322375
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cake/libs/inflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,11 @@ function slug($string, $replacement = '_', $map = array()) {
'/Ü/' => '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);
}
Expand Down
12 changes: 12 additions & 0 deletions cake/tests/cases/libs/inflector.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,18 @@ function testInflectorSlug() {
$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);
}

/**
Expand Down
20 changes: 20 additions & 0 deletions cake/tests/cases/libs/view/helpers/cache.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,26 @@ function testLayoutCacheParsingNoTagsInView() {
@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.
*
Expand Down

0 comments on commit 6322375

Please sign in to comment.