@@ -52,7 +52,7 @@ final class question_test extends \advanced_testcase {
5252 * tests will be skipped
5353 * @var bool
5454 */
55- protected int $ islive ;
55+ protected bool $ islive = false ;
5656
5757 /**
5858 * Config.php should include the apikey and orgid in the form
@@ -74,6 +74,7 @@ protected function setUp(): void {
7474 * Make a trivial request to the LLM to check the code works
7575 * Only designed to test the 4.5 subsystem when run locally
7676 * not when in GHA ci
77+ *
7778 * @covers \qtype_aitext\question::perform_request
7879 * @return void
7980 */
@@ -111,6 +112,9 @@ public function test_get_question_summary(): void {
111112 */
112113 public function test_build_full_ai_prompt (): void {
113114 $ this ->resetAfterTest ();
115+ if (!$ this ->islive ) {
116+ $ this ->markTestSkipped ('No live connection to the AI system ' );
117+ }
114118
115119 $ question = qtype_aitext_test_helper::make_aitext_question ([]);
116120 set_config ('prompt ' , 'in [responsetext] ' , 'qtype_aitext ' );
@@ -119,6 +123,9 @@ public function test_build_full_ai_prompt(): void {
119123 set_config ('jsonprompt ' , 'testprompt ' , 'qtype_aitext ' );
120124
121125 $ response = '<p> Thank you </p> ' ;
126+ $ aiprompt = '' ;
127+ $ defaultmark = '' ;
128+ $ markscheme = '' ;
122129 $ result = $ question ->build_full_ai_prompt ($ response , $ aiprompt , $ defaultmark , $ markscheme );
123130
124131 $ this ->assertStringContainsString ('[[ Thank you ]] ' , $ result );
@@ -277,4 +284,4 @@ public function test_is_same_response_with_template(): void {
277284 ['answer ' => '0 ' ]));
278285 }
279286
280- }
287+ }
0 commit comments