MDL-69700 tests: clarify expected exceptions in unit tests.

Resolves some leftovers from MDL-67673, see d95c3787.
This commit is contained in:
Paul Holden 2021-12-01 12:54:32 +00:00
parent 541d999d27
commit 892fa580b2
2 changed files with 6 additions and 11 deletions

View File

@ -826,12 +826,10 @@ class core_competency_external_testcase extends externallib_advanced_testcase {
'competencyframeworkid' => $framework->id,
'sortorder' => 0
);
// TODO: MDL-69700 - Analyse if the throw exception is happening
// in the correct place and decide what happens with the trailing
// code that is never executed.
$this->expectException(invalid_parameter_exception::class);
$this->expectExceptionMessage('Invalid external api parameter');
$result = external::create_competency($competency);
$result = (object) external_api::clean_returnvalue(external::create_competency_returns(), $result);
}
/**

View File

@ -103,20 +103,17 @@ class core_exporter_testcase extends advanced_testcase {
$exporter = new core_testable_exporter($this->invaliddata, $this->validrelated);
$output = $PAGE->get_renderer('core');
// The exception message is a bit misleading, it actually indicates an expected property wasn't found.
$this->expectException(coding_exception::class);
$this->expectExceptionMessage('Unexpected property stringAformat');
$result = $exporter->export($output);
}
public function test_invalid_related() {
global $PAGE;
// TODO: MDL-69700 - Analyse if the throw exception is happening
// in the correct place and decide what happens with the trailing
// code that is never executed.
$this->expectException(coding_exception::class);
$this->expectExceptionMessage('Exporter class is missing required related data: (core_testable_exporter) ' .
'simplestdClass => stdClass');
$exporter = new core_testable_exporter($this->validdata, $this->invalidrelated);
$output = $PAGE->get_renderer('core');
$result = $exporter->export($output);
}
public function test_invalid_related_all_cases() {