From 31cd461d223a333f28f992a5c0bbbad02ac48e4a Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 22 Feb 2009 04:09:39 +0000 Subject: [PATCH] Correcting singluarizing of taxes, faxes, waxes, and pluralization of crisis in Inflector. Tests added. Fixes #6130, #6131 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8052 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/inflector.php | 3 ++- cake/tests/cases/libs/inflector.test.php | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index 6e1d97480..3dc5b2fc5 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -167,7 +167,7 @@ class Inflector extends Object { '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i', '/us$/' => 'uses', '/(alias)$/i' => '\1es', - '/(ax|cri|test)is$/i' => '\1es', + '/(ax|cris|test)is$/i' => '\1es', '/s$/' => 's', '/^$/' => '', '/$/' => 's'); @@ -282,6 +282,7 @@ class Inflector extends Object { '/^(ox)en/i' => '\1', '/(alias)(es)*$/i' => '\1', '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us', + '/([ftw]ax)es/' => '\1', '/(cris|ax|test)es$/i' => '\1is', '/(shoe)s$/i' => '\1', '/(o)es$/i' => '\1', diff --git a/cake/tests/cases/libs/inflector.test.php b/cake/tests/cases/libs/inflector.test.php index 9480321d1..e3f1b5710 100644 --- a/cake/tests/cases/libs/inflector.test.php +++ b/cake/tests/cases/libs/inflector.test.php @@ -101,6 +101,10 @@ class InflectorTest extends CakeTestCase { $this->assertEqual(Inflector::singularize('knives'), 'knife'); $this->assertEqual(Inflector::singularize('wolves'), 'wolf'); $this->assertEqual(Inflector::singularize('shelves'), 'shelf'); + $this->assertEqual(Inflector::singularize('taxis'), 'taxi'); + $this->assertEqual(Inflector::singularize('taxes'), 'tax'); + $this->assertEqual(Inflector::singularize('faxes'), 'fax'); + $this->assertEqual(Inflector::singularize('waxes'), 'wax'); $this->assertEqual(Inflector::singularize(''), ''); } /** @@ -143,6 +147,7 @@ class InflectorTest extends CakeTestCase { $this->assertEqual(Inflector::pluralize('person'), 'people'); $this->assertEqual(Inflector::pluralize('people'), 'people'); $this->assertEqual(Inflector::pluralize('glove'), 'gloves'); + $this->assertEqual(Inflector::pluralize('crisis'), 'crises'); $this->assertEqual(Inflector::pluralize(''), ''); } /**