public function prompt_save_name() { if ($this->file_name != null) { return; } // Prompt to save a file when running a test $save_name = null; if ($env = pts_client::read_env('TEST_RESULTS_NAME')) { $save_name = $env; //echo 'Saving Results To: ' . $proposed_name . PHP_EOL; } if (!$this->batch_mode || $this->batch_mode['PromptSaveName']) { $is_reserved_word = false; // Be of help to the user by showing recently saved test results if ($save_name == null) { pts_tests::recently_saved_results(); } $save_name_length = strlen($save_name); while (empty($save_name) || ($is_reserved_word = pts_types::is_test_or_suite($save_name)) || $save_name_length > 126) { if ($is_reserved_word) { echo PHP_EOL . 'The name of the saved file cannot be the same as a test/suite: ' . $save_name . PHP_EOL; $is_reserved_word = false; } if ($save_name_length > 126) { echo PHP_EOL . 'The name of the saved file must have between 2 and 126 characters in length.' . PHP_EOL; } pts_client::$display->generic_prompt('Enter a name to save these results under: '); $save_name = pts_user_io::read_user_input(); } } $this->set_save_name($save_name); }