diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index c40ff5eed..65045f3c9 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -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', diff --git a/cake/tests/cases/libs/inflector.test.php b/cake/tests/cases/libs/inflector.test.php index 1057f0e59..940b7a744 100644 --- a/cake/tests/cases/libs/inflector.test.php +++ b/cake/tests/cases/libs/inflector.test.php @@ -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() {