Adding test for Ticket #2333.

Added fix for Ticket #2333

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4744 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-04-03 03:03:42 +00:00
parent 8cead38c69
commit a46e1caa9e
2 changed files with 42 additions and 1 deletions

View file

@ -77,7 +77,7 @@ class Inflector extends Object {
'/(quiz)$/i' => '\1zes',
'/^(ox)$/i' => '\1\2en', # ox
'/([m|l])ouse$/i' => '\1ice', # mouse, louse
'/(matr|vert|ind)ix|ex$/i' => '\1ices', # matrix, vertex, index
'/(matr|vert|ind)(ix|ex)$/i' => '\1ices', # matrix, vertex, index
'/(x|ch|ss|sh)$/i' => '\1es', # search, switch, fix, box, process, address
'/([^aeiouy]|qu)y$/i' => '\1ies', # query, ability, agency
'/(hive)$/i' => '\1s', # archive, hive

View file

@ -48,6 +48,31 @@ class InflectorTest extends UnitTestCase {
$result = $this->inflector->singularize('quizzes');
$expected = 'quiz';
$this->assertEqual($result, $expected);
$result = $this->inflector->singularize('Buses');
$expected = 'Bus';
$this->assertEqual($result, $expected);
$result = $this->inflector->singularize('buses');
$expected = 'bus';
$this->assertEqual($result, $expected);
$result = $this->inflector->singularize('matrix_rows');
$expected = 'matrix_row';
$this->assertEqual($result, $expected);
$result = $this->inflector->singularize('matrices');
$expected = 'matrix';
$this->assertEqual($result, $expected);
$result = $this->inflector->singularize('vertices');
$expected = 'vertex';
$this->assertEqual($result, $expected);
$result = $this->inflector->singularize('indices');
$expected = 'index';
$this->assertEqual($result, $expected);
}
function testInflectingPlurals() {
@ -66,6 +91,22 @@ class InflectorTest extends UnitTestCase {
$result = $this->inflector->pluralize('quiz');
$expected = 'quizzes';
$this->assertEqual($result, $expected);
$result = $this->inflector->pluralize('matrix_row');
$expected = 'matrix_rows';
$this->assertEqual($result, $expected);
$result = $this->inflector->pluralize('matrix');
$expected = 'matrices';
$this->assertEqual($result, $expected);
$result = $this->inflector->pluralize('vertex');
$expected = 'vertices';
$this->assertEqual($result, $expected);
$result = $this->inflector->pluralize('index');
$expected = 'indices';
$this->assertEqual($result, $expected);
}
function tearDown() {