MDL-81581 phpunit: Create the normalise_line_endings() method

And apply it to all the obvious places related with the issue.

Note that surely there are way more in code base, but it's
out of scope for this issue.
This commit is contained in:
Eloy Lafuente (stronk7)
2024-04-25 18:52:25 +02:00
parent 894ee17f53
commit c9d48f6f25
4 changed files with 18 additions and 4 deletions
+10
View File
@@ -990,6 +990,16 @@ class phpunit_util extends testing_util {
return str_repeat(" ", $level * 2) . "{$string}\n";
}
/**
* Normalise any text to always use unix line endings (line-feeds).
*
* @param string $text The text to normalize
* @return string
*/
public static function normalise_line_endings(string $text): string {
return str_replace(["\r\n", "\r"], "\n", $text);
}
/**
* Get the coverage config for the supplied includelist and excludelist configuration.
*