MDL-29029 move all the simpletest bits into new tool unittest

AMOS BEGIN
 MOV [pluginname,report_unittest],[pluginname,tool_unittest]
 MOV [unittest:view,report_unittest],[unittest:execute,tool_unittest]
 MOV [dbtest,core_admin],[dbtest,tool_unittest]
 MOV [addconfigprefix,core_simpletest],[addconfigprefix,tool_unittest]
 MOV [all,core_simpletest],[all,tool_unittest]
 MOV [codecoverageanalysis,core_simpletest],[codecoverageanalysis,tool_unittest]
 MOV [codecoveragecompletereport,core_simpletest],[codecoveragecompletereport,tool_unittest]
 MOV [codecoveragedisabled,core_simpletest],[codecoveragedisabled,tool_unittest]
 MOV [codecoveragelatestdetails,core_simpletest],[codecoveragelatestdetails,tool_unittest]
 MOV [codecoveragelatestreport,core_simpletest],[codecoveragelatestreport,tool_unittest]
 MOV [confignonwritable,core_simpletest],[confignonwritable,tool_unittest]
 MOV [coveredlines,core_simpletest],[coveredlines,tool_unittest]
 MOV [coveredpercentage,core_simpletest],[coveredpercentage,tool_unittest]
 MOV [deletingnoninsertedrecord,core_simpletest],[deletingnoninsertedrecord,tool_unittest]
 MOV [deletingnoninsertedrecords,core_simpletest],[deletingnoninsertedrecords,tool_unittest]
 MOV [droptesttables,core_simpletest],[droptesttables,tool_unittest]
 MOV [exception,core_simpletest],[exception,tool_unittest]
 MOV [executablelines,core_simpletest],[executablelines,tool_unittest]
 MOV [fail,core_simpletest],[fail,tool_unittest]
 MOV [ignorefile,core_simpletest],[ignorefile,tool_unittest]
 MOV [ignorethisfile,core_simpletest],[ignorethisfile,tool_unittest]
 MOV [installtesttables,core_simpletest],[installtesttables,tool_unittest]
 MOV [moodleunittests,core_simpletest],[moodleunittests,tool_unittest]
 MOV [notice,core_simpletest],[notice,tool_unittest]
 MOV [onlytest,core_simpletest],[onlytest,tool_unittest]
 MOV [pass,core_simpletest],[pass,tool_unittest]
 MOV [pathdoesnotexist,core_simpletest],[pathdoesnotexist,tool_unittest]
 MOV [prefix,core_simpletest],[prefix,tool_unittest]
 MOV [prefixnotset,core_simpletest],[prefixnotset,tool_unittest]
 MOV [reinstalltesttables,core_simpletest],[reinstalltesttables,tool_unittest]
 MOV [retest,core_simpletest],[retest,tool_unittest]
 MOV [retestonlythisfile,core_simpletest],[retestonlythisfile,tool_unittest]
 MOV [runall,core_simpletest],[runall,tool_unittest]
 MOV [runat,core_simpletest],[runat,tool_unittest]
 MOV [runonlyfile,core_simpletest],[runonlyfile,tool_unittest]
 MOV [runonlyfolder,core_simpletest],[runonlyfolder,tool_unittest]
 MOV [runtests,core_simpletest],[runtests,tool_unittest]
 MOV [rununittests,core_simpletest],[rununittests,tool_unittest]
 MOV [showpasses,core_simpletest],[showpasses,tool_unittest]
 MOV [showsearch,core_simpletest],[showsearch,tool_unittest]
 MOV [skip,core_simpletest],[skip,tool_unittest]
 MOV [stacktrace,core_simpletest],[stacktrace,tool_unittest]
 MOV [summary,core_simpletest],[summary,tool_unittest]
 MOV [tablesnotsetup,core_simpletest],[tablesnotsetup,tool_unittest]
 MOV [testdboperations,core_simpletest],[testdboperations,tool_unittest]
 MOV [testtablescsvfileunwritable,core_simpletest],[testtablescsvfileunwritable,tool_unittest]
 MOV [testtablesneedupgrade,core_simpletest],[testtablesneedupgrade,tool_unittest]
 MOV [testtablesok,core_simpletest],[testtablesok,tool_unittest]
 MOV [thorough,core_simpletest],[thorough,tool_unittest]
 MOV [timetakes,core_simpletest],[timetakes,tool_unittest]
 MOV [totallines,core_simpletest],[totallines,tool_unittest]
 MOV [uncaughtexception,core_simpletest],[uncaughtexception,tool_unittest]
 MOV [uncoveredlines,core_simpletest],[uncoveredlines,tool_unittest]
 MOV [unittestprefixsetting,core_simpletest],[unittestprefixsetting,tool_unittest]
 MOV [unittests,core_simpletest],[unittests,tool_unittest]
 MOV [updatingnoninsertedrecord,core_simpletest],[updatingnoninsertedrecord,tool_unittest]
 MOV [version,core_simpletest],[version,tool_unittest]
