Affects Version/s: 3.10, 4.0
Fix Version/s: None
Component/s: Unit tests
Affected Branches:MOODLE_310_STABLE, MOODLE_400_STABLE
The test_invalid_related() unit test throws the coding exception when instantiating the core_testable_exporter:
Still the unit test has more code following and that's misleading because that code is never executed.
This issue is about to decide if the exception is being thrown in correct place and the trailing code can be removed... of if the test is bogus and the exception should happen later.
To reproduce it:
1. Edit lib/tests/exporter_test.php
2. Go to test_invalid_related()
3. Comment out the $this->expectException(coding_exception::class); line
4. Run $ vendor/bin/phpunit --filter ::test_invalid_related
5. See where the exception happens and analyse what happens with the trailing code in the method.
Exactly the same case than the above one, the exception happens when the competency is created, and there is trailing code, never executed. Decide if the exception is happening in correct place and the trailing code can be safely removed.
To reproduce, similar to the reproduction steps above... comment the $this->expectException line and run the test ($ vendor/bin/phpunit --filter ::test_create_competency_with_nasty_data).