Unit tests MDL-24993 Disable obsolete portfolio tests until such time as somebody can fix them

This commit is contained in:
Sam Marshall 2010-11-09 17:09:13 +00:00
parent 4d0552e8ea
commit 702a206cd3
8 changed files with 112 additions and 6 deletions

View File

@ -195,10 +195,21 @@ foreach ($portfolio_plugins as $plugin) {
class portfoliolib_test extends UnitTestCaseUsingDatabase {
private $olduser;
protected $testtables = array(
'lib' => array(
'portfolio_instance', 'portfolio_instance_user', 'portfolio_instance_config',
'user', 'course', 'course_categories'));
function setup() {
global $USER;
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
}
// It is necessary to store $USER object because some subclasses use generator
// stuff which breaks $USER
$this->olduser = $USER;

View File

@ -7,6 +7,7 @@ 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';
@ -14,6 +15,19 @@ class testAssignmentPortfolioCallers extends portfoliolib_test {
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;
@ -52,5 +66,6 @@ class testAssignmentPortfolioCallers extends portfoliolib_test {
public function test_caller_with_plugins() {
parent::test_caller_with_plugins();
}
*/
}

View File

@ -3,6 +3,19 @@ require_once("$CFG->libdir/simpletest/portfolio_testclass.php");
require_once("$CFG->dirroot/mod/chat/lib.php");
require_once("$CFG->dirroot/$CFG->admin/generator.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');
@ -43,4 +56,4 @@ class testChatPortfolioCallers extends portfoliolib_test {
parent::test_caller_with_plugins();
}
}
*/

View File

@ -4,6 +4,19 @@ require_once("$CFG->dirroot/mod/data/lib.php");
require_once("$CFG->dirroot/$CFG->admin/generator.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');
@ -70,4 +83,4 @@ class testDataPortfolioCallers extends portfoliolib_test {
parent::test_caller_with_plugins();
}
}
*/

View File

@ -28,6 +28,19 @@ require_once("$CFG->libdir/simpletest/portfolio_testclass.php");
require_once("$CFG->dirroot/mod/forum/lib.php");
require_once("$CFG->dirroot/$CFG->admin/generator.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');
@ -96,4 +109,4 @@ class testForumPortfolioCallers extends portfoliolib_test {
parent::test_caller_with_plugins();
}
}
*/

View File

@ -4,6 +4,19 @@ require_once("$CFG->dirroot/mod/glossary/lib.php");
require_once("$CFG->dirroot/mod/glossary/locallib.php");
require_once("$CFG->dirroot/$CFG->admin/generator.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');
@ -59,4 +72,5 @@ class testGlossaryPortfolioCallers extends portfoliolib_test {
parent::test_caller_with_plugins();
}
}
*/

View File

@ -3,6 +3,19 @@ require_once("$CFG->libdir/simpletest/testportfoliolib.php");
require_once("$CFG->dirroot/portfolio/boxnet/lib.php");
require_once("$CFG->dirroot/$CFG->admin/generator.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('boxclient', 'mock_boxclient');
Mock::generatePartial('portfolio_plugin_boxnet', 'mock_boxnetplugin', array('ensure_ticket', 'ensure_account_tree'));
@ -56,4 +69,5 @@ class testPortfolioPluginBoxnet extends portfoliolib_test {
$this->assertTrue($this->plugin->send_package());
}
}
*/

View File

@ -2,16 +2,29 @@
require_once($CFG->libdir.'/simpletest/testportfoliolib.php');
require_once($CFG->dirroot.'/portfolio/download/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('boxclient', 'mock_boxclient');
Mock::generatePartial('portfolio_plugin_download', 'mock_downloadplugin', array('ensure_ticket', 'ensure_account_tree'));
*/
class testPortfolioPluginDownload extends portfoliolib_test {
public static $includecoverage = array('lib/portfoliolib.php', 'portfolio/download/lib.php');
public function setUp() {
parent::setUp();
$this->plugin = new mock_boxnetplugin($this);
$this->plugin->boxclient = new mock_boxclient();
// $this->plugin = new mock_boxnetplugin($this);
// $this->plugin->boxclient = new mock_boxclient();
}
public function tearDown() {