mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding test for #2550.
Added fix for #2550, fixes incorrect inflection of Alias git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5044 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
2fa0bd866c
commit
6837a51f50
2 changed files with 18 additions and 2 deletions
|
@ -90,7 +90,7 @@ class Inflector extends Object {
|
|||
'/(c)hild$/i' => '\1hildren', # child
|
||||
'/(buffal|tomat)o$/i' => '\1\2oes', # buffalo, tomato
|
||||
'/us$/' => 'uses', # us
|
||||
'/(alias)/i' => '\1es', # alias
|
||||
'/(alias)$/i' => '\1es', # alias
|
||||
'/(octop|vir)us$/i' => '\1i', # octopus, virus - virus has no defined plural (according to Latin/dictionary.com), but viri is better than viruses/viruss
|
||||
'/(ax|cri|test)is$/i' => '\1es', # axis, crisis
|
||||
'/s$/' => 's', # no change (compatibility)
|
||||
|
@ -209,7 +209,7 @@ class Inflector extends Object {
|
|||
'/(matr)ices$/i' => '\1ix',
|
||||
'/(vert|ind)ices$/i' => '\1ex',
|
||||
'/^(ox)en/i' => '\1',
|
||||
'/(alias)es$/i' => '\1',
|
||||
'/(alias)(es)*$/i' => '\1',
|
||||
'/([octop|vir])i$/i' => '\1us',
|
||||
'/(cris|ax|test)es$/i' => '\1is',
|
||||
'/(shoe)s$/i' => '\1',
|
||||
|
|
|
@ -80,6 +80,14 @@ class InflectorTest extends UnitTestCase {
|
|||
$result = $this->inflector->singularize('indices');
|
||||
$expected = 'index';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->inflector->singularize('Aliases');
|
||||
$expected = 'Alias';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->inflector->singularize('Alias');
|
||||
$expected = 'Alias';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testInflectingPlurals() {
|
||||
|
@ -122,6 +130,14 @@ class InflectorTest extends UnitTestCase {
|
|||
$result = $this->inflector->pluralize('index');
|
||||
$expected = 'indices';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->inflector->pluralize('Alias');
|
||||
$expected = 'Aliases';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->inflector->pluralize('Aliases');
|
||||
$expected = 'Aliases';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
|
Loading…
Add table
Reference in a new issue