MDL-40877 core_text: Added UTF-8 safe strrchr method

This commit is contained in:
Frederic Massart
2013-08-16 14:17:04 +08:00
parent 661777c503
commit a0b3ed79e3
2 changed files with 41 additions and 0 deletions
+11
View File
@@ -379,6 +379,17 @@ class core_textlib_testcase extends advanced_testcase {
$this->assertSame($textlib->specialtoascii('ábc'), 'abc');
$this->assertSame($textlib->strtotitle('abc ABC'), 'Abc Abc');
}
/**
* Test strrchr.
*/
public function test_strrchr() {
$str = "Žluťoučký koníček";
$this->assertSame('koníček', textlib::strrchr($str, 'koní'));
$this->assertSame('Žluťoučký ', textlib::strrchr($str, 'koní', true));
$this->assertFalse(textlib::strrchr($str, 'A'));
$this->assertFalse(textlib::strrchr($str, 'ç', true));
}
}