AMOS END
This commit is contained in:
Petr Skoda 2011-09-17 11:51:00 +02:00
parent 187536f6c4
commit b412f9c4c9
25 changed files with 336 additions and 218 deletions

View File

@ -1,38 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
$capabilities = array(
'report/unittest:view' => array(
'riskbitmask' => RISK_DATALOSS,
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:config',
)
);

View File

@ -1,8 +0,0 @@
<?php
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
$ADMIN->add('development', new admin_externalpage('reportsimpletest', get_string('simpletest', 'admin'), "$CFG->wwwroot/$CFG->admin/report/unittest/index.php",'report/unittest:view'));
$ADMIN->add('development', new admin_externalpage('reportdbtest', get_string('dbtest', 'admin'), "$CFG->wwwroot/$CFG->admin/report/unittest/dbtest.php",'report/unittest:view'));
}

View File

@ -1,28 +0,0 @@
<?PHP
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
$plugin->version = 2010090501;
$plugin->requires = 2010090501;

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@ -21,8 +20,8 @@
* Syntax: coveragefile.php/path/to/file/file.html
* coveragefile.php?file=path/to/file/file.html
*
* @package moodlecore
* @subpackage simpletestcoverage
* @package tool
* @subpackage unittest
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -30,12 +29,12 @@
// disable moodle specific debug messages and any errors in output
define('NO_DEBUG_DISPLAY', true);
require_once(dirname(__FILE__) . '/../../../config.php');
require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir . '/filelib.php');
// basic security, require login + require site config cap
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_capability('tool/unittest:execute', get_context_instance(CONTEXT_SYSTEM));
// get file requested
$relativepath = get_file_argument();

View File

@ -0,0 +1,37 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unitest caps.
*
* @package tool
* @subpackage unittest
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$capabilities = array(
// Note: do not add managers here, unittests are dangerous and not intended for production sites!!!
'tool/unittest:execute' => array(
'riskbitmask' => RISK_DATALOSS,
'captype' => 'write', // it writes into database, really!
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
)
)
);

View File

@ -0,0 +1,39 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Post installation and migration code.
*
* @package tool
* @subpackage unittest
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
function xmldb_tool_unittest_install() {
global $CFG;
// this is a hack - this plugin used to live in admin/tool/unittest,
// we want to remove the orphaned version info and capability
// unless there is a new report type with the same name
if (!file_exists("$CFG->dirroot/report/unittest")) {
unset_all_config_for_plugin('report_unittest');
capabilities_cleanup('report_unittest');
}
}

View File

