Implemented test generation for crud command.

This commit is contained in:
qiang.xue
2009-06-19 20:41:53 +00:00
parent fd36bef5a4
commit 40aa75f791
3 changed files with 43 additions and 23 deletions

View File

@@ -234,29 +234,6 @@ EOD;
return $relationName;
}
/**
* Converts a word to its plural form.
* @param string the word to be pluralized
* @return string the pluralized word
*/
public function pluralize($name)
{
$rules=array(
'/(x|ch|ss|sh|us|as|is|os)$/i' => '\1es',
'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
'/(m)an$/i' => '\1en',
'/(child)$/i' => '\1ren',
'/(r)y$/i' => '\1ies',
'/s$/' => 's',
);
foreach($rules as $rule=>$replacement)
{
if(preg_match($rule,$name))
return preg_replace($rule,$replacement,$name);
}
return $name.'s';
}
/**
* Execute the action.
* @param array command line parameters specific for this command