Skip to content

Commit

Permalink
MDL-67169 phpunit: fix clear flaw in unit test provider
Browse files Browse the repository at this point in the history
Basically the provider is ignoring the CRLF to LF normalization
results and loading the original file again.

This doesn't have any impact normally, because all moodle
files are LF ones and people using other systems have their
git configurations set to work that way (not modify or force LF).

But there may be checkouts out there (for example travis) where
the git configuration by defult is to convert to the OS, causing
windows runs to fail badly there. See the issue for more info
and links.
  • Loading branch information
stronk7 committed Nov 7, 2019
1 parent 01aa126 commit a5cd14e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tests/messageinbound_test.php
Expand Up @@ -111,7 +111,7 @@ protected function read_test_file(\SplFileInfo $file, $fixturesdir) {
// Break on the --[TOKEN]-- tags in the file.
$content = file_get_contents($file->getRealPath());
$content = preg_replace("#\r\n#", "\n", $content);
$tokens = preg_split('#(?:^|\n*)----([A-Z]+)----\n#', file_get_contents($file->getRealPath()),
$tokens = preg_split('#(?:^|\n*)----([A-Z]+)----\n#', $content,
null, PREG_SPLIT_DELIM_CAPTURE);
$sections = array(
// Key => Required.
Expand Down

0 comments on commit a5cd14e

Please sign in to comment.