@ -1,14 +1,34 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Run database functional tests.
* @package SimpleTestEx
*
* @package tool
* @subpackage unittest
* @copyright 2008 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once(dirname(__FILE__).'/../../../config.php');
require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/simpletestcoveragelib.php');
require_once('simpletestlib.php');
require_once('simpletestcoveragelib.php');
require_once('ex_simple_test.php');
require_once('ex_reporter.php');
@ -17,7 +37,7 @@ $codecoverage = optional_param('codecoverage', false, PARAM_BOOL);
$selected = optional_param_array('selected', array(), PARAM_INT);
// Print the header and check access.
admin_externalpage_setup('reportdbtest');
admin_externalpage_setup('tooldbtest');
echo $OUTPUT->header();
global $UNITTEST;
@ -108,11 +128,11 @@ echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
echo '<form method="post" action="dbtest.php">';
echo '<div>';
echo $OUTPUT->heading("Run functional database tests"); // TODO: localise
echo '<p>'.html_writer::checkbox('showpasses', 1, $showpasses, get_string('showpasses', 'simpletest')).'</p>';
echo '<p>'.html_writer::checkbox('showpasses', 1, $showpasses, get_string('showpasses', 'tool_unittest')).'</p>';
if (moodle_coverage_recorder::can_run_codecoverage()) {
echo '<p>'.html_writer::checkbox('codecoverage', 1, $codecoverage, get_string('codecoverageanalysis', 'simpletest')).'</p>';
echo '<p>'.html_writer::checkbox('codecoverage', 1, $codecoverage, get_string('codecoverageanalysis', 'tool_unittest')).'</p>';
} else {
echo '<p>'; print_string('codecoveragedisabled', 'simpletest'); echo '<input type="hidden" name="codecoverage" value="0" /></p>';
echo '<p>'; print_string('codecoveragedisabled', 'tool_unittest'); echo '<input type="hidden" name="codecoverage" value="0" /></p>';
}
echo '<p><strong>'."Databases:".'</strong></p>';
echo '<ul>';
@ -134,7 +154,7 @@ $CFG->func_test_db_1 = array("native", "pgsql", "localhost", "moodleuser", "pass
$CFG->func_test_db_2 = array("native", "mssql", "localhost", "moodleuser", "password", "moodle", "test", null);
</pre>
<p>where order of parameters is: dblibrary, dbtype, dbhost, dbuser, dbpass, dbname, prefix, dboptions</p>';
echo '<p><input type="submit" value="' . get_string('runtests', 'simpletest') . '" /></p>';
echo '<p><input type="submit" value="' . get_string('runtests', 'tool_unittest') . '" /></p>';
echo '</div>';
echo '</form>';
echo $OUTPUT->box_end();

View File

@ -1,11 +1,27 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* A SimpleTest report format for Moodle.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package SimpleTestEx
* @package tool
* @subpackage unittest
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
@ -164,7 +180,7 @@ class ExHtmlReporter extends HtmlReporter {
foreach ($stacktrace as $frame) {
if (empty($frame['file']) || (strpos($frame['file'], 'simpletestlib') === false &&
strpos($frame['file'], 'simpletestcoveragelib') === false
&& strpos($frame['file'], 'report/unittest') === false)) {
&& strpos($frame['file'], 'tool/unittest') === false)) {
$filteredstacktrace[] = $frame;
$interestinglines += 1;
$dotsadded = false;
@ -271,6 +287,6 @@ class ExHtmlReporter extends HtmlReporter {
* Look up a lang string in the appropriate file.
*/
function get_string($identifier, $a = NULL) {
return get_string($identifier, 'simpletest', $a);
return get_string($identifier, 'tool_unittest', $a);
}
}

View File

@ -1,12 +1,28 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* A SimpleTest GroupTest that automatically finds all the
* test files in a directory tree according to certain rules.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package SimpleTestEx
* @package tool
* @subpackage unittest
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {

View File

@ -1,18 +1,35 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Run the unit tests.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package SimpleTestEx
* @package tool
* @subpackage unittest
* @copyright &copy; 2006 The Open University
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once(dirname(__FILE__).'/../../../config.php');
require(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/simpletestcoveragelib.php');
require_once('simpletestlib.php');
require_once('simpletestcoveragelib.php');
require_once('ex_simple_test.php');
require_once('ex_reporter.php');
@ -27,7 +44,7 @@ $showpasses = optional_param('showpasses', false, PARAM_BOOL);
$codecoverage = optional_param('codecoverage', false, PARAM_BOOL);
$showsearch = optional_param('showsearch', false, PARAM_BOOL);
admin_externalpage_setup('reportsimpletest', '', array('showpasses'=>$showpasses, 'showsearch'=>$showsearch));
admin_externalpage_setup('toolsimpletest', '', array('showpasses'=>$showpasses, 'showsearch'=>$showsearch));
$unittest = true;
@ -41,7 +58,7 @@ $UNITTEST = new stdClass();
define('TIME_ALLOWED_PER_UNIT_TEST', 60);
// Print the header.
$strtitle = get_string('unittests', 'simpletest');
$strtitle = get_string('unittests', 'tool_unittest');
if (!is_null($path)) {
//trim so user doesn't get an error if they include a space on the end of the path (ie by pasting path)
@ -85,48 +102,68 @@ if (!is_null($path)) {
} else if (is_dir($path)){
$test->findTestFiles($path);
} else {
echo $OUTPUT->box(get_string('pathdoesnotexist', 'simpletest', $path), 'errorbox');
echo $OUTPUT->box(get_string('pathdoesnotexist', 'tool_unittest', $path), 'errorbox');
$ok = false;
}
// If we have something to test, do it.
if ($ok) {
if ($path == $CFG->dirroot) {
$title = get_string('moodleunittests', 'simpletest', get_string('all', 'simpletest'));
$title = get_string('moodleunittests', 'tool_unittest', get_string('all', 'tool_unittest'));
} else {
$title = get_string('moodleunittests', 'simpletest', $displaypath);
$title = get_string('moodleunittests', 'tool_unittest', $displaypath);
}
echo $OUTPUT->heading($title);
$test->run($reporter);
}
$formheader = get_string('retest', 'simpletest');
$formheader = get_string('retest', 'tool_unittest');
} else {
$displaypath = '';
echo $OUTPUT->header();
$formheader = get_string('rununittests', 'simpletest');
$formheader = get_string('rununittests', 'tool_unittest');
}
// Print the form for adjusting options.
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
echo $OUTPUT->heading($formheader);
echo '<form method="get" action="index.php">';
echo '<fieldset class="invisiblefieldset">';
echo '<p>'.html_writer::checkbox('showpasses', 1, $showpasses, get_string('showpasses', 'simpletest')).'</p>';
echo '<p>'.html_writer::checkbox('showsearch', 1, $showsearch, get_string('showsearch', 'simpletest')).'</p>';
echo '<p>'.html_writer::checkbox('showpasses', 1, $showpasses, get_string('showpasses', 'tool_unittest')).'</p>';
echo '<p>'.html_writer::checkbox('showsearch', 1, $showsearch, get_string('showsearch', 'tool_unittest')).'</p>';
if (moodle_coverage_recorder::can_run_codecoverage()) {
echo '<p>'.html_writer::checkbox('codecoverage', 1, $codecoverage, get_string('codecoverageanalysis', 'simpletest')).'</p>';
echo '<p>'.html_writer::checkbox('codecoverage', 1, $codecoverage, get_string('codecoverageanalysis', 'tool_unittest')).'</p>';
} else {
echo '<p>'; print_string('codecoveragedisabled', 'simpletest'); echo '<input type="hidden" name="codecoverage" value="0" /></p>';
echo '<p>'; print_string('codecoveragedisabled', 'tool_unittest'); echo '<input type="hidden" name="codecoverage" value="0" /></p>';
}
echo '<p>';
echo '<label for="path">', get_string('onlytest', 'simpletest'), '</label> ';
echo '<label for="path">', get_string('onlytest', 'tool_unittest'), '</label> ';
echo '<input type="text" id="path" name="path" value="', $displaypath, '" size="40" />';
echo '</p>';
echo '<input type="submit" value="' . get_string('runtests', 'simpletest') . '" />';
echo '<input type="submit" value="' . get_string('runtests', 'tool_unittest') . '" />';
echo '</fieldset>';
echo '</form>';
echo $OUTPUT->box_end();
$otherpages = array();
$otherpages['PDF lib test'] = new moodle_url('/admin/tool/unittest/other/pdflibtestpage.php');
if (debugging('', DEBUG_DEVELOPER)) {
$otherpages['TODO checker'] = new moodle_url('/admin/tool/unittest/other/todochecker.php');
}
// print list of extra test pages that are not simpletests,
// not everything there is good enough to show to our users
if ($otherpages) {
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter');
echo $OUTPUT->heading(get_string('othertestpages', 'tool_unittest'));
echo '<ul>';
foreach ($otherpages as $name=>$url) {
echo '<li>'.html_writer::link($url, $name).'</li>';
}
echo '</ul>';
echo $OUTPUT->box_end();
}
// Print link to latest code coverage for this report type
if (is_null($path) || !$codecoverage) {
moodle_coverage_reporter::print_link_to_latest('unittest');

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@ -16,11 +15,14 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'simpletest', language 'en', branch 'MOODLE_20_STABLE'
* Strings for component 'tool_unittest', language 'en', branch 'MOODLE_22_STABLE'
*
* @package simpletest
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* This file contains strings that were previously located in lang/en/simpletest.php
*
* @package tool
* @subpackage unittest
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['addconfigprefix'] = 'Add prefix to config file';
@ -34,6 +36,7 @@ $string['confignonwritable'] = 'The file config.php is not writeable by the web
$CFG->unittestprefix = \'tst_\' // Change tst_ to a prefix of your choice, different from $CFG->prefix';
$string['coveredlines'] = 'Covered lines';
$string['coveredpercentage'] = 'Overall code coverage';
$string['dbtest'] = 'Functional DB tests';
$string['deletingnoninsertedrecord'] = 'Trying to delete a record that was not inserted by these unit tests (id {$a->id} in table {$a->table}).';
$string['deletingnoninsertedrecords'] = 'Trying to delete records that were not inserted by these unit tests (from table {$a->table}).';
$string['droptesttables'] = 'Drop test tables';
@ -46,8 +49,10 @@ $string['installtesttables'] = 'Install test tables';
$string['moodleunittests'] = 'Moodle unit tests: {$a}';
$string['notice'] = 'Notice';
$string['onlytest'] = 'Only run tests in';
$string['othertestpages'] = 'Other test pages';
$string['pass'] = 'Pass';
$string['pathdoesnotexist'] = 'The path \'{$a}\' does not exist.';
$string['pluginname'] = 'Unit tests';
$string['prefix'] = 'Unit test tables prefix';
$string['prefixnotset'] = 'The unit test database table prefix is not configured. Fill and submit this form to add it to config.php.';
$string['reinstalltesttables'] = 'Reinstall test tables';
@ -74,6 +79,7 @@ $string['timetakes'] = 'Time taken: {$a}.';
$string['totallines'] = 'Total lines';
$string['uncaughtexception'] = 'Uncaught exception [{$a->getMessage()}] in [{$a->getFile()}:{$a->getLine()}] TESTS ABORTED.';
$string['uncoveredlines'] = 'Uncovered lines';
$string['unittest:execute'] = 'Execute unit tests';
$string['unittestprefixsetting'] = 'Unit test prefix: <strong>{$a->unittestprefix}</strong> (Edit config.php to modify this).';
$string['unittests'] = 'Unit tests';
$string['updatingnoninsertedrecord'] = 'Trying to update a record that was not inserted by these unit tests (id {$a->id} in table {$a->table}).';

View File

@ -1,47 +1,42 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Run the unit tests.
*
* A simple test script that sets up test data in the database then
* measures performance of filter_get_active_in_context.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package moodlecore
*//** */
* @copyright 2009 Tim Hunt
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__) . '/../../config.php');
require(dirname(__FILE__) . '/../../../../config.php');
require_once($CFG->libdir . '/ddllib.php');
require_login();
$syscontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $syscontext);
require_capability('tool/unittest:execute', $syscontext);
$baseurl = $CFG->wwwroot . '/lib/simpletest/filtersettingsperformancetester.php';
$baseurl = new moodle_url('/admin/tool/unittest/other/filtersettingsperformancetester.php');
$title = 'filter_get_active_in_context performance test';
$PAGE->set_url('/lib/simpletest/filtersettingsperformancetester.php');
$PAGE->set_url($baseurl);
$PAGE->set_context($syscontext);
$PAGE->navbar->add($title);
$PAGE->set_title($title);
$PAGE->set_heading($title);
@ -67,6 +62,7 @@ foreach ($requiredtables as $table) {
switch (optional_param('action', '', PARAM_ACTION)) {
case 'setup':
require_sesskey();
if ($issetup == 0) {
foreach ($requiredtables as $table) {
$dbman->install_one_table_from_xmldb_file($CFG->dirroot . '/lib/db/install.xml', $table);
@ -83,6 +79,7 @@ switch (optional_param('action', '', PARAM_ACTION)) {
break;
case 'teardown':
require_sesskey();
foreach ($requiredtables as $tablename) {
$table = new xmldb_table($tablename);
if ($dbman->table_exists($table)) {
@ -94,6 +91,7 @@ switch (optional_param('action', '', PARAM_ACTION)) {
break;
case 'test':
require_sesskey();
if ($issetup != count($requiredtables)) {
echo $OUTPUT->notification('Something is wrong, please delete the test tables and try again.');
} else {
@ -116,13 +114,13 @@ $DB = $realdb;
echo $OUTPUT->container_start();
$aurl = new moodle_url($baseurl, array('action' => 'setup'));
$aurl = new moodle_url($baseurl, array('action' => 'setup', 'sesskey'=>sesskey()));
echo $OUTPUT->single_button($aurl, 'Set up test tables', 'get', array('disabled'=>($issetup > 0)));
$aurl = new moodle_url($baseurl, array('action' => 'teardown'));
$aurl = new moodle_url($baseurl, array('action' => 'teardown', 'sesskey'=>sesskey()));
echo $OUTPUT->single_button($aurl, 'Drop test tables', 'get', array('disabled'=>($issetup == 0)));
$aurl = new moodle_url($baseurl, array('action' => 'test'));
$aurl = new moodle_url($baseurl, array('action' => 'test', 'sesskey'=>sesskey()));
echo $OUTPUT->single_button($aurl, 'Run tests', 'get', array('disabled'=>($issetup != count($requiredtables))));
echo $OUTPUT->container_end();

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@ -18,17 +17,19 @@
/**
* Pruduces a sample PDF using lib/pdflib.php
*
* @package moodlecore
* @package tool
* @subpackage unittest
* @copyright 2009 David Mudrak <david.mudrak@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author N.D.Freear@open.ac.uk, T.J.Hunt@open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require(dirname(__FILE__) . '/../../../../config.php');
require_once($CFG->libdir . '/pdflib.php');
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context);
require_capability('tool/unittest:execute', $context);
$getpdf = optional_param('getpdf', 0, PARAM_INT);
$fontfamily = optional_param('fontfamily', PDF_DEFAULT_FONT, PARAM_ALPHA); // to be configurable
@ -54,7 +55,7 @@ if ($getpdf) {
$doc->SetTitle('Moodle PDF library test');
$doc->SetAuthor('Moodle ' . $CFG->release);
$doc->SetCreator('lib/simpletest/pdflibtestpage.php');
$doc->SetCreator('admin/tool/unittest/pdflibtestpage.php');
$doc->SetKeywords('Moodle, PDF');
$doc->SetSubject('This has been generated by Moodle as its PDF library test page');
$doc->SetMargins(15, 30);
@ -133,7 +134,7 @@ if ($getpdf) {
exit();
}
$PAGE->set_url('/lib/simpletest/pdflibtestpage.php');
$PAGE->set_url('/admin/tool/unittest/other/pdflibtestpage.php');
$PAGE->set_context($context);
$PAGE->set_title('PDF library test');
$PAGE->set_heading('PDF library test');

View File

@ -11,7 +11,7 @@ die;die;die;
// extra security
session_write_close();
$return_url = "$CFG->wwwroot/$CFG->admin/report/unittest/test_tables.php";
$return_url = "$CFG->wwwroot/$CFG->admin/tool/unittest/test_tables.php";
// Temporarily override $DB and $CFG for a fresh install on the unit test prefix

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@ -20,19 +19,20 @@
*
* As required by http://docs.moodle.org/dev/Coding_style.
*
* http://docs.moodle.org/dev/Coding_style
* @package moodlecore
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package tool
* @subpackage unittest
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->libdir . '/simpletestlib.php');
require(dirname(__FILE__) . '/../../../../config.php');
require_once('../simpletestlib.php');
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context);
require_capability('tool/unittest:execute', $context);
$PAGE->set_url('/lib/simpletest/todochecker.php');
$PAGE->set_url('/admin/tool/todochecker.php');
$PAGE->set_context($context);
$PAGE->set_title('To-do checker');
$PAGE->set_heading('To-do checker');

View File

@ -0,0 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unittest settings
*
* @package tool
* @subpackage unittest
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('development', new admin_externalpage('toolsimpletest', get_string('pluginname', 'tool_unittest'), "$CFG->wwwroot/$CFG->admin/tool/unittest/index.php", 'tool/unittest:execute'));
$ADMIN->add('development', new admin_externalpage('tooldbtest', get_string('dbtest', 'tool_unittest'), "$CFG->wwwroot/$CFG->admin/tool/unittest/dbtest.php", 'tool/unittest:execute'));

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@ -22,8 +21,8 @@
* ones, provide code coverage analysis to already existing tests. Also there are some
* utility functions designed to make the coverage control easier.
*
* @package core
* @subpackage simpletestcoverage
* @package tool
* @subpackage unittest
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -33,11 +32,10 @@ defined('MOODLE_INTERNAL') || die();
/**
* Includes
*/
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir . '/simpletestlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/report/unittest/ex_simple_test.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/unittest/simpletestlib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/unittest/ex_simple_test.php');
require_once($CFG->libdir . '/spikephpcoverage/src/CoverageRecorder.php');
require_once($CFG->libdir . '/spikephpcoverage/src/reporter/HtmlCoverageReporter.php');
@ -439,19 +437,19 @@ class moodle_coverage_reporter extends HtmlCoverageReporter {
$table->id = 'codecoveragetable_' . $type;
$table->rowclasses = array('label', 'value');
$table->data = array(
array(get_string('date') , userdate($data->time)),
array(get_string('files') , format_float($data->totalfiles, 0)),
array(get_string('totallines', 'simpletest') , format_float($data->totalln, 0)),
array(get_string('executablelines', 'simpletest') , format_float($data->totalcoveredln + $data->totaluncoveredln, 0)),
array(get_string('coveredlines', 'simpletest') , format_float($data->totalcoveredln, 0)),
array(get_string('uncoveredlines', 'simpletest') , format_float($data->totaluncoveredln, 0)),
array(get_string('coveredpercentage', 'simpletest'), format_float($data->totalpercentage, 2) . '%')
array(get_string('date') , userdate($data->time)),
array(get_string('files') , format_float($data->totalfiles, 0)),
array(get_string('totallines', 'tool_unittest') , format_float($data->totalln, 0)),
array(get_string('executablelines', 'tool_unittest') , format_float($data->totalcoveredln + $data->totaluncoveredln, 0)),
array(get_string('coveredlines', 'tool_unittest') , format_float($data->totalcoveredln, 0)),
array(get_string('uncoveredlines', 'tool_unittest') , format_float($data->totaluncoveredln, 0)),
array(get_string('coveredpercentage', 'tool_unittest'), format_float($data->totalpercentage, 2) . '%')
);
$url = $CFG->wwwroot . '/admin/report/unittest/coveragefile.php/' . $type . '/index.html';
$url = $CFG->wwwroot . '/'.$CFG->admin.'/tool/unittest/coveragefile.php/' . $type . '/index.html';
$result .= $OUTPUT->heading($data->title, 3, 'main codecoverageheading');
$result .= $OUTPUT->heading('<a href="' . $url . '" onclick="javascript:window.open(' . "'" . $url . "'" . ');return false;"' .
' title="">' . get_string('codecoveragecompletereport', 'simpletest') . '</a>', 4, 'main codecoveragelink');
' title="">' . get_string('codecoveragecompletereport', 'tool_unittest') . '</a>', 4, 'main codecoveragelink');
$result .= html_writer::table($table);
return $OUTPUT->box($result, 'generalbox boxwidthwide boxaligncenter codecoveragebox', '', true);
@ -489,12 +487,12 @@ class moodle_coverage_reporter extends HtmlCoverageReporter {
$info->files = format_float($data->totalfiles, 0);
$info->percentage = format_float($data->totalpercentage, 2) . '%';
$strlatestreport = get_string('codecoveragelatestreport', 'simpletest');
$strlatestdetails = get_string('codecoveragelatestdetails', 'simpletest', $info);
$strlatestreport = get_string('codecoveragelatestreport', 'tool_unittest');
$strlatestdetails = get_string('codecoveragelatestdetails', 'tool_unittest', $info);
// return one link to latest complete report
$result = '';
$url = $CFG->wwwroot . '/admin/report/unittest/coveragefile.php/' . $type . '/index.html';
$url = $CFG->wwwroot . '/'.$CFG->admin.'/tool/unittest/coveragefile.php/' . $type . '/index.html';
$result .= $OUTPUT->heading('<a href="' . $url . '" onclick="javascript:window.open(' . "'" . $url . "'" . ');return false;"' .
' title="">' . $strlatestreport . '</a>', 3, 'main codecoveragelink');
$result .= $OUTPUT->heading($strlatestdetails, 4, 'main codecoveragedetails');

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@ -25,8 +24,8 @@
* Major Contirbutors
* - T.J.Hunt@open.ac.uk
*
* @package core
* @subpackage simpletestex
* @package tool
* @subpackage unittest
* @copyright &copy; 2006 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -36,7 +35,6 @@ defined('MOODLE_INTERNAL') || die();
/**
* Includes
*/
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/simpletestlib/simpletest.php');
require_once($CFG->libdir . '/simpletestlib/unit_tester.php');
require_once($CFG->libdir . '/simpletestlib/expectation.php');
@ -214,7 +212,7 @@ abstract class XMLStructureExpectation extends SimpleExpectation {
foreach ($parsererrors as $key => $message) {
$parsererrors[$key] = $message->message;
}
return 'Could not parse XML [' . $html . '] errors were [' .
return 'Could not parse XML [' . $html . '] errors were [' .
implode('], [', $parsererrors) . ']';
}
return $this->customMessage($html);
@ -958,7 +956,7 @@ class FakeDBUnitTestCase extends UnitTestCase {
if (!file_put_contents($this->pkfile, $tabledata)) {
$a = new stdClass();
$a->filename = $this->pkfile;
throw new moodle_exception('testtablescsvfileunwritable', 'simpletest', '', $a);
throw new moodle_exception('testtablescsvfileunwritable', 'tool_unittest', '', $a);
}
}
}
@ -1010,7 +1008,7 @@ class FakeDBUnitTestCase extends UnitTestCase {
} else {
$a = new stdClass();
$a->filename = $this->pkfile;
throw new moodle_exception('testtablescsvfilemissing', 'simpletest', '', $a);
throw new moodle_exception('testtablescsvfilemissing', 'tool_unittest', '', $a);
return false;
}
}
@ -1155,7 +1153,7 @@ class UnitTestDB {
global $CFG, $DB;
UnitTestDB::$real_db = clone($DB);
if (empty($CFG->unittestprefix)) {
print_error("prefixnotset", 'simpletest');
print_error("prefixnotset", 'tool_unittest');
}
if (empty(UnitTestDB::$DB)) {
@ -1166,7 +1164,7 @@ class UnitTestDB {
$manager = UnitTestDB::$DB->get_manager();
if (!$manager->table_exists('user')) {
print_error('tablesnotsetup', 'simpletest');
print_error('tablesnotsetup', 'tool_unittest');
}
$DB = new UnitTestDB();
@ -1220,7 +1218,7 @@ class UnitTestDB {
$a = new stdClass();
$a->id = $dataobject->id;
$a->table = $table;
throw new moodle_exception('updatingnoninsertedrecord', 'simpletest', '', $a);
throw new moodle_exception('updatingnoninsertedrecord', 'tool_unittest', '', $a);
} else {
return UnitTestDB::$DB->update_record($table, $dataobject, $bulk);
}
@ -1261,7 +1259,7 @@ class UnitTestDB {
if ($proceed_with_delete) {
return UnitTestDB::$DB->delete_records($table, $conditions);
} else {
throw new moodle_exception('deletingnoninsertedrecord', 'simpletest', '', $a);
throw new moodle_exception('deletingnoninsertedrecord', 'tool_unittest', '', $a);
}
}
@ -1294,7 +1292,7 @@ class UnitTestDB {
if ($proceed_with_delete) {
return UnitTestDB::$DB->delete_records_select($table, $select, $params);
} else {
throw new moodle_exception('deletingnoninsertedrecord', 'simpletest', '', $a);
throw new moodle_exception('deletingnoninsertedrecord', 'tool_unittest', '', $a);
}
}

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@ -16,12 +15,15 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'report_unittest', language 'en', branch 'MOODLE_20_STABLE'
* Unittest version info
*
* @package report_unittest
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package tool
* @subpackage unittest
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'Unit tests';
$string['unittest:view'] = 'Execute unit tests';
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011091600; // Requires this Moodle version
$plugin->component = 'tool_unittest'; // Full name of the plugin (used for diagnostics)

View File

@ -407,7 +407,6 @@ $string['dbmigratewarning2'] = '<b>Warning: You are about to start the database
$string['dbmigrationdeprecateddb'] = '<font color="#ff0000">This database is migrated to a new UTF8 database and deprecated. Please edit your config.php and use the new database for this moodle.</font>';
$string['dbmigrationdupfailed'] = 'Database duplication failed with possible error:<font color="#ff0000"><pre>{$a}</pre></font>';
$string['dbsessions'] = 'Use database for session information';
$string['dbtest'] = 'Functional DB tests';
$string['debug'] = 'Debug messages';
$string['debugall'] = 'ALL: Show all reasonable PHP debug messages';
$string['debugdeveloper'] = 'DEVELOPER: extra Moodle debug messages for developers';
@ -936,7 +935,6 @@ $string['settingmemorylimit'] = 'Insufficient memory detected, please set higher
$string['settingsafemode'] = 'Moodle is not fully compatible with safe mode, please ask server administrator to turn it off. Running Moodle under safe mode is not supported, please expect various problems if you do so.';
$string['showcommentscount'] = 'Show comments count';
$string['showdetails'] = 'Show details';
$string['simpletest'] = 'Unit tests';
$string['simplexmlrequired'] = 'The SimpleXML PHP extension is now required by Moodle.';
$string['sitelangchanged'] = 'Site language setting changed successfully';
$string['sitemaintenance'] = 'The site is undergoing maintenance and is currently not available';

View File

@ -7245,7 +7245,6 @@ function get_core_subsystems() {
'repository' => 'repository',
'rss' => 'rss',
'role' => $CFG->admin.'/role',
'simpletest' => NULL,
'search' => 'search',
'table' => NULL,
'tag' => 'tag',

View File

@ -344,7 +344,7 @@ class plugin_manager {
'report' => array(
'backups', 'configlog', 'courseoverview',
'customlang', 'log', 'questioninstances',
'security', 'spamcleaner', 'stats', 'unittest'
'security', 'spamcleaner', 'stats'
),
'repository' => array(
@ -367,7 +367,7 @@ class plugin_manager {
),
'tool' => array(
'capability', 'profiling', 'unsuproles'
'capability', 'profiling', 'unittest', 'unsuproles'
),
'webservice' => array(

View File

@ -34,7 +34,7 @@ require_once($CFG->libdir . '/outputlib.php');
* Unit tests for the xhtml_container_stack class.
*
* These tests assume that developer debug mode is on, which, at the time of
* writing, is true. admin/report/unittest/index.php forces it on.
* writing, is true. admin/tool/unittest/index.php forces it on.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

View File

@ -237,7 +237,7 @@ class moodle_page_test extends UnitTestCase {
public function test_initialise_default_pagetype() {
// Exercise SUT
$this->testpage->initialise_default_pagetype('admin/report/unittest/index.php');
$this->testpage->initialise_default_pagetype('admin/tool/unittest/index.php');
// Validate
$this->assertEqual('admin-report-unittest-index', $this->testpage->pagetype);
}

View File

@ -26,10 +26,8 @@
defined('MOODLE_INTERNAL') || die();
require_once(dirname(__FILE__) . '/../../../../config.php');
global $CFG;
require_once($CFG->libdir . '/simpletestlib.php'); // Include the test libraries
require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php'); // Include the code to test