public function InflectorTest::testCustomRuleWithReset 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::testCustomRuleWithReset()
Test resetting inflection rules.
Return value
void
File
- vendor/
doctrine/ inflector/ tests/ Doctrine/ Tests/ Common/ Inflector/ InflectorTest.php, line 184
Class
Namespace
Doctrine\Tests\Common\InflectorCode
public function testCustomRuleWithReset() {
Inflector::reset();
$uninflected = array(
'atlas',
'lapis',
'onibus',
'pires',
'virus',
'.*x',
);
$pluralIrregular = array(
'as' => 'ases',
);
Inflector::rules('singular', array(
'rules' => array(
'/^(.*)(a|e|o|u)is$/i' => '\\1\\2l',
),
'uninflected' => $uninflected,
), true);
Inflector::rules('plural', array(
'rules' => array(
'/^(.*)(a|e|o|u)l$/i' => '\\1\\2is',
),
'uninflected' => $uninflected,
'irregular' => $pluralIrregular,
), true);
$this
->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois');
$this
->assertEquals(Inflector::pluralize('Atlas'), 'Atlas');
$this
->assertEquals(Inflector::singularize('Alcoois'), 'Alcool');
$this
->assertEquals(Inflector::singularize('Atlas'), 'Atlas');
}