public function InflectorTest::testRulesClearsCaches in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php \Doctrine\Tests\Common\Inflector\InflectorTest::testRulesClearsCaches()
test that setting new rules clears the inflector caches.
Return value
void
File
- vendor/
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.');
}