MDL-32149 remove empty tests and outdated/disabled portfolio tests

This commit is contained in:
Petr Skoda 2012-04-03 20:03:59 +02:00
parent 7fe8aac1a7
commit b60d21747f
9 changed files with 0 additions and 678 deletions

View File

@ -1,100 +0,0 @@
<?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 //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Unit tests for ../portfoliolib.php.
*
* @author nicolasconnault@gmail.com
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package moodlecore
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->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()));
}
*/
}

View File

@ -1,50 +0,0 @@
<?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 //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Unit tests for ../portfoliolib.php.
*
* @author nicolasconnault@gmail.com
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package moodlecore
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->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
}

View File

@ -1,70 +0,0 @@
<?php
require_once("$CFG->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();
}
*/
}

View File

@ -1,59 +0,0 @@
<?php
require_once("$CFG->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();
}
*/
}

View File

@ -1,86 +0,0 @@
<?php
require_once("$CFG->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();
}
*/
}

View File

@ -1,65 +0,0 @@
<?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 //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Unit tests for mod/data/preset_class.php.
*
* @author nicolas@moodle.com
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package mod_data
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->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()
{
}
}

View File

@ -1,112 +0,0 @@
<?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/>.
/**
* 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();
}
*/
}

View File

@ -1,62 +0,0 @@
<?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 //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Unit tests for (some of) ../mod/forum/lib.php.
*
* @copyright &copy; 2006 The Open University
* @author T.J.Hunt@open.ac.uk
* @author nicolas@moodle.com
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package mod-forum
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->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);
*/
}
}

View File

@ -1,74 +0,0 @@
<?php
require_once("$CFG->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();
}
*/
}