mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding tests for Inflector::rules() clearing cached values. Fixes #609
This commit is contained in:
parent
bb0ff192f7
commit
1d3b653e57
1 changed files with 21 additions and 0 deletions
|
@ -400,6 +400,27 @@ class InflectorTest extends CakeTestCase {
|
||||||
$this->assertEqual(Inflector::slug('Testing æ ø å', '-', array('/ø/' => 'oe')), 'Testing-ae-oe-aa');
|
$this->assertEqual(Inflector::slug('Testing æ ø å', '-', array('/ø/' => 'oe')), 'Testing-ae-oe-aa');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that setting new rules clears the inflector caches.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testRulesClearsCaches() {
|
||||||
|
$this->assertEqual(Inflector::singularize('Bananas'), 'Banana');
|
||||||
|
$this->assertEqual(Inflector::tableize('Banana'), 'bananas');
|
||||||
|
$this->assertEqual(Inflector::pluralize('Banana'), 'Bananas');
|
||||||
|
|
||||||
|
Inflector::rules('singular', array(
|
||||||
|
'rules' => array('/(.*)nas$/i' => '\1zzz')
|
||||||
|
));
|
||||||
|
$this->assertEqual(Inflector::singularize('Bananas'), 'Banazzz', 'Was inflected with old rules. %s');
|
||||||
|
|
||||||
|
Inflector::rules('plural', array(
|
||||||
|
'rules' => array('/(.*)na$/i' => '\1zzz')
|
||||||
|
));
|
||||||
|
$this->assertEqual(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules. %s');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test resetting inflection rules.
|
* Test resetting inflection rules.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue