Skip to content

Commit

Permalink
Unit tests MDL-24993 Disable obsolete portfolio tests until such time…
Browse files Browse the repository at this point in the history
… as somebody can fix them
  • Loading branch information
sammarshallou committed Nov 9, 2010
1 parent 4d0552e commit 702a206
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 6 deletions.
11 changes: 11 additions & 0 deletions lib/simpletest/portfolio_testclass.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,21 @@ public function get_filesize() {
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;
Expand Down
15 changes: 15 additions & 0 deletions mod/assignment/simpletest/test_assignment_portfolio_callers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@
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;
Expand Down Expand Up @@ -52,5 +66,6 @@ public function test_caller_sha1() {
public function test_caller_with_plugins() {
parent::test_caller_with_plugins();
}
*/
}

15 changes: 14 additions & 1 deletion mod/chat/simpletest/test_chat_portfolio_callers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
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');
Expand Down Expand Up @@ -43,4 +56,4 @@ public function test_caller_with_plugins() {
parent::test_caller_with_plugins();
}
}

*/
15 changes: 14 additions & 1 deletion mod/data/simpletest/test_data_portfolio_callers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
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');
Expand Down Expand Up @@ -70,4 +83,4 @@ public function test_caller_with_plugins() {
parent::test_caller_with_plugins();
}
}

*/
15 changes: 14 additions & 1 deletion mod/forum/simpletest/test_forum_portfolio_callers.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
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');
Expand Down Expand Up @@ -96,4 +109,4 @@ public function test_caller_with_plugins() {
parent::test_caller_with_plugins();
}
}

*/
14 changes: 14 additions & 0 deletions mod/glossary/simpletest/test_glossary_portfolio_callers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
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');
Expand Down Expand Up @@ -59,4 +72,5 @@ public function test_caller_with_plugins() {
parent::test_caller_with_plugins();
}
}
*/

14 changes: 14 additions & 0 deletions portfolio/boxnet/simpletest/testportfoliopluginboxnet.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
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'));
Expand Down Expand Up @@ -56,4 +69,5 @@ public function test_something() {
$this->assertTrue($this->plugin->send_package());
}
}
*/

19 changes: 16 additions & 3 deletions portfolio/download/simpletest/testportfolioplugindownload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 702a206

Please sign in to comment.