mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
MDL-19270 core_text: added unit tests for strrev
This commit is contained in:
parent
d320391099
commit
1c194014bf
@ -249,6 +249,26 @@ class core_text_testcase extends advanced_testcase {
|
||||
$this->assertSame($str, core_text::strtoupper($str, 'GB18030'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the strrev method.
|
||||
*/
|
||||
public function test_strrev() {
|
||||
$strings = array(
|
||||
"Žluťoučký koníček" => "kečínok ýkčuoťulŽ",
|
||||
'ŽLUŤOUČKÝ KONÍČEK' => "KEČÍNOK ÝKČUOŤULŽ",
|
||||
'言語設定' => '定設語言',
|
||||
'简体中文' => '文中体简',
|
||||
"Der eine stößt den Speer zum Mann" => "nnaM muz reepS ned tßöts enie reD"
|
||||
);
|
||||
foreach ($strings as $before => $after) {
|
||||
// Make sure we can reverse it both ways and that it comes out the same.
|
||||
$this->assertSame($after, core_text::strrev($before));
|
||||
$this->assertSame($before, core_text::strrev($after));
|
||||
// Reverse it twice to be doubly sure.
|
||||
$this->assertSame($after, core_text::strrev(core_text::strrev($after)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the static strpos method.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user