Merge branch 'MDL-44111_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Damyon Wiese 2014-02-24 15:39:32 +08:00
commit 8c3966773b

View File

@ -358,7 +358,7 @@ class behat_hooks extends behat_base {
* This is used for content such as the DOM, and screenshots.
*
* @param StepEvent $event
* @param String $filetype The file suffix to use.
* @param String $filetype The file suffix to use. Limited to 4 chars.
*/
protected function get_faildump_filename(StepEvent $event, $filetype) {
global $CFG;
@ -381,7 +381,11 @@ class behat_hooks extends behat_base {
// The scenario title + the failed step text.
// We want a i-am-the-scenario-title_i-am-the-failed-step.$filetype format.
$filename = $event->getStep()->getParent()->getTitle() . '_' . $event->getStep()->getText();
$filename = preg_replace('/([^a-zA-Z0-9\_]+)/', '-', $filename) . '.' . $filetype;
$filename = preg_replace('/([^a-zA-Z0-9\_]+)/', '-', $filename);
// File name limited to 256 characters. Leaving 4 chars for the file
// extension as we allow .png for images and .html for DOM contents.
$filename = substr($filename, 0, 251) . '.' . $filetype;
return array($dir, $filename);
}