public function InflectorTest::testRulesClearsCaches in Plug 7
test that setting new rules clears the inflector caches.
Return value
void
File
- lib/
doctrine/ inflector/ tests/ Doctrine/ Tests/ Common/ Inflector/ InflectorTest.php, line 157
Class
Namespace
Doctrine\Tests\Common\InflectorCode
public function testRulesClearsCaches() {
Inflector::reset();
$this
->assertEquals(Inflector::singularize('Bananas'), 'Banana');
$this
->assertEquals(Inflector::pluralize('Banana'), 'Bananas');
Inflector::rules('singular', array(
'rules' => array(
'/(.*)nas$/i' => '\\1zzz',
),
));
$this
->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.');
Inflector::rules('plural', array(
'rules' => array(
'/(.*)na$/i' => '\\1zzz',
),
'irregular' => array(
'corpus' => 'corpora',
),
));
$this
->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.');
$this
->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.');
}