mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
8cead38c69
commit
a46e1caa9e
2 changed files with 42 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue