MDL-81698 phpunit: Uncomment some tests and make them skipped

There are a few tests in core that are commented since the
beginning. That's not useful at all, so with this commit we
are un-commenting them instead.

Note that this is an initial step to have them back with skipped
outcome. Later in this issue we'll decide about to keep them or
completely remove them (each test can have a different outcome).
This commit is contained in:
Eloy Lafuente (stronk7) 2024-04-26 11:54:54 +02:00
parent 3e486ad9ca
commit 6fe0e66d06
No known key found for this signature in database
GPG Key ID: 53487A05E6228820
3 changed files with 48 additions and 46 deletions

View File

@ -126,11 +126,10 @@ class grade_grade_test extends \grade_base_testcase {
$this->assertEquals(40, \grade_grade::standardise_score(50, 30, 80, 0, 100));
}
/*
* Disabling this test: the set_locked() arguments have been modified, rendering these tests useless until they are re-written
protected function test_grade_grade_set_locked() {
public function test_grade_grade_set_locked() {
// Skip this test because set_locked() arguments have been modified, rendering these tests
// useless until they are re-written. Note this comes from MDL-32323 (2012!).
$this->markTestSkipped('Useless set_locked() tests until they are re-written');
$grade_item = new \grade_item($this->grade_items[0]);
$grade = new \grade_grade($grade_item->get_final(1));
$this->assertTrue(method_exists($grade, 'set_locked'));
@ -154,7 +153,6 @@ class grade_grade_test extends \grade_base_testcase {
$this->assertTrue($grade->set_locked(true, false));
}
*/
protected function sub_test_grade_grade_is_locked() {
$grade = new \grade_grade($this->grade_grades[0], false);

View File

@ -223,43 +223,50 @@ STRING;
];
}
// Uncomment following tests to see logging of unexpected changes in global state and database.
/*
public function test_db_modification() {
global $DB;
$DB->set_field('user', 'confirmed', 1, array('id'=>-1));
}
// The following tests are only useful when modifying the reset code and need to check tha
// changes in global state are being properly detected. Hence, they are skipped by default.
// To run them, remove the markTestSkipped() call when working in that area.
public function test_cfg_modification() {
global $CFG;
$CFG->xx = 'yy';
unset($CFG->admin);
$CFG->rolesactive = 0;
}
public function test_db_modification() {
global $DB;
$this->markTestSkipped('This test is only useful to confirm that the reset stuff works as expected.');
$DB->set_field('user', 'confirmed', 1, ['id' => -1]);
}
public function test_user_modification() {
global $USER;
$USER->id = 10;
}
public function test_cfg_modification() {
global $CFG;
$this->markTestSkipped('This test is only useful to confirm that the reset stuff works as expected.');
$CFG->xx = 'yy';
unset($CFG->admin);
$CFG->rolesactive = 0;
}
public function test_course_modification() {
global $COURSE;
$COURSE->id = 10;
}
public function test_user_modification() {
global $USER;
$this->markTestSkipped('This test is only useful to confirm that the reset stuff works as expected.');
$USER->id = 10;
}
public function test_all_modifications() {
global $DB, $CFG, $USER, $COURSE;
$DB->set_field('user', 'confirmed', 1, array('id'=>-1));
$CFG->xx = 'yy';
unset($CFG->admin);
$CFG->rolesactive = 0;
$USER->id = 10;
$COURSE->id = 10;
}
public function test_course_modification() {
global $COURSE;
$this->markTestSkipped('This test is only useful to confirm that the reset stuff works as expected.');
$COURSE->id = 10;
}
public function test_transaction_problem() {
global $DB;
$DB->start_delegated_transaction();
}
*/
public function test_all_modifications() {
global $DB, $CFG, $USER, $COURSE;
$this->markTestSkipped('This test is only useful to confirm that the reset stuff works as expected.');
$DB->set_field('user', 'confirmed', 1, ['id' => -1]);
$CFG->xx = 'yy';
unset($CFG->admin);
$CFG->rolesactive = 0;
$USER->id = 10;
$COURSE->id = 10;
}
public function test_transaction_problem() {
global $DB;
$this->markTestSkipped('This test is only useful to confirm that the reset stuff works as expected.');
$DB->start_delegated_transaction();
}
}

View File

@ -1129,12 +1129,11 @@ class rtlcss_test extends basic_testcase {
* @param array $data the provider data.
* @dataProvider background_image_provider
*/
/* Not supported by MoodleHQ/RTLCSS yet.
public function test_background_image($data) {
$this->markTestSkipped('Not yet supported!');
$output = new OutputFormat();
$this->assert_sample($data, $output);
}
*/
/**
* Test background position.
@ -1197,14 +1196,13 @@ class rtlcss_test extends basic_testcase {
* @param array $data the provider data.
* @dataProvider special_provider
*/
/* Not supported by MoodleHQ/RTLCSS yet.
public function test_special($data) {
$this->markTestSkipped('Not yet supported!');
$output = new OutputFormat();
$output->set('SpaceBeforeRules', ' ');
$output->set('SpaceAfterListArgumentSeparator', array('default' => '', ',' => ' '));
$this->assert_sample($data, $output);
}
*/
/**
* Test transform original.
@ -1226,15 +1224,14 @@ class rtlcss_test extends basic_testcase {
* @param array $data the provider data.
* @dataProvider transforms_provider
*/
/* Not supported by MoodleHQ/RTLCSS yet.
public function test_transforms($data) {
$this->markTestSkipped('Not yet supported!');
$output = new OutputFormat();
$output->set('SpaceBeforeRules', ' ');
$output->set('SpaceAfterRules', ' ');
$output->set('SpaceAfterListArgumentSeparator', array('default' => '', ',' => ' '));
$this->assert_sample($data, $output);
}
*/
/**
* Test values n-syntax.