Unit tests screws up other unit test

Issue #221 resolved
Philipp Memmel created an issue

The format_tiles_course_format_options_test has a data provider restore_from_old_format_mbz_provider

This provider restores backup files which is not allowed, see https://docs.moodle.org/dev/Writing_PHPUnit_tests#Make_use_of_the_dataProvider_functionality, I citate: “Data providers must not instantiate/create data. Just define it. And then, the test body can proceed with the instantiation/creation. The dataProvider is called after the testSuite is instantiated, but before any tests are run. Each test will run a full setUp and tearDown, which will destroy any data which was created.”

This fact screws up other unit tests, because there are for example adhoc tasks left from course restore.

Please fix and move the restoring of the courses into real test functions which can cleanup after themselves with $this->resetAfterTest();

Comments (1)

  1. Log in to comment