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
This commit is contained in:
mark_story 2009-02-22 04:09:39 +00:00
parent 5dfa7bf46f
commit 31cd461d22
2 changed files with 7 additions and 1 deletions

View file

@ -167,7 +167,7 @@ class Inflector extends Object {
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i', '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
'/us$/' => 'uses', '/us$/' => 'uses',
'/(alias)$/i' => '\1es', '/(alias)$/i' => '\1es',
'/(ax|cri|test)is$/i' => '\1es', '/(ax|cris|test)is$/i' => '\1es',
'/s$/' => 's', '/s$/' => 's',
'/^$/' => '', '/^$/' => '',
'/$/' => 's'); '/$/' => 's');
@ -282,6 +282,7 @@ class Inflector extends Object {
'/^(ox)en/i' => '\1', '/^(ox)en/i' => '\1',
'/(alias)(es)*$/i' => '\1', '/(alias)(es)*$/i' => '\1',
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us', '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
'/([ftw]ax)es/' => '\1',
'/(cris|ax|test)es$/i' => '\1is', '/(cris|ax|test)es$/i' => '\1is',
'/(shoe)s$/i' => '\1', '/(shoe)s$/i' => '\1',
'/(o)es$/i' => '\1', '/(o)es$/i' => '\1',

View file

@ -101,6 +101,10 @@ class InflectorTest extends CakeTestCase {
$this->assertEqual(Inflector::singularize('knives'), 'knife'); $this->assertEqual(Inflector::singularize('knives'), 'knife');
$this->assertEqual(Inflector::singularize('wolves'), 'wolf'); $this->assertEqual(Inflector::singularize('wolves'), 'wolf');
$this->assertEqual(Inflector::singularize('shelves'), 'shelf'); $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(''), ''); $this->assertEqual(Inflector::singularize(''), '');
} }
/** /**
@ -143,6 +147,7 @@ class InflectorTest extends CakeTestCase {
$this->assertEqual(Inflector::pluralize('person'), 'people'); $this->assertEqual(Inflector::pluralize('person'), 'people');
$this->assertEqual(Inflector::pluralize('people'), 'people'); $this->assertEqual(Inflector::pluralize('people'), 'people');
$this->assertEqual(Inflector::pluralize('glove'), 'gloves'); $this->assertEqual(Inflector::pluralize('glove'), 'gloves');
$this->assertEqual(Inflector::pluralize('crisis'), 'crises');
$this->assertEqual(Inflector::pluralize(''), ''); $this->assertEqual(Inflector::pluralize(''), '');
} }
/** /**