mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +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
|
'/(c)hild$/i' => '\1hildren', # child
|
||||||
'/(buffal|tomat)o$/i' => '\1\2oes', # buffalo, tomato
|
'/(buffal|tomat)o$/i' => '\1\2oes', # buffalo, tomato
|
||||||
'/us$/' => 'uses', # us
|
'/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
|
'/(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
|
'/(ax|cri|test)is$/i' => '\1es', # axis, crisis
|
||||||
'/s$/' => 's', # no change (compatibility)
|
'/s$/' => 's', # no change (compatibility)
|
||||||
|
@ -209,7 +209,7 @@ class Inflector extends Object {
|
||||||
'/(matr)ices$/i' => '\1ix',
|
'/(matr)ices$/i' => '\1ix',
|
||||||
'/(vert|ind)ices$/i' => '\1ex',
|
'/(vert|ind)ices$/i' => '\1ex',
|
||||||
'/^(ox)en/i' => '\1',
|
'/^(ox)en/i' => '\1',
|
||||||
'/(alias)es$/i' => '\1',
|
'/(alias)(es)*$/i' => '\1',
|
||||||
'/([octop|vir])i$/i' => '\1us',
|
'/([octop|vir])i$/i' => '\1us',
|
||||||
'/(cris|ax|test)es$/i' => '\1is',
|
'/(cris|ax|test)es$/i' => '\1is',
|
||||||
'/(shoe)s$/i' => '\1',
|
'/(shoe)s$/i' => '\1',
|
||||||
|
|
|
@ -80,6 +80,14 @@ class InflectorTest extends UnitTestCase {
|
||||||
$result = $this->inflector->singularize('indices');
|
$result = $this->inflector->singularize('indices');
|
||||||
$expected = 'index';
|
$expected = 'index';
|
||||||
$this->assertEqual($result, $expected);
|
$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() {
|
function testInflectingPlurals() {
|
||||||
|
@ -122,6 +130,14 @@ class InflectorTest extends UnitTestCase {
|
||||||
$result = $this->inflector->pluralize('index');
|
$result = $this->inflector->pluralize('index');
|
||||||
$expected = 'indices';
|
$expected = 'indices';
|
||||||
$this->assertEqual($result, $expected);
|
$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() {
|
function tearDown() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue