extensions_to_ignore) . ')$/'; $this->badstrings = array(); $this->badstrings['DONOT' . 'COMMIT'] = 'DONOT' . 'COMMIT'; // If we put the literal string here, it fails the test! $this->badstrings['trailing whitespace'] = "[\t ][\r\n]"; foreach ($this->badstrings as $description => $ignored) { $this->allok[$description] = true; } recurseFolders($CFG->dirroot, array($this, 'search_file_for_dnc'), $regexp, true); foreach ($this->badstrings as $description => $ignored) { if ($this->allok[$description]) { $this->pass("No files contain $description."); } } } function search_file_for_dnc($filepath) { $content = file_get_contents($filepath); foreach ($this->badstrings as $description => $badstring) { $pass = (stripos($content, $badstring) === false); if (!$pass) { $this->fail("File $filepath contains $description."); $this->allok[$description] = false; } } } }