MDL-42170 tool_behat: simple OR patterns now shown as select boxes
authorSam Hemelryk <sam@moodle.com>
Sun, 6 Oct 2013 21:17:04 +0000 (10:17 +1300)
committerSam Hemelryk <sam@moodle.com>
Sun, 6 Oct 2013 21:17:04 +0000 (10:17 +1300)
admin/tool/behat/renderer.php

index 0f5ac5e..324241b 100644 (file)
@@ -105,6 +105,15 @@ class tool_behat_renderer extends plugin_renderer_base {
                 $stepsdefinitions
             );
 
+            // Replace simple OR options.
+            $regex = '#\(\?P<[^>]+>([^\)|]+\|[^\)]+)\)#';
+            $stepsdefinitions = preg_replace_callback($regex,
+                function($matches){
+                    return html_writer::select(explode('|', $matches[1]), uniqid());
+                },
+                $stepsdefinitions
+            );
+
         }
 
         // Steps definitions.