public function InflectorTest::testCustomPluralRule in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php \Doctrine\Tests\Common\Inflector\InflectorTest::testCustomPluralRule()
testCustomPluralRule method
Return value
void
File
- vendor/
doctrine/ inflector/ tests/ Doctrine/ Tests/ Common/ Inflector/ InflectorTest.php, line 103
Class
Namespace
Doctrine\Tests\Common\InflectorCode
public function testCustomPluralRule() {
Inflector::reset();
Inflector::rules('plural', array(
'/^(custom)$/i' => '\\1izables',
));
$this
->assertEquals(Inflector::pluralize('custom'), 'customizables');
Inflector::rules('plural', array(
'uninflected' => array(
'uninflectable',
),
));
$this
->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable');
Inflector::rules('plural', array(
'rules' => array(
'/^(alert)$/i' => '\\1ables',
),
'uninflected' => array(
'noflect',
'abtuse',
),
'irregular' => array(
'amaze' => 'amazable',
'phone' => 'phonezes',
),
));
$this
->assertEquals(Inflector::pluralize('noflect'), 'noflect');
$this
->assertEquals(Inflector::pluralize('abtuse'), 'abtuse');
$this
->assertEquals(Inflector::pluralize('alert'), 'alertables');
$this
->assertEquals(Inflector::pluralize('amaze'), 'amazable');
$this
->assertEquals(Inflector::pluralize('phone'), 'phonezes');
}