diff --git a/extra/index.php b/extra/index.php new file mode 100644 index 00000000..d1c974a8 --- /dev/null +++ b/extra/index.php @@ -0,0 +1,503 @@ +status = ''; + $output->failures = array(); + $output->testcount = 0; + $output->totaltests = 0; + + $thisrun = 0; + foreach ($content as $item) { + if ($item->event == 'suiteStart') { + if ($item->suite == '') { + $output->totaltests += $item->tests; + } else { + $thisrun = $item->tests; + } + } else if ($item->event == 'test') { + if ($item->status == 'pass') { + $output->status .= '.'; + $output->testcount++; + $thisrun--; + } else { + $output->status .= 'F'; + $output->failures = $item; + $output->testcount += $thisrun; + } + } + } + echo json_encode($output); + die; + } + + public static function get_instances() { + + static $instances = null; + + if ($instances !== null) { + return $instances; + } + + // Assume that we are in the mdk extras directory. + $path = dirname(getcwd()); + $dirs = scandir($path); + + // Instances have three types: + $instances = array( + FEATURE => array(), + INTEGRATION => array(), + STABLE => array(), + ); + + foreach ($dirs as $dir) { + $name = $dir; + $fulldir = $path . DIRECTORY_SEPARATOR . $dir; + if ($dir == '.' || $dir == '..' || !is_dir($fulldir)) { + continue; + } + if (!file_exists($fulldir . "/lib/moodlelib.php")) { + continue; + } + + $type = 'stable'; + + if (preg_match('/^s.*/', $name)) { + $type = STABLE; + } else if (preg_match('/^i.*/', $name)) { + $type = INTEGRATION; + } else { + $type = FEATURE; + } + + $instances[$type][$fulldir] = $name; + } + + return $instances; + } +} +?> + + + + + + + Moodle SDK Web Interface + + + + + + + + + + + + + + + + + + +
+ +
+ +
Detected MDK Instances
+ + + + + + + + + + + + + $instancelist) { + switch ($instancetype) { + case FEATURE: + $type = 'Feature'; + break; + case INTEGRATION: + $type = 'Integration'; + break; + case STABLE: + default: + $type = 'Stable'; + break; + } + foreach ($instancelist as $instance => $name) { +echo << + + + +EOF; + } +} + +?> + + + +
InstanceTypeMDK ExtraPHPUnitBehat
+ + + + + {$type} + + + +EOF; +echo << + +EOF; +echo << + + + + +EOF; +echo << + +EOF; +echo << + + + +EOF; +echo << +
+
+
+ + + + + + + + + + + + + + + diff --git a/mdk/phpunit.py b/mdk/phpunit.py index 1f5628e4..c099e03a 100644 --- a/mdk/phpunit.py +++ b/mdk/phpunit.py @@ -62,6 +62,14 @@ def getCommand(self, testcase=None, unittest=None, filter=None, coverage=None, t cmd.append('--testsuite') cmd.append(testsuite) + outputDir = self._Wp.getExtraDir(self._M.get('identifier'), 'phpunit') + cmd.append('--log-json') + cmd.append('%s/status.json' % outputDir) + cmd.append('--log-tap') + cmd.append('%s/status.tap' % outputDir) + cmd.append('--log-junit') + cmd.append('%s/status.xml' % outputDir) + return cmd def getCoverageDir(self):