@@ -117,7 +117,6 @@ protected function load_question_data_by_name($name) {
117117
118118 public function test_restore_from_v3_1_2 (): void {
119119 global $ CFG ;
120-
121120 $ this ->restore_backup ($ CFG ->dirroot .
122121 '/question/type/coderunner/tests/fixtures/loadtesting_pseudocourse_backup_V3.1.2.mbz ' );
123122
@@ -133,17 +132,21 @@ public function test_restore_from_v3_1_2(): void {
133132
134133 public function test_restore_from_v4_5_3 (): void {
135134 global $ CFG ;
136-
137- $ this ->restore_backup ($ CFG ->dirroot .
138- '/question/type/coderunner/tests/fixtures/loadtesting_pseudocourse_backup_V4.5.3.mbz ' );
139-
140- // Verify some restored questions look OK.
141- [$ options , $ tests ] = $ this ->load_question_data_by_name ('c_to_fpy3 ' );
142- $ this ->assertCount (3 , $ tests );
143- $ this ->assertNull ($ options ->template );
144-
145- [$ options , $ tests ] = $ this ->load_question_data_by_name ('PROTOTYPE_clojure_with_combinator ' );
146- $ this ->assertCount (1 , $ tests );
147- $ this ->assertStringStartsWith ('import subprocess ' , $ options ->template );
135+ $ moodleversion = (float ) get_config ('core ' , 'release ' );
136+ if ($ moodleversion < 4.5 ) {
137+ $ this ->markTestSkipped ('This test requires Moodle 4.5.3 or later. ' );
138+ } else {
139+ $ this ->restore_backup ($ CFG ->dirroot .
140+ '/question/type/coderunner/tests/fixtures/loadtesting_pseudocourse_backup_V4.5.3.mbz ' );
141+
142+ // Verify some restored questions look OK.
143+ [$ options , $ tests ] = $ this ->load_question_data_by_name ('c_to_fpy3 ' );
144+ $ this ->assertCount (3 , $ tests );
145+ $ this ->assertNull ($ options ->template );
146+
147+ [$ options , $ tests ] = $ this ->load_question_data_by_name ('PROTOTYPE_clojure_with_combinator ' );
148+ $ this ->assertCount (1 , $ tests );
149+ $ this ->assertStringStartsWith ('import subprocess ' , $ options ->template );
150+ }
148151 }
149152}
0 commit comments