mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #1412 from wernerhp/master
Inflector pluralize and singularize update
This commit is contained in:
commit
1ecc921e13
2 changed files with 25 additions and 4 deletions
|
@ -109,6 +109,14 @@ class InflectorTest extends CakeTestCase {
|
|||
$this->assertEquals(Inflector::singularize('foes'), 'foe');
|
||||
$this->assertEquals(Inflector::singularize('databases'), 'database');
|
||||
$this->assertEquals(Inflector::singularize('cookies'), 'cookie');
|
||||
$this->assertEquals(Inflector::singularize('thieves'), 'thief');
|
||||
$this->assertEquals(Inflector::singularize('potatoes'), 'potato');
|
||||
$this->assertEquals(Inflector::singularize('heroes'), 'hero');
|
||||
$this->assertEquals(Inflector::singularize('buffalos'), 'buffalo');
|
||||
$this->assertEquals(Inflector::singularize('babies'), 'baby');
|
||||
$this->assertEquals(Inflector::singularize('teeth'), 'tooth');
|
||||
$this->assertEquals(Inflector::singularize('geese'), 'goose');
|
||||
$this->assertEquals(Inflector::singularize('feet'), 'foot');
|
||||
|
||||
$this->assertEquals(Inflector::singularize(''), '');
|
||||
}
|
||||
|
@ -161,6 +169,14 @@ class InflectorTest extends CakeTestCase {
|
|||
$this->assertEquals(Inflector::pluralize('roof'), 'roofs');
|
||||
$this->assertEquals(Inflector::pluralize('foe'), 'foes');
|
||||
$this->assertEquals(Inflector::pluralize('cookie'), 'cookies');
|
||||
$this->assertEquals(Inflector::pluralize('wolf'), 'wolves');
|
||||
$this->assertEquals(Inflector::pluralize('thief'), 'thieves');
|
||||
$this->assertEquals(Inflector::pluralize('potato'), 'potatoes');
|
||||
$this->assertEquals(Inflector::pluralize('hero'), 'heroes');
|
||||
$this->assertEquals(Inflector::pluralize('buffalo'), 'buffalo');
|
||||
$this->assertEquals(Inflector::pluralize('tooth'), 'teeth');
|
||||
$this->assertEquals(Inflector::pluralize('goose'), 'geese');
|
||||
$this->assertEquals(Inflector::pluralize('foot'), 'feet');
|
||||
$this->assertEquals(Inflector::pluralize(''), '');
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class Inflector {
|
|||
'/(x|ch|ss|sh)$/i' => '\1es',
|
||||
'/([^aeiouy]|qu)y$/i' => '\1ies',
|
||||
'/(hive)$/i' => '\1s',
|
||||
'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
|
||||
'/(?:([^f])fe|([lre])f)$/i' => '\1\2ves',
|
||||
'/sis$/i' => 'ses',
|
||||
'/([ti])um$/i' => '\1a',
|
||||
'/(p)erson$/i' => '\1eople',
|
||||
|
@ -90,7 +90,12 @@ class Inflector {
|
|||
'soliloquy' => 'soliloquies',
|
||||
'testis' => 'testes',
|
||||
'trilby' => 'trilbys',
|
||||
'turf' => 'turfs'
|
||||
'turf' => 'turfs',
|
||||
'potato' => 'potatoes',
|
||||
'hero' => 'heroes',
|
||||
'tooth' => 'teeth',
|
||||
'goose' => 'geese',
|
||||
'foot' => 'feet'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -120,11 +125,11 @@ class Inflector {
|
|||
'/(m)ovies$/i' => '\1\2ovie',
|
||||
'/(s)eries$/i' => '\1\2eries',
|
||||
'/([^aeiouy]|qu)ies$/i' => '\1y',
|
||||
'/([lr])ves$/i' => '\1f',
|
||||
'/([lre])ves$/i' => '\1f',
|
||||
'/([^fo])ves$/i' => '\1fe',
|
||||
'/(tive)s$/i' => '\1',
|
||||
'/(hive)s$/i' => '\1',
|
||||
'/(drive)s$/i' => '\1',
|
||||
'/([^fo])ves$/i' => '\1fe',
|
||||
'/(^analy)ses$/i' => '\1sis',
|
||||
'/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
|
||||
'/([ti])a$/i' => '\1um',
|
||||
|
|
Loading…
Reference in a new issue