mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding tests for Inflector::slug with non-latin characters & removing redundant element in preg_replace map.
This commit is contained in:
parent
659c1a65bc
commit
54d1577276
2 changed files with 9 additions and 1 deletions
|
@ -447,7 +447,7 @@ class Inflector extends Object {
|
|||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/ß/' => 'ss',
|
||||
'/[^\w\s\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]/mu' => ' ',
|
||||
'/[^\s\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]/mu' => ' ',
|
||||
'/\\s+/' => $replacement,
|
||||
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
|
||||
);
|
||||
|
|
|
@ -204,6 +204,14 @@ class InflectorTest extends CakeTestCase {
|
|||
$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);
|
||||
}
|
||||
/**
|
||||
* testInflectorSlugWithMap method
|
||||
|
|
Loading…
Add table
Reference in a new issue