MDL-67673 phpunit: Remove expectedException annotations

While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

The annotations `@expectedException`, `@expectedExceptionCode`,
`@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp`
are now deprecated.
Using these annotations will trigger a deprecation warning
in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.

Also, all uses of expectExceptionMessageRegExp() has been moved
to expectExceptionMessageMatches(). See https://github.com/sebastianbergmann/phpunit/issues/3957

TODO: Various weirdness found while doing the changes with these tests:
- vendor/bin/phpunit lib/tests/exporter_test.php (created MDL-69700)
- vendor/bin/phpunit competency/tests/external_test.php (same issue than prev one)
- vendor/bin/phpunit question/engine/tests/questionengine_test.php (created MDL-69624)
- vendor/bin/phpunit lib/tests/event_test.php (created MDL-69688)
This commit is contained in:
Eloy Lafuente (stronk7)
2020-10-21 12:46:05 +02:00
parent 0ae27225f5
commit ddf72dd60d
59 changed files with 345 additions and 633 deletions
+1 -3
View File
@@ -111,14 +111,12 @@ class core_update_code_manager_testcase extends advanced_testcase {
$files = $codeman->unzip_plugin_file($zipfilepath, $targetdir, 'bar');
}
/**
* @expectedException moodle_exception
*/
public function test_unzip_plugin_file_multidir() {
$codeman = new \core\update\testable_code_manager();
$zipfilepath = __DIR__.'/fixtures/update_validator/zips/multidir.zip';
$targetdir = make_request_directory();
// Attempting to rename the root folder if there are multiple ones should lead to exception.
$this->expectException(moodle_exception::class);
$files = $codeman->unzip_plugin_file($zipfilepath, $targetdir, 'foo');
}