Adding inflection rule for empty string. Fixes #5325. Tests added.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7509 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-08-26 18:30:54 +00:00
parent fc012dc32f
commit 6086e96a61
2 changed files with 3 additions and 2 deletions

View file

@ -97,6 +97,7 @@ class Inflector extends Object {
'/(alias)$/i' => '\1es',
'/(ax|cri|test)is$/i' => '\1es',
'/s$/' => 's',
'/^$/' => '',
'/$/' => 's');
$coreUninflectedPlural = array(
@ -164,7 +165,6 @@ class Inflector extends Object {
* @static
*/
function pluralize($word) {
$_this =& Inflector::getInstance();
if (!isset($_this->pluralRules) || empty($_this->pluralRules)) {
$_this->__initPluralRules();

View file

@ -104,6 +104,7 @@ 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(''), '');
}
/**
* testInflectingPlurals method
@ -145,7 +146,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(''), '');
}
/**
* testInflectorSlug method