I found a bug, as you've seen too, that when updating the modules $this->cmid would be set instead of $this->relativecoursemodule - The main problem there was that if it was possible for an activity to rely on a non-existing activity, it would throw an error, cause it could not find the course module. But that is now fixed with your latest update.
How to replicate current error I'm still experiencing;
Create a courses (C1)
Create 2 activities in C1 (A1 & A2)
2.1. Give A2 a restrict access on A1 using "After completion of activity"
Backup course C1 only with the activity A2
Restore course as a new course
This should throw an error, since the course module should have a valid id. This PR should fix that problem, and instead of an error just shows the activity as missing.
I've hereto updated tests to test on all the 7 different cases that can happen, hereto for their debug string. Also updated a test, that had no assertions.
Hello @ewallah
I found a bug, as you've seen too, that when updating the modules $this->cmid would be set instead of $this->relativecoursemodule - The main problem there was that if it was possible for an activity to rely on a non-existing activity, it would throw an error, cause it could not find the course module. But that is now fixed with your latest update.
How to replicate current error I'm still experiencing;
This should throw an error, since the course module should have a valid id. This PR should fix that problem, and instead of an error just shows the activity as missing.
I've hereto updated tests to test on all the 7 different cases that can happen, hereto for their debug string. Also updated a test, that had no assertions.
Thank you for looking at this!
Kind regards, Anders Rasmussen