public function InflectorTest::testCustomRuleWithReset in Plug 7
Test resetting inflection rules.
Return value
void
File
- lib/
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');
}