diff --git a/lib/simpletest/testportfolioaddbutton.php b/lib/simpletest/testportfolioaddbutton.php deleted file mode 100644 index 5238b2b0266..00000000000 --- a/lib/simpletest/testportfolioaddbutton.php +++ /dev/null @@ -1,100 +0,0 @@ -libdir . '/portfoliolib.php'); - -class portfoliolibaddbutton_test extends UnitTestCaseUsingDatabase { - - public static $includecoverage = array('lib/portfoliolib.php'); - - protected $testtables = array( - 'lib' => array( - 'portfolio_instance', 'portfolio_instance_user')); - - public function setUp() { - parent::setUp(); - - $this->switch_to_test_db(); // Switch to test DB for all the execution - - foreach ($this->testtables as $dir => $tables) { - $this->create_test_tables($tables, $dir); // Create tables - } - - } - - public function tearDown() { - parent::tearDown(); // In charge of droppng all the test tables - } - - /* - * TODO: The portfolio unit tests were obselete and did not work. - * They have been commented out so that they do not break the - * unit tests in Moodle 2. - * - * At some point: - * 1. These tests should be audited to see which ones were valuable. - * 2. The useful ones should be rewritten using the current standards - * for writing test cases. - * - * This might be left until Moodle 2.1 when the test case framework - * is due to change. - */ - /* - * A test of setting and getting formats. What is returned in the getter is a combination of what is explicitly set in - * the button, and what is set in the static method of the export class. - * - * In some cases they conflict, in which case the button wins. - */ - - /* - function test_set_formats() { - - $button = new portfolio_add_button(); - $button->set_callback_options('assignment_portfolio_caller', array('id' => 6), '/mod/assignment/locallib.php'); - $formats = array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_IMAGE); - $button->set_formats($formats); - - // Expecting $formats + assignment_portfolio_caller::base_supported_formats merged to unique values. - $formats_combined = array_unique(array_merge($formats, assignment_portfolio_caller::base_supported_formats())); - - // In this case, neither file or image conflict with leap2a, which is why all three are returned. - $this->assertEqual(count($formats_combined), count($button->get_formats())); - } - */ -} - - diff --git a/lib/simpletest/testportfoliolib.php b/lib/simpletest/testportfoliolib.php deleted file mode 100644 index ca0819aa87c..00000000000 --- a/lib/simpletest/testportfoliolib.php +++ /dev/null @@ -1,50 +0,0 @@ -libdir . '/simpletest/portfolio_testclass.php'); - -// Load tests for various modules -foreach (get_list_of_plugins('mod') as $module) { - $modtest = $CFG->dirroot . '/mod/' . $module . '/simpletest/test_' . $module . '_portfolio_callers.php'; - if (file_exists($modtest)) { - require_once($modtest); - } -} - -class empty_portfoliolib_test extends UnitTestCase { - // empty, this prevents warning in coverage report -} diff --git a/mod/assignment/simpletest/test_assignment_portfolio_callers.php b/mod/assignment/simpletest/test_assignment_portfolio_callers.php deleted file mode 100644 index f9ce0fa58ef..00000000000 --- a/mod/assignment/simpletest/test_assignment_portfolio_callers.php +++ /dev/null @@ -1,70 +0,0 @@ -libdir/simpletest/portfolio_testclass.php"); -require_once("$CFG->dirroot/mod/assignment/lib.php"); -require_once("$CFG->dirroot/mod/assignment/locallib.php"); - -Mock::generate('assignment_portfolio_caller', 'mock_caller'); -Mock::generate('portfolio_exporter', 'mock_exporter'); - - -class testAssignmentPortfolioCallers extends portfoliolib_test { - public static $includecoverage = array('lib/portfoliolib.php', 'mod/assignment/lib.php'); - public $module_type = 'assignment'; - public $modules = array(); - public $entries = array(); - public $caller; - - /* - * TODO: The portfolio unit tests were obselete and did not work. - * They have been commented out so that they do not break the - * unit tests in Moodle 2. - * - * At some point: - * 1. These tests should be audited to see which ones were valuable. - * 2. The useful ones should be rewritten using the current standards - * for writing test cases. - * - * This might be left until Moodle 2.1 when the test case framework - * is due to change. - * - public function setUp() { - global $DB, $USER; - - parent::setUp(); - $assignment_types = new stdClass(); - $assignment_types->type = GENERATOR_SEQUENCE; - $assignment_types->options = array('online'); - - $settings = array('quiet' => 1, - 'modules_list' => array($this->module_type), 'assignment_grades' => true, - 'assignment_type' => $assignment_types, - 'number_of_students' => 5, 'students_per_course' => 5, 'number_of_sections' => 1, - 'number_of_modules' => 3, 'questions_per_course' => 0); - - generator_generate_data($settings); - - $this->modules = $DB->get_records($this->module_type); - $first_module = reset($this->modules); - $cm = get_coursemodule_from_instance($this->module_type, $first_module->id); - $submissions = $DB->get_records('assignment_submissions', array('assignment' => $first_module->id)); - $first_submission = reset($submissions); - - $this->caller = parent::setup_caller('assignment_portfolio_caller', array('id' => $cm->id), $first_submission->userid); - } - - public function tearDown() { - parent::tearDown(); - } - - public function test_caller_sha1() { - $sha1 = $this->caller->get_sha1(); - $this->caller->prepare_package(); - $this->assertEqual($sha1, $this->caller->get_sha1()); - } - - public function test_caller_with_plugins() { - parent::test_caller_with_plugins(); - } - */ -} - diff --git a/mod/chat/simpletest/test_chat_portfolio_callers.php b/mod/chat/simpletest/test_chat_portfolio_callers.php deleted file mode 100644 index 1069a4395c0..00000000000 --- a/mod/chat/simpletest/test_chat_portfolio_callers.php +++ /dev/null @@ -1,59 +0,0 @@ -libdir/simpletest/portfolio_testclass.php"); -require_once("$CFG->dirroot/mod/chat/lib.php"); - -/* - * TODO: The portfolio unit tests were obselete and did not work. - * They have been commented out so that they do not break the - * unit tests in Moodle 2. - * - * At some point: - * 1. These tests should be audited to see which ones were valuable. - * 2. The useful ones should be rewritten using the current standards - * for writing test cases. - * - * This might be left until Moodle 2.1 when the test case framework - * is due to change. - */ -Mock::generate('chat_portfolio_caller', 'mock_caller'); -Mock::generate('portfolio_exporter', 'mock_exporter'); - -class testChatPortfolioCallers extends portfoliolib_test { -/* - public static $includecoverage = array('lib/portfoliolib.php', 'mod/chat/lib.php'); - public $module_type = 'chat'; - public $modules = array(); - public $entries = array(); - public $caller; - - public function setUp() { - global $DB, $USER; - - parent::setUp(); - - $settings = array('quiet' => 1, 'pre_cleanup' => 1, - 'modules_list' => array($this->module_type), - 'number_of_students' => 15, 'students_per_course' => 15, 'number_of_sections' => 1, - 'number_of_modules' => 1, 'messages_per_chat' => 15); - - generator_generate_data($settings); - - $this->modules = $DB->get_records($this->module_type); - $first_module = reset($this->modules); - $cm = get_coursemodule_from_instance($this->module_type, $first_module->id); - $userid = $DB->get_field('chat_users', 'userid', array('chatid' => $first_module->id)); - - $this->caller = parent::setup_caller('chat_portfolio_caller', array('id' => $cm->id), $userid); - } - - public function test_caller_sha1() { - $sha1 = $this->caller->get_sha1(); - $this->caller->prepare_package(); - $this->assertEqual($sha1, $this->caller->get_sha1()); - } - - public function test_caller_with_plugins() { - parent::test_caller_with_plugins(); - } -*/ -} diff --git a/mod/data/simpletest/test_data_portfolio_callers.php b/mod/data/simpletest/test_data_portfolio_callers.php deleted file mode 100644 index 4ea08e48301..00000000000 --- a/mod/data/simpletest/test_data_portfolio_callers.php +++ /dev/null @@ -1,86 +0,0 @@ -libdir/simpletest/portfolio_testclass.php"); -require_once("$CFG->dirroot/mod/data/lib.php"); -require_once("$CFG->dirroot/mod/data/locallib.php"); - -/* - * TODO: The portfolio unit tests were obselete and did not work. - * They have been commented out so that they do not break the - * unit tests in Moodle 2. - * - * At some point: - * 1. These tests should be audited to see which ones were valuable. - * 2. The useful ones should be rewritten using the current standards - * for writing test cases. - * - * This might be left until Moodle 2.1 when the test case framework - * is due to change. - */ -Mock::generate('data_portfolio_caller', 'mock_caller'); -Mock::generate('portfolio_exporter', 'mock_exporter'); - -class testDataPortfolioCallers extends portfoliolib_test { -/* - public static $includecoverage = array('lib/portfoliolib.php', 'mod/data/lib.php'); - public $module_type = 'data'; - public $modules = array(); - public $entries = array(); - public $caller_single; - public $caller; - - public function setUp() { - global $DB, $USER; - - parent::setUp(); - - $settings = array('quiet' => 1, - - 'pre_cleanup' => 0, - 'modules_list' => array($this->module_type), - 'number_of_students' => 5, - 'students_per_course' => 5, - 'number_of_sections' => 1, - 'number_of_modules' => 1, - 'questions_per_course' => 0); - - generator_generate_data($settings); - - $this->modules = $DB->get_records($this->module_type); - $first_module = reset($this->modules); - $cm = get_coursemodule_from_instance($this->module_type, $first_module->id); - - $fields = $DB->get_records('data_fields', array('dataid' => $first_module->id)); - $recordid = data_add_record($first_module); - foreach ($fields as $field) { - $content->recordid = $recordid; - $content->fieldid = $field->id; - $content->content = 'test content'; - $content->content1 = 'test content 1'; - $content->content2 = 'test content 2'; - $DB->insert_record('data_content',$content); - } - - // Callback args required: id, record, delimiter_name, exporttype - $this->caller_single = parent::setup_caller('data_portfolio_caller', array('id' => $cm->id, 'record' => $recordid)); - $this->caller = parent::setup_caller('data_portfolio_caller', array('id' => $cm->id)); - } - - public function tearDown() { - parent::tearDown(); - } - - public function test_caller_sha1() { - $sha1 = $this->caller->get_sha1(); - $this->caller->prepare_package(); - $this->assertEqual($sha1, $this->caller->get_sha1()); - - $sha1 = $this->caller_single->get_sha1(); - $this->caller_single->prepare_package(); - $this->assertEqual($sha1, $this->caller_single->get_sha1()); - } - - public function test_caller_with_plugins() { - parent::test_caller_with_plugins(); - } -*/ -} diff --git a/mod/data/simpletest/testpreset.php b/mod/data/simpletest/testpreset.php deleted file mode 100644 index b543693e7cb..00000000000 --- a/mod/data/simpletest/testpreset.php +++ /dev/null @@ -1,65 +0,0 @@ -dirroot . '/mod/data/lib.php'); - -class data_preset_test extends UnitTestCase { - public static $includecoverage = array('mod/data/lib.php'); - - function setUp() { - } - - function tearDown() { - } - - function test_address_in_subnet() { - } - - /** - * Modifies $_SERVER['HTTP_USER_AGENT'] manually to check if check_browser_version - * works as expected. - */ - function test_check_browser_version() - { - } - - function test_optional_param() - { - } -} - - diff --git a/mod/forum/simpletest/test_forum_portfolio_callers.php b/mod/forum/simpletest/test_forum_portfolio_callers.php deleted file mode 100644 index 503ef15ed12..00000000000 --- a/mod/forum/simpletest/test_forum_portfolio_callers.php +++ /dev/null @@ -1,112 +0,0 @@ -. - -/** - * Code fragment to define the module version etc. - * This fragment is called by /admin/index.php - * - * @package mod-forum - * @copyright 2008 Nicolas Connault - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -require_once("$CFG->libdir/simpletest/portfolio_testclass.php"); -require_once("$CFG->dirroot/mod/forum/lib.php"); - -/* - * TODO: The portfolio unit tests were obselete and did not work. - * They have been commented out so that they do not break the - * unit tests in Moodle 2. - * - * At some point: - * 1. These tests should be audited to see which ones were valuable. - * 2. The useful ones should be rewritten using the current standards - * for writing test cases. - * - * This might be left until Moodle 2.1 when the test case framework - * is due to change. - */ -Mock::generate('forum_portfolio_caller', 'mock_caller'); -Mock::generate('portfolio_exporter', 'mock_exporter'); - -class testForumPortfolioCallers extends portfoliolib_test { -/* - public static $includecoverage = array('lib/portfoliolib.php', 'mod/forum/lib.php'); - public $module_type = 'forum'; - public $modules = array(); - public $entries = array(); - public $postcaller; - public $discussioncaller; - - public function setUp() { - global $DB, $USER; - - parent::setUp(); - - $settings = array('quiet' => 1, - 'verbose' => 0, - - 'pre_cleanup' => 0, - 'post_cleanup' => 0, - 'modules_list' => array($this->module_type), - 'discussions_per_forum' => 5, - 'posts_per_discussion' => 10, - 'number_of_students' => 5, - 'students_per_course' => 5, - 'number_of_sections' => 1, - 'number_of_modules' => 1, - 'questions_per_course' => 0); - - generator_generate_data($settings); - - $this->modules = $DB->get_records($this->module_type); - $first_module = reset($this->modules); - $cm = get_coursemodule_from_instance($this->module_type, $first_module->id); - - $discussions = $DB->get_records('forum_discussions', array('forum' => $first_module->id)); - $first_discussion = reset($discussions); - - $posts = $DB->get_records('forum_posts', array('discussion' => $first_discussion->id)); - $first_post = reset($posts); - - $callbackargs = array('postid' => $first_post->id, 'discussionid' => $first_discussion->id); - $this->postcaller = parent::setup_caller('forum_portfolio_caller', $callbackargs, $first_post->userid); - - unset($callbackargs['postid']); - $this->discussioncaller = parent::setup_caller('forum_portfolio_caller', $callbackargs, $first_post->userid); - - } - - public function tearDown() { - parent::tearDown(); - } - - public function test_caller_sha1() { - $sha1 = $this->postcaller->get_sha1(); - $this->postcaller->prepare_package(); - $this->assertEqual($sha1, $this->postcaller->get_sha1()); - - $sha1 = $this->discussioncaller->get_sha1(); - $this->discussioncaller->prepare_package(); - $this->assertEqual($sha1, $this->discussioncaller->get_sha1()); - } - - public function test_caller_with_plugins() { - parent::test_caller_with_plugins(); - } -*/ -} diff --git a/mod/forum/simpletest/testmodforumlib.php b/mod/forum/simpletest/testmodforumlib.php deleted file mode 100644 index b42ff68aca5..00000000000 --- a/mod/forum/simpletest/testmodforumlib.php +++ /dev/null @@ -1,62 +0,0 @@ -dirroot . '/mod/forum/lib.php'); - -class modforumlib_test extends UnitTestCase { - public static $includecoverage = array('mod/forum/lib.php'); - - function setUp() { - } - - function tearDown() { - } - - function test_forum_cron() { - // watch out: forum_cron() should not be called from here, - // it relies on special environment setup used in admin/cron.php, - // mainly special cookieless session and $USER object - /* - forum_cron(); - $this->assertTrue(false); - */ - } -} - - diff --git a/mod/glossary/simpletest/test_glossary_portfolio_callers.php b/mod/glossary/simpletest/test_glossary_portfolio_callers.php deleted file mode 100644 index 78ac42a1440..00000000000 --- a/mod/glossary/simpletest/test_glossary_portfolio_callers.php +++ /dev/null @@ -1,74 +0,0 @@ -libdir/simpletest/portfolio_testclass.php"); -require_once("$CFG->dirroot/mod/glossary/lib.php"); -require_once("$CFG->dirroot/mod/glossary/locallib.php"); - -/* - * TODO: The portfolio unit tests were obselete and did not work. - * They have been commented out so that they do not break the - * unit tests in Moodle 2. - * - * At some point: - * 1. These tests should be audited to see which ones were valuable. - * 2. The useful ones should be rewritten using the current standards - * for writing test cases. - * - * This might be left until Moodle 2.1 when the test case framework - * is due to change. - */ -Mock::generate('glossary_entry_portfolio_caller', 'mock_entry_caller'); -Mock::generate('glossary_csv_portfolio_caller', 'mock_csv_caller'); -Mock::generate('portfolio_exporter', 'mock_exporter'); - -class testGlossaryPortfolioCallers extends portfoliolib_test { -/* - public static $includecoverage = array('lib/portfoliolib.php', 'mod/glossary/lib.php'); - public $glossaries = array(); - public $entries = array(); - public $entry_caller; - public $csv_caller; - - public function setUp() { - global $DB; - - parent::setUp(); - $settings = array('tiny' => 1, 'quiet' => 1, 'pre_cleanup' => 1, - 'modules_list' => array('glossary'), 'entries_per_glossary' => 20, - 'number_of_students' => 5, 'students_per_course' => 5, 'number_of_sections' => 1, - 'number_of_modules' => 1, 'questions_per_course' => 0); - generator_generate_data($settings); - - $this->glossaries = $DB->get_records('glossary'); - $first_glossary = reset($this->glossaries); - $cm = get_coursemodule_from_instance('glossary', $first_glossary->id); - - $this->entries = $DB->get_records('glossary_entries', array('glossaryid' => $first_glossary->id)); - $first_entry = reset($this->entries); - - $callbackargs = array('id' => $cm->id, 'entryid' => $first_entry->id); - $this->entry_caller = parent::setup_caller('glossary_entry_portfolio_caller', $callbackargs); - - $this->csv_caller = parent::setup_caller('glossary_csv_portfolio_caller', $callbackargs); - } - - public function tearDown() { - parent::tearDown(); - } - - public function test_entry_caller_sha1() { - $entry_sha1 = $this->entry_caller->get_sha1(); - $this->entry_caller->prepare_package(); - $this->assertEqual($entry_sha1, $this->entry_caller->get_sha1()); - } - - public function test_csv_caller_sha1() { - $csv_sha1 = $this->csv_caller->get_sha1(); - $this->csv_caller->prepare_package(); - $this->assertEqual($csv_sha1, $this->csv_caller->get_sha1()); - } - - public function test_caller_with_plugins() { - parent::test_caller_with_plugins(); - } -*/ -}