mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Unit tests MDL-24980 Initial fix (no fully working yet) for portfolioaddbutton test
This commit is contained in:
parent
f7fcf4cd47
commit
fc2b6316f1
1 changed files with 20 additions and 2 deletions
|
@ -37,17 +37,35 @@ if (!defined('MOODLE_INTERNAL')) {
|
|||
|
||||
require_once($CFG->libdir . '/portfoliolib.php');
|
||||
|
||||
class portfoliolibaddbutton_test extends FakeDBUnitTestCase {
|
||||
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
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
$this->assertEqual(2, count($button->get_formats()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue