diff --git a/adminui/answertests.php b/adminui/answertests.php
index d1e0544957d..b1782365eff 100644
--- a/adminui/answertests.php
+++ b/adminui/answertests.php
@@ -21,6 +21,7 @@
* correctly, and second it serves to document the expected behaviour of answer
* tests, which is useful for learning how they work.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/adminui/cascacheview.php b/adminui/cascacheview.php
index 4fc5433869e..7d51028fc17 100644
--- a/adminui/cascacheview.php
+++ b/adminui/cascacheview.php
@@ -18,6 +18,7 @@
* This script lets the user see the latest commands stored to CAS
* cache as pretty printted presentations. This exists for debugging.
*
+ * @package qtype_stack
* @copyright 2019 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/adminui/caschat.php b/adminui/caschat.php
index 5f4408ca38e..cf2d573c300 100644
--- a/adminui/caschat.php
+++ b/adminui/caschat.php
@@ -19,6 +19,7 @@
* This can be useful for learning about the CAS syntax, and also for testing
* that maxima is working correctly.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/adminui/compiledquestion.php b/adminui/compiledquestion.php
index 573ea00b85f..e61ae38cef4 100644
--- a/adminui/compiledquestion.php
+++ b/adminui/compiledquestion.php
@@ -20,6 +20,7 @@
*
* This is for developers.
*
+ * @package qtype_stack
* @copyright 2022 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/adminui/dependencies.php b/adminui/dependencies.php
index c87f65fc578..9b43afb1ff9 100644
--- a/adminui/dependencies.php
+++ b/adminui/dependencies.php
@@ -22,6 +22,7 @@
* the whole logic in a fast way. Thus this does not work for questions
* that have not been compiled.
*
+ * @package qtype_stack
* @copyright 2022 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/adminui/equivdemo.php b/adminui/equivdemo.php
index 283962804d5..c730f0c3d26 100644
--- a/adminui/equivdemo.php
+++ b/adminui/equivdemo.php
@@ -15,6 +15,8 @@
// along with Stack. If not, see
Hello World
'; } diff --git a/classes/form/category_form.php b/classes/form/category_form.php index 40a3715eb51..a10847a728c 100644 --- a/classes/form/category_form.php +++ b/classes/form/category_form.php @@ -24,8 +24,10 @@ defined('MOODLE_INTERNAL') || die(); require_once("$CFG->libdir/formslib.php"); +// phpcs:ignore moodle.Commenting.MissingDocblock.Class class category_form extends moodleform { // Add elements to form. + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function definition() { $mform = $this->_form; $mform->disable_form_change_checker(); @@ -34,6 +36,7 @@ public function definition() { } // Custom validation should be added here. + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public function validation($data, $files) { return []; } diff --git a/classes/output/mobile.php b/classes/output/mobile.php index 04f3370e7b9..466eac7a82b 100644 --- a/classes/output/mobile.php +++ b/classes/output/mobile.php @@ -25,6 +25,7 @@ */ class mobile { + // phpcs:ignore moodle.Commenting.MissingDocblock.Function public static function stack_view() { global $CFG; return [ diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index a21c9d57671..607527361fe 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -27,6 +27,7 @@ /** * Privacy Subsystem for qtype_stack implementing null_provider. * + * @package qtype_stack * @copyright 2018 The University of Edinburgh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/cli/answertests_docs.php b/cli/answertests_docs.php index da36a97e748..24e67809ab1 100644 --- a/cli/answertests_docs.php +++ b/cli/answertests_docs.php @@ -14,6 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Stack. If not, seeThis script crawls the entire documentation and checks for dead links and other issues.
dirroot.'/question/type/stack/doc/en');
$a = report($docs);
diff --git a/edit_stack_form.php b/edit_stack_form.php
index ebd6303ee15..9b4cf945a06 100644
--- a/edit_stack_form.php
+++ b/edit_stack_form.php
@@ -34,6 +34,7 @@
/**
* Stack question editing form definition.
*
+ * @package qtype_stack
* @copyright 2012 The Open University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -72,7 +73,9 @@ class qtype_stack_edit_form extends question_edit_form {
/** @var array the set of choices used for the score mode of all PRT branches. */
protected $scoremodechoices;
- /** Patch up data from the database before a user edits it in the form. */
+ /**
+ * Patch up data from the database before a user edits it in the form.
+ */
public function set_data($question) {
if (!empty($question->questiontext)) {
$question->questiontext = $this->convert_legacy_fact_sheets($question->questiontext);
@@ -108,6 +111,7 @@ protected function convert_legacy_fact_sheets($text) {
}
/**
+ * Add description here.
* @return string the current value of the question text, given the state the form is in.
*/
protected function get_current_question_text() {
@@ -130,6 +134,7 @@ protected function get_current_question_text() {
}
/**
+ * Add description here.
* @return string the current value of the specific feedback, given the state the form is in.
*/
protected function get_current_specific_feedback() {
@@ -149,6 +154,7 @@ protected function get_current_specific_feedback() {
return $this->specificfeedback;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function definition() {
parent::definition();
$mform = $this->_form;
@@ -166,6 +172,7 @@ protected function definition() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function definition_inner(/* MoodleQuickForm */ $mform) {
global $OUTPUT;
@@ -227,7 +234,6 @@ protected function definition_inner(/* MoodleQuickForm */ $mform) {
/* Check if we have a new question. */
if (isset($this->question->id)) {
- //var_dump($this->question);die();
$out = stack_string('runquestiontests');
if (empty($this->question->deployedseeds) &&
qtype_stack_question::random_variants_check($this->question->options->questionvariables)) {
@@ -414,7 +420,9 @@ protected function definition_inner(/* MoodleQuickForm */ $mform) {
stack_string('stackBlock_geogebra_heading'));
$mform->insertElementBefore($geogebraheading, 'questiontext');
- // Add function to get GeoGebra material_ids in STACK questiontext.
+ /**
+ * Add function to get GeoGebra material_ids in STACK questiontext.
+ */
function get_geogebra_material_ids($str) {
$start = "material_id:\"";
$end = "\"";
@@ -728,6 +736,7 @@ protected function definition_prt_node($prtname, $name, $nextnodechoices, $delet
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function data_preprocessing($question) {
$question = parent::data_preprocessing($question);
$question = $this->data_preprocessing_options($question);
@@ -921,6 +930,7 @@ protected function prepare_text_field($field, $text, $format, $itemid, $filearea
return $data;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validation($fromform, $files) {
$errors = parent::validation($fromform, $files);
@@ -928,6 +938,7 @@ public function validation($fromform, $files) {
return $qtype->validate_fromform($fromform, $errors);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function qtype() {
return 'stack';
}
diff --git a/exportone.php b/exportone.php
index 7664bbba5f4..f8d4ff5239c 100644
--- a/exportone.php
+++ b/exportone.php
@@ -17,13 +17,16 @@
/**
* Script to download the export of a single STACK question.
*
+ * @package qtype_stack
+ * @copyright 2015 the Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
* TO-DO: Since MDL-63738 landed in Moodle 3.6, this has been a core Moodle
* feature, so we don't really need to keep mainaining this file. We could
* use question/exportone.php, or question/bank/exporttoxml/exportone.php,
* as it later became, instead.
- *
- * @copyright 2015 the Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__.'/../../../config.php');
diff --git a/lang/de/qtype_stack.php b/lang/de/qtype_stack.php
index e3dd1466af6..201fa6ad41b 100644
--- a/lang/de/qtype_stack.php
+++ b/lang/de/qtype_stack.php
@@ -24,7 +24,8 @@
*/
defined('MOODLE_INTERNAL') || die();
-
+// phpcs:disable moodle.Files.LangFilesOrdering.IncorrectOrder
+// phpcs:disable moodle.Files.LangFilesOrdering.UnexpectedComment
$string['ATAlgEquiv_SA_not_equation'] = 'Ihre Anwort sollte eine Gleichung sein, ist es aber nicht.';
$string['ATAlgEquiv_SA_not_expression'] = 'Ihre Antwort sollte ein Ausdruck und keine Gleichung/Ungleichung/Liste/Menge/Matrix sein.';
$string['ATAlgEquiv_SA_not_function'] = 'Ihre Antwort sollte eine Funktion sein, die durch den Operator := definiert wird. Sie ist es aber nicht.';
diff --git a/lang/en/qtype_stack.php b/lang/en/qtype_stack.php
index 9b428830500..ea2d30f5ae5 100644
--- a/lang/en/qtype_stack.php
+++ b/lang/en/qtype_stack.php
@@ -21,7 +21,8 @@
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
+// phpcs:disable moodle.Files.LangFilesOrdering.IncorrectOrder
+// phpcs:disable moodle.Files.LangFilesOrdering.UnexpectedComment
$string['pluginname'] = 'STACK';
$string['pluginname_help'] = 'STACK is an assessment system for mathematics.';
$string['pluginnameadding'] = 'Adding a STACK question';
@@ -317,9 +318,8 @@
$string['questionwarnings'] = 'Question warnings';
$string['questionwarnings_help'] = 'Question warnings are issues you might want to address, but which are not outright errors.';
$string['questiontext'] = 'Question text';
-// @codingStandardsIgnoreStart
+// phpcs:ignore
$string['questiontext_help'] = 'The question text is CASText. This is the "question" which the student actually sees. You must put input elements, and the validation strings, in this field, and only in this field. For example, using `[[input:ans1]] [[validation:ans1]]`.';
-// @codingStandardsIgnoreEnd
$string['questiontext_link'] = '%%WWWROOT%%/question/type/stack/doc/doc.php/Authoring/CASText.md#question_text';
$string['questiontextnonempty'] = 'The question text must be non-empty.';
$string['questiontextmustcontain'] = 'The question text must contain the token \'{$a}\'.';
diff --git a/lang/multilang.php b/lang/multilang.php
index 26ad63ae3b6..270819d7161 100644
--- a/lang/multilang.php
+++ b/lang/multilang.php
@@ -27,10 +27,11 @@
require_once(__DIR__ . '/../stack/cas/castext2/utils.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_multilang {
- /*
- * Variable to hold the current language.
+ /**
+ * @var string Variable to hold the current language.
*/
private $lang = 'en';
@@ -40,11 +41,14 @@ class stack_multilang {
protected static $parentcache = [];
// Note, we only support the new style language tags. For more information see Moodle's filter/multilang.php class.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $search = '/(.*?<\/span>)+/is';
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $searchtosplit = '/<(?:lang|span)[^>]+lang="([a-zA-Z0-9_-]+)"[^>]*>(.*?)<\/(?:lang|span)>/is';
// The search pattern as seen in filter/multilang2.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $search2 =
'/{\s*mlang\s+( # Look for the leading {mlang
(?:[a-z0-9_-]+) # At least one language must be present
@@ -56,7 +60,7 @@ class stack_multilang {
{\s*mlang\s*} # And look for the trailing {mlang}.
/isx';
- /*
+ /**
* Filter text for the specified language.
*/
public function filter($text, $lang) {
@@ -134,6 +138,7 @@ function ($matches) {
return $text;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function filter_multilang_impl($langblock) {
$mylang = $this->lang;
@@ -165,6 +170,7 @@ private function filter_multilang_impl($langblock) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function filter_multilang2_impl($langblock) {
// Note that this is pretty much perfect clone of the original.
$blocklangs = explode(',', str_replace(' ', '', str_replace('-', '_', strtolower($langblock[1]))));
@@ -180,7 +186,7 @@ private function filter_multilang2_impl($langblock) {
return '';
}
- /*
+ /**
* Return those languages _explicitly_ found in the text.
*/
public function languages_used($langblock) {
@@ -189,7 +195,7 @@ public function languages_used($langblock) {
}
- /*
+ /**
* Consolidate all the text inside langage blocks.
*/
public function consolidate_languages($text) {
@@ -212,7 +218,7 @@ public function consolidate_languages($text) {
return implode("\n", $filtered);
}
- /*
+ /**
* Check for non-trivial content.
*/
public function non_trivial_content_for_check($text) {
@@ -224,7 +230,7 @@ public function non_trivial_content_for_check($text) {
return true;
}
- /*
+ /**
* Identify used filter. We know of a few tools that are used for this.
* Will return the first matching in this list, we do not deal with mixed ones.
* 0 for no match
@@ -298,7 +304,7 @@ function ($matches) use (&$gotlangs) {
return [0, []];
}
- /*
+ /**
* Select the best language match from a list.
* Note this is one of those functions that will need to be tuned in othe VLEs.
*/
diff --git a/locallib.php b/locallib.php
index a39e74685c4..62b54c23f53 100644
--- a/locallib.php
+++ b/locallib.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/stack/mathsoutput/mathsoutput.class.php');
@@ -22,6 +29,7 @@
* Base class for all the types of exception we throw.
*/
class stack_exception extends moodle_exception {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($error) {
parent::__construct('exceptionmessage', 'qtype_stack', '', $error);
}
@@ -164,6 +172,7 @@ function stack_maxima_translate($rawfeedback) {
}
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Function
function stack_maxima_format_casstring($str) {
// Santise the output, E.g. '>' -> '>'.
$str = stack_string_sanitise($str);
@@ -173,6 +182,7 @@ function stack_maxima_format_casstring($str) {
return html_writer::tag('span', $str, ['class' => 'stacksyntaxexample']);
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Function
function stack_string_sanitise($str) {
// Students may not input strings containing specific LaTeX
// i.e. no math-modes due to us being unable to decide if
@@ -241,11 +251,13 @@ function qtype_stack_setup_question_test_page($question) {
return [$context, $seed, $urlparams];
}
-/* This class is needed to ignore requests for pluginfile rewrites in the bulk tester
+/**
+ * This class is needed to ignore requests for pluginfile rewrites in the bulk tester
* and possibly elsewhere, e.g. API.
*/
class stack_outofcontext_process {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct() {
}
diff --git a/plot.php b/plot.php
index bb06ac512c8..8c8fad6e247 100644
--- a/plot.php
+++ b/plot.php
@@ -17,6 +17,7 @@
/**
* This script serves plot files that have been saved in the moodledata folder.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/question.php b/question.php
index 7afa4cda5ee..108617c7e5c 100644
--- a/question.php
+++ b/question.php
@@ -44,6 +44,7 @@
/**
* Represents a Stack question.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -278,6 +279,7 @@ protected function validate_cache($response, $acceptvalid = null) {
}
/**
+ * Add description here.
* @return bool do any of the inputs in this question require the student
* validate the input.
*/
@@ -290,6 +292,7 @@ protected function any_inputs_require_validation() {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function make_behaviour(question_attempt $qa, $preferredbehaviour) {
if (empty($this->inputs)) {
return question_engine::make_behaviour('informationitem', $qa, $preferredbehaviour);
@@ -322,6 +325,7 @@ public function make_behaviour(question_attempt $qa, $preferredbehaviour) {
return parent::make_behaviour($qa, $preferredbehaviour);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function start_attempt(question_attempt_step $step, $variant) {
// @codingStandardsIgnoreStart
// Work out the right seed to use.
@@ -535,6 +539,7 @@ public function initialise_question_from_seed() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function apply_attempt_state(question_attempt_step $step) {
$this->seed = (int) $step->get_qt_var('_seed');
$this->initialise_question_from_seed();
@@ -717,6 +722,7 @@ public function format_correct_response($qa) {
return stack_ouput_castext($feedback);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_expected_data() {
$expected = ['step_lang' => 'raw'];
foreach ($this->inputs as $input) {
@@ -725,6 +731,7 @@ public function get_expected_data() {
return $expected;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_question_summary() {
$processor = new castext2_qa_processor(new stack_outofcontext_process());
if ($this->questionnoteinstantiated !== null &&
@@ -734,6 +741,7 @@ public function get_question_summary() {
return stack_string('questionnote_missing');
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_question_todos() {
$hastodos = false;
$tags = [];
@@ -754,6 +762,7 @@ public function get_question_todos() {
return [$hastodos, $tags];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function summarise_response(array $response) {
// Provide seed information on student's version via the normal moodle quiz report.
$bits = ['Seed: ' . $this->seed];
@@ -789,6 +798,7 @@ public function summarise_response(array $response) {
}
// Used in reporting - needs to return an array.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function summarise_response_data(array $response) {
$bits = [];
foreach ($this->inputs as $name => $input) {
@@ -798,6 +808,7 @@ public function summarise_response_data(array $response) {
return $bits;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_correct_response() {
$teacheranswer = [];
if ($this->runtimeerrors || $this->get_cached('units') === null) {
@@ -810,7 +821,7 @@ public function get_correct_response() {
return $teacheranswer;
}
- /*
+ /**
* This function returns an array of values for inputs which could be typed into Maxima.
* Used in the caschat function as possible input values.
*/
@@ -825,6 +836,7 @@ public function get_correct_response_testcase() {
return $teacheranswer;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_same_response(array $prevresponse, array $newresponse) {
foreach ($this->get_expected_data() as $name => $notused) {
if (!question_utils::arrays_same_at_key_missing_is_blank(
@@ -835,6 +847,7 @@ public function is_same_response(array $prevresponse, array $newresponse) {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_same_response_for_part($index, array $prevresponse, array $newresponse) {
$previnput = $this->get_prt_input($index, $prevresponse, true);
$newinput = $this->get_prt_input($index, $newresponse, true);
@@ -884,6 +897,7 @@ public function get_input_state($name, $response, $rawinput=false) {
}
/**
+ * Add description here
* @param array $response the current response being processed.
* @return boolean whether any of the inputs are blank.
*/
@@ -896,6 +910,7 @@ public function is_any_input_blank(array $response) {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_any_part_invalid(array $response) {
// Invalid if any input is invalid, ...
foreach ($this->inputs as $name => $input) {
@@ -915,6 +930,7 @@ public function is_any_part_invalid(array $response) {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_complete_response(array $response) {
// If all PRTs are gradable, then the question is complete. Optional inputs may be blank.
@@ -937,6 +953,7 @@ public function is_complete_response(array $response) {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_gradable_response(array $response) {
// Manually graded answers are always gradable.
if (!empty($this->inputs)) {
@@ -968,6 +985,7 @@ public function is_gradable_response(array $response) {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_validation_error(array $response) {
if ($this->is_any_part_invalid($response)) {
// There will already be a more specific validation error displayed.
@@ -981,6 +999,7 @@ public function get_validation_error(array $response) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function grade_response(array $response) {
$fraction = 0;
@@ -1001,6 +1020,7 @@ public function grade_response(array $response) {
return [$fraction, question_state::graded_state_for_fraction($fraction)];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function is_same_prt_input($index, $prtinput1, $prtinput2) {
foreach ($this->get_cached('required')[$this->prts[$index]->get_name()] as $name => $ignore) {
if (!question_utils::arrays_same_at_key_missing_is_blank($prtinput1, $prtinput2, $name)) {
@@ -1010,6 +1030,7 @@ protected function is_same_prt_input($index, $prtinput1, $prtinput2) {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_parts_and_weights() {
$weights = [];
foreach ($this->prts as $index => $prt) {
@@ -1020,6 +1041,7 @@ public function get_parts_and_weights() {
return $weights;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function grade_parts_that_can_be_graded(array $response, array $lastgradedresponses, $finalsubmit) {
$partresults = [];
@@ -1060,6 +1082,7 @@ public function grade_parts_that_can_be_graded(array $response, array $lastgrade
return $partresults;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compute_final_grade($responses, $totaltries) {
// This method is used by the interactive behaviour to compute the final
// grade after all the tries are done.
@@ -1349,6 +1372,7 @@ public function setup_fake_feedback_and_input_validation() {
}
/**
+ * Add description here.
* @return bool whether this question uses randomisation.
*/
public function has_random_variants() {
@@ -1356,6 +1380,7 @@ public function has_random_variants() {
}
/**
+ * Add description here
* @param string Input text (raw keyvals) to check for random functions, or use of stack_seed.
* @return bool Actual test of whether text uses randomisation.
*/
@@ -1364,6 +1389,7 @@ public static function random_variants_check($text) {
|| preg_match('~\bstack_seed~', $text);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_num_variants() {
if (!$this->has_random_variants()) {
// This question does not use randomisation. Only declare one variant.
@@ -1379,6 +1405,7 @@ public function get_num_variants() {
return 1000000;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_variants_selection_seed() {
if (!empty($this->variantsselectionseed)) {
return $this->variantsselectionseed;
@@ -1387,6 +1414,7 @@ public function get_variants_selection_seed() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) {
if ($component == 'qtype_stack' && $filearea == 'specificfeedback') {
// Specific feedback files only visibile when the feedback is.
@@ -1410,10 +1438,12 @@ public function check_file_access($qa, $options, $component, $filearea, $args, $
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_context() {
return context::instance_by_id($this->contextid);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function has_question_capability($type) {
global $USER;
$context = $this->get_context();
@@ -1421,7 +1451,8 @@ protected function has_question_capability($type) {
($USER->id == $this->createdby && has_capability("moodle/question:{$type}mine", $context));
}
- /* Get the values of all variables which have a key. So, function definitions
+ /**
+ * Get the values of all variables which have a key. So, function definitions
* and assignments are ignored by this method. Used to display the values of
* variables used in a question variant. Beware that some functions have side
* effects in Maxima, e.g. orderless. If you use these values you may not get
@@ -1483,6 +1514,7 @@ public function get_ta_render_for_input(string $vname): string {
return '';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function classify_response(array $response) {
$classification = [];
@@ -1657,7 +1689,7 @@ public function validate_against_stackversion($context) {
return implode(' ', $errors);
}
- /*
+ /**
* Unfortunately, "errors" stop a question being saved. So, we have a parallel warning mechanism.
* Warnings need to be addressed but should not stop a question being saved.
*/
diff --git a/questiondisplayoptions.php b/questiondisplayoptions.php
index ba085bfded8..63acd5883d8 100644
--- a/questiondisplayoptions.php
+++ b/questiondisplayoptions.php
@@ -24,5 +24,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_stack_question_display_options extends question_display_options {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $suppressruntestslink = false;
}
diff --git a/questiontestdelete.php b/questiontestdelete.php
index 52007fb4ea7..289e64eee7b 100644
--- a/questiontestdelete.php
+++ b/questiontestdelete.php
@@ -17,6 +17,7 @@
/**
* This script lets the user delete a question test for a question, after confirmation.
*
+ * @package qtype_stack
* @copyright 2012 the Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/questiontestedit.php b/questiontestedit.php
index dde9768e9ab..edf33855567 100644
--- a/questiontestedit.php
+++ b/questiontestedit.php
@@ -17,6 +17,7 @@
/**
* This script lets the user create or edit question tests for a question.
*
+ * @package qtype_stack
* @copyright 2012 the Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/questiontestform.php b/questiontestform.php
index cd9867d4654..d2b43c7f4e4 100644
--- a/questiontestform.php
+++ b/questiontestform.php
@@ -17,6 +17,7 @@
/**
* This file defines the editing form for editing question tests.
*
+ * @package qtype_stack
* @copyright 2012 the Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -30,10 +31,12 @@
/**
* The editing form for editing STACK question tests.
*
+ * @package qtype_stack
* @copyright 2012 the Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_stack_question_test_form extends moodleform {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function definition() {
$mform = $this->_form;
@@ -81,6 +84,7 @@ protected function definition() {
$this->add_action_buttons(true, $this->_customdata['submitlabel']);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function definition_after_data() {
if ($this->_form->exportValue('complete')) {
$this->complete_passing_testcase();
@@ -90,6 +94,7 @@ public function definition_after_data() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function complete_passing_testcase() {
$mform = $this->_form;
@@ -119,6 +124,7 @@ protected function complete_passing_testcase() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function complete_teacher_testcase() {
$mform = $this->_form;
@@ -131,6 +137,7 @@ protected function complete_teacher_testcase() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validation($data, $files) {
$errors = parent::validation($data, $files);
diff --git a/questiontestreport.php b/questiontestreport.php
index 01ed4694368..a239a1183d7 100644
--- a/questiontestreport.php
+++ b/questiontestreport.php
@@ -21,6 +21,7 @@
* re-generate reports. The script is designed to let a question author improve feedback
* and assessment by looking at what students type, easily and without going through a quiz report.
*
+ * @package qtype_stack
* @copyright 2020 the University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/questiontestrun.php b/questiontestrun.php
index 678213ff3b3..d7dc2efec66 100644
--- a/questiontestrun.php
+++ b/questiontestrun.php
@@ -27,6 +27,7 @@
* The script takes one parameter id which is a questionid as a parameter.
* In can optionally also take a random seed.
*
+ * @package qtype_stack
* @copyright 2012 the Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -333,6 +334,7 @@
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
function sort_by_note($a1, $b1) {
$a = $a1['1'];
$b = $b1['1'];
diff --git a/questiontype.php b/questiontype.php
index c309f9a00f6..96d9abc2fb7 100644
--- a/questiontype.php
+++ b/questiontype.php
@@ -43,6 +43,7 @@
/**
* Stack question type class.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -65,6 +66,7 @@ class qtype_stack extends question_type {
*/
protected $prtgraph = [];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function save_question($question, $fromform) {
if (!empty($fromform->fixdollars)) {
@@ -118,6 +120,7 @@ protected function fix_dollars_in_form_data($fromform) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function save_question_options($fromform) {
global $DB;
$context = $fromform->context;
@@ -404,6 +407,7 @@ public function save_question_options($fromform) {
'questionid = :questionid AND prtname ' . $nametest, $params);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_question_options($question) {
global $DB;
@@ -438,6 +442,7 @@ public function get_question_options($question) {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function get_question_deployed_seeds($qid) {
global $DB;
@@ -448,6 +453,7 @@ protected function get_question_deployed_seeds($qid) {
ORDER BY id', [$qid]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function initialise_question_instance(question_definition $question, $questiondata) {
parent::initialise_question_instance($question, $questiondata);
@@ -613,6 +619,7 @@ public function get_tidy_question_url($question) {
return new moodle_url('/question/type/stack/tidyquestion.php', $linkparams);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_extra_question_bank_actions(stdClass $question): array {
$actions = parent::get_extra_question_bank_actions($question);
@@ -637,6 +644,7 @@ public function get_extra_question_bank_actions(stdClass $question): array {
return $actions;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function delete_question($questionid, $contextid) {
global $DB;
$this->delete_question_tests($questionid);
@@ -648,6 +656,7 @@ public function delete_question($questionid, $contextid) {
parent::delete_question($questionid, $contextid);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function move_files($questionid, $oldcontextid, $newcontextid) {
global $DB;
$fs = get_file_storage();
@@ -677,6 +686,7 @@ public function move_files($questionid, $oldcontextid, $newcontextid) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function delete_files($questionid, $contextid) {
global $DB;
$fs = get_file_storage();
@@ -1163,6 +1173,7 @@ public function delete_question_test($questionid, $testcase) {
$transaction->allow_commit();
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_possible_responses($questiondata) {
$parts = [];
@@ -1209,6 +1220,7 @@ protected function export_xml_text(qformat_xml $format, $tag, $text, $textformat
return $output;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function export_to_xml($questiondata, qformat_xml $format, $notused = null) {
$contextid = $questiondata->contextid;
@@ -1346,6 +1358,7 @@ public function export_to_xml($questiondata, qformat_xml $format, $notused = nul
return $output;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function import_from_xml($xml, $fromform, qformat_xml $format, $notused = null) {
if (!isset($xml['@']['type']) || $xml['@']['type'] != $this->name()) {
return false;
@@ -1580,7 +1593,7 @@ protected function import_xml_qtest($xml, qformat_xml $format) {
return [$number, $testcase];
}
- /*
+ /**
* This method takes Moodle's "fromform" data type and validates the question. All question level validation and warnings
* should be in this method.
* Much of this code was in edit_stack_form.php (until Jan 2018).
@@ -2284,6 +2297,7 @@ public function get_input_names_from_question_text($questiontext) {
return($this->get_input_names_from_question_text_lang($ml->filter($questiontext, $lang)));
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function get_input_names_from_question_text_lang($questiontext) {
$inputs = stack_utils::extract_placeholders($questiontext, 'input');
$validations = stack_utils::extract_placeholders($questiontext, 'validation');
@@ -2332,6 +2346,7 @@ public function get_prt_names_from_question($questiontext, $specificfeedback) {
return($this->get_prt_names_from_question_lang($ml->filter($questiontext.$specificfeedback, $lang)));
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function get_prt_names_from_question_lang($text) {
$prts = stack_utils::extract_placeholders($text, 'feedback');
$prtnames = [];
diff --git a/renderer.php b/renderer.php
index e83806e6cfd..3ed3bdcdfe3 100644
--- a/renderer.php
+++ b/renderer.php
@@ -29,6 +29,7 @@
/**
* Generates the output for Stack questions.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -37,6 +38,7 @@
class qtype_stack_renderer extends qtype_renderer {
// @codingStandardsIgnoreEnd
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function formulation_and_controls(question_attempt $qa, question_display_options $options) {
/* Return type should be @var qtype_stack_question $question. */
$question = $qa->get_question();
@@ -197,6 +199,7 @@ protected function question_tests_link(qtype_stack_question $question, question_
return html_writer::tag('div', implode(' | ', $links), ['class' => 'questiontestslink']);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function feedback(question_attempt $qa, question_display_options $options) {
$output = '';
if ($options->feedback) {
@@ -214,6 +217,7 @@ public function feedback(question_attempt $qa, question_display_options $options
return $output;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function stack_specific_feedback_errors_only(question_attempt $qa) {
$question = $qa->get_question();
$response = $qa->get_last_qt_data();
@@ -504,6 +508,7 @@ protected function overall_standard_prt_feedback(question_attempt $qa,
return $this->standard_prt_feedback($qa, $qa->get_question(), $result, 1);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function hint(question_attempt $qa, question_hint $hint) {
if (empty($hint->hint)) {
return '';
@@ -525,11 +530,13 @@ protected function hint(question_attempt $qa, question_hint $hint) {
$question->format_hint($newhint, $qa), ['class' => 'hint']);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function correct_response(question_attempt $qa) {
$question = $qa->get_question();
return '
'.$question->format_correct_response($qa);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function general_feedback(question_attempt $qa) {
$question = $qa->get_question();
if (empty($question->generalfeedback)) {
@@ -549,6 +556,7 @@ public function general_feedback(question_attempt $qa) {
return $question->get_generalfeedback_castext()->apply_placeholder_holder($gf);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function question_description(question_attempt $qa) {
$question = $qa->get_question();
if (empty($question->questiondescription)) {
diff --git a/settingslib.php b/settingslib.php
index 343e3bd8e6e..95c6f80a8ec 100644
--- a/settingslib.php
+++ b/settingslib.php
@@ -30,10 +30,12 @@
*
* Just so we can lazy-load the choices.
*
+ * @package qtype_stack
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_stack_admin_setting_maths_display_method extends admin_setting_configselect {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function load_choices() {
if (is_array($this->choices)) {
return true;
@@ -70,10 +72,12 @@ public function load_choices() {
*
* So we can lazy-load the choices.
*
+ * @package qtype_stack
* @copyright 2013 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_stack_admin_setting_input_types extends admin_setting_configselect {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function load_choices() {
global $CFG;
require_once($CFG->dirroot . '/question/type/stack/stack/input/factory.class.php');
diff --git a/stack/answertest/anstest.class.php b/stack/answertest/anstest.class.php
index c594d61883d..da9d4a0969c 100644
--- a/stack/answertest/anstest.class.php
+++ b/stack/answertest/anstest.class.php
@@ -17,6 +17,7 @@
/**
* Answer test base class.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -86,7 +87,7 @@ class stack_anstest {
protected $atfeedback;
/**
- * $var string. Copies the debug info, e.g. from the CAS session.
+ * @var string. Copies the debug info, e.g. from the CAS session.
*/
protected $debuginfo;
@@ -127,7 +128,7 @@ public function do_test() {
}
/**
- *
+ * Add description here
*
* @return string
*/
@@ -136,7 +137,7 @@ public function get_at_errors() {
}
/**
- *
+ * Add description here
*
* @return float
*/
@@ -145,7 +146,7 @@ public function get_at_mark() {
}
/**
- *
+ * Add description here
*
* @return bool
*/
@@ -154,7 +155,7 @@ public function get_at_valid() {
}
/**
- *
+ * Add description here
*
* @return string
*/
@@ -163,7 +164,7 @@ public function get_at_answernote() {
}
/**
- *
+ * Add description here
*
* @return string
*/
@@ -175,7 +176,6 @@ public function get_at_feedback() {
* Returns some sensible debug information for testing questions.
*
* @return string
- * @access public
*/
public function get_debuginfo() {
return $this->debuginfo;
@@ -185,7 +185,6 @@ public function get_debuginfo() {
* Returns some sensible debug information for testing questions.
*
* @return string
- * @access public
*/
protected function get_casfunction() {
return $this->casfunction;
@@ -196,7 +195,6 @@ protected function get_casfunction() {
* This should strip out any internal functions like _C(..).
*
* @return string
- * @access public
*/
public function get_trace($includeresult) {
diff --git a/stack/answertest/at_general_cas.class.php b/stack/answertest/at_general_cas.class.php
index 0b056c1f0e5..3ab2776fed0 100644
--- a/stack/answertest/at_general_cas.class.php
+++ b/stack/answertest/at_general_cas.class.php
@@ -22,18 +22,20 @@
/**
* General answer test which connects to the CAS - prevents duplicate code.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_answertest_general_cas extends stack_anstest {
/**
- * $var bool If this variable is set to true or false we override the
+ * @var bool If this variable is set to true or false we override the
* simplification options in the CAS variables.
*/
protected $simp;
/**
+ * Add description here
* @param string $sans
* @param string $tans
* @param string $casoption
@@ -48,10 +50,9 @@ public function __construct(stack_ast_container $sans, stack_ast_container $tans
}
/**
- *
+ * Add description here
*
* @return bool
- * @access public
*/
public function do_test() {
@@ -211,6 +212,7 @@ public function do_test() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function unpack_result(MP_Node $result): array {
$r = ['valid' => false, 'result' => 'unknown', 'answernote' => '', 'feedback' => ''];
@@ -242,6 +244,7 @@ private function unpack_result(MP_Node $result): array {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_debuginfo() {
return $this->debuginfo;
}
@@ -250,7 +253,6 @@ public function get_debuginfo() {
* Validates the options, when needed.
*
* @return (bool, string)
- * @access public
*/
public function validate_atoptions($opt) {
if (stack_ans_test_controller::process_atoptions($this->atname)) {
diff --git a/stack/answertest/at_general_cas_preprepare.class.php b/stack/answertest/at_general_cas_preprepare.class.php
index ccd695e11e0..be6f5382ac8 100644
--- a/stack/answertest/at_general_cas_preprepare.class.php
+++ b/stack/answertest/at_general_cas_preprepare.class.php
@@ -22,12 +22,14 @@
/**
* General answer test which connects to the CAS - prevents duplicate code.
*
+ * @package qtype_stack
* @copyright 2020 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_answertest_general_cas_preprepare extends stack_answertest_general_cas {
/**
+ * Add description here
* @param string $sans
* @param string $tans
* @param string $casoption
diff --git a/stack/answertest/controller.class.php b/stack/answertest/controller.class.php
index 0be6d44c2fb..5e7536d9fa5 100644
--- a/stack/answertest/controller.class.php
+++ b/stack/answertest/controller.class.php
@@ -17,17 +17,22 @@
defined('MOODLE_INTERNAL') || die();
-// Answer test controller class.
-//
-// @copyright 2012 University of Birmingham
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Answer test controller class.
+ *
+ * @package qtype_stack
+ * @copyright 2012 University of Birmingham
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/anstest.class.php');
require_once(__DIR__ . '/at_general_cas.class.php');
require_once(__DIR__ . '/../cas/connector.class.php');
require_once(__DIR__ . '/../cas/ast.container.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_ans_test_controller {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $types = [
'AlgEquiv' => 'stackOptions_AnsTest_values_AlgEquiv',
'AlgEquivNouns' => 'stackOptions_AnsTest_values_AlgEquivNouns',
@@ -70,13 +75,14 @@ class stack_ans_test_controller {
'Validator' => 'stackOptions_AnsTest_values_Validator',
];
- /*
+ /**
* Does this test require options [0] and are these evaluated by the CAS [1] ?
* In [2] we have the value of simp in the CAS session.
* Does the test require the raw value of the student's answer as a string [3] ?
*
* Note, the options are currently always simplified in the node class.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $pops = [
'AlgEquiv' => [false, false, true, false],
'AlgEquivNouns' => [false, false, false, false],
@@ -122,7 +128,6 @@ class stack_ans_test_controller {
/**
* The answertest object that the functions call.
* @var stack_anstest
- * @access private
*/
private $at;
@@ -134,7 +139,6 @@ class stack_ans_test_controller {
* @param string $tans A CAS string assumed to represent the tecaher's answer.
* @param object $options
* @param CasString $casoption
- * @access public
*/
public function __construct(string $anstest, stack_ast_container $sans, stack_ast_container $tans, $casoption = null,
$options = null, $contextsession = []) {
@@ -215,10 +219,9 @@ public function __construct(string $anstest, stack_ast_container $sans, stack_as
}
/**
- *
+ * Add description here
*
* @return bool
- * @access public
*/
public function do_test() {
$result = $this->at->do_test();
@@ -226,56 +229,52 @@ public function do_test() {
}
/**
- *
+ * Add description here
*
* @return string
- * @access public
*/
public function get_at_errors() {
return $this->at->get_at_errors();
}
/**
- *
+ * Add description here
*
* @return float
- * @access public
*/
public function get_at_mark() {
return $this->at->get_at_mark();
}
/**
- *
+ * Add description here
*
* @return bool
- * @access public
*/
public function get_at_valid() {
return $this->at->get_at_valid();
}
/**
- *
+ * Add description here
*
* @return string
- * @access public
*/
public function get_at_answernote() {
return trim($this->at->get_at_answernote());
}
/**
- *
+ * Add description here
*
* @return string
- * @access public
*/
public function get_at_feedback() {
return ($this->at->get_at_feedback());
}
/**
+ * Add description here.
* @return array the list of available answertest types. An array
* answertest internal name => language string key.
*/
@@ -287,7 +286,6 @@ public static function get_available_ans_tests() {
* Returns whether the testops are required for this test.
*
* @return bool
- * @access public
*/
public static function required_atoptions($atest) {
$op = self::$pops[$atest];
@@ -298,7 +296,6 @@ public static function required_atoptions($atest) {
* Returns a list of the answer tests who do not require test options
*
* @return array
- * @access public
*/
public static function get_ans_tests_without_options() {
$anstests = [];
@@ -314,7 +311,6 @@ public static function get_ans_tests_without_options() {
* Returns whether the testops should be processed by the CAS for this AnswerTest
*
* @return bool
- * @access public
*/
public static function process_atoptions($atest) {
$op = self::$pops[$atest];
@@ -325,7 +321,6 @@ public static function process_atoptions($atest) {
* Returns whether the session needs simplification.
*
* @return bool
- * @access public
*/
public static function simp($atest) {
$op = self::$pops[$atest];
@@ -336,7 +331,6 @@ public static function simp($atest) {
* Returns whether the test requires the raw input of the student's answer.
*
* @return bool
- * @access public
*/
public static function required_raw($atest) {
$op = self::$pops[$atest];
@@ -347,7 +341,6 @@ public static function required_raw($atest) {
* Validates the options, when needed.
*
* @return bool
- * @access public
*/
public function validate_atoptions($opt) {
return $this->at->validate_atoptions($opt);
@@ -357,7 +350,6 @@ public function validate_atoptions($opt) {
* Pass back CAS debug information for testing.
*
* @return string
- * @access public
*/
public function get_debuginfo() {
return $this->at->get_debuginfo();
@@ -367,7 +359,6 @@ public function get_debuginfo() {
* Returns an intelligible trace of an executed answer test.
*
* @return string
- * @access public
*/
public function get_trace($includeresult = true) {
return $this->at->get_trace($includeresult);
diff --git a/stack/bulktester.class.php b/stack/bulktester.class.php
index b2ae17182b3..048e03eb350 100644
--- a/stack/bulktester.class.php
+++ b/stack/bulktester.class.php
@@ -19,6 +19,7 @@
/**
* Class for running the question tests in bulk.
*
+ * @package qtype_stack
* @copyright 2015 The Open University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
@@ -26,6 +27,7 @@
require_once(__DIR__ . '/../vle_specific.php');
require_once(__DIR__ . '/../../../engine/bank.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_bulk_tester {
/**
diff --git a/stack/cas/ast.container.class.php b/stack/cas/ast.container.class.php
index 781721f586b..b1056b713f5 100644
--- a/stack/cas/ast.container.class.php
+++ b/stack/cas/ast.container.class.php
@@ -16,10 +16,13 @@
defined('MOODLE_INTERNAL')|| die();
-// Ast container and related functions, which replace "cas strings".
-//
-// @copyright 2019 University of Aalto.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Ast container and related functions, which replace "cas strings".
+ *
+ * @package qtype_stack
+ * @copyright 2019 University of Aalto.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/parsingrules/parsingrule.factory.php');
require_once(__DIR__ . '/cassecurity.class.php');
@@ -32,6 +35,7 @@
require_once(__DIR__ . '/../maximaparser/MP_classes.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_ast_container extends stack_ast_container_silent implements cas_latex_extractor,
cas_value_extractor, cas_display_value_extractor {
@@ -52,26 +56,32 @@ class stack_ast_container extends stack_ast_container_silent implements cas_late
/**
* If this is an input about to be validated, then we need to store some information here.
*/
- private $validationcontext = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
+ private $validationcontext = null;
/**
* AST value coming back from CAS.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $evaluated;
/**
* LaTeX value coming back from CAS.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $latex;
/**
* CAS rendered displayvalue.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $displayvalue;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function __construct() {
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_errors($err) {
if ('' !== trim($err)) {
// Force validation first so that all the errors are in the same form.
@@ -80,6 +90,7 @@ public function add_errors($err) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluationform(): string {
// The common_ast_container provides means of dealing with validation context.
if ($this->validationcontext === null) {
@@ -128,10 +139,12 @@ public function get_evaluationform(): string {
return $this->validationcontext['vname'] . ':' . $vcmd;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_evaluated_value(MP_Node $ast) {
$this->evaluated = $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_display_value(string $displayvalue) {
// Maxima displays floats as sting with these tags.
// The last of the old mess left?
@@ -141,18 +154,22 @@ public function set_cas_display_value(string $displayvalue) {
$this->displayvalue = $displayvalue;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_latex_value(string $latex) {
$this->latex = stack_maxima_latex_tidy($latex);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluated(): MP_Node {
return $this->evaluated;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_latex(): string {
return $this->latex;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_correctly_evaluated(): bool {
/*
* In cases where a statement occurs many times, only the last values will be stored.
@@ -166,6 +183,7 @@ public function is_correctly_evaluated(): bool {
// If we "CAS validate" this string, then we need to set various options.
// If the teacher's answer is null then we use typeless validation, otherwise we check type.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_validation_context($vname, $lowestterms, $tans, $validationmethod, $simp, $checkvars) {
if (!($validationmethod == 'checktype' || $validationmethod == 'typeless' || $validationmethod == 'units'
@@ -183,10 +201,12 @@ public function set_cas_validation_context($vname, $lowestterms, $tans, $validat
];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_cas_validation_context() {
return $this->validationcontext;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_value() {
if (null === $this->evaluated) {
throw new stack_exception('stack_ast_container: tried to get the value from of an unevaluated casstring.');
@@ -194,7 +214,8 @@ public function get_value() {
return $this->ast_to_string($this->evaluated, ['checkinggroup' => true]);
}
- /* This function returns something a teacher might claim a student types in.
+ /**
+ * This function returns something a teacher might claim a student types in.
* This means we have to de-parse a lot of things, listed below.
*/
public function get_dispvalue() {
@@ -227,6 +248,7 @@ public function get_dispvalue() {
return $computedinput;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_display() {
if (!$this->is_correctly_evaluated()) {
throw new stack_exception('stack_ast_container: ' .
@@ -235,7 +257,7 @@ public function get_display() {
return trim($this->latex);
}
- /*
+ /**
* Used to test the ast within the container.
*/
public function get_ast_test() {
@@ -245,6 +267,7 @@ public function get_ast_test() {
return $this->ast->toString(['flattree' => true]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_ast_clone() {
if ($this->is_correctly_evaluated()) {
$ast = clone $this->evaluated;
@@ -276,10 +299,12 @@ public function get_commentles_primary_statement() {
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_answernote($val) {
$this->answernotes[] = $val;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_answernote($raw = 'implode') {
if (null === $this->valid) {
$this->get_valid();
@@ -290,7 +315,7 @@ public function get_answernote($raw = 'implode') {
return $this->answernotes;
}
- /*
+ /**
* We sometimes need to modify the ast to set a particular key.
*/
public function set_key($key) {
diff --git a/stack/cas/ast.container.conditional.class.php b/stack/cas/ast.container.conditional.class.php
index 446d251facf..48c62f4a05a 100644
--- a/stack/cas/ast.container.conditional.class.php
+++ b/stack/cas/ast.container.conditional.class.php
@@ -16,10 +16,13 @@
defined('MOODLE_INTERNAL')|| die();
-// Ast container and related functions, which replace "cas strings".
-//
-// @copyright 2019 University of Aalto.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Ast container and related functions, which replace "cas strings".
+ *
+ * @package qtype_stack
+ * @copyright 2019 University of Aalto.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/parsingrules/parsingrule.factory.php');
require_once(__DIR__ . '/cassecurity.class.php');
@@ -32,14 +35,18 @@
require_once(__DIR__ . '/../maximaparser/MP_classes.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_ast_container_conditional extends stack_ast_container {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $conditions;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_conditions(array $conditions) {
$this->conditions = $conditions;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid(): bool {
$valid = parent::get_valid();
foreach ($this->conditions as $cond) {
@@ -48,6 +55,7 @@ public function get_valid(): bool {
return $valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluationform(): string {
if ($this->conditions === null || count($this->conditions) === 0) {
return parent::get_evaluationform();
@@ -80,19 +88,25 @@ public function __clone() {
}
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_ast_container_conditional_value extends stack_ast_container_silent implements cas_value_extractor {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $conditions;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $evaluated;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_evaluated_value(MP_Node $ast) {
$this->evaluated = $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_conditions(array $conditions) {
$this->conditions = $conditions;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid(): bool {
$valid = parent::get_valid();
foreach ($this->conditions as $cond) {
@@ -101,6 +115,7 @@ public function get_valid(): bool {
return $valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluationform(): string {
if ($this->conditions === null || count($this->conditions) === 0) {
return parent::get_evaluationform();
@@ -132,10 +147,12 @@ public function __clone() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluated(): MP_Node {
return $this->evaluated;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_value() {
if (null === $this->evaluated) {
throw new stack_exception('stack_ast_container: tried to get the value from of an unevaluated casstring.');
@@ -144,21 +161,28 @@ public function get_value() {
}
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_ast_container_conditional_latex_and_value extends stack_ast_container_silent
implements cas_value_extractor, cas_latex_extractor {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $conditions;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $evaluated;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $latex;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_evaluated_value(MP_Node $ast) {
$this->evaluated = $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_conditions(array $conditions) {
$this->conditions = $conditions;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid(): bool {
$valid = parent::get_valid();
foreach ($this->conditions as $cond) {
@@ -167,6 +191,7 @@ public function get_valid(): bool {
return $valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluationform(): string {
if ($this->conditions === null || count($this->conditions) === 0) {
return parent::get_evaluationform();
@@ -198,10 +223,12 @@ public function __clone() {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluated(): MP_Node {
return $this->evaluated;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_value() {
if (null === $this->evaluated) {
throw new stack_exception('stack_ast_container: tried to get the value from of an unevaluated casstring.');
@@ -209,10 +236,12 @@ public function get_value() {
return $this->ast_to_string($this->evaluated, ['checkinggroup' => true]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_latex_value(string $latex) {
$this->latex = stack_maxima_latex_tidy($latex);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_display() {
if (!$this->is_correctly_evaluated()) {
throw new stack_exception('stack_ast_container: ' .
@@ -223,14 +252,18 @@ public function get_display() {
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_ast_container_conditional_silent extends stack_ast_container_silent {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $conditions;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_conditions(array $conditions) {
$this->conditions = $conditions;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid(): bool {
$valid = parent::get_valid();
foreach ($this->conditions as $cond) {
@@ -239,6 +272,7 @@ public function get_valid(): bool {
return $valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluationform(): string {
if ($this->conditions === null || count($this->conditions) === 0) {
return parent::get_evaluationform();
diff --git a/stack/cas/ast.container.silent.class.php b/stack/cas/ast.container.silent.class.php
index a8079569d4b..aa8bdce4491 100644
--- a/stack/cas/ast.container.silent.class.php
+++ b/stack/cas/ast.container.silent.class.php
@@ -16,10 +16,13 @@
defined('MOODLE_INTERNAL')|| die();
-// Ast container and related functions, which replace "cas strings".
-//
-// @copyright 2019 Aalto University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Ast container and related functions, which replace "cas strings".
+ *
+ * @package qtype_stack
+ * @copyright 2019 Aalto University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/parsingrules/parsingrule.factory.php');
@@ -31,36 +34,43 @@
require_once(__DIR__ . '/../maximaparser/corrective_parser.php');
require_once(__DIR__ . '/../maximaparser/MP_classes.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_ast_container_silent implements cas_evaluatable {
/**
* The parsetree representing this ast after all modifications.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ast;
/**
* The source of this ast. As used for security considerations.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $source = 's';
/**
* Cached result of the validity check.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $valid = null;
/**
* Errors collected from various sources of validation.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $errors = [];
/**
* Answernotes collected from various sources of validation.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $answernotes = [];
/**
* Feedback collected from various sources of validation and processing.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $feedback = [];
/**
@@ -68,11 +78,13 @@ class stack_ast_container_silent implements cas_evaluatable {
* ast comes from. e.g., '/questionvariables' or '/prt/0/node/2/tans'.
* more specific location data i.e. character position data is in the AST.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $context;
/**
* The cassecurity settings applied to this question.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $securitymodel;
/**
@@ -82,6 +94,7 @@ class stack_ast_container_silent implements cas_evaluatable {
* If 1 we add all nouns.
* If 2 we only add logic nouns such as nounand.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $nounify = null;
/**
@@ -90,16 +103,19 @@ class stack_ast_container_silent implements cas_evaluatable {
* cassession only returning the values of last statements with a given
* key.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $keyless = false;
/**
* Track the status of correct evaluation at statement level.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $isevaluated = false;
/**
* These strings might occur as errors or notes and need to be tided up.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $maximastrings = [
'DivisionZero', 'CommaError', 'Illegal_floats', 'Lowest_Terms', 'SA_not_matrix',
'SA_not_list', 'SA_not_equation', 'SA_not_inequality', 'SA_not_set', 'SA_not_expression',
@@ -113,7 +129,7 @@ class stack_ast_container_silent implements cas_evaluatable {
*/
public $errclass = 'stack_cas_error';
- /*
+ /**
* NOTES:
* 1. this does not provide means of storing the results of evaluation.
* 2. the usage of this class boils down to this:
@@ -123,9 +139,10 @@ class stack_ast_container_silent implements cas_evaluatable {
* - ask for inputform or evaluation form representation
* - you can also retrieve the AST but it is not secured and you should
* never modify it when taking it from an existing casstring, make
- sure that the AST is ready before you put it in a casstring
+ * sure that the AST is ready before you put it in a casstring
*/
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make_from_student_source(string $raw, string $context,
stack_cas_security $securitymodel, array $filterstoapply = [],
array $filteroptions = [], string $grammar = 'Root', string $decimals = '.') {
@@ -180,8 +197,9 @@ public static function make_from_student_source(string $raw, string $context,
return $astc;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make_from_teacher_source(string $raw, string $context='',
- stack_cas_security $securitymodel=null) {
+ ?stack_cas_security $securitymodel=null) {
// If you wonder why the security model is in play for teachers it
// is here to bring in the information on whether units are constants
// or not and thus affect the teachers ability to write into them.
@@ -233,6 +251,7 @@ public static function make_from_teacher_source(string $raw, string $context='',
return $astc;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make_from_teacher_ast(MP_Statement $ast, string $context,
stack_cas_security $securitymodel) {
// This function is intended to be used when dealing with keyvals,
@@ -261,19 +280,24 @@ public static function make_from_teacher_ast(MP_Statement $ast, string $context,
return $astc;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function __construct() {
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_keyless(bool $key=true) {
$this->keyless = $key;
}
- /* TO-DO: a more coherent system for dealing with all options such as keyless, nounify. */
+ /**
+ * TO-DO: a more coherent system for dealing with all options such as keyless, nounify.
+ */
public function set_nounify(int $key=1) {
$this->nounify = $key;
}
// Functions required by cas_evaluatable.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid(): bool {
if ($this->valid === null) {
if ($this->ast === null) {
@@ -311,7 +335,7 @@ public function get_valid(): bool {
return $this->valid;
}
- /*
+ /**
* This is the string which actually gets sent to Maxima.
*/
public function get_evaluationform(): string {
@@ -323,6 +347,7 @@ public function get_evaluationform(): string {
}
// This returns the fully filtered AST as it should be inputted were it inputted perfectly.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_inputform(bool $keyless = false, $nounify = null, $nontuples = false,
$decimals = '.'): string {
if (!($nounify === null || is_int($nounify))) {
@@ -353,7 +378,7 @@ public function get_inputform(bool $keyless = false, $nounify = null, $nontuples
return $this->ast_to_string($this->ast, $params);
}
- /*
+ /**
* Top-level function for turning AST into a string representation.
*/
public function ast_to_string($root = null, $parameters = []): string {
@@ -429,6 +454,7 @@ public function get_debug_print() {
return $ast->debugPrint($ast->toString(['nosemicolon' => true]));
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_status(array $errors, array $answernotes, array $feedback) {
// Here we have a slightly difficult situation, as the new
// session collects real errors through different means than
@@ -473,26 +499,32 @@ public function set_cas_status(array $errors, array $answernotes, array $feedbac
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_evaluated(): bool {
return $this->isevaluated;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_correctly_evaluated(): bool {
return $this->isevaluated && $this->valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_securitymodel(): stack_cas_security {
return $this->securitymodel;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_securitymodel(stack_cas_security $sec) {
$this->securitymodel = $sec;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_source_context(): string {
return $this->context;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_key(): string {
if ($this->keyless === true) {
return '';
@@ -522,6 +554,7 @@ public function get_key(): string {
// When asking for errors the default is to implode them into a string.
// One can also have an array of strings or objects depending on which
// is more convenient.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_errors($raw = 'implode') {
if (null === $this->valid) {
$this->get_valid();
@@ -547,6 +580,7 @@ public function get_errors($raw = 'implode') {
return $errors;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_answernote($raw = 'implode') {
if (null === $this->valid) {
$this->get_valid();
@@ -557,6 +591,7 @@ public function get_answernote($raw = 'implode') {
return $this->answernotes;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_variable_usage(array $updatearray = []): array {
if (!array_key_exists('read', $updatearray)) {
$updatearray['read'] = [];
@@ -575,6 +610,7 @@ public function get_variable_usage(array $updatearray = []): array {
return $updatearray;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_feedback($raw = 'implode') {
if (null === $this->valid) {
$this->get_valid();
@@ -670,6 +706,7 @@ public function is_int(bool $evaluated=false): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_float(bool $evaluated=false): bool {
$root = $this->ast;
if ($evaluated) {
@@ -704,6 +741,7 @@ public function is_float(bool $evaluated=false): bool {
}
// Exception of the bool value style, we return the length of the list or -1 if not a list.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_list(bool $evaluated=false): int {
$root = $this->ast;
if ($evaluated) {
@@ -732,6 +770,7 @@ public function is_list(bool $evaluated=false): int {
return -1;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_string(bool $evaluated=false): bool {
$root = $this->ast;
if ($evaluated) {
@@ -760,6 +799,7 @@ public function is_string(bool $evaluated=false): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_set(bool $evaluated=false): bool {
$root = $this->ast;
if ($evaluated) {
@@ -788,6 +828,7 @@ public function is_set(bool $evaluated=false): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_toplevel_property($prop): bool {
$root = $this->ast;
if ($root instanceof MP_Root) {
@@ -822,6 +863,7 @@ public function is_toplevel_property($prop): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_matrix(bool $evaluated=false): bool {
$root = $this->ast;
if ($evaluated) {
@@ -859,6 +901,7 @@ public function is_matrix(bool $evaluated=false): bool {
// Do not call this unless you are dealing with a list.
// TO-DO: ?MP_Node for return type.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_list_element(int $index, bool $evaluated=false) {
$root = $this->ast;
if ($evaluated) {
diff --git a/stack/cas/caserror.class.php b/stack/cas/caserror.class.php
index a04834f3eda..8f7e195c60f 100644
--- a/stack/cas/caserror.class.php
+++ b/stack/cas/caserror.class.php
@@ -24,6 +24,7 @@
*
* This class also defines the syntax for those context/location paths.
*
+ * @package qtype_stack
* @copyright 2022 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -39,6 +40,7 @@ class stack_cas_error {
*/
private $error;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct(string $error , string $context = '') {
$this->error = $error;
$this->context = $context;
@@ -182,10 +184,12 @@ public function get_legacy_error(): string {
return $this->error;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_context(): string {
return $this->context;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_interpreted_context($question): array {
// Maybe that should be cached, on the other hand errors are slow anyway.
return self::interpret_context($this->context);
diff --git a/stack/cas/cassecurity.class.php b/stack/cas/cassecurity.class.php
index ece45b76d51..0e4d14ea609 100644
--- a/stack/cas/cassecurity.class.php
+++ b/stack/cas/cassecurity.class.php
@@ -18,13 +18,17 @@
require_once(__DIR__ . '/casstring.units.class.php');
-// CAS identifier related security data-lookups.
-//
-// @copyright 2018 Aalto University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * CAS identifier related security data-lookups.
+ *
+ * @package qtype_stack
+ * @copyright 2018 Aalto University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
class stack_cas_security {
// This holds a copy of the security-map.json so that it does not need to
// be loaded too many times.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $securitymap = null;
/** @var bool if this security context considers units as constants. */
@@ -33,11 +37,13 @@ class stack_cas_security {
/** @var string specific allowed words or groups of them. Used to expand
the student allowed identifiers set. */
private $allowedwords = '';
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $allowedwordsasmap = null;
/** @var string specific forbidden words or groups of them. Used to cut down
the student allowed identifiers set. */
private $forbiddenwords = '';
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $forbiddenwordsasmap = null;
/** @var array typically the teacher side variable identifiers. Used to cut
@@ -52,6 +58,7 @@ class stack_cas_security {
* They should be lower case, because Maxima is lower case, and these correspond to Maxima names.
* Actually, not lower case, Maxima is not case insensitive just check "ModeMatrix" for an example.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public static $keywordlists = [
'[[basic-algebra]]' => [
'coeff' => true, 'conjugate' => true, 'cspline' => true, 'disjoin' => true,
@@ -85,6 +92,7 @@ class stack_cas_security {
];
// TO-DO: remove once baselogic.class.php has been removed.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function is_good_function(string $identifier): bool {
// Generic tool for telling if a given identifier matches a function.
if (self::$securitymap === null) {
@@ -102,6 +110,7 @@ public static function is_good_function(string $identifier): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_feature(string $identifier, string $feature) {
// Generic tool for telling if a given identifier matches a function.
if (self::$securitymap === null) {
@@ -118,6 +127,7 @@ public static function get_feature(string $identifier, string $feature) {
return null;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($units = false, $allowedwords = '', $forbiddenwords = '', $forbiddenkeys = []) {
if (self::$securitymap === null) {
// Initialise the map.
@@ -154,11 +164,13 @@ public function __construct($units = false, $allowedwords = '', $forbiddenwords
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_allowedwords(string $allowedwords) {
$this->allowedwords = $allowedwords;
$this->allowedwordsasmap = null;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_allowedwords(string $allowedwords) {
// We now add things like "dispdp" to existing allowedwords.
if ($this->allowedwords === '') {
@@ -169,20 +181,24 @@ public function add_allowedwords(string $allowedwords) {
$this->allowedwordsasmap = null;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_forbiddenwords(string $forbiddenwords) {
$this->forbiddenwords = $forbiddenwords;
$this->forbiddenwordsasmap = null;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_context(array $context) {
$this->context = $context;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_context(): array {
return $this->context;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_forbiddenkeys(array $forbiddenkeys) {
$this->forbiddenkeys = $forbiddenkeys;
// Check that the keys if present are the correct way around.
@@ -210,10 +226,12 @@ public function set_forbiddenkeys(array $forbiddenkeys) {
$this->forbiddenkeys = $real;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_units(bool $units) {
$this->units = $units;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_units(): bool {
return $this->units;
}
@@ -435,6 +453,7 @@ public function is_allowed_as_operator(string $security, string $identifier): bo
return $security === 't';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_allowed_word(string $identifier, string $type='variable'): bool {
if ($this->allowedwordsasmap == null) {
$this->allowedwordsasmap = self::list_to_map($this->allowedwords);
@@ -543,6 +562,7 @@ public function get_case_variants(string $identifier, string $type='variable'):
}
// Takes a string form allowed/forbiddenwords list and turns it into an array.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function list_to_map(string $list): array {
// Probably called often, why waste time repeating the loops.
static $cache = [];
@@ -618,6 +638,7 @@ public static function list_to_map(string $list): array {
}
// Returns all identifiers with a given feature as long as the feature is not valued 'f'.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_all_with_feature(string $feature, bool $units = false): array {
static $cache = [];
if (!isset($cache[$units ? 'true' : 'false'])) {
@@ -653,6 +674,7 @@ public static function get_all_with_feature(string $feature, bool $units = false
// The so called alpha-map, of all known identifiers that should be protected from
// insert-stars. Indexed with the identifiers.
// NOT ordered by length anymore.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_protected_identifiers(string $type = 'variable', bool $units = false): array {
static $variablewithoutunits = null;
static $variablewithunits = null;
diff --git a/stack/cas/cassession2.class.php b/stack/cas/cassession2.class.php
index 5805b89684e..0561f157eea 100644
--- a/stack/cas/cassession2.class.php
+++ b/stack/cas/cassession2.class.php
@@ -16,13 +16,16 @@
defined('MOODLE_INTERNAL') || die();
-// Note that is a complete rewrite of cassession, in this we generate
-// no "caching" in the form of keyval representations as we do not
-// necessarily return enough information from the CAS to do that, for
-// that matter neither did the old one...
-//
-// @copyright 2019 Aalto University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Note that is a complete rewrite of cassession, in this we generate
+ * no "caching" in the form of keyval representations as we do not
+ * necessarily return enough information from the CAS to do that, for
+ * that matter neither did the old one...
+ *
+ * @package qtype_stack
+ * @copyright 2019 Aalto University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/connectorhelper.class.php');
require_once(__DIR__ . '/../options.class.php');
@@ -30,6 +33,7 @@
require_once(__DIR__ . '/evaluatable_object.interfaces.php');
require_once(__DIR__ . '/caserror.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_session2 {
/**
* @var string separator used between successive CAS commands inside the block.
@@ -70,6 +74,7 @@ class stack_cas_session2 {
*/
public $errclass = 'stack_cas_error';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct(array $statements, $options = null, $seed = null) {
$this->instantiated = false;
@@ -100,10 +105,12 @@ public function __construct(array $statements, $options = null, $seed = null) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_session(): array {
return $this->statements;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_contextvariables(): array {
$ret = [];
foreach ($this->statements as $statement) {
@@ -115,10 +122,12 @@ public function get_contextvariables(): array {
return $ret;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_options(): stack_options {
return $this->options;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_statement(cas_evaluatable $statement, bool $append = true) {
if ($append) {
$this->statements[] = $statement;
@@ -128,6 +137,7 @@ public function add_statement(cas_evaluatable $statement, bool $append = true) {
$this->instantiated = false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_statements(array $statements, bool $append = true) {
foreach ($statements as $statement) {
if (!is_subclass_of($statement, 'cas_evaluatable')) {
@@ -163,6 +173,7 @@ public function append_to_session(stack_cas_session2 $target) {
$target->instantiated = false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_variable_usage(array $updatearray = []): array {
foreach ($this->statements as $statement) {
$updatearray = $statement->get_variable_usage($updatearray);
@@ -170,10 +181,12 @@ public function get_variable_usage(array $updatearray = []): array {
return $updatearray;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_instantiated(): bool {
return $this->instantiated;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid(): bool {
$valid = true;
foreach ($this->statements as $statement) {
@@ -185,7 +198,7 @@ public function get_valid(): bool {
return $valid;
}
- /*
+ /**
* TO-DO: set return value of : ?cas_evaluatable
*/
public function get_by_key(string $key) {
@@ -410,10 +423,10 @@ public function instantiate(): bool {
$asts[$key] = $value;
}
} catch (Exception $e) {
- // TODO: issue #1279 would change this exception to add in an error associated
+ // TO-DO: issue #1279 would change this exception to add in an error associated
// with the values collected rather than a stack_exception.
// We would then add something like this to allow the process to continue.
- // $asts[$key] = maxima_parser_utils::parse('null', 'Root', false);
+ // $asts[$key] = maxima_parser_utils::parse('null', 'Root', false); .
throw new stack_exception('stack_cas_session: tried to parse the value ' .
$value . ', but got the following exception ' . $e->getMessage());
}
@@ -516,7 +529,7 @@ public function instantiate(): bool {
return $this->instantiated;
}
- /*
+ /**
* This representation is only used in debugging questions, and for
* offline (sandbox) testing. We need to provide teachers with something
* they can type back into Maxima.
@@ -556,6 +569,7 @@ public function get_keyval_representation($evaluatedvalues = false): string {
return trim($keyvals);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_debuginfo() {
if (trim($this->timeoutdebug ?? '') !== '') {
return $this->timeoutdebug;
diff --git a/stack/cas/casstring.units.class.php b/stack/cas/casstring.units.class.php
index 620a6cf16ce..773915e37cc 100644
--- a/stack/cas/casstring.units.class.php
+++ b/stack/cas/casstring.units.class.php
@@ -16,20 +16,25 @@
defined('MOODLE_INTERNAL') || die();
-// Functions related to dealing with scientific units in STACK.
-//
-// @copyright 2015 University of Edinburgh.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Functions related to dealing with scientific units in STACK.
+ *
+ * @package qtype_stack
+ * @copyright 2015 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/../../locallib.php');
require_once(__DIR__ . '/../utils.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_casstring_units {
- /*
+ /**
* Entries in this array are supported prefix mulipliers.
* They are in the form of array(label, multiplier, TeX, fullname).
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $supportedprefix = [
['y', '10^-24', 'y', 'yocto'],
['z', '10^-21', 'z', 'zepto'],
@@ -53,7 +58,7 @@ class stack_cas_casstring_units {
['Y', '10^24', 'Y', 'yotta'],
];
- /*
+ /**
* Entries in this array are supported units.
* For more informatio on SI, see
* http://www.bipm.org/utils/common/pdf/si_brochure_8_en.pdf
@@ -62,6 +67,7 @@ class stack_cas_casstring_units {
*
* Entries below are in the form of array(label, base, TeX, fullname).
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $supportedunits = [
['m', 'm', 'm', 'meter'],
['l', 'm^3/1000', 'l', 'litre'],
@@ -113,11 +119,12 @@ class stack_cas_casstring_units {
// @codingStandardsIgnoreEnd
];
- /*
+ /**
* Entries in this array are supported units which are used without any prefix.
* Entries below are in the form of array(label, base, TeX, fullname).
* Remember to add any with three or more letters to security-map.json.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $nonprefixunits = [
['min', 's*60', 'min', 'minutes'],
['amu', 'amu', 'amu', 'Atomic mass units'],
@@ -151,9 +158,11 @@ class stack_cas_casstring_units {
['lb', '4.4482*N', 'lb', 'pound'],
];
- /* This array keeps a list of synoymns which students are likely to use.
+ /**
+ * This array keeps a list of synoymns which students are likely to use.
* These arrays are used for generating helpful feedback.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $unitsynonyms = [
'mol' => ['mols', 'moles', 'mole'],
'kat' => ['kats', 'katal', 'katals'],
@@ -173,7 +182,9 @@ private function __construct() {
throw new stack_exception('stack_casstring_units: you cannot create instances of this class.');
}
- /* This function contributes to the maximalocal.mac file generated in installhelper.class.php. */
+ /**
+ * This function contributes to the maximalocal.mac file generated in installhelper.class.php.
+ */
public static function maximalocal_units() {
$maximalocal = " /* Define units available in STACK. */\n";
@@ -219,7 +230,7 @@ public static function maximalocal_units() {
return $maximalocal;
}
- /*
+ /**
* Sort out the TeX code for this string.
*/
private static function maximalocal_units_tex($texstr) {
@@ -230,7 +241,8 @@ private static function maximalocal_units_tex($texstr) {
}
}
- /* This function builds a list of all permitted prefix.unit combinations as defined above.
+ /**
+ * This function builds a list of all permitted prefix.unit combinations as defined above.
* @param int len This is the minimum length of string to be needed to be worth considering.
*/
public static function get_permitted_units($len) {
@@ -260,14 +272,17 @@ public static function get_permitted_units($len) {
}
- /* This array keeps a list of substitutions which are made when we deal with units.
+ /**
+ * This array keeps a list of substitutions which are made when we deal with units.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $unitsubstitutions = [
'Torr' => 'torr',
'kgm/s' => 'kg*m/s',
];
- /* Make substitutions in an expression.
+ /**
+ * Make substitutions in an expression.
* @param MP_Identifier any identifier in the parse tree.
*/
public static function make_units_substitutions($identifiernode) {
@@ -290,7 +305,8 @@ public static function make_units_substitutions($identifiernode) {
}
}
- /* Check to see if the student looks like they have used a synonym instead of a correct unit.
+ /**
+ * Check to see if the student looks like they have used a synonym instead of a correct unit.
* @param string $key is just a single atomic key.
*/
public static function find_units_synonyms($key) {
@@ -322,7 +338,8 @@ public static function find_units_synonyms($key) {
return [$fndsynonym, $answernote, $synonymerr];
}
- /* Check to see if the student looks like they have used units with the wrong case.
+ /**
+ * Check to see if the student looks like they have used units with the wrong case.
* @param string $key is just a single atomic key.
*/
public static function check_units_case($key) {
diff --git a/stack/cas/castext2/CTP_classes.php b/stack/cas/castext2/CTP_classes.php
index a63ebea31e7..35080426bce 100644
--- a/stack/cas/castext2/CTP_classes.php
+++ b/stack/cas/castext2/CTP_classes.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
declare(strict_types = 1);
/*
@@ -59,10 +66,10 @@ public function callbackRecurse($function) {
return true;
}
public function removeChild(CTP_Node $node) {
- return "[NO REMOVECHILD FOR ".get_class($this)."]";
- }
+ return "[NO REMOVECHILD FOR ".get_class($this)."]";
+ }
public function insertChild(CTP_Node $node, $before = null) {
- return "[NO INSERTCHILD FOR ".get_class($this)."]";
+ return "[NO INSERTCHILD FOR ".get_class($this)."]";
}
}
@@ -85,7 +92,7 @@ public function removeChild(CTP_Node $node) {
$i = array_search($node, $this->items);
if ($i !== false) {
array_splice($this->items, $i, 1);
- }
+ }
}
public function insertChild(CTP_Node $node, $before = null) {
if ($before === null) {
@@ -175,7 +182,7 @@ public function toString($params=array()) {
}
if ($this->name === 'if' && array_key_exists(' branch lengths', $this->parameters)) {
- // if-blocks use the parameters for more complex things for their branches.
+ // if-blocks use the parameters for more complex things for their branches.
// Note the space in front of the parameter name...
$i = 0; // Total iterator
$j = 0; // In block iterator
diff --git a/stack/cas/castext2/block.factory.php b/stack/cas/castext2/block.factory.php
index 35a986c9118..bb25d903551 100644
--- a/stack/cas/castext2/block.factory.php
+++ b/stack/cas/castext2/block.factory.php
@@ -14,11 +14,20 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class castext2_block_factory {
/**
* Cache the block types so that we do not need to check from the
* filesystem every time.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $types = [];
/**
@@ -47,6 +56,7 @@ protected static function class_for_type($type) {
return null;
}
/**
+ * Add description here.
* @return array of available type names.
*/
public static function get_available_types() {
diff --git a/stack/cas/castext2/block.interface.php b/stack/cas/castext2/block.interface.php
index bfc29a47a55..398da116578 100644
--- a/stack/cas/castext2/block.interface.php
+++ b/stack/cas/castext2/block.interface.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/CTP_classes.php');
@@ -21,23 +28,31 @@
require_once(__DIR__ . '/castext2_placeholder_holder.class.php');
require_once(__DIR__ . '/../../maximaparser/MP_classes.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
abstract class stack_cas_castext2_block {
// In entry phase these are the params of the CTP_Node matching this block.
// But in postprocess phase this will be NULL.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $params;
// These are the blocks matching the children of the CTP block. NULL again in
// postprocess phase.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $children;
// We have no clue what this would be in postprocess phase.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $mathmode = false;
// Position data from the parser.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $position = null;
// Painter detected format. TO-DO: remove compile-function argument for this.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $paintformat = null;
// Store any errors.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $err = [];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct(
$params,
$children = [],
diff --git a/stack/cas/castext2/blocks/body.block.php b/stack/cas/castext2/blocks/body.block.php
index 2f6a56ca484..c417721a5eb 100644
--- a/stack/cas/castext2/blocks/body.block.php
+++ b/stack/cas/castext2/blocks/body.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -25,6 +32,7 @@
*/
class stack_cas_castext2_body extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_List([
new MP_String('body'),
@@ -47,16 +55,19 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// These are never flat.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
// No CAS arguments.
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
diff --git a/stack/cas/castext2/blocks/castext.block.php b/stack/cas/castext2/blocks/castext.block.php
index 3798baf68dc..f32bb724202 100644
--- a/stack/cas/castext2/blocks/castext.block.php
+++ b/stack/cas/castext2/blocks/castext.block.php
@@ -14,14 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../../ast.container.silent.class.php');
require_once(__DIR__ . '/../../ast.container.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_castext extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// The purpose of this block is to inject a section of CASText
// structure into another CASText structure so this does
@@ -31,10 +40,12 @@ public function compile($format, $options): ?MP_Node {
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
$r = [
stack_ast_container_silent::make_from_teacher_source($this->params['evaluated'],
@@ -43,6 +54,7 @@ public function validate_extract_attributes(): array {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options = []): bool {
if (!array_key_exists('evaluated', $this->params)) {
$errors[] = new $options['errclass']('The castext block must be empty and needs to have the "evaluated" ' .
diff --git a/stack/cas/castext2/blocks/comment.block.php b/stack/cas/castext2/blocks/comment.block.php
index cf5c6e48c45..bf3fc9a58dc 100644
--- a/stack/cas/castext2/blocks/comment.block.php
+++ b/stack/cas/castext2/blocks/comment.block.php
@@ -14,21 +14,32 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_comment extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Comments do not get anywhere ever.
return null;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/commonstring.block.php b/stack/cas/castext2/blocks/commonstring.block.php
index d62a8454be7..c0792bcdf67 100644
--- a/stack/cas/castext2/blocks/commonstring.block.php
+++ b/stack/cas/castext2/blocks/commonstring.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -40,6 +47,7 @@
*/
class stack_cas_castext2_commonstring extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// The user should use this block's full name "commonstring" but
// as this is a common block and chars take room we tend to use a shorter
@@ -129,10 +137,12 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
$r = [];
foreach ($this->params as $key => $value) {
@@ -143,6 +153,7 @@ public function validate_extract_attributes(): array {
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
if (count($params) === 2) {
@@ -164,6 +175,7 @@ public function postprocess(array $params, castext2_processor $processor,
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
if (!array_key_exists('key', $this->params)) {
$errors[] = new $options['errclass']('The commonstring block must always have a key for the string template.',
diff --git a/stack/cas/castext2/blocks/cors.block.php b/stack/cas/castext2/blocks/cors.block.php
index 9655878558f..4e4da97a8a9 100644
--- a/stack/cas/castext2/blocks/cors.block.php
+++ b/stack/cas/castext2/blocks/cors.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -26,19 +33,23 @@
*/
class stack_cas_castext2_cors extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_String(stack_cors_link($this->params['src']));
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(
&$errors = [],
$options = []
diff --git a/stack/cas/castext2/blocks/debug.block.php b/stack/cas/castext2/blocks/debug.block.php
index 331d105fe5d..a452cc99041 100644
--- a/stack/cas/castext2/blocks/debug.block.php
+++ b/stack/cas/castext2/blocks/debug.block.php
@@ -14,13 +14,22 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../utils.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_debug extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// So we are to print out a table of bound variable values.
$bounds = [];
@@ -63,10 +72,12 @@ public function compile($format, $options): ?MP_Node {
return castext2_parser_utils::compile($castext, $format, $options);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/define.block.php b/stack/cas/castext2/blocks/define.block.php
index 58e4ae48834..5a63e9f25e8 100644
--- a/stack/cas/castext2/blocks/define.block.php
+++ b/stack/cas/castext2/blocks/define.block.php
@@ -14,13 +14,22 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../../ast.container.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_define extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$epos = $options['context'] . '/' . $this->position['start'] . '-' . $this->position['end'];
$r = new MP_Group([]);
@@ -48,10 +57,12 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
$r = [];
foreach ($this->params as $param) {
diff --git a/stack/cas/castext2/blocks/demarkdown.block.php b/stack/cas/castext2/blocks/demarkdown.block.php
index 0d5a5e91e27..790567da793 100644
--- a/stack/cas/castext2/blocks/demarkdown.block.php
+++ b/stack/cas/castext2/blocks/demarkdown.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
global $CFG;
@@ -27,6 +34,7 @@
*/
class stack_cas_castext2_demarkdown extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Basically mark the contents for post-processing.
$r = new MP_List([new MP_String('demarkdown')]);
@@ -47,10 +55,12 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
// First collapse the content.
@@ -90,6 +100,7 @@ public function postprocess(array $params, castext2_processor $processor,
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/demoodle.block.php b/stack/cas/castext2/blocks/demoodle.block.php
index ddd8adf0d05..34e56b4dd77 100644
--- a/stack/cas/castext2/blocks/demoodle.block.php
+++ b/stack/cas/castext2/blocks/demoodle.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
global $CFG;
@@ -28,6 +35,7 @@
*/
class stack_cas_castext2_demoodle extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Basically mark the contents for post-processing.
$r = new MP_List([new MP_String('demoodle')]);
@@ -42,10 +50,12 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
// First collapse the content.
@@ -79,6 +89,7 @@ public function postprocess(array $params, castext2_processor $processor,
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/escape.block.php b/stack/cas/castext2/blocks/escape.block.php
index d89fda6f409..42502ab720e 100644
--- a/stack/cas/castext2/blocks/escape.block.php
+++ b/stack/cas/castext2/blocks/escape.block.php
@@ -14,15 +14,24 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../../../utils.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_escape extends stack_cas_castext2_block {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $content;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($params, $children=[], $mathmode=false) {
parent::__construct($params, $children, $mathmode);
if (count($children) > 0) {
@@ -33,6 +42,7 @@ public function __construct($params, $children=[], $mathmode=false) {
$this->children = []; // We want to modify the iteration here a bit.
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
if ($this->content === null && !array_key_exists('value', $this->params)) {
return null;
@@ -44,14 +54,17 @@ public function compile($format, $options): ?MP_Node {
return new MP_String($this->content);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
// Due to escape block needing some backwards compatibility we still need to support
// the old way of defining the value as an parameter but not both ways at the same time.
diff --git a/stack/cas/castext2/blocks/foreach.block.php b/stack/cas/castext2/blocks/foreach.block.php
index b7ff0b2e9fd..a305ab8467d 100644
--- a/stack/cas/castext2/blocks/foreach.block.php
+++ b/stack/cas/castext2/blocks/foreach.block.php
@@ -14,13 +14,22 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../../ast.container.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_foreach extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$flat = $this->is_flat();
@@ -135,6 +144,7 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Now then the problem here is that the flatness depends on the flatness of
// the blocks contents. If they all generate strings then we are flat but if not...
@@ -147,6 +157,7 @@ public function is_flat(): bool {
return $flat;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
$r = [];
foreach ($this->params as $key => $value) {
diff --git a/stack/cas/castext2/blocks/geogebra.block.php b/stack/cas/castext2/blocks/geogebra.block.php
index 0398be79bae..9a576d36be0 100644
--- a/stack/cas/castext2/blocks/geogebra.block.php
+++ b/stack/cas/castext2/blocks/geogebra.block.php
@@ -25,6 +25,7 @@
* are responsible for the content or liable for any losses or damage resulting
* of the use of these resources.
*
+ * @package qtype_stack
* @copyright 2022-2023 University of Edinburgh
* @author Tim Lutz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -36,11 +37,14 @@
require_once(__DIR__ . '/root.specialblock.php');
require_once(__DIR__ . '/stack_translate.specialblock.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_geogebra extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $countgraphs = 1;
// Compatibility with php 7.4: Defining "str_ends_with" if not in existence, delete this function when
// dropping support for php 7.4, replace all occurences of this->str_ends_with(args) by str_ends_with(args).
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function str_ends_with($word, $searchstring) {
$searchstringlen = mb_strlen($searchstring);
if (mb_substr($word, -$searchstringlen, $searchstringlen) == $searchstring) {
@@ -49,6 +53,7 @@ private function str_ends_with($word, $searchstring) {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// We are outputting as [[iframe]], so we will generate some parameters for it on the side.
$r = new MP_List([new MP_String('iframe')]);
@@ -452,15 +457,18 @@ public function compile($format, $options): ?MP_Node {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
return 'This is never happening! The logic goes to [[iframe]].';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
// Note that all the "set" variables are actually CAS variables.
// So we should return the nosuffix versions here for checking.
@@ -470,6 +478,7 @@ public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors = [], $options = []): bool {
// Basically, check that the dimensions have units we know.
// Also that the references make sense.
diff --git a/stack/cas/castext2/blocks/hint.block.php b/stack/cas/castext2/blocks/hint.block.php
index c847f83c648..7a5ae741c09 100644
--- a/stack/cas/castext2/blocks/hint.block.php
+++ b/stack/cas/castext2/blocks/hint.block.php
@@ -14,12 +14,21 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_hint extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$body = new MP_List([new MP_String('%root')]);
@@ -39,10 +48,12 @@ public function compile($format, $options): ?MP_Node {
return $body;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
$r = [];
if (!isset($this->params['title'])) {
@@ -52,6 +63,7 @@ public function validate_extract_attributes(): array {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
if (!array_key_exists('title', $this->params)) {
$errors[] = new $options['errclass']('Hint block requires a title parameter.', $options['context'] . '/' .
diff --git a/stack/cas/castext2/blocks/htmlformat.block.php b/stack/cas/castext2/blocks/htmlformat.block.php
index 0b6763bf82e..4a8b4287fea 100644
--- a/stack/cas/castext2/blocks/htmlformat.block.php
+++ b/stack/cas/castext2/blocks/htmlformat.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with STACK. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -27,6 +34,7 @@
*/
class stack_cas_castext2_htmlformat extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Basically we change the value of $format for this subtree.
// Note that the jsxgraph and geogebra block does this automatically.
@@ -52,6 +60,7 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Now then the problem here is that the flatness depends on the flatness of
// the blocks contents. If they all generate strings then we are flat but if not...
@@ -64,6 +73,7 @@ public function is_flat(): bool {
return $flat;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
$content = '';
@@ -79,6 +89,7 @@ public function postprocess(array $params, castext2_processor $processor,
return $content;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/if.block.php b/stack/cas/castext2/blocks/if.block.php
index dd15c839d72..bfaea1171fc 100644
--- a/stack/cas/castext2/blocks/if.block.php
+++ b/stack/cas/castext2/blocks/if.block.php
@@ -14,14 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../../ast.container.silent.class.php');
require_once(__DIR__ . '/../../ast.container.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_if extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// If we are flat we just sconcat stuff to return but if not then we need to
// generate the list version like the root-block.
@@ -160,6 +169,7 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Now then the problem here is that the flatness depends on the flatness of
// the blocks contents. If they all generate strings then we are flat but if not...
@@ -172,6 +182,7 @@ public function is_flat(): bool {
return $flat;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
$r = [];
if (!isset($this->params['test'])) {
@@ -190,6 +201,7 @@ public function validate_extract_attributes(): array {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
if (!array_key_exists('test', $this->params)) {
$errors[] = new $options['errclass']('If block requires a test parameter.', $options['context'] . '/' .
diff --git a/stack/cas/castext2/blocks/iframe.block.php b/stack/cas/castext2/blocks/iframe.block.php
index d9b206f4555..98be4560404 100644
--- a/stack/cas/castext2/blocks/iframe.block.php
+++ b/stack/cas/castext2/blocks/iframe.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -38,15 +45,18 @@ class stack_cas_castext2_iframe extends stack_cas_castext2_block {
// All frames need unique (at request level) identifiers,
// we use running numbering.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $counters = ['///IFRAME_COUNT///' => 1];
// Add separate running numbering for different block types to
// ease debugging, so that one does not need to know which all affect
// the numbers. This numbering applies only to the titles.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function register_counter(string $name): void {
self::$counters[$name] = 1;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_List([
new MP_String('iframe'),
@@ -71,16 +81,19 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// These are never flat.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
// No CAS arguments.
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
global $PAGE;
@@ -213,6 +226,7 @@ public function postprocess(array $params, castext2_processor $processor,
return $holder->add_to_map(html_writer::tag('div', '', $attributes));
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
// Basically, check that the dimensions have units we know.
// Also that the references make sense.
diff --git a/stack/cas/castext2/blocks/include.block.php b/stack/cas/castext2/blocks/include.block.php
index 113c56a1e28..aa0ecf19031 100644
--- a/stack/cas/castext2/blocks/include.block.php
+++ b/stack/cas/castext2/blocks/include.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -41,6 +48,7 @@
*/
class stack_cas_castext2_include extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$src = stack_fetch_included_content($this->params['src']);
if (isset($options['in include'])) {
@@ -62,10 +70,12 @@ public function compile($format, $options): ?MP_Node {
return castext2_parser_utils::compile($src, $format, $opt2);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
// This is tricky, we need to validate the attributes of the included content.
// To do that we need to retrieve it and process it again, luckily this gets cached.
@@ -77,6 +87,7 @@ public function validate_extract_attributes(): array {
return castext2_parser_utils::get_casstrings($src);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
if (!array_key_exists('src', $this->params)) {
$errors[] = new $options['errclass']('Include block requires a src parameter.', $options['context'] . '/' .
diff --git a/stack/cas/castext2/blocks/ioblock.specialblock.php b/stack/cas/castext2/blocks/ioblock.specialblock.php
index aa12503e6e3..9868378a7f4 100644
--- a/stack/cas/castext2/blocks/ioblock.specialblock.php
+++ b/stack/cas/castext2/blocks/ioblock.specialblock.php
@@ -14,21 +14,32 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_special_ioblock extends stack_cas_castext2_block {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $channel;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $variable;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($params, $children=[], $mathmode=false, $channel='', $variable='') {
parent::__construct($params, $children, $mathmode);
$this->channel = $channel;
$this->variable = $variable;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// If used before input2 we do not need to maintain the parsed structure.
// If we do not need the structure we can cut down on processign and compile
@@ -39,15 +50,18 @@ public function compile($format, $options): ?MP_Node {
return new MP_List([new MP_String('ioblock'), new MP_String($this->channel), new MP_String($this->variable)]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
// Might seem odd to postprocess this but this is a hook that others connect to.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
return '[[' . $params[1] . ':' . $params[2] . ']]';
diff --git a/stack/cas/castext2/blocks/javascript.block.php b/stack/cas/castext2/blocks/javascript.block.php
index 62c16cc3bab..f1af0112ea8 100644
--- a/stack/cas/castext2/blocks/javascript.block.php
+++ b/stack/cas/castext2/blocks/javascript.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -39,6 +46,7 @@
*/
class stack_cas_castext2_javascript extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_List([new MP_String('iframe')]);
@@ -104,21 +112,25 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Even when the content were flat we need to evaluate this during postprocessing.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
return 'This is never happening! The logic goes to [[iframe]].';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(
&$errors = [],
$options = []
diff --git a/stack/cas/castext2/blocks/jsstring.block.php b/stack/cas/castext2/blocks/jsstring.block.php
index 49851a82bb6..fcc3d83f767 100644
--- a/stack/cas/castext2/blocks/jsstring.block.php
+++ b/stack/cas/castext2/blocks/jsstring.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -24,6 +31,7 @@
*/
class stack_cas_castext2_jsstring extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_List([new MP_String('jsstring')]);
@@ -50,6 +58,7 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Now then the problem here is that the flatness depends on the flatness of
// the blocks contents. If they all generate strings then we are flat but if not...
@@ -62,6 +71,7 @@ public function is_flat(): bool {
return $flat;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
// NOTE! We now have a problem with $holder the json_encode won't get applied to things
@@ -79,6 +89,7 @@ public function postprocess(array $params, castext2_processor $processor,
return json_encode($content);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/jsxgraph.block.php b/stack/cas/castext2/blocks/jsxgraph.block.php
index d3130c0cbe0..a1c670bed8c 100644
--- a/stack/cas/castext2/blocks/jsxgraph.block.php
+++ b/stack/cas/castext2/blocks/jsxgraph.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -26,9 +33,13 @@
require_once(__DIR__ . '/iframe.block.php');
stack_cas_castext2_iframe::register_counter('///JSXGRAPH_COUNT///');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_jsxgraph extends stack_cas_castext2_block {
- /* This is not something we want people to edit in general. */
+ /**
+ * This is not something we want people to edit in general.
+ */
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public static $namedversions = [
'cdn' => [
'css' => 'https://cdn.jsdelivr.net/npm/jsxgraph/distrib/jsxgraph.min.css',
@@ -52,6 +63,7 @@ class stack_cas_castext2_jsxgraph extends stack_cas_castext2_block {
],
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_List([new MP_String('iframe')]);
@@ -198,20 +210,24 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Even when the content were flat we need to evaluate this during postprocessing.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
return 'This is never happening! The logic goes to [[iframe]].';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(
&$errors = [],
$options = []
diff --git a/stack/cas/castext2/blocks/lang.block.php b/stack/cas/castext2/blocks/lang.block.php
index daee35905b7..546e818f12b 100644
--- a/stack/cas/castext2/blocks/lang.block.php
+++ b/stack/cas/castext2/blocks/lang.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -26,6 +33,7 @@
*/
class stack_cas_castext2_lang extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$checks = null;
foreach (explode(',', $this->params['code']) as $code) {
@@ -64,6 +72,7 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
$flat = true;
@@ -74,10 +83,12 @@ public function is_flat(): bool {
return $flat;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
if (!array_key_exists('code', $this->params)) {
$errors[] = new $options['errclass']('The "lang"-block needs a code atribute with a singular code or a comma ' .
diff --git a/stack/cas/castext2/blocks/latex.block.php b/stack/cas/castext2/blocks/latex.block.php
index abf81b4c50a..a24959b4443 100644
--- a/stack/cas/castext2/blocks/latex.block.php
+++ b/stack/cas/castext2/blocks/latex.block.php
@@ -14,13 +14,22 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/raw.block.php');
require_once(__DIR__ . '/../../ast.container.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_latex extends stack_cas_castext2_raw {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Convert possible simplification flags.
$ev = stack_ast_container::make_from_teacher_source($this->content);
@@ -95,6 +104,7 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
diff --git a/stack/cas/castext2/blocks/markdownformat.block.php b/stack/cas/castext2/blocks/markdownformat.block.php
index 5b70ba70fe0..d4d3330bc15 100644
--- a/stack/cas/castext2/blocks/markdownformat.block.php
+++ b/stack/cas/castext2/blocks/markdownformat.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
global $CFG;
diff --git a/stack/cas/castext2/blocks/moodleformat.block.php b/stack/cas/castext2/blocks/moodleformat.block.php
index 3ef466d42ef..2a6276fd9bb 100644
--- a/stack/cas/castext2/blocks/moodleformat.block.php
+++ b/stack/cas/castext2/blocks/moodleformat.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
global $CFG;
diff --git a/stack/cas/castext2/blocks/parsons.block.php b/stack/cas/castext2/blocks/parsons.block.php
index 3eea6e3c7e8..05a7c85d2aa 100644
--- a/stack/cas/castext2/blocks/parsons.block.php
+++ b/stack/cas/castext2/blocks/parsons.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with STACK. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -26,8 +33,10 @@
require_once(__DIR__ . '/iframe.block.php');
stack_cas_castext2_iframe::register_counter('///PARSONS_COUNT///');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_parsons extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public static $namedversions = [
'cdn' => [
'js' => 'https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.15.0/Sortable.min.js',
@@ -38,6 +47,7 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block {
],
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_List([new MP_String('iframe')]);
@@ -375,20 +385,24 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Even when the content were flat we need to evaluate this during postprocessing.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
return 'This is never happening! The logic goes to [[iframe]].';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(
&$errors = [],
$options = []
diff --git a/stack/cas/castext2/blocks/pfs.specialblock.php b/stack/cas/castext2/blocks/pfs.specialblock.php
index e073a3f638d..bed9e6b20b5 100644
--- a/stack/cas/castext2/blocks/pfs.specialblock.php
+++ b/stack/cas/castext2/blocks/pfs.specialblock.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
global $CFG;
@@ -28,10 +35,14 @@
* filestores.
*/
class stack_cas_castext2_special_rewrite_pluginfile_urls extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $filearea;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $itemid;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $component = 'qtype_stack';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($params, $children=[], $mathmode=false, $value='') {
parent::__construct($params, $children, $mathmode);
if (count($params) == 0) {
@@ -47,6 +58,7 @@ public function __construct($params, $children=[], $mathmode=false, $value='') {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Now we might actually do the rewrite before everything else but
// for now we prefer to leave it as a latter step, just in case someone
@@ -90,11 +102,13 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Not flat as this always requires rewriting.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
// First collapse the content.
@@ -113,6 +127,7 @@ public function postprocess(array $params, castext2_processor $processor,
return $content;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/placeholder.specialblock.php b/stack/cas/castext2/blocks/placeholder.specialblock.php
index 835327d7e52..cc0e55981b0 100644
--- a/stack/cas/castext2/blocks/placeholder.specialblock.php
+++ b/stack/cas/castext2/blocks/placeholder.specialblock.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -26,18 +33,22 @@
*/
class stack_cas_castext2_special_placeholder extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
return new MP_String("THIS NEVER HAPPENS, IT IS NOT ALLOWED TO USE THIS BLOCK ON THE AUTHOR SIDE");
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
return $holder->add_to_map($params[1]);
diff --git a/stack/cas/castext2/blocks/quid.block.php b/stack/cas/castext2/blocks/quid.block.php
index f8dc32fdbd7..12e4915cef2 100644
--- a/stack/cas/castext2/blocks/quid.block.php
+++ b/stack/cas/castext2/blocks/quid.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -27,14 +34,17 @@
class stack_cas_castext2_quid extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
return new MP_List([new MP_String('quid'), new MP_String($this->params['id'])]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
$id = $params[1];
@@ -45,10 +55,12 @@ public function postprocess(array $params, castext2_processor $processor,
return $content;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
if (!array_key_exists('id', $this->params)) {
$errors[] = new $options['errclass']('quid-blocks need an id-attribute with a value.',
diff --git a/stack/cas/castext2/blocks/raw.block.php b/stack/cas/castext2/blocks/raw.block.php
index d6a407e5d80..7f10d94387a 100644
--- a/stack/cas/castext2/blocks/raw.block.php
+++ b/stack/cas/castext2/blocks/raw.block.php
@@ -14,22 +14,32 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../../ast.container.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_raw extends stack_cas_castext2_block {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $content;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($params, $children=[], $mathmode=false) {
parent::__construct($params, $children, $mathmode);
$this->content = $children[0]->content; // The child is a different type of RAW.
$this->children = []; // We want to modify the iteration here a bit.
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Convert possible simplification flags.
$ev = stack_ast_container::make_from_teacher_source($this->content);
@@ -90,10 +100,12 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [stack_ast_container::make_from_teacher_source($this->content, 'ct2:raw', new stack_cas_security())];
}
diff --git a/stack/cas/castext2/blocks/raw.specialblock.php b/stack/cas/castext2/blocks/raw.specialblock.php
index 93772d02e80..1b18da534c3 100644
--- a/stack/cas/castext2/blocks/raw.specialblock.php
+++ b/stack/cas/castext2/blocks/raw.specialblock.php
@@ -14,28 +14,40 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../../../utils.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_special_raw extends stack_cas_castext2_block {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $content;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($params, $children=[], $mathmode=false, $value='') {
parent::__construct($params, $children, $mathmode);
$this->content = $value;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
return new MP_String($this->content);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/reveal.block.php b/stack/cas/castext2/blocks/reveal.block.php
index 8fd3d014585..c02b4a96b76 100644
--- a/stack/cas/castext2/blocks/reveal.block.php
+++ b/stack/cas/castext2/blocks/reveal.block.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with STACK. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -30,6 +37,7 @@
*/
class stack_cas_castext2_reveal extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
static $count = 0;
/*
@@ -90,16 +98,19 @@ public function compile($format, $options): ?MP_Node {
return $body;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Never flat, the [[iframe]] portion needs extra processing.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
return 'Post processing of reveal blocks never happens, this block is handled through [[iframe]].';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/root.specialblock.php b/stack/cas/castext2/blocks/root.specialblock.php
index 08bc2a1f681..139456fd082 100644
--- a/stack/cas/castext2/blocks/root.specialblock.php
+++ b/stack/cas/castext2/blocks/root.specialblock.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -29,7 +36,9 @@
require_once(__DIR__ . '/demarkdown.block.php');
require_once(__DIR__ . '/demoodle.block.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_special_root extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = null;
@@ -113,6 +122,7 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// Now then the problem here is that the flatness depends on the flatness of
// the blocks contents. If they all generate strings then we are flat but if not...
@@ -154,12 +164,14 @@ public function postprocess(array $params, castext2_processor $processor,
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
// Creates a block from a node.
// TO-DO: pick another place for this function.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make(CTP_Node $node): stack_cas_castext2_block {
if ($node instanceof CTP_IOBlock) {
$r = new stack_cas_castext2_special_ioblock([], [], $node->
diff --git a/stack/cas/castext2/blocks/script.block.php b/stack/cas/castext2/blocks/script.block.php
index 72f360f60c2..1bc55f7e560 100644
--- a/stack/cas/castext2/blocks/script.block.php
+++ b/stack/cas/castext2/blocks/script.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -30,6 +37,7 @@
*/
class stack_cas_castext2_script extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_List([
new MP_String('script'),
@@ -53,16 +61,19 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// These are never flat.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
// No CAS arguments.
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
diff --git a/stack/cas/castext2/blocks/smlt.specialblock.php b/stack/cas/castext2/blocks/smlt.specialblock.php
index 7f8b2e441d9..1b718abe376 100644
--- a/stack/cas/castext2/blocks/smlt.specialblock.php
+++ b/stack/cas/castext2/blocks/smlt.specialblock.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -25,23 +32,28 @@
* stack_maxima_latex_tidy() function.
*/
class stack_cas_castext2_special_stack_maxima_latex_tidy extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $content;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($params, $children = [], $mathmode = false, $value = '') {
parent::__construct($params, $children, $mathmode);
$this->content = $value;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Should not even happen. This is not a block that makes sense for
// end users.
return new MP_List([new MP_String('smlt'), new MP_String($this->content)]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
if (count($params) < 2) {
@@ -71,6 +83,7 @@ public function postprocess(array $params, castext2_processor $processor,
return stack_maxima_latex_tidy($t);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/stack_translate.specialblock.php b/stack/cas/castext2/blocks/stack_translate.specialblock.php
index ad5cbc5eaf4..0c491458839 100644
--- a/stack/cas/castext2/blocks/stack_translate.specialblock.php
+++ b/stack/cas/castext2/blocks/stack_translate.specialblock.php
@@ -14,18 +14,28 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
require_once(__DIR__ . '/../../../../locallib.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_special_stack_translate extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// These blocks do not actually exist in the normal input flow, they only appear in
// PRT feedback generation. For now.
return new MP_String('');
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// While flat there always require post processing.
return false;
@@ -48,6 +58,7 @@ public function postprocess(array $params, castext2_processor $processor,
return stack_maxima_translate($t);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
diff --git a/stack/cas/castext2/blocks/style.block.php b/stack/cas/castext2/blocks/style.block.php
index 43362e770b4..bde8c0e0fd0 100644
--- a/stack/cas/castext2/blocks/style.block.php
+++ b/stack/cas/castext2/blocks/style.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -29,6 +36,7 @@
*/
class stack_cas_castext2_style extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$r = new MP_List([
new MP_String('style'),
@@ -52,16 +60,19 @@ public function compile($format, $options): ?MP_Node {
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
// These are never flat.
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
// No CAS arguments.
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
diff --git a/stack/cas/castext2/blocks/template.block.php b/stack/cas/castext2/blocks/template.block.php
index 51b1a9d18df..bbb62c510ea 100644
--- a/stack/cas/castext2/blocks/template.block.php
+++ b/stack/cas/castext2/blocks/template.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -28,6 +35,7 @@
*/
class stack_cas_castext2_template extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
if (count($this->children) === 0) {
// If we are applying a template then we need to decide how we
@@ -74,6 +82,7 @@ public function compile($format, $options): ?MP_Node {
]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
if (count($this->children) === 0 && !array_key_exists('mode', $this->params)) {
// When declaring a template the result will always be an empty string.
@@ -83,10 +92,12 @@ public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
if (!array_key_exists('name', $this->params)) {
$errors[] = new $options['errclass']('The "template"-block needs a name.',
diff --git a/stack/cas/castext2/blocks/textdownload.block.php b/stack/cas/castext2/blocks/textdownload.block.php
index 846b57b43fb..37c27315e52 100644
--- a/stack/cas/castext2/blocks/textdownload.block.php
+++ b/stack/cas/castext2/blocks/textdownload.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -36,8 +43,10 @@
*/
class stack_cas_castext2_textdownload extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public static $countfiles = 1;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
if (!isset($options['in main content']) || !$options['in main content']) {
throw new stack_exception('CASText2 textdownload is currently only supported in question-text / scene-text.');
@@ -71,14 +80,17 @@ public function compile($format, $options): ?MP_Node {
return $code;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function postprocess(array $params, castext2_processor $processor,
castext2_placeholder_holder $holder): string {
if (get_config('qtype_stack', 'stackapi')) {
@@ -103,6 +115,7 @@ public function postprocess(array $params, castext2_processor $processor,
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate(&$errors=[], $options=[]): bool {
if (!array_key_exists('name', $this->params)) {
$errors[] = new $options['errclass']('The textdownload-block requires one to declare a name for the file.',
diff --git a/stack/cas/castext2/blocks/todo.block.php b/stack/cas/castext2/blocks/todo.block.php
index c3ae29c2276..0fab1320115 100644
--- a/stack/cas/castext2/blocks/todo.block.php
+++ b/stack/cas/castext2/blocks/todo.block.php
@@ -14,27 +14,39 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_castext2_todo extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
$body = new MP_List([new MP_String('%root')]);
$body->items[] = new MP_String('');
return $body;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function extract_todo(): array {
$tags = [];
if (!array_key_exists('tags', $this->params)) {
diff --git a/stack/cas/castext2/blocks/unknown.block.php b/stack/cas/castext2/blocks/unknown.block.php
index d5a1be94724..1c9acad2a8a 100644
--- a/stack/cas/castext2/blocks/unknown.block.php
+++ b/stack/cas/castext2/blocks/unknown.block.php
@@ -15,6 +15,13 @@
// along with Stack. If not, see .
//
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../block.interface.php');
@@ -28,20 +35,23 @@
*/
class stack_cas_castext2_unknown extends stack_cas_castext2_block {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile($format, $options): ?MP_Node {
// Unknown blocks do not get anywhere ever.
return null;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_flat(): bool {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function validate_extract_attributes(): array {
return [];
}
- /*
+ /**
* Unknown blocks are always invalid.
*/
public function validate(&$errors = [], $options = []): bool {
diff --git a/stack/cas/castext2/castext2_evaluatable.class.php b/stack/cas/castext2/castext2_evaluatable.class.php
index 14ebc52b03f..d8197b3f93d 100644
--- a/stack/cas/castext2/castext2_evaluatable.class.php
+++ b/stack/cas/castext2/castext2_evaluatable.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../evaluatable_object.interfaces.php');
@@ -38,19 +45,28 @@
*/
class castext2_evaluatable implements cas_raw_value_extractor {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $compiled = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $source = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $value = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $evaluated = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $valid = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $errors = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $context = null;
// Because we do not want to transfer large static strings to CAS we use a store that contains those values
// and replace them into the result once eberything is complete.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $statics = null;
// Values from blocks that escape the context.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $special = [];
/**
@@ -62,8 +78,10 @@ class castext2_evaluatable implements cas_raw_value_extractor {
/**
* The placeholder holder.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $holder;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make_from_compiled(string $compiled, string $context,
castext2_static_replacer $statics): castext2_evaluatable {
$r = new castext2_evaluatable();
@@ -75,6 +93,7 @@ public static function make_from_compiled(string $compiled, string $context,
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make_from_source(string $source, string $context): castext2_evaluatable {
$r = new castext2_evaluatable();
$r->source = $source;
@@ -91,6 +110,7 @@ public static function make_from_source(string $source, string $context): castex
return $r;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function __construct() {
$this->errors = [];
$this->holder = new castext2_placeholder_holder();
@@ -101,6 +121,7 @@ private function __construct() {
// some blocks may need details. Note though that if you give this
// Markdown or other types of formated stuff it will do the formating
// and the rendered output will be FORMAT_HTML.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid($format=null, $options=null, $sec=null): bool {
if ($this->valid !== null) {
return $this->valid;
@@ -216,6 +237,7 @@ public function get_valid($format=null, $options=null, $sec=null): bool {
return $this->valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluationform(): string {
if ($this->compiled === null) {
if (!$this->get_valid()) {
@@ -225,6 +247,7 @@ public function get_evaluationform(): string {
return $this->compiled;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_status(array $errors, array $answernotes, array $feedback) {
$this->errors = $errors;
if (count($this->errors) > 0) {
@@ -232,18 +255,22 @@ public function set_cas_status(array $errors, array $answernotes, array $feedbac
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_source_context(): string {
return $this->context;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_key(): string {
return '';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_evaluated_value(string $stringval) {
$this->value = $stringval;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function requires_evaluation(): bool {
if ($this->valid === null) {
// Compile if not compiled.
@@ -263,7 +290,8 @@ public function requires_evaluation(): bool {
return true;
}
- public function get_rendered(castext2_processor $processor = null): string {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public function get_rendered(?castext2_processor $processor = null): string {
if ($this->evaluated === null) {
// Do the simpler parse of the value. The full MaximaParser
// would obviously work but would be more expensive.
@@ -304,6 +332,7 @@ public function get_rendered(castext2_processor $processor = null): string {
return $this->evaluated;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_errors($implode = true) {
if ($implode === 'objects') {
return $this->errors;
diff --git a/stack/cas/castext2/castext2_placeholder_holder.class.php b/stack/cas/castext2/castext2_placeholder_holder.class.php
index 9a6389792a6..55017ea66e6 100644
--- a/stack/cas/castext2/castext2_placeholder_holder.class.php
+++ b/stack/cas/castext2/castext2_placeholder_holder.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../maximaparser/utils.php');
@@ -31,8 +38,10 @@
* exists only over the filtering phase.
*/
class castext2_placeholder_holder {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $map;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct() {
$this->map = [];
}
diff --git a/stack/cas/castext2/castext2_static_replacer.class.php b/stack/cas/castext2/castext2_static_replacer.class.php
index c85b87db77a..ec041a9060c 100644
--- a/stack/cas/castext2/castext2_static_replacer.class.php
+++ b/stack/cas/castext2/castext2_static_replacer.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../maximaparser/utils.php');
@@ -28,17 +35,21 @@
* it after it returns from the CAS.
*/
class castext2_static_replacer {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $map;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct(array $map) {
$this->map = $map;
}
// One might need to gain access to this after extraction.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_map(): array {
return $this->map;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function replace($in) {
// This might be called with a complete string.
if (is_string($in)) {
@@ -67,6 +78,7 @@ public function replace($in) {
return $in;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function extract(string $in): string {
// If the castext is already a static string don't do anything.
if (mb_substr($in, 0, 1) === '"') {
diff --git a/stack/cas/castext2/processor.class.php b/stack/cas/castext2/processor.class.php
index 4c3869bcf27..d71a15e93a5 100644
--- a/stack/cas/castext2/processor.class.php
+++ b/stack/cas/castext2/processor.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/blocks/root.specialblock.php');
@@ -35,17 +42,21 @@
* similar io-blocks.
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface castext2_processor {
// The override helps when you want to chain things. Basically, use it to
// give the top most processor to the lower ones so that they can pass things
// back when processing nested things.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function process(string $blocktype, array $arguments, castext2_placeholder_holder $holder,
- castext2_processor $override = null): string;
+ ?castext2_processor $override = null): string;
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class castext2_default_processor implements castext2_processor {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function process(string $blocktype, array $arguments, castext2_placeholder_holder $holder,
- castext2_processor $override = null): string {
+ ?castext2_processor $override = null): string {
$proc = $this;
$block = null;
if ($override !== null) {
@@ -72,10 +83,13 @@ public function process(string $blocktype, array $arguments, castext2_placeholde
}
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class castext2_qa_processor extends castext2_default_processor {
// Special one giving access to a question-attempt so that the blocks
// can call things like `rewrite_pluginfile_urls`.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $qa;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($qa) {
if (!method_exists($qa, 'rewrite_pluginfile_urls')) {
stack_exception('Error in constructing castext2_qa_processor: argument must provide rewrite_pluginfile_urls.');
diff --git a/stack/cas/castext2/utils.php b/stack/cas/castext2/utils.php
index 0aa7ba81929..2f3da3bd570 100644
--- a/stack/cas/castext2/utils.php
+++ b/stack/cas/castext2/utils.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stateful. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
declare(strict_types = 1);
defined('MOODLE_INTERNAL') || die();
@@ -26,18 +33,22 @@
require_once(__DIR__ . '/../../utils.class.php');
require_once(__DIR__ . '/autogen/parser.mbstring.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class castext2_parser_utils {
// For the cases where you need to define the format.
// In general it is either MD or anything else. For now we
// have no other special cases.
// Intentionally matching Moodle values.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const MDFORMAT = FORMAT_MARKDOWN;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const RAWFORMAT = FORMAT_HTML;
// Does the whole compile process.
// Basically when compiling we need to know if Markdown is in use and
// some blocks may need details. That is why we have those parameters.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function compile(string $castext, $format=null, $options=null): MP_Node {
if ($castext === '' || $castext === null) {
return new MP_String('');
@@ -49,6 +60,7 @@ public static function compile(string $castext, $format=null, $options=null): MP
return $root->compile($format, $options);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_casstrings(string $castext): array {
if ($castext === '' || $castext === null) {
return [];
@@ -68,6 +80,7 @@ public static function get_casstrings(string $castext): array {
return $css;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function has_todoblocks(string $castext): bool {
if ($castext === '' || $castext === null) {
return false;
@@ -88,6 +101,7 @@ public static function has_todoblocks(string $castext): bool {
return $hastodo;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_todoblocks(string $castext): array {
if ($castext === '' || $castext === null) {
return [];
@@ -116,6 +130,7 @@ public static function get_todoblocks(string $castext): array {
// parsed the response. Does not use the full maximaparser infrastructure
// as the result is just an list of strings... well should be for all simple
// blocks for now.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function postprocess_string(string $casresult, castext2_placeholder_holder $holder): string {
if (mb_substr($casresult, 0, 1) === '"') {
// If it was flat.
@@ -129,7 +144,9 @@ public static function postprocess_string(string $casresult, castext2_placeholde
// Postprocesses the result from CAS. For those that have parsed the response
// to PHP array/string form. Note that you need to give unescaped strings...
- public static function postprocess_parsed(array $casresult, ?castext2_processor $processor, castext2_placeholder_holder $holder): string {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public static function postprocess_parsed(array $casresult, ?castext2_processor $processor,
+ castext2_placeholder_holder $holder): string {
if ($processor === null) {
$processor = new castext2_default_processor();
}
@@ -137,7 +154,9 @@ public static function postprocess_parsed(array $casresult, ?castext2_processor
}
// Postprocesses AST style result, as often one includes stuff in larger structures.
- public static function postprocess_mp_parsed(MP_Node $result, ?castext2_processor $processor, castext2_placeholder_holder $holder): string {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public static function postprocess_mp_parsed(MP_Node $result, ?castext2_processor $processor,
+ castext2_placeholder_holder $holder): string {
// Some common unpacking.
if ($result instanceof MP_Root) {
$result = $result->items[0];
@@ -152,6 +171,7 @@ public static function postprocess_mp_parsed(MP_Node $result, ?castext2_processo
}
// Parses a string of castext code to an AST tree for use elsewhere.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function parse(string $code, $format=null): CTP_Root {
$parser = new CTP_Parser();
$ast = $parser->parse($code);
@@ -166,6 +186,7 @@ public static function parse(string $code, $format=null): CTP_Root {
// Searches mathmode information and sets the nodes to match. Note that
// This aims to ignore comments.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function math_paint(
CTP_Root $ast,
string $code,
@@ -451,6 +472,7 @@ public static function math_paint(
// This takes a top level list, set or group and splits it taking into account strings...
// The original versions of those stack_utils functions should really be
// resurrected as they did this already but were lost due to fear of strings.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function string_to_list(
string $stringwithcommasandnesting,
bool $deep = false
@@ -490,6 +512,7 @@ public static function string_to_list(
// Takes a nested array with string valued elements assumed to
// represent Maxima escaped strings and turns them to raw PHP-strings.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function unpack_maxima_strings(array $context): array {
$r = [];
foreach ($context as $value) {
@@ -507,6 +530,7 @@ public static function unpack_maxima_strings(array $context): array {
// Reduces a list that has MP_String-elements mixed with other stuff.
// By reduce we mean that it merges the adjacent MP_Strings to cut
// down the parsers work.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function string_list_reduce(array $list, bool $ignorefirst=false): array {
$r = [];
$work = array_reverse($list);
@@ -538,7 +562,8 @@ public static function string_list_reduce(array $list, bool $ignorefirst=false):
// Takes a raw tree and the matching source code and remaps the positions from char to line:linechar
// use when you need to have pretty printed position data.
- public static function position_remap(CTP_Node $ast, string $code, array $limits = null) {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public static function position_remap(CTP_Node $ast, string $code, ?array $limits = null) {
if ($limits === null) {
$limits = [];
foreach (explode("\n", $code) as $line) {
diff --git a/stack/cas/connector.class.php b/stack/cas/connector.class.php
index 0ddc28450f9..b2e2e463eee 100644
--- a/stack/cas/connector.class.php
+++ b/stack/cas/connector.class.php
@@ -22,6 +22,7 @@
/**
* The base class for connections to Maxima.
*
+ * @package qtype_stack
* @copyright 2012 The University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -59,6 +60,7 @@ abstract class stack_cas_connection_base implements stack_cas_connection {
// @codingStandardsIgnoreStart
/* @see stack_cas_connection::compute() */
// @codingStandardsIgnoreEnd
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compute($command) {
$context = "Platform: ". stack_connection_helper::get_platform() . "\n";
@@ -84,6 +86,7 @@ public function compute($command) {
return $unpackedresult;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function json_compute($command): array {
$this->debug->log('Maxima command', $command);
@@ -130,11 +133,14 @@ public function json_compute($command): array {
// @codingStandardsIgnoreStart
/* @see stack_cas_connection::get_debuginfo() */
// @codingStandardsIgnoreEnd
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_debuginfo() {
return $this->debug->get_log();
}
- /* On a Linux system list the versions of maxima available for use. */
+ /**
+ * On a Linux system list the versions of maxima available for use.
+ */
public function get_maxima_available() {
if ('linux' != stack_connection_helper::get_platform()) {
return stack_string('healthunabletolistavail');
@@ -282,6 +288,7 @@ protected function unpack_raw_result($rawresult) {
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function unpack_helper($rawresultfragment) {
// Take the raw string from the CAS, and unpack this into an array.
$offset = 0;
diff --git a/stack/cas/connector.dbcache.class.php b/stack/cas/connector.dbcache.class.php
index cf44b33f186..7a488560137 100644
--- a/stack/cas/connector.dbcache.class.php
+++ b/stack/cas/connector.dbcache.class.php
@@ -17,6 +17,7 @@
/**
* Class which undertakes process control to connect to Maxima.
*
+ * @package qtype_stack
* @copyright 2012 The University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -41,6 +42,7 @@ public function __construct(stack_cas_connection $rawconnection, stack_debug_log
$this->db = $db;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compute($command) {
$cached = $this->get_cached_result($command);
if ($cached->result) {
@@ -63,10 +65,12 @@ public function compute($command) {
return $result;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_maxima_available() {
return stack_string('healthunabletolistavail');
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function json_compute($command): array {
$cached = $this->get_cached_result($command);
if ($cached->result) {
@@ -91,6 +95,7 @@ public function json_compute($command): array {
return $parsed;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_debuginfo() {
return $this->debug->get_log();
}
@@ -153,6 +158,7 @@ protected function add_to_cache($command, $result, $key = null) {
}
/**
+ * Add description here
* @param string $command Maxima code to execute.
* @return string the key used to store this command.
*/
@@ -188,6 +194,7 @@ public static function clear_cache($db) {
}
/**
+ * Add description here
* @param moodle_database $db the database connection to use to access the cache.
* @return int the number of entries in the cache.
*/
diff --git a/stack/cas/connector.healthcheck.class.php b/stack/cas/connector.healthcheck.class.php
index 8137956682c..2370c6406f8 100644
--- a/stack/cas/connector.healthcheck.class.php
+++ b/stack/cas/connector.healthcheck.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * This class supports the healthcheck functions.
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../locallib.php');
@@ -24,26 +31,26 @@
require_once(__DIR__ . '/castext2/castext2_evaluatable.class.php');
require_once(__DIR__ . '/connector.dbcache.class.php');
require_once(__DIR__ . '/installhelper.class.php');
-
-/**
- * This class supports the healthcheck functions..
- *
- * @copyright 2023 The University of Edinburgh
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
require_once(__DIR__ . '/ast.container.class.php');
require_once(__DIR__ . '/connectorhelper.class.php');
require_once(__DIR__ . '/cassession2.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_healthcheck {
- /* This variable holds the state of the healthcheck. */
+ /**
+ * This variable holds the state of the healthcheck.
+ */
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ishealthy = true;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $config = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $tests = [];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($config) {
global $CFG;
$this->config = $config;
@@ -259,7 +266,7 @@ public function __construct($config) {
$this->tests[] = $test;
}
- /*
+ /**
* Try and evaluate the raw castext and build a result entry.
*
* $hideraw is for those cases where we do not wish to show the raw CASText.
@@ -293,14 +300,14 @@ private function output_cas_text($title, $intro, $castext, $hideraw=false) {
$this->tests[] = $test;
}
- /*
+ /**
* This function returns a summary of the status of the healthcheck.
*/
public function get_test_results() {
return $this->tests;
}
- /*
+ /**
* Return overall results.
*/
public function get_overall_result() {
diff --git a/stack/cas/connector.interface.php b/stack/cas/connector.interface.php
index 671fb5f9ff3..2218dc9e182 100644
--- a/stack/cas/connector.interface.php
+++ b/stack/cas/connector.interface.php
@@ -17,6 +17,7 @@
/**
* Defines the stack_cas_connection interface.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -30,6 +31,7 @@ interface stack_cas_connection {
public function compute($command);
/**
+ * Add description here.
* @return string any debug info from this session. Will be blank unless
* debugging is enabled by the configuration.
*/
diff --git a/stack/cas/connector.linux.class.php b/stack/cas/connector.linux.class.php
index 45cb6f6c47e..16008739235 100644
--- a/stack/cas/connector.linux.class.php
+++ b/stack/cas/connector.linux.class.php
@@ -17,11 +17,13 @@
/**
* Connection to Maxima for linux-like systems.
*
+ * @package qtype_stack
* @copyright 2012 The University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_cas_connection_linux extends stack_cas_connection_base {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function guess_maxima_command($path) {
global $CFG;
if (stack_connection_helper::get_platform() == 'linux-optimised') {
@@ -48,6 +50,7 @@ protected function guess_maxima_command($path) {
return $maximacommand;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function call_maxima($command) {
// For unicode support, we need to add something like 'LANG' => 'en_GB.UTF-8' to the environment below.
$env = ['PATH' => getenv('PATH')];
diff --git a/stack/cas/connector.server.class.php b/stack/cas/connector.server.class.php
index c5f5178e67d..5e10684139c 100644
--- a/stack/cas/connector.server.class.php
+++ b/stack/cas/connector.server.class.php
@@ -19,6 +19,7 @@
* This version handles transfer of the plots generated on possibly remote servlet.
* For details of this see https://github.com/maths/stack_util_maximapool/
*
+ * @package qtype_stack
* @copyright 2012 The University of Birmingham
* @copyright 2012 Aalto University - Matti Harjula
* @copyright 2014 Loughborough University
@@ -26,10 +27,12 @@
*/
class stack_cas_connection_server extends stack_cas_connection_base {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function guess_maxima_command($path) {
return 'http://localhost:8080/MaximaPool/MaximaPool';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function call_maxima($command) {
global $CFG;
$err = '';
diff --git a/stack/cas/connector.server_proxy.class.php b/stack/cas/connector.server_proxy.class.php
index ef94a31aaa6..2f6a38c54c3 100644
--- a/stack/cas/connector.server_proxy.class.php
+++ b/stack/cas/connector.server_proxy.class.php
@@ -19,6 +19,7 @@
* This version handles transfer of the plots generated on possibly remote servlet.
* For details of this see https://github.com/maths/stack_util_maximapool/
*
+ * @package qtype_stack
* @copyright 2012 The University of Birmingham
* @copyright 2012 Aalto University - Matti Harjula
* @copyright 2014 Loughborough University
@@ -26,10 +27,12 @@
*/
class stack_cas_connection_server_proxy extends stack_cas_connection_base {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function guess_maxima_command($path) {
return 'http://localhost:8080/MaximaPool/MaximaPool';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function call_maxima($command) {
global $CFG;
$err = '';
diff --git a/stack/cas/connector.windows.class.php b/stack/cas/connector.windows.class.php
index a9a3efe717b..7a368af9932 100644
--- a/stack/cas/connector.windows.class.php
+++ b/stack/cas/connector.windows.class.php
@@ -17,11 +17,13 @@
/**
* Connection to Maxima for Windows systems.
*
+ * @package qtype_stack
* @copyright 2012 The University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_cas_connection_windows extends stack_cas_connection_base {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function guess_maxima_command($path) {
if ('default' == stack_connection_helper::get_maximaversion()) {
throw new stack_exception("stack_cas_connection: maxima cannot be set to default on Windows platform. ".
@@ -34,6 +36,7 @@ protected function guess_maxima_command($path) {
return $cmd;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function call_maxima($command) {
set_time_limit(0); // Note, some users may not want this!
$ret = false;
diff --git a/stack/cas/connectorhelper.class.php b/stack/cas/connectorhelper.class.php
index 57d2030eaa3..9b05ef8e877 100644
--- a/stack/cas/connectorhelper.class.php
+++ b/stack/cas/connectorhelper.class.php
@@ -25,6 +25,7 @@
/**
* The base class for connections to Maxima.
*
+ * @package qtype_stack
* @copyright 2012 The University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -122,6 +123,7 @@ protected static function get_other_db() {
}
/**
+ * Add description here.
* @return string the configured platform type.
*/
public static function get_platform() {
@@ -130,6 +132,7 @@ public static function get_platform() {
}
/**
+ * Add description here.
* @return string the configured version number.
*/
public static function get_maximaversion() {
@@ -199,6 +202,7 @@ public static function check_stackmaxima_version($unpackedresult) {
}
/**
+ * Add description here.
* @return string the version of the STACK Maxima libraries that should be in use.
*/
public static function get_required_stackmaxima_version() {
@@ -390,7 +394,7 @@ public static function stackmaxima_genuine_connect() {
return [$message, $debug, $success];
}
- /*
+ /**
* This function is in this class, rather than installhelper.class.php, to
* ensure the lowest level connection to the CAS, without caching.
*/
diff --git a/stack/cas/evaluatable_object.interfaces.php b/stack/cas/evaluatable_object.interfaces.php
index 508e9ee6ba3..8d2f648a9a9 100644
--- a/stack/cas/evaluatable_object.interfaces.php
+++ b/stack/cas/evaluatable_object.interfaces.php
@@ -25,6 +25,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface cas_evaluatable {
/**
@@ -70,6 +71,7 @@ public function get_key(): string;
// for cases where the full parser is overkill. For example CASText2 where
// the response is just nested lists of strings which can be parsed much
// cheaper using traditional means.
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface cas_value_extractor extends cas_evaluatable {
/**
@@ -83,6 +85,7 @@ public function set_cas_evaluated_value(MP_Node $ast);
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface cas_raw_value_extractor extends cas_evaluatable {
/**
@@ -97,6 +100,7 @@ public function set_cas_evaluated_value(string $value);
}
// Things that also come out. In the latex form.
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface cas_latex_extractor extends cas_evaluatable {
/**
@@ -111,6 +115,7 @@ public function set_cas_latex_value(string $latex);
}
// Things that also come out. In the old display form.
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface cas_display_value_extractor extends cas_evaluatable {
/**
diff --git a/stack/cas/installhelper.class.php b/stack/cas/installhelper.class.php
index eacacb83e4a..bfb7a4f0f87 100644
--- a/stack/cas/installhelper.class.php
+++ b/stack/cas/installhelper.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
// This provides helper code for creating the files needed to connect to the CAS.
@@ -25,7 +32,9 @@
require_once(__DIR__ . '/cassession2.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_cas_configuration {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $instance = null;
/**
@@ -42,17 +51,22 @@ class stack_cas_configuration {
'simplex' => 'floatnump(epsilon_lp)',
];
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $settings;
/** @var string the date when these settings were worked out. */
protected $date;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $maximacodepath;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $logpath;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $vnum;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $blocksettings;
/**
@@ -149,6 +163,7 @@ public function get_plotcommand_win() {
throw new stack_exception('Could not locate GNUPlot.');
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function maxima_win_location() {
if ($this->settings->platform != 'win') {
return '';
@@ -191,6 +206,7 @@ public function maxima_win_location() {
implode(', ', $locations));
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function copy_maxima_bat() {
global $CFG;
@@ -212,6 +228,7 @@ public function copy_maxima_bat() {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_maximalocal_contents() {
$contents = <<get_validate_maximalibraries();
}
- /*
+ /**
* This function genuinely recreates the maxima image and stores the results in
* the configuration settings.
*/
diff --git a/stack/cas/keyval.class.php b/stack/cas/keyval.class.php
index 3233f5ef6df..583146b0ae0 100644
--- a/stack/cas/keyval.class.php
+++ b/stack/cas/keyval.class.php
@@ -25,6 +25,7 @@
/**
* Class to parse user-entered data into CAS sessions.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -46,13 +47,16 @@ class stack_cas_keyval {
private $security;
// For those using keyvals as a generator for sessions.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $options;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $seed;
/** @var bool to hold when we add slashes to Maxima strings. */
private $pslash;
// For error mapping keyvals do need a context.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $context;
/**
@@ -61,6 +65,7 @@ class stack_cas_keyval {
*/
public $errclass = 'stack_cas_error';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($raw, $options = null, $seed=null, $ctx='', $pslash=false) {
$this->raw = $raw;
$this->statements = [];
@@ -85,6 +90,7 @@ public function __construct($raw, $options = null, $seed=null, $ctx='', $pslash=
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function validate($inputs) {
if (empty($this->raw) || '' == trim($this->raw) || null == $this->raw) {
@@ -191,20 +197,25 @@ private function validate($inputs) {
return $this->valid;
}
- /** Specify non default security, do this before validation. */
+ /**
+ * Specify non default security, do this before validation.
+ */
public function set_security(stack_cas_security $security) {
$this->security = clone $security;
}
- /** Extract a security object with type related context information, do this after validation. */
+ /**
+ * Extract a security object with type related context information, do this after validation.
+ */
public function get_security(): stack_cas_security {
return $this->security;
}
- /*
- * @array $inputs Holds an array of the input names which are forbidden as keys.
- * @bool $inputstrict Decides if we should forbid any reference to the inputs in the values of variables.
+ /**
+ * Add description
+ * @param array $inputs Holds an array of the input names which are forbidden as keys.
+ * @param bool $inputstrict Decides if we should forbid any reference to the inputs in the values of variables.
*/
public function get_valid($inputs = null) {
if (null === $this->valid || is_array($inputs)) {
@@ -213,6 +224,7 @@ public function get_valid($inputs = null) {
return $this->valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_errors($casdebug = false, $raw = 'strings') {
if (null === $this->valid) {
$this->validate(null);
@@ -241,6 +253,7 @@ public function get_errors($casdebug = false, $raw = 'strings') {
return $errors;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function instantiate() {
if (null === $this->valid) {
$this->validate(null);
@@ -253,6 +266,7 @@ public function instantiate() {
return $cs->get_errors(true);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_session() {
if (null === $this->valid) {
$this->validate(null);
@@ -260,10 +274,12 @@ public function get_session() {
return new stack_cas_session2($this->statements, $this->options, $this->seed);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_raw() {
return $this->raw;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_variable_usage(array $updatearray = []): array {
if (!array_key_exists('read', $updatearray)) {
$updatearray['read'] = [];
@@ -289,7 +305,7 @@ public function get_variable_usage(array $updatearray = []): array {
*
* Note that one must have done validation in advance.
*/
- public function compile(string $contextname, castext2_static_replacer $map = null): array {
+ public function compile(string $contextname, ?castext2_static_replacer $map = null): array {
$bestatements = [];
$statements = [];
$contextvariables = [];
diff --git a/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php b/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php
index 4278abfd678..cebd1328414 100644
--- a/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php
+++ b/stack/cas/parsingrules/001_fix_call_of_a_group_or_function.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_001_fix_call_of_a_group_or_function implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$valid, &$errors, &$answernotes) {
diff --git a/stack/cas/parsingrules/002_log_candy.filter.php b/stack/cas/parsingrules/002_log_candy.filter.php
index d6ba37619b6..a0cdef4e65a 100644
--- a/stack/cas/parsingrules/002_log_candy.filter.php
+++ b/stack/cas/parsingrules/002_log_candy.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -29,6 +36,7 @@
* Will add 'logsubs' answernote if triggered.
*/
class stack_ast_filter_002_log_candy implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors,
array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$errors, &$answernotes) {
diff --git a/stack/cas/parsingrules/003_no_dot_dot.filter.php b/stack/cas/parsingrules/003_no_dot_dot.filter.php
index a3585781630..725e8ee7b0a 100644
--- a/stack/cas/parsingrules/003_no_dot_dot.filter.php
+++ b/stack/cas/parsingrules/003_no_dot_dot.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_003_no_dot_dot implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$valid, &$errors, &$answernotes) {
diff --git a/stack/cas/parsingrules/005_i_is_never_a_function.filter.php b/stack/cas/parsingrules/005_i_is_never_a_function.filter.php
index 93bf16f54b8..b8e50e05c69 100644
--- a/stack/cas/parsingrules/005_i_is_never_a_function.filter.php
+++ b/stack/cas/parsingrules/005_i_is_never_a_function.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -22,6 +29,7 @@
*/
class stack_ast_filter_005_i_is_never_a_function implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$valid, &$errors, &$answernotes) {
diff --git a/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php b/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php
index cdbd73010af..cd8d2f81aaa 100644
--- a/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php
+++ b/stack/cas/parsingrules/022_trig_replace_synonyms.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -22,6 +29,7 @@
*/
class stack_ast_filter_022_trig_replace_synonyms implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
// As these are invalid they do not exist in the security-map.
diff --git a/stack/cas/parsingrules/025_no_trig_power.filter.php b/stack/cas/parsingrules/025_no_trig_power.filter.php
index 3612e18b086..d30371d01a8 100644
--- a/stack/cas/parsingrules/025_no_trig_power.filter.php
+++ b/stack/cas/parsingrules/025_no_trig_power.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,8 +30,10 @@
*/
class stack_ast_filter_025_no_trig_power implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public static $ssmap = null;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
if (self::$ssmap === null) {
self::$ssmap = json_decode(file_get_contents(__DIR__ . '/../../maximaparser/unicode/superscript-stack.json'), true);
diff --git a/stack/cas/parsingrules/030_no_trig_space.filter.php b/stack/cas/parsingrules/030_no_trig_space.filter.php
index f4e9e432a7b..d39fbbdd272 100644
--- a/stack/cas/parsingrules/030_no_trig_space.filter.php
+++ b/stack/cas/parsingrules/030_no_trig_space.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_030_no_trig_space implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$selectednames = stack_cas_security::get_all_with_feature('trigfun');
diff --git a/stack/cas/parsingrules/031_no_trig_brackets.filter.php b/stack/cas/parsingrules/031_no_trig_brackets.filter.php
index 8bdef690d7e..46feedcdff7 100644
--- a/stack/cas/parsingrules/031_no_trig_brackets.filter.php
+++ b/stack/cas/parsingrules/031_no_trig_brackets.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_031_no_trig_brackets implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$selectednames = stack_cas_security::get_all_with_feature('trigfun');
diff --git a/stack/cas/parsingrules/033_no_extra_evaluation.filter.php b/stack/cas/parsingrules/033_no_extra_evaluation.filter.php
index 6bbd683bf9a..93d6c365472 100644
--- a/stack/cas/parsingrules/033_no_extra_evaluation.filter.php
+++ b/stack/cas/parsingrules/033_no_extra_evaluation.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -22,6 +29,7 @@
*/
class stack_ast_filter_033_no_extra_evaluation implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$errors, &$answernotes) {
diff --git a/stack/cas/parsingrules/050_no_chained_inequalities.filter.php b/stack/cas/parsingrules/050_no_chained_inequalities.filter.php
index be2b40d8449..8e2ee376f52 100644
--- a/stack/cas/parsingrules/050_no_chained_inequalities.filter.php
+++ b/stack/cas/parsingrules/050_no_chained_inequalities.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -22,6 +29,7 @@
*/
class stack_ast_filter_050_no_chained_inequalities implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$ops = [
diff --git a/stack/cas/parsingrules/090_special_forbidden_characters.filter.php b/stack/cas/parsingrules/090_special_forbidden_characters.filter.php
index b48e69210ee..a3b148d2f05 100644
--- a/stack/cas/parsingrules/090_special_forbidden_characters.filter.php
+++ b/stack/cas/parsingrules/090_special_forbidden_characters.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_090_special_forbidden_characters implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$warned = [];
diff --git a/stack/cas/parsingrules/101_no_floats.filter.php b/stack/cas/parsingrules/101_no_floats.filter.php
index 44e3fc57390..de8d7145570 100644
--- a/stack/cas/parsingrules/101_no_floats.filter.php
+++ b/stack/cas/parsingrules/101_no_floats.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that prevents the use of any floats.
*/
class stack_ast_filter_101_no_floats implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$checkfloats = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_Float) {
@@ -37,6 +45,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '450_split_floats') {
return true;
diff --git a/stack/cas/parsingrules/102_no_strings.filter.php b/stack/cas/parsingrules/102_no_strings.filter.php
index a4ea2b69059..5d40f870bfb 100644
--- a/stack/cas/parsingrules/102_no_strings.filter.php
+++ b/stack/cas/parsingrules/102_no_strings.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that prevents the use of any strings.
*/
class stack_ast_filter_102_no_strings implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$checkfloats = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_String) {
diff --git a/stack/cas/parsingrules/103_no_lists.filter.php b/stack/cas/parsingrules/103_no_lists.filter.php
index f8163f09afd..24e41ff2f86 100644
--- a/stack/cas/parsingrules/103_no_lists.filter.php
+++ b/stack/cas/parsingrules/103_no_lists.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that prevents the use of any lists.
*/
class stack_ast_filter_103_no_lists implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$checkfloats = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_List) {
diff --git a/stack/cas/parsingrules/104_no_sets.filter.php b/stack/cas/parsingrules/104_no_sets.filter.php
index c75242a86d4..274146c5e49 100644
--- a/stack/cas/parsingrules/104_no_sets.filter.php
+++ b/stack/cas/parsingrules/104_no_sets.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that prevents the use of any sets.
*/
class stack_ast_filter_104_no_sets implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$checkfloats = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_Set) {
diff --git a/stack/cas/parsingrules/105_no_grouppings.filter.php b/stack/cas/parsingrules/105_no_grouppings.filter.php
index e72c09b1387..bfa3fd443e5 100644
--- a/stack/cas/parsingrules/105_no_grouppings.filter.php
+++ b/stack/cas/parsingrules/105_no_grouppings.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -25,6 +32,7 @@
* This is a different thing than 505_no_evaluation_groups.
*/
class stack_ast_filter_105_no_grouppings implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$checkfloats = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_Group && (count($node->items) === 1)) {
diff --git a/stack/cas/parsingrules/106_no_control_flow.filter.php b/stack/cas/parsingrules/106_no_control_flow.filter.php
index 27a32e529c9..7818517b540 100644
--- a/stack/cas/parsingrules/106_no_control_flow.filter.php
+++ b/stack/cas/parsingrules/106_no_control_flow.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
* to do the same.
*/
class stack_ast_filter_106_no_control_flow implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$checkfloats = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_If ||
diff --git a/stack/cas/parsingrules/120_no_arc.filter.php b/stack/cas/parsingrules/120_no_arc.filter.php
index daec840ae6d..d760aa06ca7 100644
--- a/stack/cas/parsingrules/120_no_arc.filter.php
+++ b/stack/cas/parsingrules/120_no_arc.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -25,6 +32,7 @@
*/
class stack_ast_filter_120_no_arc implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
// As these are invalid they do not exist in the security-map.
diff --git a/stack/cas/parsingrules/150_replace_unicode_letters.filter.php b/stack/cas/parsingrules/150_replace_unicode_letters.filter.php
index d1934aff789..e2223acc7d1 100644
--- a/stack/cas/parsingrules/150_replace_unicode_letters.filter.php
+++ b/stack/cas/parsingrules/150_replace_unicode_letters.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../maximaparser/corrective_parser.php');
@@ -23,8 +30,10 @@
*/
class stack_ast_filter_150_replace_unicode_letters implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public static $ssmap = null;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
if (self::$ssmap === null) {
self::$ssmap = json_decode(file_get_contents(__DIR__ . '/../../maximaparser/unicode/letters-stack.json'), true);
diff --git a/stack/cas/parsingrules/180_char_based_superscripts.filter.php b/stack/cas/parsingrules/180_char_based_superscripts.filter.php
index d4c5fc0aa70..a72ec1121c3 100644
--- a/stack/cas/parsingrules/180_char_based_superscripts.filter.php
+++ b/stack/cas/parsingrules/180_char_based_superscripts.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../maximaparser/corrective_parser.php');
@@ -25,8 +32,10 @@
*/
class stack_ast_filter_180_char_based_superscripts implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public static $ssmap = null;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
if (self::$ssmap === null) {
self::$ssmap = json_decode(file_get_contents(__DIR__ . '/../../maximaparser/unicode/superscript-stack.json'), true);
diff --git a/stack/cas/parsingrules/201_sig_figs_validation.filter.php b/stack/cas/parsingrules/201_sig_figs_validation.filter.php
index 694fb172eed..251a39cafb9 100644
--- a/stack/cas/parsingrules/201_sig_figs_validation.filter.php
+++ b/stack/cas/parsingrules/201_sig_figs_validation.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../utils.class.php');
@@ -27,16 +34,21 @@
class stack_ast_filter_201_sig_figs_validation implements stack_cas_astfilter_parametric {
// Min and max are integer or null, null or values less than
// 1 signify that there is no limit in the given direction.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $min = 3;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $max = 3;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $strict = false;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_filter_parameters(array $parameters) {
$this->min = $parameters['min'];
$this->max = $parameters['max'];
$this->strict = $parameters['strict'];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$root = $ast;
if ($root instanceof MP_Root) {
@@ -108,6 +120,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_leftmost_int_or_float(MP_Node $tree) {
$nodes = [];
$search = function($node) use(&$nodes) {
diff --git a/stack/cas/parsingrules/202_decimal_places_validation.filter.php b/stack/cas/parsingrules/202_decimal_places_validation.filter.php
index c243e6a0a8f..69ecb20164f 100644
--- a/stack/cas/parsingrules/202_decimal_places_validation.filter.php
+++ b/stack/cas/parsingrules/202_decimal_places_validation.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../utils.class.php');
@@ -27,14 +34,18 @@
class stack_ast_filter_202_decimal_places_validation implements stack_cas_astfilter_parametric {
// Min and max are integer or null, null or values less than
// 1 signify that there is no limit in the given direction.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $min = 3;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $max = 3;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_filter_parameters(array $parameters) {
$this->min = $parameters['min'];
$this->max = $parameters['max'];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$root = $ast;
if ($root instanceof MP_Root) {
diff --git a/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php b/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php
index 87bdda4deb7..3a079672625 100644
--- a/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php
+++ b/stack/cas/parsingrules/210_x_used_as_multiplication.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../utils.class.php');
@@ -26,6 +33,7 @@
*/
class stack_ast_filter_210_x_used_as_multiplication implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$answernotes, &$errors) {
diff --git a/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php b/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php
index 5f2dea98985..1ac5ba58d5f 100644
--- a/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php
+++ b/stack/cas/parsingrules/402_split_prefix_from_common_function_name.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -29,6 +36,7 @@
*/
class stack_ast_filter_402_split_prefix_from_common_function_name implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$known = stack_cas_security::get_protected_identifiers('function', $identifierrules->get_units());
diff --git a/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php b/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php
index 3280f4b96fd..3a1f8e377b3 100644
--- a/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php
+++ b/stack/cas/parsingrules/403_split_at_number_letter_boundary.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -26,6 +33,7 @@
*/
class stack_ast_filter_403_split_at_number_letter_boundary implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$answernotes) {
diff --git a/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php b/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php
index a5992a1575d..5fea1dcbb13 100644
--- a/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php
+++ b/stack/cas/parsingrules/404_split_at_number_letter_number_boundary.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -28,6 +35,7 @@
*/
class stack_ast_filter_404_split_at_number_letter_number_boundary implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$answernotes) {
diff --git a/stack/cas/parsingrules/406_split_implied_variable_names.filter.php b/stack/cas/parsingrules/406_split_implied_variable_names.filter.php
index 6bc939596c6..84ec9469c53 100644
--- a/stack/cas/parsingrules/406_split_implied_variable_names.filter.php
+++ b/stack/cas/parsingrules/406_split_implied_variable_names.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -29,6 +36,7 @@
*/
class stack_ast_filter_406_split_implied_variable_names implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$usage = maxima_parser_utils::variable_usage_finder($ast);
diff --git a/stack/cas/parsingrules/410_single_char_vars.filter.php b/stack/cas/parsingrules/410_single_char_vars.filter.php
index 16fa53a426a..e7408aa1ac1 100644
--- a/stack/cas/parsingrules/410_single_char_vars.filter.php
+++ b/stack/cas/parsingrules/410_single_char_vars.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_410_single_char_vars implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
// TO-DO: do we maybe want to use the allowed words here also?
diff --git a/stack/cas/parsingrules/420_consolidate_subscripts.filter.php b/stack/cas/parsingrules/420_consolidate_subscripts.filter.php
index 36301cbdf51..e0106c04362 100644
--- a/stack/cas/parsingrules/420_consolidate_subscripts.filter.php
+++ b/stack/cas/parsingrules/420_consolidate_subscripts.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -26,6 +33,7 @@
*/
class stack_ast_filter_420_consolidate_subscripts implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$protected = stack_cas_security::get_protected_identifiers('variable', $identifierrules->get_units());
diff --git a/stack/cas/parsingrules/441_split_unknown_functions.filter.php b/stack/cas/parsingrules/441_split_unknown_functions.filter.php
index 5d6a5e935fc..cddcef81cfa 100644
--- a/stack/cas/parsingrules/441_split_unknown_functions.filter.php
+++ b/stack/cas/parsingrules/441_split_unknown_functions.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that prevents any function calls.
*/
class stack_ast_filter_441_split_unknown_functions implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$known = stack_cas_security::get_protected_identifiers('function', $identifierrules->get_units());
@@ -47,6 +55,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '542_no_functions_at_all' ||
$otherfiltername === '442_split_all_functions') {
diff --git a/stack/cas/parsingrules/442_split_all_functions.filter.php b/stack/cas/parsingrules/442_split_all_functions.filter.php
index 34299a44979..a2ca5c80df7 100644
--- a/stack/cas/parsingrules/442_split_all_functions.filter.php
+++ b/stack/cas/parsingrules/442_split_all_functions.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that prevents any function calls, including standard functions.
*/
class stack_ast_filter_442_split_all_functions implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$hasany, &$errors) {
@@ -42,6 +50,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '542_no_functions_at_all' ||
$otherfiltername === '541_no_unknown_functions' ||
diff --git a/stack/cas/parsingrules/450_split_floats.filter.php b/stack/cas/parsingrules/450_split_floats.filter.php
index 1136aa73bb5..ab13eb6de35 100644
--- a/stack/cas/parsingrules/450_split_floats.filter.php
+++ b/stack/cas/parsingrules/450_split_floats.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -27,6 +34,7 @@
* turns that -/+ to an op.
*/
class stack_ast_filter_450_split_floats implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$answernotes) {
if ($node instanceof MP_Float && $node->raw !== null) {
@@ -85,6 +93,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '101_no_floats') {
return true;
diff --git a/stack/cas/parsingrules/502_replace_pm.filter.php b/stack/cas/parsingrules/502_replace_pm.filter.php
index 5d2e3292c04..5bc1ecf3e69 100644
--- a/stack/cas/parsingrules/502_replace_pm.filter.php
+++ b/stack/cas/parsingrules/502_replace_pm.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -22,6 +29,7 @@
*/
class stack_ast_filter_502_replace_pm implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) {
diff --git a/stack/cas/parsingrules/504_insert_tuples_for_groups.php b/stack/cas/parsingrules/504_insert_tuples_for_groups.php
index 5e326c8f58f..b46da2d07cc 100644
--- a/stack/cas/parsingrules/504_insert_tuples_for_groups.php
+++ b/stack/cas/parsingrules/504_insert_tuples_for_groups.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_504_insert_tuples_for_groups implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$insettuples = function($node) use (&$answernotes, &$errors) {
diff --git a/stack/cas/parsingrules/505_no_evaluation_groups.filter.php b/stack/cas/parsingrules/505_no_evaluation_groups.filter.php
index e1810c5fa2e..7b0dfa7627f 100644
--- a/stack/cas/parsingrules/505_no_evaluation_groups.filter.php
+++ b/stack/cas/parsingrules/505_no_evaluation_groups.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
* syntax manipulations for example for tuples.
*/
class stack_ast_filter_505_no_evaluation_groups implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$checkfloats = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_Group && count($node->items) > 1) {
diff --git a/stack/cas/parsingrules/520_no_equality_with_logic.filter.php b/stack/cas/parsingrules/520_no_equality_with_logic.filter.php
index c4480800fb7..e9dd2a80010 100644
--- a/stack/cas/parsingrules/520_no_equality_with_logic.filter.php
+++ b/stack/cas/parsingrules/520_no_equality_with_logic.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that spots statements like 'x=1 or 2' and 'x=1 and 2'.
*/
class stack_ast_filter_520_no_equality_with_logic implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
// The logic is that if you have a logic operation and one side has
diff --git a/stack/cas/parsingrules/541_no_unknown_functions.filter.php b/stack/cas/parsingrules/541_no_unknown_functions.filter.php
index 158c6e28e0d..0e74436ac21 100644
--- a/stack/cas/parsingrules/541_no_unknown_functions.filter.php
+++ b/stack/cas/parsingrules/541_no_unknown_functions.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that prevents any function calls.
*/
class stack_ast_filter_541_no_unknown_functions implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$hasany = false;
$known = stack_cas_security::get_protected_identifiers('function', $identifierrules->get_units());
@@ -56,6 +64,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '442_split_all_functions' ||
$otherfiltername === '441_split_unknown_functions') {
diff --git a/stack/cas/parsingrules/542_no_functions_at_all.filter.php b/stack/cas/parsingrules/542_no_functions_at_all.filter.php
index 92f92720d06..e7ec33d28be 100644
--- a/stack/cas/parsingrules/542_no_functions_at_all.filter.php
+++ b/stack/cas/parsingrules/542_no_functions_at_all.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that prevents any function calls, including standard functions.
*/
class stack_ast_filter_542_no_functions_at_all implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$hasany = false;
@@ -52,6 +60,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '442_split_all_functions' ||
$otherfiltername === '441_split_unknown_functions') {
diff --git a/stack/cas/parsingrules/601_castext.filter.php b/stack/cas/parsingrules/601_castext.filter.php
index 9903bfe90c8..91994cdec88 100644
--- a/stack/cas/parsingrules/601_castext.filter.php
+++ b/stack/cas/parsingrules/601_castext.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -25,9 +32,12 @@
class stack_ast_filter_601_castext implements stack_cas_astfilter_parametric {
// What do we mark as the context of the CASText.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $context = 'unknown';
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $errclass = 'stack_cas_error';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_filter_parameters(array $parameters) {
if (isset($parameters['context'])) {
$this->context = $parameters['context'];
@@ -37,6 +47,7 @@ public function set_filter_parameters(array $parameters) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$ctx = $this->context;
$errclass = $this->errclass;
diff --git a/stack/cas/parsingrules/602_castext_simplifier.filter.php b/stack/cas/parsingrules/602_castext_simplifier.filter.php
index 47f865a89f4..6b0d047acce 100644
--- a/stack/cas/parsingrules/602_castext_simplifier.filter.php
+++ b/stack/cas/parsingrules/602_castext_simplifier.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -30,6 +37,7 @@ class stack_ast_filter_602_castext_simplifier implements stack_cas_astfilter {
// Is a node of the form ["%root",...].
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private static function is_castext($node) {
if ($node instanceof MP_List && count($node->items) > 0 && $node->items[0] instanceof MP_String) {
return $node->items[0]->value === "%root";
@@ -38,6 +46,7 @@ private static function is_castext($node) {
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) use (&$answernotes, &$errors) {
if (isset($node->position['castext']) && $node->position['castext']) {
diff --git a/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php b/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php
index be14c8bde41..694b69b0fd3 100644
--- a/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php
+++ b/stack/cas/parsingrules/610_castext_static_string_extractor.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -24,12 +31,15 @@
class stack_ast_filter_610_castext_static_string_extractor implements stack_cas_astfilter_parametric {
// A reference to the extractor.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $extractor = false;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_filter_parameters(array $parameters) {
$this->extractor = isset($parameters['static string extractor']) ? $parameters['static string extractor'] : null;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
// Simply nothing to do if we have nowhere to place those strings.
diff --git a/stack/cas/parsingrules/650_string_protect_slash.filter.php b/stack/cas/parsingrules/650_string_protect_slash.filter.php
index 97242aec9cf..51b5badc21e 100644
--- a/stack/cas/parsingrules/650_string_protect_slash.filter.php
+++ b/stack/cas/parsingrules/650_string_protect_slash.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -21,6 +28,7 @@
* AST filter that rewrites contents of Maxima strings to protect backslashes.
*/
class stack_ast_filter_650_string_protect_slash implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$strings = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_String) {
diff --git a/stack/cas/parsingrules/680_gcl_sconcat.filter.php b/stack/cas/parsingrules/680_gcl_sconcat.filter.php
index 11a5219334d..0bb68f73e19 100644
--- a/stack/cas/parsingrules/680_gcl_sconcat.filter.php
+++ b/stack/cas/parsingrules/680_gcl_sconcat.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -27,6 +34,7 @@
*/
class stack_ast_filter_680_gcl_sconcat implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$simplode = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_Functioncall) {
diff --git a/stack/cas/parsingrules/801_singleton_numeric.filter.php b/stack/cas/parsingrules/801_singleton_numeric.filter.php
index 8fa4502e826..f1c879c5c3f 100644
--- a/stack/cas/parsingrules/801_singleton_numeric.filter.php
+++ b/stack/cas/parsingrules/801_singleton_numeric.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../maximaparser/utils.php');
@@ -30,19 +37,24 @@ class stack_ast_filter_801_singleton_numeric implements stack_cas_astfilter_para
// These two control the aceptable raw data types as well as
// the mantissa allowed in the third option.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $integer = true;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $float = true;
// @codingStandardsIgnoreStart
// Accepts 0.123*10^45 or 123*10^45.
// Will not accept 0.123e4*10^5 as that is mixed usage.
// @codingStandardsIgnoreEnd
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $power = true;
// Convert from power form to float or vice versa
// Will not convert raw integers to floats.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $convert = 'none'; // Other options are 'to float', 'to power'.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_filter_parameters(array $parameters) {
$this->integer = $parameters['integer'];
$this->float = $parameters['float'];
@@ -50,6 +62,7 @@ public function set_filter_parameters(array $parameters) {
$this->convert = $parameters['convert'];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
// First unpack the $ast.
@@ -254,6 +267,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function acceptable_forms(): string {
$r = [];
if ($this->integer) {
@@ -276,6 +290,7 @@ private function acceptable_forms(): string {
return implode(', ', $r);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function float_to_power(MP_Float $float): MP_Node {
$raw = strtolower($float->raw);
$p = 0;
diff --git a/stack/cas/parsingrules/802_singleton_units.filter.php b/stack/cas/parsingrules/802_singleton_units.filter.php
index 27d0d113842..1d712d3252b 100644
--- a/stack/cas/parsingrules/802_singleton_units.filter.php
+++ b/stack/cas/parsingrules/802_singleton_units.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/801_singleton_numeric.filter.php');
@@ -39,20 +46,25 @@ class stack_ast_filter_802_singleton_units implements stack_cas_astfilter_parame
// Do we only accept the default units or do we allow additional
// variables/constants? Use the forbidden words to limit more accurately.
// That limitation will happen through the security-filter.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $allowvariables = false;
// Allow the expression to contain constants like `pi`.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $allowconstants = false;
// Convert all floats to powers.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $floattopower = false;
// Invalid if no known unit found. This means that one can allow
// this to function even if the "unit" is not one of the official ones
// it will still require an identifier though.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $mandatoryunit = true;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_filter_parameters(array $parameters) {
if (isset($parameters['allowvariables'])) {
$this->allowvariables = $parameters['allowvariables'];
@@ -68,6 +80,7 @@ public function set_filter_parameters(array $parameters) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$ops = [];
diff --git a/stack/cas/parsingrules/901_remove_comments.filter.php b/stack/cas/parsingrules/901_remove_comments.filter.php
index 4c82491446e..eafa312d3ff 100644
--- a/stack/cas/parsingrules/901_remove_comments.filter.php
+++ b/stack/cas/parsingrules/901_remove_comments.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -22,6 +29,7 @@
*/
class stack_ast_filter_901_remove_comments implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) {
diff --git a/stack/cas/parsingrules/909_parsons_decode_state_for_display.filter.php b/stack/cas/parsingrules/909_parsons_decode_state_for_display.filter.php
index ee9f0134757..071ffb094d5 100644
--- a/stack/cas/parsingrules/909_parsons_decode_state_for_display.filter.php
+++ b/stack/cas/parsingrules/909_parsons_decode_state_for_display.filter.php
@@ -14,11 +14,20 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../utils.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_ast_filter_909_parsons_decode_state_for_display implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$strings = function($node) use (&$answernotes, &$errors) {
// We validate the node to check that it is a string that represents a Parson's state.
diff --git a/stack/cas/parsingrules/910_inert_float_for_display.filter.php b/stack/cas/parsingrules/910_inert_float_for_display.filter.php
index b6413e654eb..015c897add9 100644
--- a/stack/cas/parsingrules/910_inert_float_for_display.filter.php
+++ b/stack/cas/parsingrules/910_inert_float_for_display.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../utils.class.php');
@@ -35,6 +42,7 @@
*/
class stack_ast_filter_910_inert_float_for_display implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$floats = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_Float) {
diff --git a/stack/cas/parsingrules/912_inert_string_for_display.filter.php b/stack/cas/parsingrules/912_inert_string_for_display.filter.php
index 2382b8b3ea2..3522cb751c5 100644
--- a/stack/cas/parsingrules/912_inert_string_for_display.filter.php
+++ b/stack/cas/parsingrules/912_inert_string_for_display.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/../../utils.class.php');
@@ -31,6 +38,7 @@
* target some very specific cases separately.
*/
class stack_ast_filter_912_inert_string_for_display implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$strings = function($node) use (&$answernotes, &$errors) {
if ($node instanceof MP_String) {
diff --git a/stack/cas/parsingrules/990_no_fixing_spaces.filter.php b/stack/cas/parsingrules/990_no_fixing_spaces.filter.php
index 37b57ef8d22..18e5e9bc898 100644
--- a/stack/cas/parsingrules/990_no_fixing_spaces.filter.php
+++ b/stack/cas/parsingrules/990_no_fixing_spaces.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_990_no_fixing_spaces implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$spaces = false;
@@ -52,6 +60,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '999_strict') {
return true;
diff --git a/stack/cas/parsingrules/991_no_fixing_stars.filter.php b/stack/cas/parsingrules/991_no_fixing_stars.filter.php
index 0399ed5e012..3565efd599c 100644
--- a/stack/cas/parsingrules/991_no_fixing_stars.filter.php
+++ b/stack/cas/parsingrules/991_no_fixing_stars.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_991_no_fixing_stars implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$stars = false;
@@ -53,6 +61,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '999_strict') {
return true;
diff --git a/stack/cas/parsingrules/995_ev_modification.filter.php b/stack/cas/parsingrules/995_ev_modification.filter.php
index 34f73cc4b51..047603254a9 100644
--- a/stack/cas/parsingrules/995_ev_modification.filter.php
+++ b/stack/cas/parsingrules/995_ev_modification.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
require_once(__DIR__ . '/996_call_modification.filter.php');
@@ -26,12 +33,15 @@
class stack_ast_filter_995_ev_modification implements stack_cas_astfilter_parametric {
// Whether to rewrite evaluation flags. Don't do for students.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $flags = false;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_filter_parameters(array $parameters) {
$this->flags = isset($parameters['flags']) ? $parameters['flags'] : false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) {
diff --git a/stack/cas/parsingrules/996_call_modification.filter.php b/stack/cas/parsingrules/996_call_modification.filter.php
index 83c5d6fc3e8..ea565b7ba4a 100644
--- a/stack/cas/parsingrules/996_call_modification.filter.php
+++ b/stack/cas/parsingrules/996_call_modification.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,11 +30,14 @@
class stack_ast_filter_996_call_modification implements stack_cas_astfilter {
// The name of the function that checks identifiers.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const IDCHECK = '%_C';
// The name of the function that checks expressions.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const EXPCHECK = '%_E';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$mapfuns = stack_cas_security::get_all_with_feature('mapfunction');
diff --git a/stack/cas/parsingrules/997_string_security.filter.php b/stack/cas/parsingrules/997_string_security.filter.php
index b1b93e7c653..219cac7c58c 100644
--- a/stack/cas/parsingrules/997_string_security.filter.php
+++ b/stack/cas/parsingrules/997_string_security.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -27,6 +34,7 @@
*/
class stack_ast_filter_997_string_security implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$process = function($node) {
diff --git a/stack/cas/parsingrules/998_security.filter.php b/stack/cas/parsingrules/998_security.filter.php
index c5cf34bd817..8fd39c586f7 100644
--- a/stack/cas/parsingrules/998_security.filter.php
+++ b/stack/cas/parsingrules/998_security.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -22,12 +29,15 @@
*/
class stack_ast_filter_998_security implements stack_cas_astfilter_parametric {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $source = 's';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_filter_parameters(array $parameters) {
$this->source = isset($parameters['security']) ? $parameters['security'] : 's';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$valid = true;
diff --git a/stack/cas/parsingrules/999_strict.filter.php b/stack/cas/parsingrules/999_strict.filter.php
index 21d04e5caba..a8494799da3 100644
--- a/stack/cas/parsingrules/999_strict.filter.php
+++ b/stack/cas/parsingrules/999_strict.filter.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,6 +30,7 @@
*/
class stack_ast_filter_999_strict implements stack_cas_astfilter_exclusion {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$spaces = false;
@@ -70,6 +78,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function conflicts_with(string $otherfiltername): bool {
if ($otherfiltername === '990_no_fixing_spaces' ||
$otherfiltername === '991_no_fixing_stars') {
diff --git a/stack/cas/parsingrules/filter.interface.php b/stack/cas/parsingrules/filter.interface.php
index 6f7a7c29a00..4e796c7ec35 100644
--- a/stack/cas/parsingrules/filter.interface.php
+++ b/stack/cas/parsingrules/filter.interface.php
@@ -14,11 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../maximaparser/MP_classes.php');
require_once(__DIR__ . '/../cassecurity.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface stack_cas_astfilter {
/**
@@ -33,6 +41,7 @@ public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface stack_cas_astfilter_parametric extends stack_cas_astfilter {
/**
@@ -47,6 +56,7 @@ public function set_filter_parameters(array $parameters);
* that should one make an coding error leading to such filters being in the
* same pipeline the situation will become obvious very fast indeed.
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Interface
interface stack_cas_astfilter_exclusion extends stack_cas_astfilter {
/**
diff --git a/stack/cas/parsingrules/parsingrule.factory.php b/stack/cas/parsingrules/parsingrule.factory.php
index 0db2521ae37..2001c539a5b 100644
--- a/stack/cas/parsingrules/parsingrule.factory.php
+++ b/stack/cas/parsingrules/parsingrule.factory.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL')|| die();
require_once(__DIR__ . '/filter.interface.php');
@@ -83,8 +90,10 @@
*/
class stack_parsing_rule_factory {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private static $singletons = [];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private static function build_from_name(string $name): stack_cas_astfilter {
// Might as well do the require once here, but better limit to
// vetted and require all by default to catch syntax errors.
@@ -204,6 +213,7 @@ private static function build_from_name(string $name): stack_cas_astfilter {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_by_common_name(string $name): stack_cas_astfilter {
if (empty(self::$singletons)) {
// If the static set has not been initialised do so.
@@ -256,6 +266,7 @@ public static function get_by_common_name(string $name): stack_cas_astfilter {
return self::$singletons[$name];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_filter_pipeline(array $activefilters, array $settings, bool $includecore=true): stack_cas_astfilter {
$tobeincluded = [];
if ($includecore === true) {
@@ -308,6 +319,7 @@ public static function get_filter_pipeline(array $activefilters, array $settings
return new stack_ast_filter_pipeline($tobeincluded);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function list_filters(): array {
if (empty(self::$singletons)) {
self::get_by_common_name('001_fix_call_of_a_group_or_function');
diff --git a/stack/cas/parsingrules/pipeline.class.php b/stack/cas/parsingrules/pipeline.class.php
index 965233967af..9477b51ff38 100644
--- a/stack/cas/parsingrules/pipeline.class.php
+++ b/stack/cas/parsingrules/pipeline.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL')|| die();
require_once(__DIR__ . '/filter.interface.php');
@@ -23,12 +30,15 @@
* the filter factory if asked for a set of filters.
*/
class stack_ast_filter_pipeline implements stack_cas_astfilter {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $filters = [];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($filtersinorder) {
$this->filters = $filtersinorder;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node {
$filtered = $ast;
foreach ($this->filters as $filter) {
diff --git a/stack/cas/secure_loader.class.php b/stack/cas/secure_loader.class.php
index 4e2c4274b09..3cbf76e77be 100644
--- a/stack/cas/secure_loader.class.php
+++ b/stack/cas/secure_loader.class.php
@@ -16,23 +16,32 @@
defined('MOODLE_INTERNAL')|| die();
-// Way to load in whatever CAS code one wants without having to deal
-// with validation, intended to be used with caching of large logic blocks
-// like PRTs as pre validated strings.
-//
-// @copyright 2019 Aalto University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Way to load in whatever CAS code one wants without having to deal
+ * with validation, intended to be used with caching of large logic blocks
+ * like PRTs as pre validated strings.
+ *
+ * @package qtype_stack
+ * @copyright 2019 Aalto University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/evaluatable_object.interfaces.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_secure_loader implements cas_evaluatable {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $code;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $errors;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $context;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $blockexternal;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct(string $securedcode, string $fromwhere = '', string $blockexternal = '') {
if ($securedcode === null) {
throw new stack_exception('secure_loader: the code must not be null.');
@@ -49,24 +58,29 @@ public function __construct(string $securedcode, string $fromwhere = '', string
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid(): bool {
// This code has been validated elsewhere.
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluationform(): string {
return $this->code;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_status(array $errors, array $answernotes, array $feedback) {
// Note that secure_loader content does not care about feedback or notes.
$this->errors = $errors;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_source_context(): string {
return $this->context;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_errors($raw = 'implode') {
if ($raw === 'objects') {
return $this->errors;
@@ -82,22 +96,28 @@ public function get_errors($raw = 'implode') {
return $errors;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_key(): string {
return '';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_blockexternal(): bool {
return $this->blockexternal;
}
}
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_secure_loader_value extends stack_secure_loader implements cas_value_extractor {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $value;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_evaluated_value(MP_Node $ast) {
$this->value = $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_value() {
return $this->value;
}
diff --git a/stack/graphlayout/graph.php b/stack/graphlayout/graph.php
index 10959c9a545..a3cb89e1a26 100644
--- a/stack/graphlayout/graph.php
+++ b/stack/graphlayout/graph.php
@@ -33,6 +33,7 @@
/**
* Abstract representation of a graph (e.g. a PRT).
*
+ * @package qtype_stack
* @copyright 2013 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -67,6 +68,7 @@ class stack_abstract_graph {
*/
protected $stack = [];
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $clumps = null;
/**
@@ -101,6 +103,7 @@ public function add_prt_node($name, $description, $leftchild, $rightchild, $left
$leftlabel, $rightlabel, $url);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_prt_text($name, $casstatement, $quiet, $truenote, $falsenote) {
if ($this->nodes[$name] instanceof stack_prt_graph_node) {
$this->nodes[$name]->add_prt_text($casstatement, $quiet, $truenote, $falsenote);
@@ -109,6 +112,7 @@ public function add_prt_text($name, $casstatement, $quiet, $truenote, $falsenote
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function remove_node($nametodelete) {
foreach ($this->nodes as $name => $node) {
if ($name == $nametodelete) {
@@ -354,6 +358,7 @@ public function get($nodename) {
}
/**
+ * Add description here.
* @return array node name => stack_abstract_graph_node the list of all nodes.
*/
public function get_nodes() {
@@ -363,6 +368,7 @@ public function get_nodes() {
}
/**
+ * Add description here.
* @return array node name => stack_abstract_graph_node nodes that are
* roots in the graph. (That is, no other node links to them.) Only available
* once the graph has been laid out.
@@ -372,6 +378,7 @@ public function get_roots() {
}
/**
+ * Add description here.
* @return array with keys like "node name|-1" or "node name|1". If, we
* find a cycle in the graph we break it at an arbitrary point, and record
* that fact here, then carry on. Therefore, this is a list of errors.
@@ -382,6 +389,7 @@ public function get_broken_cycles() {
}
/**
+ * Add description here
* @param stack_abstract_graph_node $node the parent node of the edge.
* @param int $direction self::LEFT or self::RIGHT.
* @return book whether this edge was broken to break a cycle.
@@ -391,6 +399,7 @@ public function is_broken_edge(stack_abstract_graph_node $node, $direction) {
}
/**
+ * Add description here.
* @return int the maximum depth of any node. Root nodes have depth 1.
*/
public function max_depth() {
@@ -399,6 +408,7 @@ public function max_depth() {
}
/**
+ * Add description here.
* @return array with two elements, the minimum and maximum x-coordinates of any node.
*/
public function x_range() {
@@ -417,6 +427,7 @@ public function x_range() {
}
/**
+ * Add description here
* @param stack_abstract_graph_node $parent the parent node.
* @param stack_abstract_graph_node $child one of its children.
* @return bool whether there is another node on the direct line from parent to child.
@@ -487,6 +498,7 @@ protected function suggested_names_worker(array $alreadynamed,
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __toString() {
$string = '';
foreach ($this->nodesbydepth as $depth => $nodes) {
diff --git a/stack/graphlayout/graphclump.php b/stack/graphlayout/graphclump.php
index 65286f1880f..80680e03f06 100644
--- a/stack/graphlayout/graphclump.php
+++ b/stack/graphlayout/graphclump.php
@@ -26,6 +26,7 @@
* Used by {@link stack_abstract_graph} during the layout algorithm.
* This represents a group of nodes that have been laid out relative to each other.
*
+ * @package qtype_stack
* @copyright 2013 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/stack/graphlayout/graphnode.php b/stack/graphlayout/graphnode.php
index 64f7e970761..9eed7bc32d2 100644
--- a/stack/graphlayout/graphnode.php
+++ b/stack/graphlayout/graphnode.php
@@ -25,6 +25,7 @@
/**
* Represents a node in a {@link stack_abstract_graph}.
*
+ * @package qtype_stack
* @copyright 2013 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -47,7 +48,7 @@ class stack_abstract_graph_node {
/** @var string label on the left edge. */
public $rightlabel = '';
- /** @param string $url if set, this node should be a link to that URL. */
+ /** @var string $url if set, this node should be a link to that URL. */
public $url = '';
/** @var int depth of this node in the display. */
@@ -85,6 +86,7 @@ public function __construct($name, $description, $left, $right, $leftlabel = '',
$this->url = $url;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __toString() {
return '[' . $this->name . ' (' . $this->x . ', ' . $this->depth . '): -> ' . $this->left . ', -> ' . $this->right . ']';
}
diff --git a/stack/graphlayout/prtnode.php b/stack/graphlayout/prtnode.php
index 5f1cd9261f7..4792b000137 100644
--- a/stack/graphlayout/prtnode.php
+++ b/stack/graphlayout/prtnode.php
@@ -29,6 +29,7 @@
/**
* Represents a node in a STACK PRT extending {@link stack_abstract_graph}.
*
+ * @package qtype_stack
* @copyright 2023 The University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/stack/graphlayout/svgrenderer.php b/stack/graphlayout/svgrenderer.php
index 49426285532..a137593fcf3 100644
--- a/stack/graphlayout/svgrenderer.php
+++ b/stack/graphlayout/svgrenderer.php
@@ -25,6 +25,7 @@
/**
* Displays a {@link stack_abstract_graph} as SVG.
*
+ * @package qtype_stack
* @copyright 2013 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/stack/graphlayout/textrenderer.php b/stack/graphlayout/textrenderer.php
index fcdfcebdac8..6381de86008 100644
--- a/stack/graphlayout/textrenderer.php
+++ b/stack/graphlayout/textrenderer.php
@@ -25,6 +25,7 @@
/**
* Displays a {@link stack_abstract_graph} as text.
*
+ * @package qtype_stack
* @copyright 2023 The University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -33,6 +34,7 @@ class stack_prt_graph_text_renderer {
/**
* Hold the graph itself.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $g = null;
/**
diff --git a/stack/input/algebraic/algebraic.class.php b/stack/input/algebraic/algebraic.class.php
index 8fe5994fd53..e49edce0182 100644
--- a/stack/input/algebraic/algebraic.class.php
+++ b/stack/input/algebraic/algebraic.class.php
@@ -17,11 +17,12 @@
/**
* A basic text-field input.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_algebraic_input extends stack_input {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $extraoptions = [
'hideanswer' => false,
'allowempty' => false,
@@ -36,6 +37,7 @@ class stack_algebraic_input extends stack_input {
'monospace' => false,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
@@ -91,6 +93,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return html_writer::empty_tag('input', $attributes);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -107,6 +110,7 @@ public function render_api_data($tavalue) {
return $data;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -150,6 +154,7 @@ public function internal_validate_parameter($parameter, $value) {
}
/**
+ * Add description here.
* @return string the teacher's answer, displayed to the student in the general feedback.
*/
public function get_teacher_answer_display($value, $display) {
diff --git a/stack/input/boolean/boolean.class.php b/stack/input/boolean/boolean.class.php
index 42d844994dc..c88748173b3 100644
--- a/stack/input/boolean/boolean.class.php
+++ b/stack/input/boolean/boolean.class.php
@@ -17,14 +17,19 @@
/**
* Input for entering true/false using a select dropdown.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_boolean_input extends stack_input {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const F = 'false';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const T = 'true';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const NA = '';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_choices() {
return [
self::F => stack_string('false'),
@@ -33,6 +38,7 @@ public static function get_choices() {
];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function extra_validation($contents) {
$validation = $contents[0];
if ($validation === 'EMPTYANSWER') {
@@ -44,6 +50,7 @@ protected function extra_validation($contents) {
return '';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
return $this->render_error($this->errors);
@@ -66,6 +73,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
$value, '', $attributes);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -79,6 +87,7 @@ public function render_api_data($tavalue) {
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name);
$mform->setType($this->name, PARAM_RAW);
diff --git a/stack/input/checkbox/checkbox.class.php b/stack/input/checkbox/checkbox.class.php
index c38000cec85..516d409b54b 100644
--- a/stack/input/checkbox/checkbox.class.php
+++ b/stack/input/checkbox/checkbox.class.php
@@ -16,24 +16,30 @@
defined('MOODLE_INTERNAL') || die();
-// Input that is a checkbox/multiple choice.
-//
-// @copyright 2015 University of Edinburgh.
-// @author Chris Sangwin.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Input that is a checkbox/multiple choice.
+ *
+ * @package qtype_stack
+ * @copyright 2015 University of Edinburgh.
+ * @author Chris Sangwin.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/../dropdown/dropdown.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_checkbox_input extends stack_dropdown_input {
- /*
+ /**
* ddltype must be one of 'select', 'checkbox' or 'radio'.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ddltype = 'checkbox';
- /*
+ /**
* Default ddldisplay for checkboxes is 'LaTeX'.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ddldisplay = 'LaTeX';
/**
@@ -57,6 +63,7 @@ public function contents_to_maxima($contents) {
return '['.implode(',', $vals).']';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
return $this->render_error($this->errors);
@@ -103,6 +110,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return $result;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -160,6 +168,7 @@ public function maxima_to_response_array($in) {
return $response;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function ajax_to_response_array($in) {
if (((string) $in) === '') {
return [];
@@ -177,7 +186,6 @@ protected function ajax_to_response_array($in) {
*
* @param string $in
* @return string
- * @access public
*/
public function response_to_contents($response) {
// Did the student chose the "Not answered" response?
@@ -194,6 +202,7 @@ public function response_to_contents($response) {
}
/**
+ * Add description here.
* @return string the teacher's answer, suitable for testcase construction.
*/
public function get_teacher_answer_testcase() {
@@ -217,6 +226,7 @@ protected function is_blank_response($contents) {
return $allblank;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_api_solution($tavalue) {
$solution = [];
foreach ($this->ddlvalues as $key => $value) {
diff --git a/stack/input/dropdown/dropdown.class.php b/stack/input/dropdown/dropdown.class.php
index 152b6dc3746..85af8c27d5b 100644
--- a/stack/input/dropdown/dropdown.class.php
+++ b/stack/input/dropdown/dropdown.class.php
@@ -14,59 +14,69 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
-defined('MOODLE_INTERNAL') || die();
-
-require_once(__DIR__ . '/../../cas/castext2/utils.php');
-
/**
* Input that is a dropdown list/multiple choice that the teacher
* has specified.
*
+ * @package qtype_stack
* @copyright 2015 University of Edinburgh
* @author Chris Sangwin
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
+require_once(__DIR__ . '/../../cas/castext2/utils.php');
+
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_dropdown_input extends stack_input {
- /*
+ /**
* ddlvalues is an array of the types used.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ddlvalues = [];
- /*
+ /**
* ddltype must be one of 'select', 'checkbox' or 'radio'.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ddltype = 'select';
- /*
+ /**
* ddldisplay must be either 'LaTeX' or 'casstring' and it determines what is used for the displayed
* string the student uses. The default is LaTeX, but this doesn't always work in dropdowns.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ddldisplay = 'casstring';
- /*
+ /**
* Controls whether a "not answered" option is presented to the students.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $nonotanswered = true;
- /*
+ /**
* Controls the "not answered" message presented to the students.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $notanswered = '';
- /*
+ /**
* This holds the value of those
* entries which the teacher has indicated are correct.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $teacheranswervalue = '';
- /*
+ /**
* This holds a displayed form of $this->teacheranswer. We need to generate this from those
* entries which the teacher has indicated are correct.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $teacheranswerdisplay = '';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function internal_construct() {
$options = $this->get_parameter('options');
if ($options != null && trim($options) != '') {
@@ -124,7 +134,7 @@ protected function internal_construct() {
return true;
}
- /*
+ /**
* For the dropdown, each expression must be a list of pairs:
* [CAS expression, true/false].
* The second Boolean value determines if this should be considered
@@ -364,6 +374,7 @@ public function adapt_to_model_answer($teacheranswer) {
return;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function key_order($values) {
// Make sure the array keys start at 1. This avoids
@@ -386,6 +397,7 @@ private function key_order($values) {
return $values;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function extra_validation($contents) {
if (!array_key_exists($contents[0], $this->get_choices())) {
return stack_string('dropdowngotunrecognisedvalue');
@@ -393,6 +405,7 @@ protected function extra_validation($contents) {
return '';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function validate_contents($contents, $basesecurity, $localoptions) {
$valid = true;
$errors = $this->errors;
@@ -431,7 +444,8 @@ public function contents_to_maxima($contents) {
return $this->get_input_ddl_value($contents[0]);
}
- /* This function always returns an array where the key is the key in the ddlvalues.
+ /**
+ * This function always returns an array where the key is the key in the ddlvalues.
*/
protected function get_choices() {
@@ -448,6 +462,7 @@ protected function get_choices() {
return $choices;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
@@ -486,6 +501,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return $result;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -514,6 +530,7 @@ public function get_expected_data() {
return $expected;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name);
$mform->setDefault($this->name, '');
@@ -564,6 +581,7 @@ public function get_correct_response($value) {
}
/**
+ * Add description here.
* @return string the teacher's answer, suitable for testcase construction.
*/
public function get_teacher_answer_testcase() {
@@ -591,6 +609,7 @@ public function maxima_to_response_array($in) {
}
/**
+ * Add description here.
* @return string the teacher's answer, displayed to the student in the general feedback.
*/
public function get_teacher_answer_display($value, $display) {
@@ -606,7 +625,6 @@ public function get_teacher_answer_display($value, $display) {
*
* @param string $in
* @return string
- * @access public
*/
public function response_to_contents($response) {
$contents = [];
@@ -633,7 +651,7 @@ protected function is_blank_response($contents) {
return $allblank;
}
- /*
+ /**
* In this type we use the array keys in $this->ddlvalues within the HTML interactions,
* not the CAS values. These next two methods map between the keys and the CAS values.
*/
@@ -653,6 +671,7 @@ protected function get_input_ddl_value($key) {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function get_input_ddl_key($value) {
foreach ($this->ddlvalues as $key => $val) {
if ($val['value'] == $value) {
@@ -664,6 +683,7 @@ protected function get_input_ddl_key($value) {
return false;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_api_solution($tavalue) {
$solution = "";
foreach ($this->ddlvalues as $key => $value) {
diff --git a/stack/input/equiv/equiv.class.php b/stack/input/equiv/equiv.class.php
index 50f17938c68..38e91725703 100644
--- a/stack/input/equiv/equiv.class.php
+++ b/stack/input/equiv/equiv.class.php
@@ -22,6 +22,7 @@
* This is an input that allows reasoning by equivalence.
* Each line input becomes one element of a list.
*
+ * @package qtype_stack
* @copyright 2015 Loughborough University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -56,6 +57,7 @@ class stack_equiv_input extends stack_input {
'checkvars' => 0,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
// Note that at the moment, $this->boxHeight and $this->boxWidth are only
// used as minimums. If the current input is bigger, the box is expanded.
@@ -131,6 +133,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return $output;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -162,6 +165,7 @@ public function render_api_data($tavalue) {
return $data;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -194,6 +198,7 @@ protected function response_to_contents($response) {
return $contents;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function caslines_to_answer($caslines, $secrules = false) {
$vals = [];
// We don't use full "inputform" here as we need to keep stacklet and stackeq as is.
@@ -410,7 +415,8 @@ protected function validation_display($answer, $lvars, $caslines, $additionalvar
}
- /** This function creates additional session variables.
+ /**
+ * This function creates additional session variables.
*/
protected function additional_session_variables($caslines, $teacheranswer) {
$equivdebug = 'false';
@@ -457,10 +463,12 @@ protected function additional_session_variables($caslines, $teacheranswer) {
return ['calculus' => $ca, 'equivdisplay' => $an, 'equivfirstline' => $fl];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function get_validation_method() {
return 'equiv';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function comment_tag($index) {
return 'EQUIVCOMMENT'.$index;
}
@@ -506,6 +514,7 @@ public function internal_validate_parameter($parameter, $value) {
}
/**
+ * Add description here.
* @return string the teacher's answer, displayed to the student in the general feedback.
*/
public function get_teacher_answer_display($value, $display) {
@@ -573,12 +582,14 @@ public function render_validation(stack_input_state $state, $fieldname, $lang) {
return $feedback;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function ajax_to_response_array($in) {
$in = explode('
', $in);
$in = implode("\n", $in);
return [$this->name => $in];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_api_solution($tavalue) {
return ['' => $this->maxima_to_raw_input($tavalue)];
}
diff --git a/stack/input/factory.class.php b/stack/input/factory.class.php
index ce6bd534e66..7b95ea30ecd 100644
--- a/stack/input/factory.class.php
+++ b/stack/input/factory.class.php
@@ -14,17 +14,28 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../options.class.php');
require_once(__DIR__ . '/inputbase.class.php');
-// Input factory. Provides a convenient way to create an input of any type,
-// and to get metadata about the input types.
-//
-// @copyright 2012 University of Birmingham.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Input factory. Provides a convenient way to create an input of any type,
+ * and to get metadata about the input types.
+ *
+ * @package qtype_stack
+ * @copyright 2012 University of Birmingham.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_input_factory {
/**
* @var array type name => array of parameter names used. Used to cache the
@@ -78,6 +89,7 @@ protected static function class_for_type($type) {
}
/**
+ * Add description here.
* @return array of available type names.
*/
public static function get_available_types() {
@@ -127,6 +139,7 @@ public static function get_available_types() {
}
/**
+ * Add description here.
* @return array input type internal name => display name.
*/
public static function get_available_type_choices() {
diff --git a/stack/input/geogebra/geogebra.class.php b/stack/input/geogebra/geogebra.class.php
index 73619d3ab06..ddcbaee319f 100644
--- a/stack/input/geogebra/geogebra.class.php
+++ b/stack/input/geogebra/geogebra.class.php
@@ -17,12 +17,14 @@
/**
* GeoGebra-Input field (algebraic input field with GeoGebra specific features)
* derived by algebraic/algebraic.class.php "A basic text-field input."
+ * @package qtype_stack
* @copyright 2012 University of Birmingham (algebraic.class.php), 2022 University of Edinburgh(geogebra.class.php)
* @author Tim Lutz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_geogebra_input extends stack_input {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $extraoptions = [
'hideanswer' => true,
'simp' => false,
@@ -34,6 +36,7 @@ class stack_geogebra_input extends stack_input {
'checkvars' => 0,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
@@ -86,11 +89,13 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return html_writer::empty_tag('input', $attributes);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
// Dummy function to allow code to run. GeoGebra not currently functional in API.
throw new stack_exception("Usage of geogebra is currently not supported.");
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -134,6 +139,7 @@ public function internal_validate_parameter($parameter, $value) {
}
/**
+ * Add description here.
* @return string the teacher's answer, displayed to the student in the general feedback. default = hideanswer.
*/
public function get_teacher_answer_display($value, $display) {
diff --git a/stack/input/inputbase.class.php b/stack/input/inputbase.class.php
index a2124ad734c..8bbe7e9b4be 100644
--- a/stack/input/inputbase.class.php
+++ b/stack/input/inputbase.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../locallib.php');
@@ -27,18 +34,27 @@
* Inputs are the controls that the teacher can put into the question
* text to receive the student's response.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class stack_input {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const BLANK = '';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const VALID = 'valid';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const INVALID = 'invalid';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const SCORE = 'score';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const GRAMMAR_FIX_INSERT_STARS = 1;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const GRAMMAR_FIX_SPACES = 2;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const GRAMMAR_FIX_SINGLE_CHAR = 4;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const GRAMMAR_FIX_FUNCTIONS = 16;
/**
@@ -60,6 +76,7 @@ abstract class stack_input {
/**
* Special variables in the question which should be exposed to the inputs and answer tests.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $contextsession = [];
/**
@@ -103,6 +120,7 @@ abstract class stack_input {
/**
* The question level options for CAS sessions.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $options;
/**
@@ -464,7 +482,7 @@ public function adapt_to_model_answer($teacheranswer) {
// By default, do nothing.
}
- /*
+ /**
* Set the contextsession values.
*/
public function add_contextsession($contextsession) {
@@ -475,6 +493,7 @@ public function add_contextsession($contextsession) {
}
/**
+ * Add description here
* @param string $param a settings parameter name.
* @return bool whether this input type uses this parameter.
*/
@@ -603,7 +622,7 @@ public function get_extra_option($option, $default = false) {
}
}
- /*
+ /**
* Return the value of any extra options.
*/
public function get_extra_options() {
@@ -625,6 +644,7 @@ public function get_expected_data() {
}
/**
+ * Add description here.
* @return string the teacher's answer, an example of what could be typed into
* this input as part of a correct response to the question.
*/
@@ -633,6 +653,7 @@ public function get_teacher_answer() {
}
/**
+ * Add description here.
* @return string the teacher's answer, suitable for testcase construction.
*/
public function get_teacher_answer_testcase() {
@@ -640,6 +661,7 @@ public function get_teacher_answer_testcase() {
}
/**
+ * Add description here.
* @return string the teacher's answer, displayed to the student in the general feedback.
*/
public function get_teacher_answer_display($value, $display) {
@@ -927,7 +949,8 @@ public function validate_student_response($response, $options, $teacheranswer, s
return $state;
}
- /* Allow different input types to change the CAS method used.
+ /**
+ * Allow different input types to change the CAS method used.
* In particular, the units and equiv inputs do something different here.
*/
protected function get_validation_method() {
@@ -938,7 +961,7 @@ protected function get_validation_method() {
return $validationmethod;
}
- /*
+ /**
* Sort out which filters to apply, based on options to the input.
* Should be mostly independent of input type.
*/
@@ -1120,6 +1143,7 @@ protected function additional_session_variables($caslines, $teacheranswer) {
return [];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function extra_option_variables($questionvariables) {
$additionalvars = [];
@@ -1383,6 +1407,7 @@ protected function validation_display($answer, $lvars, $caslines, $additionalvar
return [$valid, $errors, $display];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function requires_validation() {
return $this->get_parameter('mustVerify', true);
}
@@ -1398,7 +1423,7 @@ public function requires_validation() {
*/
abstract public function render(stack_input_state $state, $fieldname, $readonly, $tavalue);
- /*
+ /**
* Render any error messages.
*/
protected function render_error($error) {
@@ -1484,7 +1509,8 @@ public function render_validation(stack_input_state $state, $fieldname, $lang) {
return $feedback;
}
- /* Allows individual input types to change the way the list of variables is tagged.
+ /**
+ * Allows individual input types to change the way the list of variables is tagged.
* Used by the units input type.
*/
protected function tag_listofvariables($vars) {
@@ -1644,7 +1670,7 @@ protected function ajax_to_response_array($in) {
return [$this->name => $in];
}
- /*
+ /**
* Return the value of any errors.
*/
public function get_errors() {
@@ -1660,7 +1686,7 @@ public function get_errors() {
return array_keys($errors);
}
- /*
+ /**
* Provide a summary of the student's response for the Moodle reporting.
* Notes do something different here.
*/
diff --git a/stack/input/inputstate.class.php b/stack/input/inputstate.class.php
index 4f288848a8d..8c556c6c6e1 100644
--- a/stack/input/inputstate.class.php
+++ b/stack/input/inputstate.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../locallib.php');
@@ -28,6 +35,7 @@
* @property-read string $contentsdisplayed how Stack interpreted the current contents of the input.
* @property-read string $errors any validation errors.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -100,6 +108,7 @@ public function __construct($status, $contents, $contentsmodified, $contentsdisp
$this->_simp = $simp;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __get($field) {
switch ($field) {
case 'status':
diff --git a/stack/input/matrix/matrix.class.php b/stack/input/matrix/matrix.class.php
index 384a2b02b26..7e5e99ecf90 100644
--- a/stack/input/matrix/matrix.class.php
+++ b/stack/input/matrix/matrix.class.php
@@ -17,13 +17,17 @@
/**
* A basic text-field input.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_matrix_input extends stack_input {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $width;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $height;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $extraoptions = [
'hideanswer' => false,
'allowempty' => false,
@@ -35,6 +39,7 @@ class stack_matrix_input extends stack_input {
'feedback' => false,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function adapt_to_model_answer($teacheranswer) {
// Work out how big the matrix should be from the INSTANTIATED VALUE of the teacher's answer.
@@ -53,6 +58,7 @@ public function adapt_to_model_answer($teacheranswer) {
$this->width = $cs->get_list_element(1, true)->value;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_expected_data() {
$expected = [];
@@ -95,7 +101,6 @@ protected function is_blank_response($contents) {
*
* @param string $in
* @return string
- * @access public
*/
public function response_to_contents($response) {
// At the start of an attempt we will have a completely blank matrix.
@@ -134,6 +139,7 @@ public function response_to_contents($response) {
return $matrix;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function contents_to_maxima($contents) {
$matrix = [];
foreach ($contents as $row) {
@@ -249,6 +255,7 @@ protected function validate_contents($contents, $basesecurity, $localoptions) {
return [$valid, $errors, $notes, $answer, $caslines, $inertform, $caslines];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
@@ -339,6 +346,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return $xhtml;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -401,6 +409,7 @@ public function maxima_to_response_array($in) {
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -442,6 +451,7 @@ public function internal_validate_parameter($parameter, $value) {
return $valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_correct_response($value) {
if (trim($value) == 'EMPTYANSWER' || $value === null) {
@@ -544,7 +554,6 @@ protected function ajax_to_response_array($in) {
* @author Matti Harjula
*
* @param string $in
- * @access private
* @return array with the parsed elements, if no elements then array
* contains only the input string
*/
diff --git a/stack/input/notes/notes.class.php b/stack/input/notes/notes.class.php
index 63b39dc006b..ab7876298b8 100644
--- a/stack/input/notes/notes.class.php
+++ b/stack/input/notes/notes.class.php
@@ -22,17 +22,19 @@
* Input that is a text area.
* However, the purpose is to allow a student to write language (English) notes.
* These are not passed into the CAS
+ * @package qtype_stack
* @copyright 2017 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_notes_input extends stack_input {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $extraoptions = [
'hideanswer' => false,
'allowempty' => false,
'manualgraded' => false,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
return $this->render_error($this->errors);
@@ -72,6 +74,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
html_writer::tag('div', "", ['class' => 'clearfix']);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -105,6 +108,7 @@ protected function validate_contents($contents, $basesecurity, $localoptions) {
return [$valid, $errors, $notes, $answer, $caslines, $answer, []];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -162,6 +166,7 @@ public function internal_validate_parameter($parameter, $value) {
}
/**
+ * Add description here.
* @return string the teacher's answer, an example of what could be typed into
* this input as part of a correct response to the question.
* For the notes class this is always the boolean "true".
@@ -214,6 +219,7 @@ public function render_validation(stack_input_state $state, $fieldname, $lang) {
return format_text(stack_maths::process_display_castext($render));
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function summarise_response($name, $state, $response) {
// Output the value for reporting.
$val = '';
@@ -223,14 +229,17 @@ public function summarise_response($name, $state, $response) {
return $name . ': ' . $val . ' [' . $state->status . ']';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_api_solution($tavalue) {
return new stdClass();
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_api_solution_render($tadisplay) {
return '';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function ajax_to_response_array($in) {
// ISS1317 EJMF - Notes are treated the same as textareas on the front end so
// we need to add this to match the textarea input and avoid
diff --git a/stack/input/numerical/numerical.class.php b/stack/input/numerical/numerical.class.php
index 521b81891be..38aefb98dac 100644
--- a/stack/input/numerical/numerical.class.php
+++ b/stack/input/numerical/numerical.class.php
@@ -17,6 +17,7 @@
/**
* A basic text-field input.
*
+ * @package qtype_stack
* @copyright 2017 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -52,6 +53,7 @@ class stack_numerical_input extends stack_input {
'monospace' => false,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
@@ -107,6 +109,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return html_writer::empty_tag('input', $attributes);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -123,6 +126,7 @@ public function render_api_data($tavalue) {
return $data;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -166,6 +170,7 @@ public function internal_validate_parameter($parameter, $value) {
}
/**
+ * Add description here.
* @return string the teacher's answer, displayed to the student in the general feedback.
*/
public function get_teacher_answer_display($value, $display) {
diff --git a/stack/input/parsons/parsons.class.php b/stack/input/parsons/parsons.class.php
index dcfde5eb350..4372d4962b0 100644
--- a/stack/input/parsons/parsons.class.php
+++ b/stack/input/parsons/parsons.class.php
@@ -14,10 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../string/string.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_parsons_input extends stack_string_input {
/**
@@ -77,6 +85,7 @@ private static function answer_function_testcase($ta) {
protected $protectfilters = ['909_parsons_decode_state_for_display', '910_inert_float_for_display',
'912_inert_string_for_display', ];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
// This is the same as `string` input render except we hide the input box.
@@ -151,6 +160,7 @@ public function get_correct_response($in) {
}
/**
+ * Add description here.
* @return string the teacher's answer, suitable for testcase construction.
*/
public function get_teacher_answer_testcase() {
diff --git a/stack/input/radio/radio.class.php b/stack/input/radio/radio.class.php
index 942cdd83df7..76bdf8627d6 100644
--- a/stack/input/radio/radio.class.php
+++ b/stack/input/radio/radio.class.php
@@ -16,22 +16,29 @@
defined('MOODLE_INTERNAL') || die();
-// Input that is a radio/multiple choice.
-//
-// @copyright 2015 University of Edinburgh.
-// @author Chris Sangwin.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Input that is a radio/multiple choice.
+ *
+ * @package qtype_stack
+ * @copyright 2015 University of Edinburgh.
+ * @author Chris Sangwin.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/../dropdown/dropdown.class.php');
-class stack_radio_input extends stack_dropdown_input {
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
+class stack_radio_input extends stack_dropdown_input {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ddltype = 'radio';
- /*
+ /**
* Default ddldisplay for radio is 'LaTeX'.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $ddldisplay = 'LaTeX';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
return $this->render_error($this->errors);
@@ -85,6 +92,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return $result;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
diff --git a/stack/input/singlechar/singlechar.class.php b/stack/input/singlechar/singlechar.class.php
index 6651d0a315f..649170855d2 100644
--- a/stack/input/singlechar/singlechar.class.php
+++ b/stack/input/singlechar/singlechar.class.php
@@ -17,11 +17,12 @@
/**
* Input that accepts a single character.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_singlechar_input extends stack_input {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $extraoptions = [
'hideanswer' => false,
'allowempty' => false,
@@ -30,6 +31,7 @@ class stack_singlechar_input extends stack_input {
'feedback' => false,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
@@ -57,6 +59,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return html_writer::empty_tag('input', $attributes);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -69,6 +72,7 @@ public function render_api_data($tavalue) {
return $data;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function extra_validation($contents) {
if (strlen($contents[0]) > 1) {
return stack_string('singlechargotmorethanone');
@@ -76,6 +80,7 @@ protected function extra_validation($contents) {
return '';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name);
$mform->setType($this->name, PARAM_RAW);
diff --git a/stack/input/string/string.class.php b/stack/input/string/string.class.php
index 8851d130cbd..50413f33af0 100644
--- a/stack/input/string/string.class.php
+++ b/stack/input/string/string.class.php
@@ -22,22 +22,24 @@
* A basic text-field input which is always interpreted as a Maxima string.
* This has been requested to support the input of things like multi-base numbers.
*
+ * @package qtype_stack
* @copyright 2018 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_string_input extends stack_algebraic_input {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $extraoptions = [
'hideanswer' => false,
'allowempty' => false,
'validator' => false,
];
- /*
- * @var integer We allow string inputs to be longer.
+ /**
+ * @var int We allow string inputs to be longer.
*/
protected $maxinputlength = 262144;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
@@ -77,6 +79,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return html_writer::empty_tag('input', $attributes);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -116,6 +119,7 @@ protected function response_to_contents($response) {
}
/**
+ * Add description here.
* @return string The teacher's answer, displayed to the student in the general feedback.
*/
public function get_teacher_answer_display($value, $display) {
@@ -180,6 +184,7 @@ public function contents_to_maxima($contents) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function ensure_string($ex) {
$ex = trim($ex);
if (substr($ex, 0, 1) !== '"') {
@@ -188,6 +193,7 @@ public function ensure_string($ex) {
return $ex;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_api_solution_render($tadisplay) {
return stack_utils::maxima_string_strip_mbox($tadisplay);
}
diff --git a/stack/input/textarea/textarea.class.php b/stack/input/textarea/textarea.class.php
index 6a4fb576151..45536487463 100644
--- a/stack/input/textarea/textarea.class.php
+++ b/stack/input/textarea/textarea.class.php
@@ -23,11 +23,12 @@
*
* The value is stored as a string maxima list. For example [1,hello,x + y].
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_textarea_input extends stack_input {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $extraoptions = [
'hideanswer' => false,
'allowempty' => false,
@@ -36,6 +37,7 @@ class stack_textarea_input extends stack_input {
'consolidatesubscripts' => false,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
// Note that at the moment, $this->boxHeight and $this->boxWidth are only
// used as minimums. If the current input is bigger, the box is expanded.
@@ -89,6 +91,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return html_writer::tag('textarea', htmlspecialchars($current, ENT_COMPAT), $attributes);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -103,6 +106,7 @@ public function render_api_data($tavalue) {
return $data;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -135,6 +139,7 @@ protected function response_to_contents($response) {
return $contents;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function caslines_to_answer($caslines, $secrules = false) {
$vals = [];
// We don't use full "inputform" here as we need to keep stacklet and stackeq as is.
@@ -191,6 +196,7 @@ protected function maxima_to_raw_input($in) {
return implode("\n", $values);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function ajax_to_response_array($in) {
$in = explode('
', $in);
$in = implode("\n", $in);
@@ -316,6 +322,7 @@ public function internal_validate_parameter($parameter, $value) {
}
/**
+ * Add description here.
* @return string the teacher's answer, displayed to the student in the general feedback.
*/
public function get_teacher_answer_display($value, $display) {
@@ -336,6 +343,7 @@ public function get_teacher_answer_display($value, $display) {
return stack_string('teacheranswershow', ['value' => $value, 'display' => $display]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_api_solution($tavalue) {
$values = stack_utils::list_to_array($tavalue, false);
foreach ($values as $key => $val) {
diff --git a/stack/input/units/units.class.php b/stack/input/units/units.class.php
index 70551aac449..181cf362fc5 100644
--- a/stack/input/units/units.class.php
+++ b/stack/input/units/units.class.php
@@ -17,6 +17,7 @@
/**
* An input to support scientific units. Heavily based on algebraic.
*
+ * @package qtype_stack
* @copyright 2015 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -46,6 +47,7 @@ class stack_units_input extends stack_input {
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) {
@@ -100,6 +102,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return html_writer::empty_tag('input', $attributes);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -118,6 +121,7 @@ public function render_api_data($tavalue) {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -182,6 +186,7 @@ public function internal_validate_parameter($parameter, $value) {
}
/**
+ * Add description here.
* @return string the teacher's answer, displayed to the student in the general feedback.
*/
public function get_teacher_answer_display($value, $display) {
@@ -197,14 +202,16 @@ public function get_teacher_answer_display($value, $display) {
return stack_string('teacheranswershow', ['value' => ''.$value.'
', 'display' => $display]);
}
- /* Allows individual input types to change the way the list of variables is tagged.
+ /**
+ * Allows individual input types to change the way the list of variables is tagged.
* Used by the units input type.
*/
protected function tag_listofvariables($vars) {
return html_writer::tag('p', stack_string('studentValidation_listofunits', $vars));
}
- /* Allow different input types to change the CAS method used.
+ /**
+ * Allow different input types to change the CAS method used.
* In particular, the units test does something different here.
*/
protected function get_validation_method() {
diff --git a/stack/input/varmatrix/varmatrix.class.php b/stack/input/varmatrix/varmatrix.class.php
index c8d1a2a04f4..435e1926a36 100644
--- a/stack/input/varmatrix/varmatrix.class.php
+++ b/stack/input/varmatrix/varmatrix.class.php
@@ -18,11 +18,12 @@
* An input which provides a matrix input of variable size.
* Lots in common with the textarea class.
*
+ * @package qtype_stack
* @copyright 2019 Ruhr University Bochum
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_varmatrix_input extends stack_input {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $extraoptions = [
'hideanswer' => false,
'allowempty' => false,
@@ -34,6 +35,7 @@ class stack_varmatrix_input extends stack_input {
'monospace' => false,
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function is_blank_response($contents) {
if ($contents == ['EMPTYANSWER']) {
return true;
@@ -49,6 +51,7 @@ protected function is_blank_response($contents) {
return $allblank;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
// Note that at the moment, $this->boxHeight and $this->boxWidth are only
// used as minimums. If the current input is bigger, the box is expanded.
@@ -136,6 +139,7 @@ public function render(stack_input_state $state, $fieldname, $readonly, $tavalue
return html_writer::tag('div', $xhtml, ['class' => $matrixbrackets]);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function render_api_data($tavalue) {
if ($this->errors) {
throw new stack_exception("Error rendering input: " . implode(',', $this->errors));
@@ -163,6 +167,7 @@ public function render_api_data($tavalue) {
return $data;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function add_to_moodleform_testinput(MoodleQuickForm $mform) {
$mform->addElement('text', $this->name, $this->name, ['size' => $this->parameters['boxWidth']]);
$mform->setDefault($this->name, $this->parameters['syntaxHint']);
@@ -210,6 +215,7 @@ protected function response_to_contents($response) {
return $contents;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function caslines_to_answer($caslines, $secrules = false) {
$vals = [];
foreach ($caslines as $line) {
@@ -245,6 +251,7 @@ public function contents_to_maxima($contents) {
}
/**
+ * Add description here
* @param array $contents the content array of the student's input.
* @return array of the validity, errors strings and modified contents.
*/
@@ -351,6 +358,7 @@ private function maxima_to_raw_input($in) {
return $cs->ast_to_string(null, $tostringparams);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_correct_response($value) {
if (trim($value) == 'EMPTYANSWER' || $value === null) {
@@ -381,6 +389,7 @@ public function get_correct_response($value) {
return $this->maxima_to_response_array($value);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function ajax_to_response_array($in) {
$in = explode('
', $in);
$in = implode("\n", $in);
@@ -439,6 +448,7 @@ public function internal_validate_parameter($parameter, $value) {
return $valid;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_api_solution($tavalue) {
// We clear the name, and then restore its original value,
// to not include the prefix in the api solution.
diff --git a/stack/mathsoutput/fact_sheets.class.php b/stack/mathsoutput/fact_sheets.class.php
index ff2db9cce58..07090b9a8ae 100644
--- a/stack/mathsoutput/fact_sheets.class.php
+++ b/stack/mathsoutput/fact_sheets.class.php
@@ -17,6 +17,7 @@
/**
* The fact sheets class for STACK.
*
+ * @package qtype_stack
* @copyright 2014 Loughborough University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -27,6 +28,7 @@ abstract class stack_fact_sheets {
* two corresponding lines in the language file.
* E.g. greek_alphabet_name and greek_alphabet_fact
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $factsheets = [
'greek_alphabet', 'alg_inequalities',
'alg_indices', 'alg_logarithms', 'alg_quadratic_formula',
@@ -70,9 +72,9 @@ protected static function get_fact_sheet_tags($text) {
* This function replaces tags with the HTML value.
* Note, that at this point we assume we have already validated the text.
* @param string $text the text in which to expand fact sheet tags.
- * @param qtype_stack_renderer $renderer (options) the STACK renderer, if you have one.
+ * @param qtype_stack_renderer|null $renderer (options) the STACK renderer, if you have one.
*/
- public static function display($text, qtype_stack_renderer $renderer = null) {
+ public static function display($text, ?qtype_stack_renderer $renderer = null) {
// Convert any old hints tags into the new format.
$text = self::convert_legacy_tags($text);
diff --git a/stack/mathsoutput/mathsoutput.class.php b/stack/mathsoutput/mathsoutput.class.php
index b9a70c50e34..47af7db5902 100644
--- a/stack/mathsoutput/mathsoutput.class.php
+++ b/stack/mathsoutput/mathsoutput.class.php
@@ -23,6 +23,7 @@
/**
* Public API to the maths rendering system.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -46,10 +47,10 @@ public static function process_lang_string($string) {
* the question text or general feedback. The result of calling this method is
* then passed to Moodle's {@link format_text()} function.
* @param string $text the content to process.
- * @param qtype_stack_renderer $renderer (options) the STACK renderer, if you have one.
+ * @param qtype_stack_renderer|null $renderer (options) the STACK renderer, if you have one.
* @return string the content ready to pass to format_text.
*/
- public static function process_display_castext($text, qtype_stack_renderer $renderer = null) {
+ public static function process_display_castext($text, ?qtype_stack_renderer $renderer = null) {
return self::get_output()->process_display_castext($text,
stack_utils::get_config()->replacedollars, $renderer);
}
@@ -86,6 +87,7 @@ public static function replace_dollars($text, $markup = false) {
}
/**
+ * Add description here.
* @return string the name of the currently configured output method.
*/
public static function configured_output_name() {
@@ -93,6 +95,7 @@ public static function configured_output_name() {
}
/**
+ * Add description here.
* @return stack_maths_output the output method that has been set in the
* configuration options.
*/
@@ -105,6 +108,7 @@ protected static function get_output() {
}
/**
+ * Add description here
* @param string $type the output method name.
* @return stack_maths_output instance of the output class for this method.
*/
diff --git a/stack/mathsoutput/mathsoutputapi.class.php b/stack/mathsoutput/mathsoutputapi.class.php
index 965c1a16df5..6de89ab8bd3 100644
--- a/stack/mathsoutput/mathsoutputapi.class.php
+++ b/stack/mathsoutput/mathsoutputapi.class.php
@@ -21,11 +21,13 @@
/**
* STACK maths output methods for using MathJax with the minimal API.
*
+ * @package qtype_stack
* @copyright 2017 The University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_maths_output_api extends stack_maths_output_filter_base {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function initialise_delimiters() {
$this->displaywrapstart = '';
$this->displaywrapend = '';
@@ -34,15 +36,18 @@ protected function initialise_delimiters() {
$this->inlinestart = '\(';
$this->inlineend = '\)';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function make_filter() {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function process_lang_string($string) {
return $string;
}
- public function process_display_castext($text, $replacedollars, qtype_stack_renderer $renderer = null) {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public function process_display_castext($text, $replacedollars, ?qtype_stack_renderer $renderer = null) {
if ($replacedollars) {
$text = $this->replace_dollars($text);
}
diff --git a/stack/mathsoutput/mathsoutputbase.class.php b/stack/mathsoutput/mathsoutputbase.class.php
index 5ecd5ab717c..b853edf4bc0 100644
--- a/stack/mathsoutput/mathsoutputbase.class.php
+++ b/stack/mathsoutput/mathsoutputbase.class.php
@@ -21,6 +21,7 @@
/**
* The base class for STACK maths output methods.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -88,10 +89,10 @@ function ($match) {
* the question text or general feedback. The result of calling this method is
* then passed to Moodle's {@link format_text()} function.
* @param string $text the content to process.
- * @param qtype_stack_renderer $renderer (options) the STACK renderer, if you have one.
+ * @param qtype_stack_renderer|null $renderer (options) the STACK renderer, if you have one.
* @return string the content ready to pass to format_text.
*/
- public function process_display_castext($text, $replacedollars, qtype_stack_renderer $renderer = null) {
+ public function process_display_castext($text, $replacedollars, ?qtype_stack_renderer $renderer = null) {
if ($replacedollars) {
$text = $this->replace_dollars($text);
}
diff --git a/stack/mathsoutput/mathsoutputfilterbase.class.php b/stack/mathsoutput/mathsoutputfilterbase.class.php
index 2411e4477f9..86b3f97af3f 100644
--- a/stack/mathsoutput/mathsoutputfilterbase.class.php
+++ b/stack/mathsoutput/mathsoutputfilterbase.class.php
@@ -14,21 +14,27 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
-defined('MOODLE_INTERNAL') || die();
-
/**
* Base class for STACK maths output methods that use a Moodle text filter to do the work.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class stack_maths_output_filter_base extends stack_maths_output {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $filter = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $displaywrapstart = '';
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $displaywrapend = '';
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $displaystart;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $displayend;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $inlinestart;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $inlineend;
/**
@@ -38,6 +44,7 @@ public function __construct() {
$this->initialise_delimiters();
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function process_lang_string($string) {
$string = $this->find_and_render_equations($string);
$string = str_replace('!ploturl!',
@@ -45,6 +52,7 @@ public function process_lang_string($string) {
return $string;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function post_process_docs_page($html) {
$html = parent::post_process_docs_page($html);
$html = str_replace('\', '\\', $html);
@@ -52,7 +60,8 @@ public function post_process_docs_page($html) {
return $html;
}
- public function process_display_castext($text, $replacedollars, qtype_stack_renderer $renderer = null) {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public function process_display_castext($text, $replacedollars, ?qtype_stack_renderer $renderer = null) {
$text = parent::process_display_castext($text, $replacedollars, $renderer);
$text = $this->find_equations_and_replace_delimiters($text);
return $text;
@@ -140,6 +149,7 @@ protected function find_and_process_equations($html, $callback) {
}
/**
+ * Add description here.
* @return moodle_text_filter an instance of the text filter to use to
* render equations.
*/
@@ -156,6 +166,7 @@ protected function get_filter() {
abstract protected function initialise_delimiters();
/**
+ * Add description here.
* @return moodle_text_filter an newly created instance of the text filter
* to use to render equations.
*/
diff --git a/stack/mathsoutput/mathsoutputmathjax.class.php b/stack/mathsoutput/mathsoutputmathjax.class.php
index e840fe8f643..9101a4b5074 100644
--- a/stack/mathsoutput/mathsoutputmathjax.class.php
+++ b/stack/mathsoutput/mathsoutputmathjax.class.php
@@ -22,11 +22,13 @@
/**
* STACK maths output methods for using MathJax.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_maths_output_mathjax extends stack_maths_output_filter_base {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function initialise_delimiters() {
$this->displaywrapstart = '';
$this->displaywrapend = '';
@@ -36,6 +38,7 @@ protected function initialise_delimiters() {
$this->inlineend = '\)';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function make_filter() {
global $CFG, $PAGE;
if (class_exists('\filter_mathjaxloader\text_filter')) {
diff --git a/stack/mathsoutput/mathsoutputmaths.class.php b/stack/mathsoutput/mathsoutputmaths.class.php
index 4b567454299..8ab0cfc6395 100644
--- a/stack/mathsoutput/mathsoutputmaths.class.php
+++ b/stack/mathsoutput/mathsoutputmaths.class.php
@@ -24,12 +24,14 @@
/**
* STACK maths output methods for using The OU's maths filter.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_maths_output_maths extends stack_maths_output_filter_base {
/**
+ * Add description here.
* @return boolean is the OU maths filter installed?
*/
public static function filter_is_installed() {
@@ -37,6 +39,7 @@ public static function filter_is_installed() {
return file_exists($CFG->dirroot . '/filter/maths/filter.php');
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function initialise_delimiters() {
$this->displaystart = '<tex mode="display">';
$this->displayend = '</tex>';
@@ -44,6 +47,7 @@ protected function initialise_delimiters() {
$this->inlineend = '</tex>';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function make_filter() {
global $CFG;
diff --git a/stack/mathsoutput/mathsoutputoumaths.class.php b/stack/mathsoutput/mathsoutputoumaths.class.php
index f8a73562714..c1f3be6d8db 100644
--- a/stack/mathsoutput/mathsoutputoumaths.class.php
+++ b/stack/mathsoutput/mathsoutputoumaths.class.php
@@ -24,12 +24,14 @@
/**
* STACK maths output methods for using The OU's maths filter.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_maths_output_oumaths extends stack_maths_output_filter_base {
/**
+ * Add description here.
* @return boolean is the OU maths filter installed?
*/
public static function filter_is_installed() {
@@ -37,6 +39,7 @@ public static function filter_is_installed() {
return file_exists($CFG->dirroot . '/filter/oumaths/filter.php');
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function initialise_delimiters() {
$this->displaystart = '<tex mode="display">';
$this->displayend = '</tex>';
@@ -44,6 +47,7 @@ protected function initialise_delimiters() {
$this->inlineend = '</tex>';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function make_filter() {
global $CFG;
diff --git a/stack/mathsoutput/mathsoutputtex.class.php b/stack/mathsoutput/mathsoutputtex.class.php
index f1a3a97c683..82ce70a3a80 100644
--- a/stack/mathsoutput/mathsoutputtex.class.php
+++ b/stack/mathsoutput/mathsoutputtex.class.php
@@ -22,11 +22,13 @@
/**
* STACK maths output methods for using Moodle's TeX filter.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_maths_output_tex extends stack_maths_output_filter_base {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function initialise_delimiters() {
$this->displaystart = '\[\displaystyle ';
$this->displayend = '\]';
@@ -34,6 +36,7 @@ protected function initialise_delimiters() {
$this->inlineend = '\]';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function make_filter() {
global $CFG;
if (class_exists('\filter_tex\text_filter')) {
diff --git a/stack/maximaparser/MP_classes.php b/stack/maximaparser/MP_classes.php
index 27a88f125d1..236daf03721 100644
--- a/stack/maximaparser/MP_classes.php
+++ b/stack/maximaparser/MP_classes.php
@@ -15,6 +15,13 @@
// along with Stateful. If not, see .
// Stateful by Matti Harjula 2017.
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2017 Matti Harjula.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
/*
* Class defintions for the PHP version of the PEGJS parser.
* toString functions are mainly to document what the objects parts mean.
@@ -283,10 +290,10 @@ public function get_operator_on_right() {
return null;
}
*/
-
- /**
+
+ /**
* Generates an array listing the types of nodes present in this subtree.
- * Including this node. Keyed with class-name and includes some specific
+ * Including this node. Keyed with class-name and includes some specific
* predefined special cases like `ops` and `has control flow`
*/
public function type_count(): array {
@@ -360,9 +367,9 @@ public function type_count(): array {
return $r;
}
- /**
+ /**
* Checks if this node has a call for a given function in its ancestry.
- * Returns false if not otherwise tells the index of the arguments of
+ * Returns false if not otherwise tells the index of the arguments of
* that function call that includes this.
* @param string $funname Name of the function we are intersted of
* @return false or index.
@@ -1243,7 +1250,7 @@ public function isSynthetic() {
$this->items[0]->name instanceof MP_Atom &&
$this->items[0]->name->value === stack_ast_filter_996_call_modification::IDCHECK;
}
-
+
public function toString($params = null): string {
$indent = '';
diff --git a/stack/maximaparser/corrective_parser.php b/stack/maximaparser/corrective_parser.php
index 8865e46d484..16984445ddb 100644
--- a/stack/maximaparser/corrective_parser.php
+++ b/stack/maximaparser/corrective_parser.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/autogen/parser.mbstring.php');
@@ -23,17 +30,21 @@
require_once(__DIR__ . '/MP_classes.php');
-// A Maxima parser wrapper that tries to insert missing stars to statements
-// to make them parseable.
-//
-// Once we have an ast we filter further to handle extended syntax and more
-// complex star insertion.
-//
-// @copyright 2019 Aalto University
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * A Maxima parser wrapper that tries to insert missing stars to statements
+ * to make them parseable.
+ *
+ * Once we have an ast we filter further to handle extended syntax and more
+ * complex star insertion.
+ *
+ * @package qtype_stack
+ * @copyright 2019 Aalto University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
class maxima_corrective_parser {
// Returns an AST if possible.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function parse(string $string, array &$errors, array &$answernote, array $parseroptions) {
static $safespacepatterns = [
' or ' => 'STACKOR', ' and ' => 'STACKAND', 'not ' => 'STACKNOT', 'nounnot ' => 'STACKNOUNNOT',
@@ -259,6 +270,7 @@ public static function parse(string $string, array &$errors, array &$answernote,
return $ast;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function handle_parse_error($exception, $string, &$errors, &$answernote, $decimals) {
// @codingStandardsIgnoreStart
// We also disallow backticks.
@@ -507,6 +519,7 @@ public static function handle_parse_error($exception, $string, &$errors, &$answe
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function strings_replace($stringles, $original) {
$strings = stack_utils::all_substring_strings($original);
if (count($strings) > 0) {
diff --git a/stack/maximaparser/utils.php b/stack/maximaparser/utils.php
index 1aaa395b1cb..1bfefedf905 100644
--- a/stack/maximaparser/utils.php
+++ b/stack/maximaparser/utils.php
@@ -16,10 +16,12 @@
defined('MOODLE_INTERNAL') || die();
-/*
- @copyright 2018 Aalto University.
- @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
-*/
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2018 Aalto University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/autogen/parser.mbstring.php');
// Also needs stack_string().
@@ -28,6 +30,7 @@
require_once(__DIR__ . '/../utils.class.php');
require_once(__DIR__ . '/MP_classes.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class maxima_parser_utils {
/**
@@ -98,7 +101,8 @@ protected static function do_parse(string $code, array $parseoptions, string $ca
// Takes a raw tree and the matching source code and remaps the positions from char to line:linechar
// use when you need to have pretty printed position data.
- public static function position_remap(MP_Node $ast, string $code, array $limits = null) {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public static function position_remap(MP_Node $ast, string $code, ?array $limits = null) {
if ($limits === null) {
$limits = [];
foreach (explode("\n", $code) as $line) {
@@ -145,6 +149,7 @@ public static function position_remap(MP_Node $ast, string $code, array $limits
// This one removes comments before parsing.
// For those cases where you just must check for some chars.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function remove_comments(string $src): string {
$chars = preg_split('//u', $src, -1, PREG_SPLIT_NO_EMPTY);
@@ -195,6 +200,7 @@ public static function remove_comments(string $src): string {
// Takes a raw tree and drops the comments sections from it.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function strip_comments(MP_Root $ast) {
// For now comments exist only at the top level and there are no "inline"
// comments within statements, hopefully at some point we can go further.
@@ -214,6 +220,7 @@ public static function strip_comments(MP_Root $ast) {
// Tries to parse a long string of statements and if not imediately valid
// tries to fix by adding semicolons.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function parse_and_insert_missing_semicolons($str, $lastfix = -1) {
try {
$ast = self::parse($str);
@@ -247,6 +254,7 @@ public static function parse_and_insert_missing_semicolons($str, $lastfix = -1)
// Will generate a singular AST with position remaps and inlined included statements.
// Generates errors if inclusions within inclusions or inclusions in unexpected places.
// Returns either the AST or some form of an exception.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function parse_and_insert_missing_semicolons_with_includes($str) {
$root = self::parse_and_insert_missing_semicolons($str);
if ($root instanceof MP_Root) {
@@ -373,6 +381,7 @@ public static function parse_and_insert_missing_semicolons_with_includes($str) {
// Function to find suitable place to inject a semicolon to i.e. place into start of whitespace.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private static function previous_non_whitespace($code, $pos) {
$i = $pos;
if (mb_substr($code, $i - 1, 2) === '/*') {
@@ -385,6 +394,7 @@ private static function previous_non_whitespace($code, $pos) {
}
// Custom rules on what is an is not whitespace.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private static function is_whitespace($mbc) {
// So ctype_space does not handle those fancy unicode spaces...
// There are more than these but we add things as we meet them.
@@ -402,6 +412,7 @@ private static function is_whitespace($mbc) {
// Tool to extract information about which variables are being used and how.
// In a given parsed section of code. Updates a given usage list so that use
// for example in going through a PRT tree is convenient.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function variable_usage_finder($ast, $output=[]) {
if (!array_key_exists('read', $output)) {
$output['read'] = [];
@@ -442,6 +453,7 @@ public static function variable_usage_finder($ast, $output=[]) {
// Note that this identifies stackmaps by default.
// Also after this has done its thing you will not be able to separate strings from identifiers.
// Intended for processing complex return values from CAS using PHP methods.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function mp_to_php(
MP_Node $in,
bool $stackmaps = true
@@ -776,6 +788,7 @@ public static function substitute_in_parallel(MP_Node $ast, array $substs): MP_N
}
// Does blind replacement with no care about usage context.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function id_replace(MP_Node $ast, array $ids): MP_Node {
$replace = function($node) use(&$ids) {
if ($node instanceof MP_Identifier && isset($ids[$node->value])) {
@@ -803,6 +816,7 @@ public static function id_replace(MP_Node $ast, array $ids): MP_Node {
// Includes a timeout logic that will stop exploring after a time if we time out
// a special key '% TIMEOUT %' will have a value.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function identify_identifier_values($ast, $expand=[], $timeout=20): array {
$timelimit = microtime(true) + $timeout;
$output = array_merge($expand, []);
@@ -2331,7 +2345,9 @@ public static function identify_identifier_values($ast, $expand=[], $timeout=20)
return $output;
}
- /* Common merge actions for type struct fixing. */
+ /**
+ * Common merge actions for type struct fixing.
+ */
private static function mergeclasses(array $data, array $funcs, stack_cas_security $sec, bool $merge = false): array {
$output = $data;
@@ -2487,7 +2503,9 @@ private static function mergeclasses(array $data, array $funcs, stack_cas_securi
return $output;
}
- /* Turn a subtree to `stack_complex_expression`. */
+ /**
+ * Turn a subtree to `stack_complex_expression`.
+ */
private static function to_sce(MP_Node $ast, stack_cas_security $sec): MP_Node {
$terms = [];
$seek2 = function($n) use (&$terms, &$sec) {
diff --git a/stack/options.class.php b/stack/options.class.php
index 4c2de8faa4e..4bc83bffbe2 100644
--- a/stack/options.class.php
+++ b/stack/options.class.php
@@ -18,13 +18,16 @@
* Options enable a context to be set for each question, and information
* made generally available to other classes.
*
+ * @package qtype_stack
* @copyright 2012 The University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_options {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $options;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($settings = []) {
// OptionType can be: boolean, string, html, list.
@@ -141,6 +144,7 @@ public function __construct($settings = []) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_site_defaults() {
$stackconfig = stack_utils::get_config();
// Display option does not match up to $stackconfig->mathsdisplay).
@@ -158,7 +162,7 @@ public function set_site_defaults() {
return true;
}
- /*
+ /**
* This function validates the information.
*/
private function validate_key($key, $val) {
@@ -182,6 +186,7 @@ private function validate_key($key, $val) {
return true;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_option($key) {
if (!array_key_exists($key, $this->options)) {
throw new stack_exception('stack_options get_option: $key '.$key.' is not a valid option name.');
@@ -190,11 +195,13 @@ public function get_option($key) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_option($key, $val) {
$this->validate_key($key, $val); // Throws an exception on error.
$this->options[$key]['value'] = $val;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_cas_commands() {
$names = '';
@@ -230,6 +237,7 @@ public function get_cas_commands() {
}
/**
+ * Add description here.
* @return array of choices for a no/yes select menu.
*/
public static function get_yes_no_options() {
@@ -240,6 +248,7 @@ public static function get_yes_no_options() {
}
/**
+ * Add description here.
* @return array of choices for the insert stars select menu.
*/
public static function get_insert_star_options() {
@@ -256,6 +265,7 @@ public static function get_insert_star_options() {
}
/**
+ * Add description here.
* @return array of choices for the input syntax hint display attribute.
*/
public static function get_syntax_attribute_options() {
@@ -266,6 +276,7 @@ public static function get_syntax_attribute_options() {
}
/**
+ * Add description here.
* @return array of choices for the decimal sign select menu.
*/
public static function get_decimals_sign_options() {
@@ -276,6 +287,7 @@ public static function get_decimals_sign_options() {
}
/**
+ * Add description here.
* @return array of choices for the scientific notation select menu.
*/
public static function get_scientificnotation_options() {
@@ -286,6 +298,7 @@ public static function get_scientificnotation_options() {
}
/**
+ * Add description here.
* @return array of choices for the multiplication sign select menu.
*/
public static function get_multiplication_sign_options() {
@@ -298,6 +311,7 @@ public static function get_multiplication_sign_options() {
}
/**
+ * Add description here.
* @return array of choices for the complex number select menu.
*/
public static function get_complex_no_options() {
@@ -310,6 +324,7 @@ public static function get_complex_no_options() {
}
/**
+ * Add description here.
* @return array of choices for the inverse trig select menu.
*/
public static function get_inverse_trig_options() {
@@ -322,6 +337,7 @@ public static function get_inverse_trig_options() {
}
/**
+ * Add description here.
* @return array of choices for the inverse trig select menu.
*/
public static function get_logic_options() {
@@ -332,6 +348,7 @@ public static function get_logic_options() {
}
/**
+ * Add description here.
* @return array of choices for the matrix prenthesis select menu.
*/
public static function get_matrix_parens_options() {
@@ -345,6 +362,7 @@ public static function get_matrix_parens_options() {
}
/**
+ * Add description here.
* @return array of choices for the show validation select menu.
*/
public static function get_showvalidation_options() {
@@ -357,6 +375,7 @@ public static function get_showvalidation_options() {
}
/**
+ * Add description here.
* @return array of choices for the monospace input select menu.
*/
public static function get_monospace_options() {
diff --git a/stack/potentialresponsetreestate.class.php b/stack/potentialresponsetreestate.class.php
index 54a40e46442..4a97a752834 100644
--- a/stack/potentialresponsetreestate.class.php
+++ b/stack/potentialresponsetreestate.class.php
@@ -19,9 +19,11 @@
/**
* This class represents the current state of a potential response tree.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_potentialresponse_tree_state {
/**
@@ -114,6 +116,7 @@ public function __construct($weight, $valid = true, $score = null, $penalty = nu
$this->_debuginfo = $debuginfo;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __get($field) {
switch ($field) {
case 'weight':
@@ -271,6 +274,7 @@ class stack_prt_feedback_element {
/** @var int node id (used as the file area item id). */
public $itemid;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($feedback, $format, $filearea, $itemid) {
$this->feedback = $feedback;
$this->format = $format;
diff --git a/stack/prt.class.php b/stack/prt.class.php
index f392be59b81..4f927854886 100644
--- a/stack/prt.class.php
+++ b/stack/prt.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/cas/ast.container.class.php');
@@ -26,6 +33,7 @@
// A rewrite dropping everything not needed for compiled PRTs.
// Works as the compiler for the matching evaluatable.
// Otherwise used as a store for meta-data related to the question-model.
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_potentialresponse_tree_lite {
/** @var string Name of the PRT. */
@@ -64,6 +72,7 @@ class stack_potentialresponse_tree_lite {
* and other details when building those messages but do not need about those
* details otherewise.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $question = null;
/**
@@ -72,6 +81,7 @@ class stack_potentialresponse_tree_lite {
*/
private $trace = [];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct($prtdata, $value, $question = null) {
$this->name = $prtdata->name;
$this->simplify = (bool) $prtdata->autosimplify;
@@ -102,10 +112,12 @@ public function __construct($prtdata, $value, $question = null) {
// Only for get_maxima_representation() and other debug details.
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_value() {
return $this->value;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_name() {
return $this->name;
}
@@ -124,6 +136,7 @@ public function is_formative() {
}
/**
+ * Add description here.
* @return int.
*/
public function get_feedbackstyle() {
@@ -131,6 +144,7 @@ public function get_feedbackstyle() {
}
/**
+ * Add description here.
* @return string The keyval-bit for some version changes.
*/
public function get_feedbackvariables_keyvals() {
@@ -141,6 +155,7 @@ public function get_feedbackvariables_keyvals() {
}
/**
+ * Add description here.
* @return array Returns the answer tests used by this PRT for version changes.
*/
public function get_answertests(): array {
@@ -152,6 +167,7 @@ public function get_answertests(): array {
}
/**
+ * Add description here.
* @return string Representation of the PRT for Maxima offline use.
*/
public function get_maxima_representation() {
@@ -205,6 +221,7 @@ public function get_maxima_representation() {
}
/**
+ * Add description here.
* @return array All the "sans" strings used in the nodes with test requiring a raw input.
*/
public function get_raw_sans_used() {
@@ -219,6 +236,7 @@ public function get_raw_sans_used() {
}
/**
+ * Add description here.
* @return array All the non-trivial strings used in the node arguments.
*/
public function get_raw_arguments_used() {
@@ -252,6 +270,7 @@ public function get_all_answer_notes() {
return $notes;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function get_reverse_post_order_nodes(): array {
// That is to say, list the nodes in the order they are last visited to allow simple
// guard clauses... nice feature of acyclic graphs... drops the orphans too.
@@ -267,6 +286,7 @@ private function get_reverse_post_order_nodes(): array {
return array_reverse($order);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function get_node($name) {
// Simple getter that handles the cases where the key is bad or null.
if (isset($this->nodes[$name])) {
@@ -276,6 +296,7 @@ private function get_node($name) {
}
// Summary of the nodes, for use in various logics that track answernotes and scores.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_nodes_summary(): array {
$summary = [];
foreach ($this->nodes as $node) {
@@ -303,6 +324,7 @@ public function get_nodes_summary(): array {
}
/**
+ * Add description here.
* @return array Languages used in the feedback.
*/
public function get_feedback_languages() {
@@ -321,6 +343,7 @@ public function get_feedback_languages() {
}
/**
+ * Add description here.
* @return array of choices for the show validation select menu.
*/
public static function get_feedbackstyle_options() {
@@ -350,6 +373,7 @@ public function get_feedback_test() {
return $text;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function po_recurse($node, array &$postorder, array &$visited): array {
$truenode = $this->get_node($node->truenextnode);
$falsenode = $this->get_node($node->falsenextnode);
@@ -370,6 +394,7 @@ private function po_recurse($node, array &$postorder, array &$visited): array {
// what to use as local variables.
// The returned array contains the function declaration, its call signature,
// and any necessary additional preamble, i.e. textput rules and the like.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function compile(array $inputs, array $boundvars, $defaultpenalty, $security, $pathprefix, $map): array {
$r = ['sig' => '', 'def' => '', 'cv' => null, 'be' => null, 'required' => [], 'units' => false];
// Note these variables are initialised before the feedback-vars and if not forbidden
@@ -564,7 +589,7 @@ public function compile(array $inputs, array $boundvars, $defaultpenalty, $secur
return $r;
}
- /*
+ /**
* Generate the complete maxima command for a single answertest in a specific node.
*/
public static function compile_node_answertest($node) {
@@ -600,6 +625,7 @@ public static function compile_node_answertest($node) {
return $at;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function compile_node($node, $usage, $defaultpenalty, $security, $path, $ct2options): array {
/* In the old system there is a hack that covers some options let's repeat that here.
* For some tests there is an option assume_pos. This will be evaluated by maxima (since this is also the name
@@ -855,7 +881,8 @@ private function compile_node($node, $usage, $defaultpenalty, $security, $path,
return [$body, $usage, $ctincludes];
}
- /*
+ /**
+ * Add description here
* @param array $labels an array of labels for the branches.
*/
public function get_prt_graph($labels = false) {
@@ -890,7 +917,7 @@ public function get_prt_graph($labels = false) {
return $graph;
}
- /*
+ /**
* Returns the trace of the PRT.
*/
public function get_trace() {
diff --git a/stack/prt.evaluatable.class.php b/stack/prt.evaluatable.class.php
index 3c4a077f072..c00a3135528 100644
--- a/stack/prt.evaluatable.class.php
+++ b/stack/prt.evaluatable.class.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL')|| die();
require_once(__DIR__ . '/cas/evaluatable_object.interfaces.php');
@@ -30,47 +37,62 @@
class prt_evaluatable implements cas_raw_value_extractor {
// The function to call.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $signature;
// The generated feedback.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $feedback = null;
// Render the castext only if specifically asked.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $renderedfeedback = null;
// The generated path.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $path = null;
// Node notes, i.e. not the test notes.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $notes = null;
// The generated score.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $score = null;
// The generated penalty.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $penalty = null;
// The value from CAS.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $evaluated = null;
// Cas errors.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $errors;
// Did we bailout of execution?
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $bailed = false;
// A holder for the secured feedback bits.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $holder = null;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $weight = 1;
// Because we do not want to transfer large static strings to CAS we use a store that contains those values
// and replace them into the result once everything is complete.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $statics = null;
// Stores the human-readable trace created at compile time.
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
private $trace = [];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct(string $signature, $weight, castext2_static_replacer $statics, $trace) {
$this->signature = $signature;
$this->weight = $weight;
@@ -79,40 +101,49 @@ public function __construct(string $signature, $weight, castext2_static_replacer
$this->trace = $trace;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_evaluated_value(string $value) {
$this->evaluated = $value;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_valid(): bool {
// We count only errors from nodes, and ignore feebdack variable errors.
return count($this->get_errors()) === 0;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_evaluationform(): string {
return $this->signature;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_cas_status(array $errors, array $answernotes, array $feedback) {
$this->errors = $errors;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_source_context(): string {
// Assume the signature has the PRT-name... and use it.
return explode('(', substr($this->signature, 4))[0];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_key(): string {
return '';
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function is_evaluated(): bool {
return $this->evaluated !== null;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function override_feedback(string $feedback) {
$this->renderedfeedback = $feedback;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function unpack() {
if (!$this->is_evaluated()) {
return; // Cannot do this.
@@ -145,6 +176,7 @@ private function unpack() {
$this->notes = $value[4];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_score() {
if ($this->score === null) {
$this->unpack();
@@ -156,14 +188,17 @@ public function get_score() {
return $this->score;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_fraction() {
return $this->weight * $this->get_score();
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_fractionalpenalty() {
return $this->weight * $this->get_penalty();
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_penalty() {
if ($this->penalty === null) {
$this->unpack();
@@ -180,6 +215,7 @@ public function get_penalty() {
return $this->penalty;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_path() {
if ($this->path === null) {
$this->unpack();
@@ -187,6 +223,7 @@ public function get_path() {
return $this->path;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_feedback($processor=null) {
if (!$this->is_evaluated()) {
// If not procesed return undefined or any overrides.
@@ -221,6 +258,7 @@ public function get_feedback($processor=null) {
return trim($this->renderedfeedback);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_answernotes() {
if ($this->score === null) {
$this->unpack();
@@ -253,6 +291,7 @@ public function get_answernotes() {
return $notes;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_errors($format='strings') {
// Apparently one wants to separate feedback-var errors?
$err = [];
@@ -268,6 +307,7 @@ public function get_errors($format='strings') {
return $err;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_fverrors($format='strings') {
$err = [];
foreach ($this->errors as $er) {
@@ -282,16 +322,19 @@ public function get_fverrors($format='strings') {
return $err;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_trace(): array {
// TO-DO: Add in answer test results to the trace array?
return $this->trace;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_debuginfo(): string {
return 'TO-DO DEBUGINFO';
}
// Applies the held back things to the filtered feedback.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function apply_placeholder_holder(string $filtered): string {
if ($this->holder === null) {
return $filtered;
diff --git a/stack/questionreport.class.php b/stack/questionreport.class.php
index f762fbf8fdc..64dcfcef961 100644
--- a/stack/questionreport.class.php
+++ b/stack/questionreport.class.php
@@ -17,6 +17,7 @@
/**
* Loads and manipulates data for display on the response analysis page.
*
+ * @package qtype_stack
* @copyright 2024 University of Edinburgh.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
diff --git a/stack/questiontest.php b/stack/questiontest.php
index fef1b7b1e45..54900c5b0b2 100644
--- a/stack/questiontest.php
+++ b/stack/questiontest.php
@@ -16,13 +16,17 @@
defined('MOODLE_INTERNAL') || die();
-// Holds the data defining one question test.
-//
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Holds the data defining one question test.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/questiontestresult.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_question_test {
/**
* @var string Give each testcase a meaningful description.
@@ -242,6 +246,7 @@ public static function compute_response(qtype_stack_question $question, $inputs)
}
/**
+ * Add description here
* @param string $inputname the name of one of the inputs.
* @return string the value to be entered into that input.
*/
diff --git a/stack/questiontestresult.php b/stack/questiontestresult.php
index 02acd891b5d..dee16af5a20 100644
--- a/stack/questiontestresult.php
+++ b/stack/questiontestresult.php
@@ -16,13 +16,17 @@
defined('MOODLE_INTERNAL') || die();
-// Holds the results of one {@link stack_question_test).
-//
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Holds the results of one {@link stack_question_test).
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once('utils.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_question_test_result {
/**
* @var stack_question_test the test case that this is the results for.
@@ -70,7 +74,7 @@ class stack_question_test_result {
public $questionpenalty;
/**
- * @bool Store whether this looks like a trivial empty test case.
+ * @var bool Store whether this looks like a trivial empty test case.
*/
public $emptytestcase;
@@ -97,15 +101,18 @@ public function set_input_state($inputname, $inputvalue, $inputmodified, $displa
$this->inputerrors[$inputname] = $error;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_prt_result($prtname, prt_evaluatable $actualresult) {
$this->actualresults[$prtname] = $actualresult;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function set_questionpenalty($penalty) {
$this->questionpenalty = $penalty;
}
/**
+ * Add description here.
* @return array input name => object with fields ->input, ->display and ->status.
*/
public function get_input_states() {
@@ -134,6 +141,7 @@ private function round_prt_scores($score) {
}
/**
+ * Add description here.
* @return array input name => object with fields ->mark, ->expectedmark,
* ->penalty, ->expectedpenalty, ->answernote, ->expectedanswernote,
* ->feedback and ->testoutcome.
@@ -232,6 +240,7 @@ protected function test_answer_note($expected, $actual) {
}
/**
+ * Add description here.
* @return bool whether the test passed successfully.
*/
public function passed() {
@@ -247,6 +256,7 @@ public function passed() {
}
/**
+ * Add description here.
* @return array whether the test passed successfully + outcomes, inputs and reasons for failure.
*/
public function passed_with_reasons() {
diff --git a/stack/utils.class.php b/stack/utils.class.php
index 906293b0e46..2fdae1bff13 100644
--- a/stack/utils.class.php
+++ b/stack/utils.class.php
@@ -19,6 +19,7 @@
/**
* Various utility classes for Stack.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -26,12 +27,14 @@
/**
* Interface for a class that stores debug information (or not).
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
interface stack_debug_log {
/**
+ * Add description here.
* @return string the contents of the log.
*/
public function get_log();
@@ -48,14 +51,16 @@ public function log($heading = '', $message = '');
/**
* Interface for a class that stores debug information (or not).
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_debug_log_base implements stack_debug_log {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $debuginfo = '';
/**
+ * Add description here.
* @return string the contents of the log.
*/
public function get_log() {
@@ -81,12 +86,14 @@ public function log($heading = '', $message = '') {
/**
* A null stack_debug_log. Does not acutally log anything. Used when debugging is off.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class stack_debug_log_null implements stack_debug_log {
/**
+ * Add description here.
* @return string the contents of the log.
*/
public function get_log() {
@@ -107,6 +114,7 @@ public function log($heading = '', $message = '') {
/**
* Utility methods for processing strings.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -376,7 +384,6 @@ public static function underscore($string, $toreplace = []) {
/**
* Converts windows style paths to unix style with forward slashes
*
- * @access public
* @return string|null
*/
public static function convert_slash_paths($string) {
@@ -407,7 +414,6 @@ public static function convert_slash_paths($string) {
* Extracts double quoted strings with \-escapes, extracts only the content
* not the quotes.
*
- * @access public
* @return array
*/
public static function all_substring_strings($string) {
@@ -443,7 +449,6 @@ public static function all_substring_strings($string) {
* Replaces all Maxima strings with zero length strings to eliminate string
* contents for validation tasks.
*
- * @access public
* @return string
*/
public static function eliminate_strings($string) {
@@ -478,7 +483,6 @@ public static function eliminate_strings($string) {
* Convert strings to protect LaTeX backslashes for use in Maxima strings.
* @param string in
* @return string out
- * @access public
*/
public static function protect_backslash_latex($string) {
$string = addslashes($string);
@@ -492,7 +496,6 @@ public static function protect_backslash_latex($string) {
*
* @param string in
* @return array out
- * @access public
*/
public static function cvs_to_array($string, $token = ',') {
$exploded = explode($token, $string);
@@ -574,6 +577,7 @@ private static function next_element($list) {
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
private static function list_to_array_workhorse($list, $rec = true) {
$array = [];
$list = trim($list);
@@ -643,6 +647,7 @@ public static function extract_placeholders_sloppy($text, $type) {
}
/**
+ * Add description here
* @param string $name a potential name for part of a STACK question.
* @return bool whether that name is allowed.
*/
@@ -650,7 +655,9 @@ public static function is_valid_name($name) {
return preg_match('~^' . self::VALID_NAME_REGEX . '$~', $name);
}
- /** Get the stack configuration settings. */
+ /**
+ * Get the stack configuration settings.
+ */
public static function get_config() {
if (is_null(self::$config)) {
self::$config = get_config('qtype_stack');
@@ -658,6 +665,7 @@ public static function get_config() {
return self::$config;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function clear_config_cache() {
self::$config = null;
}
@@ -893,6 +901,7 @@ public static function rational_approximation($n, $accuracy) {
return [$nint * $oden + $onum, $oden];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function fix_to_continued_fraction($n, $accuracy) {
$frac = self::rational_approximation($n, $accuracy);
return $frac[0] / $frac[1];
@@ -939,7 +948,7 @@ public static function fix_trailing_zeros($str) {
return 0 + $str;
}
- /*
+ /**
* This function takes user input of the form "option:arg" and splits them up.
* Used to sort out options to the inputs field.
*/
@@ -953,7 +962,7 @@ public static function parse_option($option) {
return([$option, $arg]);
}
- /*
+ /**
* This function takes html and counts the number of img fields
* with missing or empty alt text.
*/
diff --git a/tests/answertest_general_cas_test.php b/tests/answertest_general_cas_test.php
index 4d57d569de8..82f95503cad 100644
--- a/tests/answertest_general_cas_test.php
+++ b/tests/answertest_general_cas_test.php
@@ -25,10 +25,13 @@
defined('MOODLE_INTERNAL') || die();
-// Unit tests for stack_answertest_general_cas.
-//
-// @copyright 2012 The University of Birmingham.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Unit tests for stack_answertest_general_cas.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The University of Birmingham.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/fixtures/test_base.php');
require_once(__DIR__ . '/../locallib.php');
@@ -37,12 +40,14 @@
require_once(__DIR__ . '/../stack/answertest/at_general_cas.class.php');
/**
+ * Add description here.
* @group qtype_stack
* @covers \stack_answertest_general_cas
* @covers \stack_anstest
*/
-class answertest_general_cas_test extends qtype_stack_testcase {
+final class answertest_general_cas_test extends qtype_stack_testcase {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
public function stack_answertest_general_cas_builder($sans, $tans, $atname,
$atop = 'null', $options = null) {
$sa = stack_ast_container::make_from_teacher_source($sans, '', new stack_cas_security());
@@ -52,39 +57,45 @@ public function stack_answertest_general_cas_builder($sans, $tans, $atname,
return new stack_answertest_general_cas($sa, $ta, $atname, $op, $options);
}
- public function test_is_true_for_equivalent_expressions_diff() {
+ public function test_is_true_for_equivalent_expressions_diff(): void {
+
$at = $this->stack_answertest_general_cas_builder('2*x', '2*x', 'Diff', 'x');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_for_equivalent_expressions_diff() {
+ public function test_is_false_for_equivalent_expressions_diff(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^3/3', '2*x', 'Diff', 'x');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_null_for_missing_option_diff() {
+ public function test_is_null_for_missing_option_diff(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '2*x', 'Diff', '');
$this->assertNull($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_for_equal_expressions_algequiv() {
+ public function test_is_true_for_equal_expressions_algequiv(): void {
+
$at = $this->stack_answertest_general_cas_builder('1', '1', 'AlgEquiv');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
$this->assertEquals('', $at->get_at_feedback());
}
- public function test_is_false_for_unequal_expressions_algequiv() {
+ public function test_is_false_for_unequal_expressions_algequiv(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^2+2*x-1', '(x+1)^2', 'AlgEquiv');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
$this->assertEquals('', $at->get_at_feedback());
}
- public function test_is_false_for_expressions_with_different_type_algequiv() {
+ public function test_is_false_for_expressions_with_different_type_algequiv(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '[a,b,c]', 'AlgEquiv');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
@@ -93,7 +104,8 @@ public function test_is_false_for_expressions_with_different_type_algequiv() {
$this->assertEquals("ATAlgEquiv_SA_not_list.", $at->get_at_answernote());
}
- public function test_algequivfeedback_1() {
+ public function test_algequivfeedback_1(): void {
+
$at = $this->stack_answertest_general_cas_builder('[1,2]', '[1,2,3]', 'AlgEquiv');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
@@ -104,7 +116,8 @@ public function test_algequivfeedback_1() {
$this->assertEquals("ATList_wronglen.", $at->get_at_answernote());
}
- public function test_algequivfeedback_2() {
+ public function test_algequivfeedback_2(): void {
+
$at = $this->stack_answertest_general_cas_builder('x', '{1,2,3}', 'AlgEquiv');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
@@ -113,7 +126,8 @@ public function test_algequivfeedback_2() {
$this->assertEquals("ATAlgEquiv_SA_not_set.", $at->get_at_answernote());
}
- public function test_algequivfeedback_3() {
+ public function test_algequivfeedback_3(): void {
+
$at = $this->stack_answertest_general_cas_builder('{1,2}', '{1,2,3}', 'AlgEquiv');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
@@ -122,67 +136,78 @@ public function test_algequivfeedback_3() {
$this->assertEquals("ATSet_wrongsz.", $at->get_at_answernote());
}
- public function test_is_true_for_equal_expressions_comass() {
+ public function test_is_true_for_equal_expressions_comass(): void {
+
$at = $this->stack_answertest_general_cas_builder('x+y', 'x+y', 'EqualComAss');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_for_unequal_expressions_comass() {
+ public function test_is_false_for_unequal_expressions_comass(): void {
+
$at = $this->stack_answertest_general_cas_builder('x+x', '2*x', 'EqualComAss');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_false_for_expressions_with_different_type_comass() {
+ public function test_is_false_for_expressions_with_different_type_comass(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '[a,b,c]', 'EqualComAss');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_for_equal_expressions_caseq() {
+ public function test_is_true_for_equal_expressions_caseq(): void {
+
$at = $this->stack_answertest_general_cas_builder('x+y', 'x+y', 'CasEqual');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_for_unequal_expressions_caseq() {
+ public function test_is_false_for_unequal_expressions_caseq(): void {
+
$at = $this->stack_answertest_general_cas_builder('(1-x)^2', '(x-1)^2', 'CasEqual');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_false_for_expressions_with_different_type_caseq() {
+ public function test_is_false_for_expressions_with_different_type_caseq(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '[a,b,c]', 'CasEqual');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_sametype() {
+ public function test_is_true_sametype(): void {
+
$at = $this->stack_answertest_general_cas_builder('x+1', 'x^3+x', 'SameType');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_sametype() {
+ public function test_is_false_sametype(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^2+2*x-1', '{(x+1)^2}', 'SameType');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_substequiv() {
+ public function test_is_true_substequiv(): void {
+
$at = $this->stack_answertest_general_cas_builder('a^2+b^2=c^2', 'x^2+y^2=z^2', 'SubstEquiv', '[]');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_substequiv() {
+ public function test_is_false_substequiv(): void {
+
$at = $this->stack_answertest_general_cas_builder('2*x', '3*z', 'SubstEquiv', '[]');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_substequiv_op_true() {
+ public function test_is_substequiv_op_true(): void {
+
$at = $this->stack_answertest_general_cas_builder('A*cos(t)+B', 'P*cos(t)+Q', 'SubstEquiv', '[t]');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
@@ -190,7 +215,8 @@ public function test_is_substequiv_op_true() {
$this->assertEquals('ATSubstEquiv(A*cos(t)+B, P*cos(t)+Q, [t]);', $at->get_trace(false));
}
- public function test_is_substequiv_op_false() {
+ public function test_is_substequiv_op_false(): void {
+
$at = $this->stack_answertest_general_cas_builder('A*cos(x)+B', 'P*cos(t)+Q', 'SubstEquiv', '[t]');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
@@ -198,120 +224,139 @@ public function test_is_substequiv_op_false() {
$this->assertEquals('ATSubstEquiv(A*cos(x)+B, P*cos(t)+Q, [t]);', $at->get_trace(false));
}
- public function test_is_true_for_equal_expressions_expanded() {
+ public function test_is_true_for_equal_expressions_expanded(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^2+2*x-1', 'x^2+2*x-1', 'Expanded');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_for_unequal_expressions_expanded() {
+ public function test_is_false_for_unequal_expressions_expanded(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'Expanded');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
$this->assertEquals('ATExpanded((x+1)^2, (x+1)^2, null);', $at->get_trace(false));
}
- public function test_is_true_for_equal_expression_facforms() {
+ public function test_is_true_for_equal_expression_facforms(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'FacForm', 'x');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
$this->assertEquals('ATFacForm((x+1)^2, (x+1)^2, x);', $at->get_trace(false));
}
- public function test_is_false_for_unequal_expressions_facform() {
+ public function test_is_false_for_unequal_expressions_facform(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^2+2*x+1', '(x+1)^2', 'FacForm', 'x');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_null_for_missing_option_facform() {
+ public function test_is_null_for_missing_option_facform(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'FacForm', '');
$this->assertNull($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_atsinglefrac() {
+ public function test_is_true_atsinglefrac(): void {
+
$at = $this->stack_answertest_general_cas_builder('1/(x*(x+1))', '1/(x*(x+1))', 'SingleFrac');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_atsinglefrac() {
+ public function test_is_false_atsinglefrac(): void {
+
$at = $this->stack_answertest_general_cas_builder('1/n+1/(n+1)', '1/n+1/(n+1)', 'SingleFrac');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_partfrac() {
+ public function test_is_true_partfrac(): void {
+
$at = $this->stack_answertest_general_cas_builder('1/n+1/(n+1)', '1/n+1/(n+1)', 'PartFrac', 'n');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_partfrac() {
+ public function test_is_false_partfrac(): void {
+
$at = $this->stack_answertest_general_cas_builder('1/(x*(x+1))', '1/(x*(x+1))', 'PartFrac', 'x');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
$this->assertEquals('ATPartFrac(1/(x*(x+1)), 1/(x*(x+1)), x);', $at->get_trace(false));
}
- public function test_is_null_for_missing_option_partfrac() {
+ public function test_is_null_for_missing_option_partfrac(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'PartFrac', '');
$this->assertNull($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
$this->assertEquals([true, ''], $at->validate_atoptions('x'));
}
- public function test_is_true_for_completed_quadratics_compsquare() {
+ public function test_is_true_for_completed_quadratics_compsquare(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x-1)^2-2', '(x-1)^2-2', 'CompSquare', 'x');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_for_wrong_form_compsquare() {
+ public function test_is_false_for_wrong_form_compsquare(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^2+2*x+1', '(x+1)^2', 'CompSquare', 'x');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
$this->assertEquals('ATCompSquare(x^2+2*x+1, (x+1)^2, x);', $at->get_trace(false));
}
- public function test_is_null_for_missing_option_compsquare() {
+ public function test_is_null_for_missing_option_compsquare(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'CompSquare', '');
$this->assertNull($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_for_equal_expressions_gt() {
+ public function test_is_true_for_equal_expressions_gt(): void {
+
$at = $this->stack_answertest_general_cas_builder('2', '1', 'GT');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_true_for_equal_expressions_gte() {
+ public function test_is_true_for_equal_expressions_gte(): void {
+
$at = $this->stack_answertest_general_cas_builder('2', '1', 'GTE');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_true_for_equivalent_expressions_int() {
+ public function test_is_true_for_equivalent_expressions_int(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^3/3+c', 'x^3/3', 'Int', 'x');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_for_equivalent_expressions_int() {
+ public function test_is_false_for_equivalent_expressions_int(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^3/3', '2*x', 'Int', 'x');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_null_for_missing_option_int() {
+ public function test_is_null_for_missing_option_int(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'Int', '');
$this->assertNull($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_invalid_option_int() {
+ public function test_invalid_option_int(): void {
+
$at = $this->stack_answertest_general_cas_builder('(x+1)^2', '(x+1)^2', 'Int', '(x');
$this->assertNull($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
@@ -327,46 +372,53 @@ public function test_invalid_option_int() {
'2*x.', $err);
}
- public function test_is_true_numabsolute() {
+ public function test_is_true_numabsolute(): void {
+
$at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumAbsolute', '0.05');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_numabsolute() {
+ public function test_is_false_numabsolute(): void {
+
$at = $this->stack_answertest_general_cas_builder('1.0501', '1', 'NumAbsolute', '0.01');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
$this->assertEquals('ATNumAbsolute(1.0501, 1, 0.01);', $at->get_trace(false));
}
- public function test_is_missingopt_numabsolute() {
+ public function test_is_missingopt_numabsolute(): void {
+
$at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumAbsolute');
// If the option is missing then we take 5% of the teacher's answer.
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_numrelative() {
+ public function test_is_true_numrelative(): void {
+
$at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumRelative', '0.05');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_numrelative() {
+ public function test_is_false_numrelative(): void {
+
$at = $this->stack_answertest_general_cas_builder('1.0501', '1', 'NumRelative', '0.01');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_missingopt_numrelative() {
+ public function test_is_missingopt_numrelative(): void {
+
$at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumRelative');
// If the option is missing then we take 5%.
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_invalidopt_numrelative() {
+ public function test_is_invalidopt_numrelative(): void {
+
$at = $this->stack_answertest_general_cas_builder('1.05', '1', 'NumRelative', 'x');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
@@ -403,7 +455,8 @@ public function test_is_invalidopt_numrelative() {
// This needs to be converted into something which can be translated by Moodle.
// This is the role of stack_maxima_translate in locallib.php.
// @codingStandardsIgnoreEND
- public function test_stack_maxima_translate_int() {
+ public function test_stack_maxima_translate_int(): void {
+
$at = $this->stack_answertest_general_cas_builder('x^6', 'x^6/6', 'Int', 'x');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
@@ -415,7 +468,8 @@ public function test_stack_maxima_translate_int() {
$this->assert_content_with_maths_equals($fbt, $at->get_at_feedback());
}
- public function test_stack_maxima_translate_algequiv_list() {
+ public function test_stack_maxima_translate_algequiv_list(): void {
+
// This test points out which element in the list is incorrect.
$at = $this->stack_answertest_general_cas_builder('[x^2,x^2,x^4]', '[x^2,x^3,x^4]', 'AlgEquiv');
$this->assertFalse($at->do_test());
@@ -429,7 +483,8 @@ public function test_stack_maxima_translate_algequiv_list() {
$this->assert_content_with_maths_equals($fbt, stack_maxima_translate($at->get_at_feedback()));
}
- public function test_stack_maxima_translate_algequiv_list_decimals() {
+ public function test_stack_maxima_translate_algequiv_list_decimals(): void {
+
// This test points out which element in the list is incorrect.
$options = new stack_options();
$options->set_option('decimals', ',');
@@ -445,7 +500,8 @@ public function test_stack_maxima_translate_algequiv_list_decimals() {
$this->assert_content_with_maths_equals($fbt, stack_maxima_translate($at->get_at_feedback()));
}
- public function test_stack_maxima_translate_algequiv_matrix() {
+ public function test_stack_maxima_translate_algequiv_matrix(): void {
+
// Matrices have newline characters in them.
$at = $this->stack_answertest_general_cas_builder('matrix([1,2],[2,4])', 'matrix([1,2],[3,4])', 'AlgEquiv');
$this->assertFalse($at->do_test());
@@ -460,7 +516,8 @@ public function test_stack_maxima_translate_algequiv_matrix() {
$this->assert_content_with_maths_equals($fbt, $at->get_at_feedback());
}
- public function test_stack_maxima_int_feedback_1() {
+ public function test_stack_maxima_int_feedback_1(): void {
+
$at = $this->stack_answertest_general_cas_builder('((5*%e^7*x-%e^7)*%e^(5*x))',
'((5*%e^7*x-%e^7)*%e^(5*x))/25+c', 'Int', 'x');
$this->assertFalse($at->do_test());
@@ -474,7 +531,8 @@ public function test_stack_maxima_int_feedback_1() {
$this->assert_content_with_maths_equals($fbt, $at->get_at_feedback());
}
- public function test_stack_maxima_int_feedback_2() {
+ public function test_stack_maxima_int_feedback_2(): void {
+
$at = $this->stack_answertest_general_cas_builder('((5*%e^7*x-%e^7)*%e^(5*x))',
'((5*%e^7*x-%e^7)*%e^(5*x))/25+c', 'Int', '[x,x*%e^(5*x+7)]');
$this->assertFalse($at->do_test());
@@ -487,7 +545,8 @@ public function test_stack_maxima_int_feedback_2() {
$this->assert_content_with_maths_equals($fbt, $at->get_at_feedback());
}
- public function test_stack_maxima_int_feedback_3() {
+ public function test_stack_maxima_int_feedback_3(): void {
+
$at = $this->stack_answertest_general_cas_builder('e^-(4*pi*x)/(4*pi)',
'int(exp(-4*pi*x),x)', 'Int', '[x,NOCONST]');
$this->assertFalse($at->do_test());
@@ -499,35 +558,40 @@ public function test_stack_maxima_int_feedback_3() {
$this->assert_content_with_maths_equals($fbt, $at->get_at_feedback());
}
- public function test_is_true_units_relative() {
+ public function test_is_true_units_relative(): void {
+
$at = $this->stack_answertest_general_cas_builder('3.1*m/s', '3.2*m/s', 'UnitsRelative', '0.1');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
$this->assertEquals('ATUnits_units_match.', $at->get_at_answernote());
}
- public function test_is_false_units_relative() {
+ public function test_is_false_units_relative(): void {
+
$at = $this->stack_answertest_general_cas_builder('3.0*m/s', '3.2*m/s', 'UnitsRelative', '0.05');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
$this->assertEquals('ATUnits_units_match.', $at->get_at_answernote());
}
- public function test_is_true_units_absolute() {
+ public function test_is_true_units_absolute(): void {
+
$at = $this->stack_answertest_general_cas_builder('3.1*m/s', '3.2*m/s', 'UnitsAbsolute', '0.2');
$this->assertTrue($at->do_test());
$this->assertEquals(1, $at->get_at_mark());
$this->assertEquals('ATUnits_units_match.', $at->get_at_answernote());
}
- public function test_is_false_units_absolute() {
+ public function test_is_false_units_absolute(): void {
+
$at = $this->stack_answertest_general_cas_builder('3.1*m/s', '3.2*m/s', 'UnitsAbsolute', '0.05');
$this->assertFalse($at->do_test());
$this->assertEquals(0, $at->get_at_mark());
$this->assertEquals('ATUnits_units_match.', $at->get_at_answernote());
}
- public function test_equiv_true() {
+ public function test_equiv_true(): void {
+
$at = $this->stack_answertest_general_cas_builder('[x^2-1=0,(x-1)*(x+1)=0,x=1 or x=-1]', '[x^2-1=0,(x-1)*(x+1)=0,x=1 or x=-1]',
'Equiv', 'null');
$this->assertTrue($at->do_test());
@@ -538,7 +602,8 @@ public function test_equiv_true() {
$this->assert_content_with_maths_equals($fbt, $at->get_at_feedback());
}
- public function test_equiv_false() {
+ public function test_equiv_false(): void {
+
$at = $this->stack_answertest_general_cas_builder('[x^2-1=0,(x-1)*(x+1)=0,x=i or x=-1]', '[x^2-1=0,(x-1)*(x+1)=0,x=1 or x=-1]',
'Equiv', 'null');
$this->assertFalse($at->do_test());
@@ -549,7 +614,8 @@ public function test_equiv_false() {
$this->assert_content_with_maths_equals($fbt, $at->get_at_feedback());
}
- public function test_equiv_comment() {
+ public function test_equiv_comment(): void {
+
$at = $this->stack_answertest_general_cas_builder('[x^2-1=0,(x-1)*(x+1)=0,"Could be",x=i or x=-1]',
'[x^2-1=0,(x-1)*(x+1)=0,x=1 or x=-1]', 'Equiv', 'null');
$this->assertFalse($at->do_test());
@@ -560,7 +626,8 @@ public function test_equiv_comment() {
$this->assert_content_with_maths_equals($fbt, $at->get_at_feedback());
}
- public function test_is_true_for_equal_expressions() {
+ public function test_is_true_for_equal_expressions(): void {
+
$at = new stack_ans_test_controller('NumDecPlaces',
stack_ast_container::make_from_teacher_source('1.01'),
stack_ast_container::make_from_teacher_source('1.01'),
@@ -571,7 +638,8 @@ public function test_is_true_for_equal_expressions() {
$this->assertTrue(stack_ans_test_controller::required_atoptions('NumDecPlaces'));
}
- public function test_is_false_for_unequal_expressions() {
+ public function test_is_false_for_unequal_expressions(): void {
+
$at = new stack_ans_test_controller('NumDecPlaces',
stack_ast_container::make_from_teacher_source('2'),
stack_ast_container::make_from_teacher_source('1'),
@@ -581,7 +649,8 @@ public function test_is_false_for_unequal_expressions() {
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_false_for_unequal_expressions_2() {
+ public function test_is_false_for_unequal_expressions_2(): void {
+
$at = new stack_ans_test_controller('NumDecPlaces',
stack_ast_container::make_from_teacher_source('2.000'),
stack_ast_container::make_from_teacher_source('1'),
@@ -592,7 +661,8 @@ public function test_is_false_for_unequal_expressions_2() {
$this->assertEquals('ATNumDecPlaces_Correct. ATNumDecPlaces_Not_equiv.', $at->get_at_answernote());
}
- public function test_is_true_for_equal_strings() {
+ public function test_is_true_for_equal_strings(): void {
+
$at = new stack_ans_test_controller('String',
stack_ast_container::make_from_teacher_source('"hello"'),
stack_ast_container::make_from_teacher_source('"hello"'));
@@ -601,7 +671,8 @@ public function test_is_true_for_equal_strings() {
$this->assertEquals('', $at->get_at_answernote());
}
- public function test_is_false_for_unequal_strings() {
+ public function test_is_false_for_unequal_strings(): void {
+
$at = new stack_ans_test_controller('String',
stack_ast_container::make_from_teacher_source('"hello"'),
stack_ast_container::make_from_teacher_source('"heloo"'),
@@ -610,7 +681,8 @@ public function test_is_false_for_unequal_strings() {
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_false_for_strings_with_different_case() {
+ public function test_is_false_for_strings_with_different_case(): void {
+
$at = new stack_ans_test_controller('String',
stack_ast_container::make_from_teacher_source('"Hello"'),
stack_ast_container::make_from_teacher_source('"hello"'),
@@ -619,7 +691,8 @@ public function test_is_false_for_strings_with_different_case() {
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_for_equal_strings_sloppy() {
+ public function test_is_true_for_equal_strings_sloppy(): void {
+
$at = new stack_ans_test_controller('StringSloppy',
stack_ast_container::make_from_teacher_source('"hello"'),
stack_ast_container::make_from_teacher_source('"hello"'),
@@ -628,7 +701,8 @@ public function test_is_true_for_equal_strings_sloppy() {
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_false_for_unequal_strings_sloppy() {
+ public function test_is_false_for_unequal_strings_sloppy(): void {
+
$at = new stack_ans_test_controller('StringSloppy',
stack_ast_container::make_from_teacher_source('"hello"'),
stack_ast_container::make_from_teacher_source('"heloo"'),
@@ -637,7 +711,8 @@ public function test_is_false_for_unequal_strings_sloppy() {
$this->assertEquals(0, $at->get_at_mark());
}
- public function test_is_true_for_strings_with_different_case_sloppy() {
+ public function test_is_true_for_strings_with_different_case_sloppy(): void {
+
$at = new stack_ans_test_controller('StringSloppy',
stack_ast_container::make_from_teacher_source('"Hello"'),
stack_ast_container::make_from_teacher_source('"hello"'),
@@ -646,7 +721,8 @@ public function test_is_true_for_strings_with_different_case_sloppy() {
$this->assertEquals(1, $at->get_at_mark());
}
- public function test_is_true_for_nearly_equal_strings_sloppy() {
+ public function test_is_true_for_nearly_equal_strings_sloppy(): void {
+
$at = new stack_ans_test_controller('StringSloppy',
stack_ast_container::make_from_teacher_source('"hel lo"'),
stack_ast_container::make_from_teacher_source('"Hello"'),
diff --git a/tests/answertest_general_fixtures_test.php b/tests/answertest_general_fixtures_test.php
index 8f59e788cb8..1bcd837f27b 100644
--- a/tests/answertest_general_fixtures_test.php
+++ b/tests/answertest_general_fixtures_test.php
@@ -21,11 +21,14 @@
defined('MOODLE_INTERNAL') || die();
-// Add in all the tests from answertestsfixtures.class into the unit testing framework.
-// These are exposed to users as documentation and google-ci should also run all the tests.
-//
-// @copyright 2016 The University of Edinburgh.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Add in all the tests from answertestsfixtures.class into the unit testing framework.
+ * These are exposed to users as documentation and google-ci should also run all the tests.
+ *
+ * @package qtype_stack
+ * @copyright 2016 The University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/../locallib.php');
require_once(__DIR__ . '/../stack/answertest/controller.class.php');
@@ -34,22 +37,25 @@
require_once(__DIR__ . '/fixtures/answertestfixtures.class.php');
/**
+ * Add description here.
* @group qtype_stack
* @covers \stack_answertest_general_cas
* @covers \stack_anstest
*/
-class answertest_general_fixtures_test extends qtype_stack_testcase {
+final class answertest_general_fixtures_test extends qtype_stack_testcase {
/**
+ * Add description
* @dataProvider answertest_fixtures
*/
- public function test_answertest($name, $test) {
+ public function test_answertest($name, $test): void {
list($passed, $error, $rawmark, $feedback, $ansnote, $anomalynote) = stack_answertest_test_data::run_test($test);
$this->assertEquals($test->ansnote, $ansnote);
$this->assertTrue($passed, $anomalynote);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
public static function answertest_fixtures(): array {
$tests = stack_answertest_test_data::get_all();
diff --git a/tests/api_controller_test.php b/tests/api_controller_test.php
index dec29b47f5f..e30f464c440 100644
--- a/tests/api_controller_test.php
+++ b/tests/api_controller_test.php
@@ -14,10 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-// Unit tests for the Stack question type API.
-//
-// @copyright 2023 University of Edinburgh.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Unit tests for the Stack question type API.
+ *
+ * @package qtype_stack
+ * @copyright 2023 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
namespace qtype_stack;
@@ -45,10 +48,11 @@
use qtype_stack_testcase;
/**
+ * Add description here.
* @group qtype_stack
* @covers \qtype_stack
*/
-class api_controller_test extends qtype_stack_testcase {
+final class api_controller_test extends qtype_stack_testcase {
/** @var object used to store output */
public object $output;
/** @var object used to store output */
@@ -90,6 +94,7 @@ public function setUp(): void {
// Need to use callback so data can be altered in each test.
$this->request->method("getParsedBody")->will($this->returnCallback(
function() {
+
return $this->requestdata;
})
);
@@ -118,6 +123,7 @@ function() {
$this->result->expects($this->any())->method('write')->will($this->returnCallback(
function() {
+
$this->output = json_decode(func_get_args()[0]);
return 1;
})
@@ -128,6 +134,7 @@ function() {
// so we have something easily accessible to perform some asserts on.
$this->response->expects($this->any())->method('getBody')->will($this->returnCallback(
function() {
+
return $this->result;
})
);
@@ -136,15 +143,19 @@ function() {
}
public function tearDown(): void {
+ parent::tearDown();
\stack_cas_castext2_iframe::register_counter('///IFRAME_COUNT///');
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function tearDownAfterClass(): void {
+ parent::tearDownAfterClass();
// Should not really be necessary.
set_config('stackapi', false, 'qtype_stack');
}
- public function test_render() {
+ public function test_render(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices');
$rc = new RenderController();
$rc->__invoke($this->request, $this->response, []);
@@ -162,7 +173,8 @@ public function test_render() {
$this->assertEquals(0, count($this->output->iframes));
}
- public function test_render_specified_seed() {
+ public function test_render_specified_seed(): void {
+
$this->requestdata['seed'] = 219862533;
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices');
$rc = new RenderController();
@@ -171,7 +183,8 @@ public function test_render_specified_seed() {
$this->assertEquals(219862533, $this->output->questionseed);
}
- public function test_render_plots() {
+ public function test_render_plots(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('plots');
$rc = new RenderController();
$rc->__invoke($this->request, $this->response, []);
@@ -182,21 +195,24 @@ public function test_render_plots() {
$this->assertEquals(true, isset($this->output->questionassets->{'input-ans1-4-0.svg'}));
}
- public function test_render_iframes() {
+ public function test_render_iframes(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('iframes');
$rc = new RenderController();
$rc->__invoke($this->request, $this->response, []);
$this->assertEquals(1, count($this->output->iframes));
}
- public function test_render_download() {
+ public function test_render_download(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('download');
$rc = new RenderController();
$rc->__invoke($this->request, $this->response, []);
$this->assertMatchesRegularExpression('/javascript\:download\(\'data.csv\'\, 1\)/s', $this->output->questionrender);
}
- public function test_validation() {
+ public function test_validation(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices');
$this->requestdata['answers'] = (array) json_decode(stack_api_test_data::get_answer_string('matrices_correct'));
$this->requestdata['inputName'] = 'ans1';
@@ -207,7 +223,8 @@ public function test_validation() {
$this->assertEquals(0, count($this->output->iframes));
}
- public function test_grade() {
+ public function test_grade(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices');
$this->requestdata['answers'] = (array) json_decode(stack_api_test_data::get_answer_string('matrices_correct'));
$this->requestdata['inputName'] = 'ans1';
@@ -226,7 +243,8 @@ public function test_grade() {
$this->assertEquals(0, count($this->output->iframes));
}
- public function test_grade_scores() {
+ public function test_grade_scores(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('multipleanswers');
$this->requestdata['answers'] = (array) json_decode(stack_api_test_data::get_answer_string('multiple_mixed'));
$this->requestdata['inputName'] = 'ans1';
@@ -246,7 +264,8 @@ public function test_grade_scores() {
$this->assertEquals(10, $this->output->scoreweights->total);
}
- public function test_download() {
+ public function test_download(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('download');
$this->requestdata['filename'] = 'data.csv';
$this->requestdata['fileid'] = 1;
@@ -261,7 +280,8 @@ public function test_download() {
$this->expectOutputRegex('/^A,B,C\n0.37,5.04,2.72/s');
}
- public function test_test_controller() {
+ public function test_test_controller(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('matrices');
$this->requestdata['filepath'] = 'testpath/test.xml';
$tc = new TestController();
@@ -281,7 +301,8 @@ public function test_test_controller() {
$this->assertEquals(4, count(get_object_vars($results->results->{'86'}->outcomes)));
}
- public function test_test_controller_fail() {
+ public function test_test_controller_fail(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('test');
$this->requestdata['filepath'] = 'testpath/test.xml';
$tc = new TestController();
@@ -302,7 +323,8 @@ public function test_test_controller_fail() {
$this->assertEquals(2, count(get_object_vars($results->results->noseed->outcomes)));
}
- public function test_test_controller_upgrade() {
+ public function test_test_controller_upgrade(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('test2');
$this->requestdata['filepath'] = 'testpath/test.xml';
$tc = new TestController();
@@ -318,7 +340,8 @@ public function test_test_controller_upgrade() {
$this->assertEquals([], $results->results);
}
- public function test_test_controller_default_test_fail() {
+ public function test_test_controller_default_test_fail(): void {
+
$this->requestdata['questionDefinition'] = stack_api_test_data::get_question_string('test3');
$this->requestdata['filepath'] = 'testpath/test.xml';
$tc = new TestController();
@@ -335,7 +358,8 @@ public function test_test_controller_default_test_fail() {
$this->assertEquals(0, $results->results->noseed->passes);
}
- public function test_test_controller_default_test_pass() {
+ public function test_test_controller_default_test_pass(): void {
+
$this->requestdata['questionDefinition'] =
str_replace('wrong ', 'ta ', stack_api_test_data::get_question_string('test3'));
$this->requestdata['filepath'] = 'testpath/test.xml';
diff --git a/tests/api_stackquestionloader_test.php b/tests/api_stackquestionloader_test.php
index 586291bbdea..9b67530af7f 100644
--- a/tests/api_stackquestionloader_test.php
+++ b/tests/api_stackquestionloader_test.php
@@ -14,10 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-// Unit tests for the Stack question type API.
-//
-// @copyright 2023 University of Edinburgh.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Unit tests for the Stack question type API.
+ *
+ * @package qtype_stack
+ * @copyright 2023 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
namespace qtype_stack;
@@ -32,12 +35,14 @@
use qtype_stack_testcase;
/**
+ * Add description here.
* @group qtype_stack
* @covers \qtype_stack
*/
-class api_stackquestionloader_test extends qtype_stack_testcase {
+final class api_stackquestionloader_test extends qtype_stack_testcase {
+
+ public function test_question_loader(): void {
- public function test_question_loader() {
$xml = stack_api_test_data::get_question_string('matrices');
$ql = new StackQuestionLoader();
$question = $ql->loadXML($xml)['question'];
@@ -62,7 +67,8 @@ public function test_question_loader() {
$this->assertEquals(3, count($question->deployedseeds));
}
- public function test_question_loader_use_defaults() {
+ public function test_question_loader_use_defaults(): void {
+
global $CFG;
$xml = stack_api_test_data::get_question_string('usedefaults');
$ql = new StackQuestionLoader();
@@ -93,7 +99,8 @@ public function test_question_loader_use_defaults() {
$this->assertEquals($question->inputs['ans1']->get_parameter('boxWidth'), get_config('qtype_stack', 'inputboxsize'));
}
- public function test_question_loader_do_not_use_defaults() {
+ public function test_question_loader_do_not_use_defaults(): void {
+
global $CFG;
$xml = stack_api_test_data::get_question_string('optionset');
$ql = new StackQuestionLoader();
diff --git a/tests/api_tests_stateful_test.php b/tests/api_tests_stateful_test.php
index 324daa861d1..f67af520c06 100644
--- a/tests/api_tests_stateful_test.php
+++ b/tests/api_tests_stateful_test.php
@@ -18,11 +18,14 @@
defined('MOODLE_INTERNAL') || die();
-// Unit tests to check that the requirements of a related software
-// are still present, and that the interface does not change unexpectedly.
-//
-// @copyright 2020 Aalto University
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Unit tests to check that the requirements of a related software
+ * are still present, and that the interface does not change unexpectedly.
+ *
+ * @package qtype_stack
+ * @copyright 2020 Aalto University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
// These are all the imports Stateful does, one test is to check that these exist.
// Even the test_base is one of them.
@@ -47,21 +50,24 @@
/**
+ * Add description here.
* @group qtype_stack
* @group qtype_stateful
* @group qtype_stack_compatibility
* @covers \qtype_stack
*/
-class api_tests_stateful_test extends \qtype_stack_testcase {
+final class api_tests_stateful_test extends \qtype_stack_testcase {
+
+ public function test_security_map_path(): void {
- public function test_security_map_path() {
$this->assertTrue(file_exists(__DIR__ . '/../stack/cas/security-map.json'));
$map = file_get_contents(__DIR__ . '/../stack/cas/security-map.json');
$map = json_decode($map);
$this->assertEquals(JSON_ERROR_NONE, json_last_error());
}
- public function test_names_of_interfaces_and_classes() {
+ public function test_names_of_interfaces_and_classes(): void {
+
$this->assertTrue(class_exists("MP_Root"));
$this->assertTrue(class_exists("MP_Statement"));
$this->assertTrue(class_exists("MP_FunctionCall"));
@@ -88,7 +94,8 @@ public function test_names_of_interfaces_and_classes() {
$this->assertTrue(interface_exists("cas_raw_value_extractor"));
}
- public function test_stack_utils() {
+ public function test_stack_utils(): void {
+
$this->assertTrue(method_exists('stack_utils', 'get_config'));
$this->assertTrue(method_exists('stack_utils', 'php_string_to_maxima_string'));
$this->assertTrue(method_exists('stack_utils', 'maxima_string_to_php_string'));
@@ -103,7 +110,8 @@ public function test_stack_utils() {
$this->assertEquals(["foo", "bar", "baz"], \stack_utils::all_substring_strings('["foo","bar",1+"baz"]'));
}
- public function test_maxima_parser_utils() {
+ public function test_maxima_parser_utils(): void {
+
$this->assertTrue(method_exists('maxima_parser_utils', 'parse'));
$this->assertTrue(method_exists('maxima_parser_utils', 'variable_usage_finder'));
@@ -115,12 +123,14 @@ public function test_maxima_parser_utils() {
$this->assertEquals(['sqrt' => true], $usage['calls']);
}
- public function test_stack_ast_container() {
+ public function test_stack_ast_container(): void {
+
$this->assertTrue(method_exists('stack_ast_container', 'get_evaluated'));
$this->assertTrue(method_exists('stack_ast_container', 'get_evaluationform'));
}
- public function test_stack_ast_container_silent() {
+ public function test_stack_ast_container_silent(): void {
+
$this->assertTrue(method_exists('stack_ast_container_silent', 'get_evaluationform'));
$this->assertTrue(method_exists('stack_ast_container_silent', 'get_errors'));
$this->assertTrue(method_exists('stack_ast_container_silent', 'get_inputform'));
@@ -130,45 +140,53 @@ public function test_stack_ast_container_silent() {
$this->assertTrue(method_exists('stack_ast_container_silent', 'make_from_teacher_source'));
}
- public function test_stack_cas_security() {
+ public function test_stack_cas_security(): void {
+
$this->assertTrue(method_exists('stack_cas_security', 'set_allowedwords'));
$this->assertTrue(method_exists('stack_cas_security', 'set_forbiddenwords'));
$this->assertTrue(method_exists('stack_cas_security', 'get_units'));
}
- public function test_stack_cas_session2() {
+ public function test_stack_cas_session2(): void {
+
$this->assertTrue(method_exists('stack_cas_session2', 'get_valid'));
$this->assertTrue(method_exists('stack_cas_session2', 'get_errors'));
$this->assertTrue(method_exists('stack_cas_session2', 'get_session'));
$this->assertTrue(method_exists('stack_cas_session2', 'instantiate'));
}
- public function test_stack_cas_keyval() {
+ public function test_stack_cas_keyval(): void {
+
$this->assertTrue(method_exists('stack_cas_keyval', 'get_session'));
$this->assertTrue(method_exists('stack_cas_keyval', 'get_variable_usage'));
}
- public function test_stack_maths() {
+ public function test_stack_maths(): void {
+
$this->assertTrue(method_exists('stack_maths', 'process_display_castext'));
}
- public function test_stack_options() {
+ public function test_stack_options(): void {
+
$this->assertTrue(method_exists('stack_options', 'set_option'));
$this->assertTrue(method_exists('stack_options', 'get_option'));
$this->assertTrue(method_exists('stack_options', 'set_site_defaults'));
}
- public function test_stack_secure_loader() {
+ public function test_stack_secure_loader(): void {
+
$this->assertTrue(method_exists('stack_secure_loader', 'get_valid'));
$this->assertTrue(method_exists('stack_secure_loader', 'get_evaluationform'));
}
- public function test_stack_secure_loader_value() {
+ public function test_stack_secure_loader_value(): void {
+
$this->assertTrue(method_exists('stack_secure_loader_value', 'get_value'));
}
- public function test_globals() {
+ public function test_globals(): void {
+
$this->assertTrue(function_exists('stack_maxima_latex_tidy'));
}
}
diff --git a/tests/ast_container_test.php b/tests/ast_container_test.php
index 4982a094135..fe2bbf1f491 100644
--- a/tests/ast_container_test.php
+++ b/tests/ast_container_test.php
@@ -23,10 +23,13 @@
defined('MOODLE_INTERNAL') || die();
-// Unit tests for various AST container features.
-//
-// @copyright 2019 Aalto University
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Unit tests for various AST container features.
+ *
+ * @package qtype_stack
+ * @copyright 2019 Aalto University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/fixtures/numbersfixtures.class.php');
require_once(__DIR__ . '/../stack/cas/ast.container.class.php');
@@ -34,12 +37,14 @@
require_once(__DIR__ . '/fixtures/test_base.php');
/**
+ * Add description here.
* @group qtype_stack
* @covers \stack_ast_container
*/
-class ast_container_test extends qtype_stack_testcase {
+final class ast_container_test extends qtype_stack_testcase {
+
+ public function test_types(): void {
- public function test_types() {
$matrix = stack_ast_container::make_from_teacher_source('foo:matrix([1,2],[3,4])', 'type test', new stack_cas_security());
$this->assertTrue($matrix->is_matrix());
$this->assertFalse($matrix->is_int());
@@ -81,7 +86,8 @@ public function test_types() {
$this->assertEquals(3, $list->is_list());
}
- public function test_list_accessor() {
+ public function test_list_accessor(): void {
+
$list = stack_ast_container::make_from_teacher_source('x:[1,2*x,3-4]', 'list access test', new stack_cas_security());
$this->assertEquals(3, $list->is_list());
@@ -90,6 +96,7 @@ public function test_list_accessor() {
$this->assertEquals('3-4', $list->get_list_element(2)->toString());
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
public function get_valid($s, $st, $te) {
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
@@ -99,7 +106,8 @@ public function get_valid($s, $st, $te) {
$this->assertEquals($te, $at2->get_valid());
}
- public function test_get_valid() {
+ public function test_get_valid(): void {
+
$cases = [
['', false, true],
['1', true, true],
@@ -138,7 +146,8 @@ public function test_get_valid() {
}
}
- public function test_get_valid_inequalities() {
+ public function test_get_valid_inequalities(): void {
+
$cases = [
['x>1 and x<4', true, true],
['not (x>1)', true, true],
@@ -158,7 +167,8 @@ public function test_get_valid_inequalities() {
}
}
- public function test_validation_alias() {
+ public function test_validation_alias(): void {
+
$casstring = stack_ast_container::make_from_student_source(json_decode('"\u03C0"').'*r^2', '', new stack_cas_security());
$casstring->get_valid();
$this->assertEquals($casstring->get_evaluationform(), '%pi*r^2');
@@ -166,7 +176,8 @@ public function test_validation_alias() {
$this->assertEquals('', $casstring->get_answernote());
}
- public function test_validation_unicode() {
+ public function test_validation_unicode(): void {
+
// Note the error with the * in this expression.
$casstring = stack_ast_container::make_from_student_source(json_decode('"\u212F"').'*^x', '', new stack_cas_security());
$casstring->get_valid();
@@ -177,7 +188,8 @@ public function test_validation_unicode() {
$this->assertEquals('ParseError', $casstring->get_answernote());
}
- public function test_validation_error() {
+ public function test_validation_error(): void {
+
// Consider A union B.
$casstring = stack_ast_container::make_from_student_source('A ' . json_decode('"\u222A"') . ' B', '',
new stack_cas_security());
@@ -187,7 +199,8 @@ public function test_validation_error() {
$this->assertEquals('forbiddenChar', $casstring->get_answernote());
}
- public function test_spurious_operators() {
+ public function test_spurious_operators(): void {
+
$casstring = stack_ast_container::make_from_student_source('2/*x', '', new stack_cas_security());
$casstring->get_valid();
$this->assertEquals('Unknown operator: /*.',
@@ -195,7 +208,8 @@ public function test_spurious_operators() {
$this->assertEquals('spuriousop', $casstring->get_answernote());
}
- public function test_spurious_operators_2() {
+ public function test_spurious_operators_2(): void {
+
$casstring = stack_ast_container::make_from_student_source('x==2*x', '', new stack_cas_security());
$casstring->get_valid();
$this->assertEquals('Unknown operator: ==.',
@@ -203,7 +217,7 @@ public function test_spurious_operators_2() {
$this->assertEquals('spuriousop', $casstring->get_answernote());
}
- public function test_global_forbidden_words() {
+ public function test_global_forbidden_words(): void {
$s = 'system("rm *")';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
@@ -219,7 +233,8 @@ public function test_global_forbidden_words() {
$this->assertEquals('forbiddenFunction', $at1->get_answernote());
}
- public function test_global_forbidden_words_case() {
+ public function test_global_forbidden_words_case(): void {
+
// This is a change of behaviour in Dec 2018.
$s = 'System("rm *")';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
@@ -234,7 +249,7 @@ public function test_global_forbidden_words_case() {
$this->assertEquals('', $at2->get_answernote());
}
- public function test_teacher_only_words() {
+ public function test_teacher_only_words(): void {
$s = 'setelmx(2,1,1,C)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
@@ -247,7 +262,8 @@ public function test_teacher_only_words() {
$this->assertEquals('', $at2->get_errors());
}
- public function test_allow_words() {
+ public function test_allow_words(): void {
+
$s = '2*dumvariable+3';
$secrules = new stack_cas_security();
$secrules->set_allowedwords('dumvariable');
@@ -255,7 +271,8 @@ public function test_allow_words() {
$this->assertTrue($at1->get_valid());
}
- public function test_allow_words_fail() {
+ public function test_allow_words_fail(): void {
+
$s = 'sin(2*dumvariable+3)';
$secrules = new stack_cas_security();
$secrules->set_allowedwords('dvariable');
@@ -263,7 +280,8 @@ public function test_allow_words_fail() {
$this->assertFalse($at1->get_valid());
}
- public function test_allow_words_teacher() {
+ public function test_allow_words_teacher(): void {
+
$s = 'sin(2*dumvariable+3)';
$secrules = new stack_cas_security();
$secrules->set_allowedwords('dvariable');
@@ -271,7 +289,8 @@ public function test_allow_words_teacher() {
$this->assertTrue($at1->get_valid());
}
- public function test_check_external_forbidden_words() {
+ public function test_check_external_forbidden_words(): void {
+
$cases = [
['sin(ta)', 'ta', false, 'forbiddenVariable'],
['sin(ta)', 'ta,a,b', false, 'forbiddenVariable'],
@@ -292,7 +311,8 @@ public function test_check_external_forbidden_words() {
}
}
- public function test_check_external_forbidden_words_literal() {
+ public function test_check_external_forbidden_words_literal(): void {
+
$cases = [
['3+5', '+', false],
['sin(a)', 'a', false], // It includes single letters.
@@ -314,19 +334,22 @@ public function test_check_external_forbidden_words_literal() {
}
}
- public function test_strings_1() {
+ public function test_strings_1(): void {
+
$s = 'a:"hello"';
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
}
- public function test_strings_2() {
+ public function test_strings_2(): void {
+
$s = 'a:["2x)",3*x]';
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
}
- public function test_strings_mismatched_string_delimiters() {
+ public function test_strings_mismatched_string_delimiters(): void {
+
$s = 'a:""hello""';
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
@@ -381,7 +404,8 @@ public function test_strings_mismatched_string_delimiters() {
$this->assertEquals('You are missing a quotation sign "
. ', $at1->get_errors());
}
- public function test_system_execution() {
+ public function test_system_execution(): void {
+
// First the obvious one, just eval that string.
$s = 'a:eval_string("system(\\"rm /tmp/test\\")")';
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
@@ -516,75 +540,86 @@ public function test_system_execution() {
$at1->get_errors());
}
- public function test_scientific_1() {
+ public function test_scientific_1(): void {
+
$s = 'a:3e2';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
$this->assertEquals('', $at1->get_answernote());
}
- public function test_trig_1() {
+ public function test_trig_1(): void {
+
$s = 'a:sin[2*x]';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
$this->assertEquals('trigparens', $at1->get_answernote());
}
- public function test_trig_2() {
+ public function test_trig_2(): void {
+
$s = 'a:cot*2*x';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
$this->assertEquals('forbiddenVariable', $at1->get_answernote());
}
- public function test_trig_3() {
+ public function test_trig_3(): void {
+
$s = 'a:tan^-1(x)-1';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
$this->assertEquals('missing_stars | trigexp', $at1->get_answernote());
}
- public function test_trig_4() {
+ public function test_trig_4(): void {
+
$s = 'a:sin^2(x)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
$this->assertEquals('missing_stars | trigexp', $at1->get_answernote());
}
- public function test_trig_5() {
+ public function test_trig_5(): void {
+
$s = 'a:Sim(x)-1';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
$this->assertEquals('forbiddenFunction', $at1->get_answernote());
}
- public function test_trig_6() {
+ public function test_trig_6(): void {
+
$s = 'a:Sin(x)-1';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
$this->assertEquals('unknownFunctionCase', $at1->get_answernote());
}
- public function test_in_1() {
+ public function test_in_1(): void {
+
$s = 'a:1+In(x)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
$this->assertEquals('stackCas_badLogIn', $at1->get_answernote());
}
- public function test_in_2() {
+ public function test_in_2(): void {
+
$s = 'a:1+In(x)';
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
}
- public function test_greek_1() {
+ public function test_greek_1(): void {
+
$s = 'a:Delta-1';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
}
- public function test_greek_2() {
+ public function test_greek_2(): void {
+
$s = 'a:DELTA-1';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
@@ -595,14 +630,16 @@ public function test_greek_2() {
$at1->get_errors());
}
- public function test_unencapsulated_commas_1() {
+ public function test_unencapsulated_commas_1(): void {
+
$s = 'a,b';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertFalse($at1->get_valid());
$this->assertEquals('unencapsulated_comma', $at1->get_answernote());
}
- public function test_forbid_function_single_letter() {
+ public function test_forbid_function_single_letter(): void {
+
$s = 'a:x^2+a+f(x)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -615,7 +652,8 @@ public function test_forbid_function_single_letter() {
$this->assertTrue($at1->get_valid());
}
- public function test_implied_complex_mult1() {
+ public function test_implied_complex_mult1(): void {
+
$s = '-(1/512)+i(sqrt(3)/512)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -623,13 +661,15 @@ public function test_implied_complex_mult1() {
$this->assertEquals('-(1/512)+i*(sqrt(3)/512)', $at1->get_inputform());
}
- public function test_implied_complex_mult2() {
+ public function test_implied_complex_mult2(): void {
+
$s = '-(1/512)+i(sqrt(3)/512)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
}
- public function test_semicolon() {
+ public function test_semicolon(): void {
+
$s = 'a:3;b:4';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
// This is a change in STACK 4.3.
@@ -637,7 +677,8 @@ public function test_semicolon() {
$this->assertEquals('', $at1->get_answernote());
}
- public function test_log_sugar_1() {
+ public function test_log_sugar_1(): void {
+
$s = 'log(x)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -646,7 +687,8 @@ public function test_log_sugar_1() {
$this->assertEquals('log(x)', $at1->get_inputform());
}
- public function test_log_sugar_2() {
+ public function test_log_sugar_2(): void {
+
$s = 'log_10(a+x^2)+log_a(b)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -655,7 +697,8 @@ public function test_log_sugar_2() {
$this->assertEquals('logsubs', $at1->get_answernote());
}
- public function test_log_sugar_3() {
+ public function test_log_sugar_3(): void {
+
// Note that STACK spots there is a missing * here.
// Note that in the new 4.3 world we need to define a filter to note
// the star we do not want to be inserted.
@@ -667,7 +710,8 @@ public function test_log_sugar_3() {
$this->assertEquals('missing_stars | logsubs', $at1->get_answernote());
}
- public function test_log_sugar_4() {
+ public function test_log_sugar_4(): void {
+
// The missing * in this expression is correctly inserted.
$s = 'log_5x(3)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
@@ -677,7 +721,8 @@ public function test_log_sugar_4() {
$this->assertEquals('missing_stars | logsubs', $at1->get_answernote());
}
- public function test_log_sugar_5() {
+ public function test_log_sugar_5(): void {
+
$s = 'log_x^2(3)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -686,7 +731,8 @@ public function test_log_sugar_5() {
$this->assertEquals('missing_stars | logsubs', $at1->get_answernote());
}
- public function test_log_sugar_6() {
+ public function test_log_sugar_6(): void {
+
$s = 'log_%e(%e)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -695,7 +741,8 @@ public function test_log_sugar_6() {
$this->assertEquals('logsubs', $at1->get_answernote());
}
- public function unary_plus() {
+ public function test_unary_plus(): void {
+
// This is an interesting parser edge case.
$s = 'p:+a^b*c';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
@@ -704,14 +751,16 @@ public function unary_plus() {
$this->assertEquals('', $at1->get_answernote());
}
- public function test_chained_inequalities_s() {
+ public function test_chained_inequalities_s(): void {
+
$s = 'sa:3assertFalse($at1->get_valid());
$this->assertEquals('chained_inequalities', $at1->get_answernote());
}
- public function test_chained_inequalities_t() {
+ public function test_chained_inequalities_t(): void {
+
$s = 'f(x) := if x < 0 then (if x < 1 then 1 else 2) else 3';
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -719,7 +768,7 @@ public function test_chained_inequalities_t() {
$this->assertEquals('', $at1->get_answernote());
}
- public function test_decimal_digits() {
+ public function test_decimal_digits(): void {
$tests = stack_numbers_test_data::get_raw_test_data();
@@ -734,7 +783,7 @@ public function test_decimal_digits() {
}
- public function test_decimal_digits_utils() {
+ public function test_decimal_digits_utils(): void {
$tests = stack_numbers_test_data::get_raw_test_data_utils();
@@ -748,7 +797,8 @@ public function test_decimal_digits_utils() {
}
}
- public function test_spaces_1_brackets() {
+ public function test_spaces_1_brackets(): void {
+
$s = 'a (b c)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -758,7 +808,8 @@ public function test_spaces_1_brackets() {
$this->assertEquals('spaces', $at1->get_answernote());
}
- public function test_spaces_1_bracket_brackets() {
+ public function test_spaces_1_bracket_brackets(): void {
+
$s = '(1+c) (x+1)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -768,7 +819,8 @@ public function test_spaces_1_bracket_brackets() {
$this->assertEquals('spaces', $at1->get_answernote());
}
- public function test_spaces_1_logic() {
+ public function test_spaces_1_logic(): void {
+
$s = 'a b and c';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -778,7 +830,8 @@ public function test_spaces_1_logic() {
$this->assertEquals('spaces', $at1->get_answernote());
}
- public function test_remove_add_nouns() {
+ public function test_remove_add_nouns(): void {
+
$s = "['sum(k^2,k,1,n),'product(k^2,k,1,n),a nounand b, noundiff(y,x)+y=0, nounnot false, nounnot(false)]";
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -844,7 +897,8 @@ public function test_remove_add_nouns() {
$at1->get_inputform(true, 2));
}
- public function test_stacklet() {
+ public function test_stacklet(): void {
+
$s = 'stacklet(a,x*%i+y)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
@@ -864,7 +918,8 @@ public function test_stacklet() {
$this->assertEquals('', $at1->get_answernote());
}
- public function test_pm() {
+ public function test_pm(): void {
+
$s = 'a+-b';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -922,7 +977,8 @@ public function test_pm() {
$this->assertEquals('', $at1->get_answernote());
}
- public function test_input_varmatix() {
+ public function test_input_varmatix(): void {
+
$s = 'matrix([a,b],[c,d])';
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
$expected = '([FunctionCall: ([Id] matrix)] ([List] ([Id] a), ([Id] b)),([List] ([Id] c), ([Id] d)))';
@@ -950,7 +1006,8 @@ public function test_input_varmatix() {
['inputform' => true, 'varmatrix' => true]));
}
- public function test_ntuple() {
+ public function test_ntuple(): void {
+
$s = '(x,y)';
$at1 = stack_ast_container::make_from_student_source($s, '', new stack_cas_security());
$this->assertTrue($at1->get_valid());
@@ -1000,7 +1057,8 @@ public function test_ntuple() {
}
- public function test_identify_simplification_modifications() {
+ public function test_identify_simplification_modifications(): void {
+
$t1 = 'foo+bar';
$t1 = stack_ast_container::make_from_teacher_source($t1, '', new stack_cas_security());
$t1 = $t1->identify_simplification_modifications();
@@ -1028,7 +1086,8 @@ public function test_identify_simplification_modifications() {
}
- public function test_teacher_answer_decimals() {
+ public function test_teacher_answer_decimals(): void {
+
// This tests the functions which generate "The teacher's answer is".
$s = '{4.4,4}';
$at1 = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security());
diff --git a/tests/ast_filter_000_099_common_core_auto_generated_test.php b/tests/ast_filter_000_099_common_core_auto_generated_test.php
index 91f7562550c..e91744c40c0 100644
--- a/tests/ast_filter_000_099_common_core_auto_generated_test.php
+++ b/tests/ast_filter_000_099_common_core_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_000_099_common_core
*/
+final class ast_filter_000_099_common_core_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_000_099_common_core_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_filter_pipeline([], [], true);
@@ -174,7 +182,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_filter_pipeline([], [], true);
@@ -315,7 +323,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_filter_pipeline([], [], true);
@@ -1976,7 +1984,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_filter_pipeline([], [], true);
diff --git a/tests/ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test.php b/tests/ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test.php
index 56092223a9c..cc747fc7405 100644
--- a/tests/ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test.php
+++ b/tests/ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_001_fix_call_of_a_group_or_function
*/
+final class ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('001_fix_call_of_a_group_or_function');
@@ -64,7 +72,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('001_fix_call_of_a_group_or_function');
@@ -95,7 +103,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('001_fix_call_of_a_group_or_function');
@@ -1866,7 +1874,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('001_fix_call_of_a_group_or_function');
diff --git a/tests/ast_filter_002_log_candy_auto_generated_test.php b/tests/ast_filter_002_log_candy_auto_generated_test.php
index 981f73c45e4..01341e30dc1 100644
--- a/tests/ast_filter_002_log_candy_auto_generated_test.php
+++ b/tests/ast_filter_002_log_candy_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_002_log_candy
*/
+final class ast_filter_002_log_candy_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_002_log_candy_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('002_log_candy');
@@ -74,7 +82,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('002_log_candy');
@@ -115,7 +123,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('002_log_candy');
@@ -1876,7 +1884,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('002_log_candy');
diff --git a/tests/ast_filter_003_no_dot_dot_auto_generated_test.php b/tests/ast_filter_003_no_dot_dot_auto_generated_test.php
index 474cc135f10..546b8dac864 100644
--- a/tests/ast_filter_003_no_dot_dot_auto_generated_test.php
+++ b/tests/ast_filter_003_no_dot_dot_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_003_no_dot_dot
*/
+final class ast_filter_003_no_dot_dot_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_003_no_dot_dot_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('003_no_dot_dot');
@@ -54,7 +62,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('003_no_dot_dot');
@@ -75,7 +83,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('003_no_dot_dot');
@@ -1856,7 +1864,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('003_no_dot_dot');
diff --git a/tests/ast_filter_005_i_is_never_a_function_auto_generated_test.php b/tests/ast_filter_005_i_is_never_a_function_auto_generated_test.php
index f4bf5bba37f..6f29059cec6 100644
--- a/tests/ast_filter_005_i_is_never_a_function_auto_generated_test.php
+++ b/tests/ast_filter_005_i_is_never_a_function_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_005_i_is_never_a_function
*/
+final class ast_filter_005_i_is_never_a_function_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_005_i_is_never_a_function_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('005_i_is_never_a_function');
@@ -54,7 +62,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('005_i_is_never_a_function');
@@ -75,7 +83,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('005_i_is_never_a_function');
@@ -1856,7 +1864,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('005_i_is_never_a_function');
diff --git a/tests/ast_filter_022_trig_replace_synonyms_auto_generated_test.php b/tests/ast_filter_022_trig_replace_synonyms_auto_generated_test.php
index caf9d89e1d4..649915f7491 100644
--- a/tests/ast_filter_022_trig_replace_synonyms_auto_generated_test.php
+++ b/tests/ast_filter_022_trig_replace_synonyms_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_022_trig_replace_synonyms
*/
+final class ast_filter_022_trig_replace_synonyms_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_022_trig_replace_synonyms_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('022_trig_replace_synonyms');
@@ -44,7 +52,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('022_trig_replace_synonyms');
@@ -55,7 +63,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('022_trig_replace_synonyms');
@@ -1846,7 +1854,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('022_trig_replace_synonyms');
diff --git a/tests/ast_filter_025_no_trig_power_auto_generated_test.php b/tests/ast_filter_025_no_trig_power_auto_generated_test.php
index 5f387ede74e..c83951d21e2 100644
--- a/tests/ast_filter_025_no_trig_power_auto_generated_test.php
+++ b/tests/ast_filter_025_no_trig_power_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_025_no_trig_power
*/
+final class ast_filter_025_no_trig_power_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_025_no_trig_power_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('025_no_trig_power');
@@ -49,7 +57,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('025_no_trig_power');
@@ -65,7 +73,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('025_no_trig_power');
@@ -1851,7 +1859,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('025_no_trig_power');
diff --git a/tests/ast_filter_030_no_trig_space_auto_generated_test.php b/tests/ast_filter_030_no_trig_space_auto_generated_test.php
index 9dc33c49dc9..b0b6eef080c 100644
--- a/tests/ast_filter_030_no_trig_space_auto_generated_test.php
+++ b/tests/ast_filter_030_no_trig_space_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_030_no_trig_space
*/
+final class ast_filter_030_no_trig_space_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_030_no_trig_space_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('030_no_trig_space');
@@ -44,7 +52,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('030_no_trig_space');
@@ -55,7 +63,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('030_no_trig_space');
@@ -1846,7 +1854,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('030_no_trig_space');
diff --git a/tests/ast_filter_031_no_trig_brackets_auto_generated_test.php b/tests/ast_filter_031_no_trig_brackets_auto_generated_test.php
index 3b3f62c3b13..1989b9ff107 100644
--- a/tests/ast_filter_031_no_trig_brackets_auto_generated_test.php
+++ b/tests/ast_filter_031_no_trig_brackets_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_031_no_trig_brackets
*/
+final class ast_filter_031_no_trig_brackets_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_031_no_trig_brackets_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('031_no_trig_brackets');
@@ -44,7 +52,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('031_no_trig_brackets');
@@ -55,7 +63,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('031_no_trig_brackets');
@@ -1846,7 +1854,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('031_no_trig_brackets');
diff --git a/tests/ast_filter_033_no_extra_evaluation_auto_generated_test.php b/tests/ast_filter_033_no_extra_evaluation_auto_generated_test.php
index 8f46b77e05e..7430ff2d91c 100644
--- a/tests/ast_filter_033_no_extra_evaluation_auto_generated_test.php
+++ b/tests/ast_filter_033_no_extra_evaluation_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_033_no_extra_evaluation
*/
+final class ast_filter_033_no_extra_evaluation_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_033_no_extra_evaluation_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('033_no_extra_evaluation');
@@ -44,7 +52,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('033_no_extra_evaluation');
@@ -55,7 +63,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('033_no_extra_evaluation');
@@ -1846,7 +1854,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('033_no_extra_evaluation');
diff --git a/tests/ast_filter_050_no_chained_inequalities_auto_generated_test.php b/tests/ast_filter_050_no_chained_inequalities_auto_generated_test.php
index f422c46237d..771b63a3afe 100644
--- a/tests/ast_filter_050_no_chained_inequalities_auto_generated_test.php
+++ b/tests/ast_filter_050_no_chained_inequalities_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_050_no_chained_inequalities
*/
+final class ast_filter_050_no_chained_inequalities_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_050_no_chained_inequalities_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('050_no_chained_inequalities');
@@ -54,7 +62,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('050_no_chained_inequalities');
@@ -75,7 +83,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('050_no_chained_inequalities');
@@ -1856,7 +1864,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('050_no_chained_inequalities');
diff --git a/tests/ast_filter_090_special_forbidden_characters_auto_generated_test.php b/tests/ast_filter_090_special_forbidden_characters_auto_generated_test.php
index 694b8e7c68e..884c2aaf1d1 100644
--- a/tests/ast_filter_090_special_forbidden_characters_auto_generated_test.php
+++ b/tests/ast_filter_090_special_forbidden_characters_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_090_special_forbidden_characters
*/
+final class ast_filter_090_special_forbidden_characters_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_090_special_forbidden_characters_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('090_special_forbidden_characters');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('090_special_forbidden_characters');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('090_special_forbidden_characters');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('090_special_forbidden_characters');
diff --git a/tests/ast_filter_101_no_floats_auto_generated_test.php b/tests/ast_filter_101_no_floats_auto_generated_test.php
index 9f8386000a1..9757deccc1b 100644
--- a/tests/ast_filter_101_no_floats_auto_generated_test.php
+++ b/tests/ast_filter_101_no_floats_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_101_no_floats
*/
+final class ast_filter_101_no_floats_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_101_no_floats_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('101_no_floats');
@@ -209,7 +217,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('101_no_floats');
@@ -385,7 +393,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('101_no_floats');
@@ -2011,7 +2019,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('101_no_floats');
diff --git a/tests/ast_filter_102_no_strings_auto_generated_test.php b/tests/ast_filter_102_no_strings_auto_generated_test.php
index ce84d135ecd..600c8247c9c 100644
--- a/tests/ast_filter_102_no_strings_auto_generated_test.php
+++ b/tests/ast_filter_102_no_strings_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_102_no_strings
*/
+final class ast_filter_102_no_strings_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_102_no_strings_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('102_no_strings');
@@ -79,7 +87,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('102_no_strings');
@@ -125,7 +133,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('102_no_strings');
@@ -1881,7 +1889,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('102_no_strings');
diff --git a/tests/ast_filter_103_no_lists_auto_generated_test.php b/tests/ast_filter_103_no_lists_auto_generated_test.php
index 21fb8f9eebb..ede7cb56ad2 100644
--- a/tests/ast_filter_103_no_lists_auto_generated_test.php
+++ b/tests/ast_filter_103_no_lists_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_103_no_lists
*/
+final class ast_filter_103_no_lists_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_103_no_lists_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('103_no_lists');
@@ -164,7 +172,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('103_no_lists');
@@ -295,7 +303,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('103_no_lists');
@@ -1966,7 +1974,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('103_no_lists');
diff --git a/tests/ast_filter_104_no_sets_auto_generated_test.php b/tests/ast_filter_104_no_sets_auto_generated_test.php
index 0005891aee4..ea50e1e6e5a 100644
--- a/tests/ast_filter_104_no_sets_auto_generated_test.php
+++ b/tests/ast_filter_104_no_sets_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_104_no_sets
*/
+final class ast_filter_104_no_sets_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_104_no_sets_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('104_no_sets');
@@ -64,7 +72,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('104_no_sets');
@@ -95,7 +103,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('104_no_sets');
@@ -1866,7 +1874,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('104_no_sets');
diff --git a/tests/ast_filter_105_no_grouppings_auto_generated_test.php b/tests/ast_filter_105_no_grouppings_auto_generated_test.php
index 36090f37a04..fe5212cf4c5 100644
--- a/tests/ast_filter_105_no_grouppings_auto_generated_test.php
+++ b/tests/ast_filter_105_no_grouppings_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_105_no_grouppings
*/
+final class ast_filter_105_no_grouppings_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_105_no_grouppings_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('105_no_grouppings');
@@ -249,7 +257,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('105_no_grouppings');
@@ -465,7 +473,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('105_no_grouppings');
@@ -2051,7 +2059,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('105_no_grouppings');
diff --git a/tests/ast_filter_106_no_control_flow_auto_generated_test.php b/tests/ast_filter_106_no_control_flow_auto_generated_test.php
index 9ba79a856ac..d50b350785d 100644
--- a/tests/ast_filter_106_no_control_flow_auto_generated_test.php
+++ b/tests/ast_filter_106_no_control_flow_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_106_no_control_flow
*/
+final class ast_filter_106_no_control_flow_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_106_no_control_flow_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('106_no_control_flow');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('106_no_control_flow');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('106_no_control_flow');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('106_no_control_flow');
diff --git a/tests/ast_filter_120_no_arc_auto_generated_test.php b/tests/ast_filter_120_no_arc_auto_generated_test.php
index bf1ed6d3906..9baaef2f6c3 100644
--- a/tests/ast_filter_120_no_arc_auto_generated_test.php
+++ b/tests/ast_filter_120_no_arc_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_120_no_arc
*/
+final class ast_filter_120_no_arc_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_120_no_arc_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('120_no_arc');
@@ -44,7 +52,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('120_no_arc');
@@ -55,7 +63,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('120_no_arc');
@@ -1846,7 +1854,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('120_no_arc');
diff --git a/tests/ast_filter_150_replace_unicode_letters_auto_generated_test.php b/tests/ast_filter_150_replace_unicode_letters_auto_generated_test.php
index d61b4eb9df5..e6f0e587887 100644
--- a/tests/ast_filter_150_replace_unicode_letters_auto_generated_test.php
+++ b/tests/ast_filter_150_replace_unicode_letters_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_150_replace_unicode_letters
*/
+final class ast_filter_150_replace_unicode_letters_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_150_replace_unicode_letters_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('150_replace_unicode_letters');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('150_replace_unicode_letters');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('150_replace_unicode_letters');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('150_replace_unicode_letters');
diff --git a/tests/ast_filter_180_char_based_superscripts_auto_generated_test.php b/tests/ast_filter_180_char_based_superscripts_auto_generated_test.php
index eb1d59d0f6f..0f37aafc62d 100644
--- a/tests/ast_filter_180_char_based_superscripts_auto_generated_test.php
+++ b/tests/ast_filter_180_char_based_superscripts_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_180_char_based_superscripts
*/
+final class ast_filter_180_char_based_superscripts_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_180_char_based_superscripts_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('180_char_based_superscripts');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('180_char_based_superscripts');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('180_char_based_superscripts');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('180_char_based_superscripts');
diff --git a/tests/ast_filter_201_sig_figs_validation_auto_generated_test.php b/tests/ast_filter_201_sig_figs_validation_auto_generated_test.php
index 182b54dc9c5..62fcf6db4fd 100644
--- a/tests/ast_filter_201_sig_figs_validation_auto_generated_test.php
+++ b/tests/ast_filter_201_sig_figs_validation_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_201_sig_figs_validation
*/
+final class ast_filter_201_sig_figs_validation_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_201_sig_figs_validation_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('201_sig_figs_validation');
@@ -1774,7 +1782,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('201_sig_figs_validation');
@@ -3515,7 +3523,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('201_sig_figs_validation');
@@ -3576,7 +3584,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('201_sig_figs_validation');
diff --git a/tests/ast_filter_202_decimal_places_validation_auto_generated_test.php b/tests/ast_filter_202_decimal_places_validation_auto_generated_test.php
index 74352592e4a..6ef0141caee 100644
--- a/tests/ast_filter_202_decimal_places_validation_auto_generated_test.php
+++ b/tests/ast_filter_202_decimal_places_validation_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_202_decimal_places_validation
*/
+final class ast_filter_202_decimal_places_validation_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_202_decimal_places_validation_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('202_decimal_places_validation');
@@ -1829,7 +1837,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('202_decimal_places_validation');
@@ -3625,13 +3633,13 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('202_decimal_places_validation');
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('202_decimal_places_validation');
diff --git a/tests/ast_filter_210_x_used_as_multiplication_auto_generated_test.php b/tests/ast_filter_210_x_used_as_multiplication_auto_generated_test.php
index 6959eeff623..c987e61e364 100644
--- a/tests/ast_filter_210_x_used_as_multiplication_auto_generated_test.php
+++ b/tests/ast_filter_210_x_used_as_multiplication_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_210_x_used_as_multiplication
*/
+final class ast_filter_210_x_used_as_multiplication_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_210_x_used_as_multiplication_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('210_x_used_as_multiplication');
@@ -74,7 +82,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('210_x_used_as_multiplication');
@@ -115,7 +123,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('210_x_used_as_multiplication');
@@ -1876,7 +1884,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('210_x_used_as_multiplication');
diff --git a/tests/ast_filter_402_split_prefix_from_common_function_name_auto_generated_test.php b/tests/ast_filter_402_split_prefix_from_common_function_name_auto_generated_test.php
index 2610f4bbd52..2d7c39051c8 100644
--- a/tests/ast_filter_402_split_prefix_from_common_function_name_auto_generated_test.php
+++ b/tests/ast_filter_402_split_prefix_from_common_function_name_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_402_split_prefix_from_common_function_name
*/
+final class ast_filter_402_split_prefix_from_common_function_name_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_402_split_prefix_from_common_function_name_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('402_split_prefix_from_common_function_name');
@@ -74,7 +82,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('402_split_prefix_from_common_function_name');
@@ -115,7 +123,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('402_split_prefix_from_common_function_name');
@@ -1876,7 +1884,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('402_split_prefix_from_common_function_name');
diff --git a/tests/ast_filter_403_split_at_number_letter_boundary_auto_generated_test.php b/tests/ast_filter_403_split_at_number_letter_boundary_auto_generated_test.php
index f808764476e..7277d9d6340 100644
--- a/tests/ast_filter_403_split_at_number_letter_boundary_auto_generated_test.php
+++ b/tests/ast_filter_403_split_at_number_letter_boundary_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_403_split_at_number_letter_boundary
*/
+final class ast_filter_403_split_at_number_letter_boundary_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_403_split_at_number_letter_boundary_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('403_split_at_number_letter_boundary');
@@ -54,7 +62,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('403_split_at_number_letter_boundary');
@@ -75,7 +83,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('403_split_at_number_letter_boundary');
@@ -1856,7 +1864,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('403_split_at_number_letter_boundary');
diff --git a/tests/ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test.php b/tests/ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test.php
index 9f48d4e5b68..8a8c018d5bd 100644
--- a/tests/ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test.php
+++ b/tests/ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_404_split_at_number_letter_number_boundary
*/
+final class ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('404_split_at_number_letter_number_boundary');
@@ -79,7 +87,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('404_split_at_number_letter_number_boundary');
@@ -125,7 +133,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('404_split_at_number_letter_number_boundary');
@@ -1881,7 +1889,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('404_split_at_number_letter_number_boundary');
diff --git a/tests/ast_filter_406_split_implied_variable_names_auto_generated_test.php b/tests/ast_filter_406_split_implied_variable_names_auto_generated_test.php
index 8a4d483f5cb..2c05ea7f609 100644
--- a/tests/ast_filter_406_split_implied_variable_names_auto_generated_test.php
+++ b/tests/ast_filter_406_split_implied_variable_names_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_406_split_implied_variable_names
*/
+final class ast_filter_406_split_implied_variable_names_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_406_split_implied_variable_names_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('406_split_implied_variable_names');
@@ -84,7 +92,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('406_split_implied_variable_names');
@@ -135,7 +143,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('406_split_implied_variable_names');
@@ -1886,7 +1894,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('406_split_implied_variable_names');
diff --git a/tests/ast_filter_410_single_char_vars_auto_generated_test.php b/tests/ast_filter_410_single_char_vars_auto_generated_test.php
index b0e5a575024..2ee5c28e403 100644
--- a/tests/ast_filter_410_single_char_vars_auto_generated_test.php
+++ b/tests/ast_filter_410_single_char_vars_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_410_single_char_vars
*/
+final class ast_filter_410_single_char_vars_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_410_single_char_vars_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('410_single_char_vars');
@@ -159,7 +167,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('410_single_char_vars');
@@ -285,7 +293,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('410_single_char_vars');
@@ -1961,7 +1969,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('410_single_char_vars');
diff --git a/tests/ast_filter_420_consolidate_subscripts_auto_generated_test.php b/tests/ast_filter_420_consolidate_subscripts_auto_generated_test.php
index 20e29e5c587..75b7e2ad301 100644
--- a/tests/ast_filter_420_consolidate_subscripts_auto_generated_test.php
+++ b/tests/ast_filter_420_consolidate_subscripts_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_420_consolidate_subscripts
*/
+final class ast_filter_420_consolidate_subscripts_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_420_consolidate_subscripts_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('420_consolidate_subscripts');
@@ -69,7 +77,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('420_consolidate_subscripts');
@@ -105,7 +113,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('420_consolidate_subscripts');
@@ -1871,7 +1879,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('420_consolidate_subscripts');
diff --git a/tests/ast_filter_441_split_unknown_functions_auto_generated_test.php b/tests/ast_filter_441_split_unknown_functions_auto_generated_test.php
index 41f1652e364..f718ef44b7f 100644
--- a/tests/ast_filter_441_split_unknown_functions_auto_generated_test.php
+++ b/tests/ast_filter_441_split_unknown_functions_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_441_split_unknown_functions
*/
+final class ast_filter_441_split_unknown_functions_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_441_split_unknown_functions_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('441_split_unknown_functions');
@@ -269,7 +277,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('441_split_unknown_functions');
@@ -505,7 +513,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('441_split_unknown_functions');
@@ -2071,7 +2079,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('441_split_unknown_functions');
diff --git a/tests/ast_filter_442_split_all_functions_auto_generated_test.php b/tests/ast_filter_442_split_all_functions_auto_generated_test.php
index e0f3a162ce0..00c8ed46400 100644
--- a/tests/ast_filter_442_split_all_functions_auto_generated_test.php
+++ b/tests/ast_filter_442_split_all_functions_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_442_split_all_functions
*/
+final class ast_filter_442_split_all_functions_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_442_split_all_functions_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('442_split_all_functions');
@@ -579,7 +587,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('442_split_all_functions');
@@ -1125,7 +1133,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('442_split_all_functions');
@@ -2381,7 +2389,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('442_split_all_functions');
diff --git a/tests/ast_filter_450_split_floats_auto_generated_test.php b/tests/ast_filter_450_split_floats_auto_generated_test.php
index 08eb63abb43..590640fee90 100644
--- a/tests/ast_filter_450_split_floats_auto_generated_test.php
+++ b/tests/ast_filter_450_split_floats_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_450_split_floats
*/
+final class ast_filter_450_split_floats_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_450_split_floats_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('450_split_floats');
@@ -74,7 +82,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('450_split_floats');
@@ -115,7 +123,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('450_split_floats');
@@ -1876,7 +1884,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('450_split_floats');
diff --git a/tests/ast_filter_502_replace_pm_auto_generated_test.php b/tests/ast_filter_502_replace_pm_auto_generated_test.php
index 454dece7029..4b337ea0d70 100644
--- a/tests/ast_filter_502_replace_pm_auto_generated_test.php
+++ b/tests/ast_filter_502_replace_pm_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_502_replace_pm
*/
+final class ast_filter_502_replace_pm_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_502_replace_pm_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('502_replace_pm');
@@ -59,7 +67,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('502_replace_pm');
@@ -85,7 +93,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('502_replace_pm');
@@ -1861,7 +1869,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('502_replace_pm');
diff --git a/tests/ast_filter_504_insert_tuples_for_groups_auto_generated_test.php b/tests/ast_filter_504_insert_tuples_for_groups_auto_generated_test.php
index 6f48dd80e09..b3fa88fb67b 100644
--- a/tests/ast_filter_504_insert_tuples_for_groups_auto_generated_test.php
+++ b/tests/ast_filter_504_insert_tuples_for_groups_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_504_insert_tuples_for_groups
*/
+final class ast_filter_504_insert_tuples_for_groups_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_504_insert_tuples_for_groups_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('504_insert_tuples_for_groups');
@@ -59,7 +67,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('504_insert_tuples_for_groups');
@@ -85,7 +93,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('504_insert_tuples_for_groups');
@@ -1861,7 +1869,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('504_insert_tuples_for_groups');
diff --git a/tests/ast_filter_505_no_evaluation_groups_auto_generated_test.php b/tests/ast_filter_505_no_evaluation_groups_auto_generated_test.php
index 72b46264b12..1c6effe5f5c 100644
--- a/tests/ast_filter_505_no_evaluation_groups_auto_generated_test.php
+++ b/tests/ast_filter_505_no_evaluation_groups_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_505_no_evaluation_groups
*/
+final class ast_filter_505_no_evaluation_groups_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_505_no_evaluation_groups_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('505_no_evaluation_groups');
@@ -59,7 +67,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('505_no_evaluation_groups');
@@ -85,7 +93,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('505_no_evaluation_groups');
@@ -1861,7 +1869,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('505_no_evaluation_groups');
diff --git a/tests/ast_filter_520_no_equality_with_logic_auto_generated_test.php b/tests/ast_filter_520_no_equality_with_logic_auto_generated_test.php
index 58240041995..5c0be364130 100644
--- a/tests/ast_filter_520_no_equality_with_logic_auto_generated_test.php
+++ b/tests/ast_filter_520_no_equality_with_logic_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_520_no_equality_with_logic
*/
+final class ast_filter_520_no_equality_with_logic_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_520_no_equality_with_logic_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('520_no_equality_with_logic');
@@ -49,7 +57,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('520_no_equality_with_logic');
@@ -65,7 +73,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('520_no_equality_with_logic');
@@ -1851,7 +1859,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('520_no_equality_with_logic');
diff --git a/tests/ast_filter_541_no_unknown_functions_auto_generated_test.php b/tests/ast_filter_541_no_unknown_functions_auto_generated_test.php
index 2d5382250dc..f5fa0f90dda 100644
--- a/tests/ast_filter_541_no_unknown_functions_auto_generated_test.php
+++ b/tests/ast_filter_541_no_unknown_functions_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_541_no_unknown_functions
*/
+final class ast_filter_541_no_unknown_functions_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_541_no_unknown_functions_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('541_no_unknown_functions');
@@ -294,7 +302,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('541_no_unknown_functions');
@@ -555,7 +563,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('541_no_unknown_functions');
@@ -2096,7 +2104,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('541_no_unknown_functions');
diff --git a/tests/ast_filter_542_no_functions_at_all_auto_generated_test.php b/tests/ast_filter_542_no_functions_at_all_auto_generated_test.php
index 42247ef834f..ed137c7621f 100644
--- a/tests/ast_filter_542_no_functions_at_all_auto_generated_test.php
+++ b/tests/ast_filter_542_no_functions_at_all_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_542_no_functions_at_all
*/
+final class ast_filter_542_no_functions_at_all_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_542_no_functions_at_all_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('542_no_functions_at_all');
@@ -589,7 +597,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('542_no_functions_at_all');
@@ -1145,7 +1153,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('542_no_functions_at_all');
@@ -2391,7 +2399,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('542_no_functions_at_all');
diff --git a/tests/ast_filter_601_castext_auto_generated_test.php b/tests/ast_filter_601_castext_auto_generated_test.php
index 5e49ae7d943..c87e8859169 100644
--- a/tests/ast_filter_601_castext_auto_generated_test.php
+++ b/tests/ast_filter_601_castext_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_601_castext
*/
+final class ast_filter_601_castext_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_601_castext_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('601_castext');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('601_castext');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('601_castext');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('601_castext');
diff --git a/tests/ast_filter_602_castext_simplifier_auto_generated_test.php b/tests/ast_filter_602_castext_simplifier_auto_generated_test.php
index bf8394e531d..a94bdea061f 100644
--- a/tests/ast_filter_602_castext_simplifier_auto_generated_test.php
+++ b/tests/ast_filter_602_castext_simplifier_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_602_castext_simplifier
*/
+final class ast_filter_602_castext_simplifier_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_602_castext_simplifier_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('602_castext_simplifier');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('602_castext_simplifier');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('602_castext_simplifier');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('602_castext_simplifier');
diff --git a/tests/ast_filter_610_castext_static_string_extractor_auto_generated_test.php b/tests/ast_filter_610_castext_static_string_extractor_auto_generated_test.php
index 96f636bbfce..42828613b17 100644
--- a/tests/ast_filter_610_castext_static_string_extractor_auto_generated_test.php
+++ b/tests/ast_filter_610_castext_static_string_extractor_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_610_castext_static_string_extractor
*/
+final class ast_filter_610_castext_static_string_extractor_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_610_castext_static_string_extractor_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('610_castext_static_string_extractor');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('610_castext_static_string_extractor');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('610_castext_static_string_extractor');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('610_castext_static_string_extractor');
diff --git a/tests/ast_filter_650_string_protect_slash_auto_generated_test.php b/tests/ast_filter_650_string_protect_slash_auto_generated_test.php
index b76b9bfb334..119dd6ffc64 100644
--- a/tests/ast_filter_650_string_protect_slash_auto_generated_test.php
+++ b/tests/ast_filter_650_string_protect_slash_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_650_string_protect_slash
*/
+final class ast_filter_650_string_protect_slash_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_650_string_protect_slash_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('650_string_protect_slash');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('650_string_protect_slash');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('650_string_protect_slash');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('650_string_protect_slash');
diff --git a/tests/ast_filter_680_gcl_sconcat_auto_generated_test.php b/tests/ast_filter_680_gcl_sconcat_auto_generated_test.php
index 5db5423f445..12a28a1a3c9 100644
--- a/tests/ast_filter_680_gcl_sconcat_auto_generated_test.php
+++ b/tests/ast_filter_680_gcl_sconcat_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_680_gcl_sconcat
*/
+final class ast_filter_680_gcl_sconcat_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_680_gcl_sconcat_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('680_gcl_sconcat');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('680_gcl_sconcat');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('680_gcl_sconcat');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('680_gcl_sconcat');
diff --git a/tests/ast_filter_801_singleton_numeric_auto_generated_test.php b/tests/ast_filter_801_singleton_numeric_auto_generated_test.php
index 2c04a110482..1c41499d0e4 100644
--- a/tests/ast_filter_801_singleton_numeric_auto_generated_test.php
+++ b/tests/ast_filter_801_singleton_numeric_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_801_singleton_numeric
*/
+final class ast_filter_801_singleton_numeric_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_801_singleton_numeric_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('801_singleton_numeric');
@@ -1759,7 +1767,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('801_singleton_numeric');
@@ -3485,7 +3493,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('801_singleton_numeric');
@@ -3561,7 +3569,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('801_singleton_numeric');
diff --git a/tests/ast_filter_802_singleton_units_auto_generated_test.php b/tests/ast_filter_802_singleton_units_auto_generated_test.php
index 7fc077a637e..8dc23e3aa50 100644
--- a/tests/ast_filter_802_singleton_units_auto_generated_test.php
+++ b/tests/ast_filter_802_singleton_units_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_802_singleton_units
*/
+final class ast_filter_802_singleton_units_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_802_singleton_units_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('802_singleton_units');
@@ -1814,7 +1822,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('802_singleton_units');
@@ -3595,7 +3603,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('802_singleton_units');
@@ -3616,7 +3624,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('802_singleton_units');
diff --git a/tests/ast_filter_901_remove_comments_auto_generated_test.php b/tests/ast_filter_901_remove_comments_auto_generated_test.php
index 008f481703b..04b3ceeb93d 100644
--- a/tests/ast_filter_901_remove_comments_auto_generated_test.php
+++ b/tests/ast_filter_901_remove_comments_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_901_remove_comments
*/
+final class ast_filter_901_remove_comments_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_901_remove_comments_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('901_remove_comments');
@@ -64,7 +72,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('901_remove_comments');
@@ -95,7 +103,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('901_remove_comments');
@@ -1866,7 +1874,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('901_remove_comments');
diff --git a/tests/ast_filter_909_parsons_decode_state_for_display_auto_generated_test.php b/tests/ast_filter_909_parsons_decode_state_for_display_auto_generated_test.php
index 256d36a2b1b..def172e8cc3 100644
--- a/tests/ast_filter_909_parsons_decode_state_for_display_auto_generated_test.php
+++ b/tests/ast_filter_909_parsons_decode_state_for_display_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_909_parsons_decode_state_for_display
*/
+final class ast_filter_909_parsons_decode_state_for_display_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_909_parsons_decode_state_for_display_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('909_parsons_decode_state_for_display');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('909_parsons_decode_state_for_display');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('909_parsons_decode_state_for_display');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('909_parsons_decode_state_for_display');
diff --git a/tests/ast_filter_910_inert_float_for_display_auto_generated_test.php b/tests/ast_filter_910_inert_float_for_display_auto_generated_test.php
index 08db531b3ca..e563ca6e460 100644
--- a/tests/ast_filter_910_inert_float_for_display_auto_generated_test.php
+++ b/tests/ast_filter_910_inert_float_for_display_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_910_inert_float_for_display
*/
+final class ast_filter_910_inert_float_for_display_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_910_inert_float_for_display_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('910_inert_float_for_display');
@@ -209,7 +217,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('910_inert_float_for_display');
@@ -385,7 +393,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('910_inert_float_for_display');
@@ -2011,7 +2019,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('910_inert_float_for_display');
diff --git a/tests/ast_filter_912_inert_string_for_display_auto_generated_test.php b/tests/ast_filter_912_inert_string_for_display_auto_generated_test.php
index 3d8a958fcbd..4bf97de6d83 100644
--- a/tests/ast_filter_912_inert_string_for_display_auto_generated_test.php
+++ b/tests/ast_filter_912_inert_string_for_display_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_912_inert_string_for_display
*/
+final class ast_filter_912_inert_string_for_display_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_912_inert_string_for_display_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('912_inert_string_for_display');
@@ -44,7 +52,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('912_inert_string_for_display');
@@ -55,7 +63,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('912_inert_string_for_display');
@@ -1846,7 +1854,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('912_inert_string_for_display');
diff --git a/tests/ast_filter_990_no_fixing_spaces_auto_generated_test.php b/tests/ast_filter_990_no_fixing_spaces_auto_generated_test.php
index 00b612446ee..958ea96fc8c 100644
--- a/tests/ast_filter_990_no_fixing_spaces_auto_generated_test.php
+++ b/tests/ast_filter_990_no_fixing_spaces_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_990_no_fixing_spaces
*/
+final class ast_filter_990_no_fixing_spaces_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_990_no_fixing_spaces_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('990_no_fixing_spaces');
@@ -124,7 +132,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('990_no_fixing_spaces');
@@ -215,7 +223,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('990_no_fixing_spaces');
@@ -1926,7 +1934,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('990_no_fixing_spaces');
diff --git a/tests/ast_filter_991_no_fixing_stars_auto_generated_test.php b/tests/ast_filter_991_no_fixing_stars_auto_generated_test.php
index c068d7a6655..fdabfb92eeb 100644
--- a/tests/ast_filter_991_no_fixing_stars_auto_generated_test.php
+++ b/tests/ast_filter_991_no_fixing_stars_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_991_no_fixing_stars
*/
+final class ast_filter_991_no_fixing_stars_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_991_no_fixing_stars_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('991_no_fixing_stars');
@@ -154,7 +162,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('991_no_fixing_stars');
@@ -275,7 +283,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('991_no_fixing_stars');
@@ -1956,7 +1964,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('991_no_fixing_stars');
diff --git a/tests/ast_filter_995_ev_modification_auto_generated_test.php b/tests/ast_filter_995_ev_modification_auto_generated_test.php
index a850d23e4df..dd2b6f66997 100644
--- a/tests/ast_filter_995_ev_modification_auto_generated_test.php
+++ b/tests/ast_filter_995_ev_modification_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,28 +32,28 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_995_ev_modification
*/
+final class ast_filter_995_ev_modification_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_995_ev_modification_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('995_ev_modification');
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('995_ev_modification');
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('995_ev_modification');
@@ -1841,7 +1849,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('995_ev_modification');
diff --git a/tests/ast_filter_996_call_modification_auto_generated_test.php b/tests/ast_filter_996_call_modification_auto_generated_test.php
index 11567d5f8e3..e651165a739 100644
--- a/tests/ast_filter_996_call_modification_auto_generated_test.php
+++ b/tests/ast_filter_996_call_modification_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_996_call_modification
*/
+final class ast_filter_996_call_modification_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_996_call_modification_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('996_call_modification');
@@ -579,7 +587,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('996_call_modification');
@@ -1125,7 +1133,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('996_call_modification');
@@ -2381,7 +2389,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('996_call_modification');
diff --git a/tests/ast_filter_997_string_security_auto_generated_test.php b/tests/ast_filter_997_string_security_auto_generated_test.php
index f1091865e27..d6d9f7577fa 100644
--- a/tests/ast_filter_997_string_security_auto_generated_test.php
+++ b/tests/ast_filter_997_string_security_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_997_string_security
*/
+final class ast_filter_997_string_security_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_997_string_security_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('997_string_security');
@@ -44,7 +52,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('997_string_security');
@@ -55,7 +63,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('997_string_security');
@@ -1846,7 +1854,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('997_string_security');
diff --git a/tests/ast_filter_998_security_auto_generated_test.php b/tests/ast_filter_998_security_auto_generated_test.php
index 43fcb9e9afc..ad9b5a35351 100644
--- a/tests/ast_filter_998_security_auto_generated_test.php
+++ b/tests/ast_filter_998_security_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_998_security
*/
+final class ast_filter_998_security_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_998_security_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('998_security');
@@ -274,7 +282,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('998_security');
@@ -670,7 +678,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('998_security');
@@ -2076,7 +2084,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('998_security');
diff --git a/tests/ast_filter_999_strict_auto_generated_test.php b/tests/ast_filter_999_strict_auto_generated_test.php
index 49e23d6cc9d..deaeeebbda4 100644
--- a/tests/ast_filter_999_strict_auto_generated_test.php
+++ b/tests/ast_filter_999_strict_auto_generated_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_ast_testcase;
@@ -24,16 +32,16 @@
require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php');
-// Auto-generated unit tests for AST-filter DO NOT EDIT!
/**
+ * Auto-generated unit tests for AST-filter DO NOT EDIT!
+ *
* @group qtype_stack
* @group qtype_stack_ast_filters
* @covers \ast_filter_999_strict
*/
+final class ast_filter_999_strict_auto_generated_test extends qtype_stack_ast_testcase {
-class ast_filter_999_strict_auto_generated_test extends qtype_stack_ast_testcase {
-
- public function test_affected_no_units() {
+ public function test_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('999_strict');
@@ -229,7 +237,7 @@ public function test_affected_no_units() {
}
- public function test_affected_units() {
+ public function test_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('999_strict');
@@ -425,7 +433,7 @@ public function test_affected_units() {
}
- public function test_non_affected_units() {
+ public function test_non_affected_units(): void {
$this->security = new stack_cas_security(true);
$this->filter = stack_parsing_rule_factory::get_by_common_name('999_strict');
@@ -2031,7 +2039,7 @@ public function test_non_affected_units() {
}
- public function test_non_affected_no_units() {
+ public function test_non_affected_no_units(): void {
$this->security = new stack_cas_security(false);
$this->filter = stack_parsing_rule_factory::get_by_common_name('999_strict');
diff --git a/tests/caskeyval_exception_test.php b/tests/caskeyval_exception_test.php
index fc12f609d98..58a3eea0280 100644
--- a/tests/caskeyval_exception_test.php
+++ b/tests/caskeyval_exception_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_testcase;
@@ -30,43 +37,51 @@
// Unit tests for {@link stack_cas_keyval} involving exceptions.
/**
+ * Add description
* @group qtype_stack
* @covers \stack_cas_keyval
*/
-class caskeyval_exception_test extends qtype_stack_testcase {
+final class caskeyval_exception_test extends qtype_stack_testcase {
+
+ public function test_exception_1(): void {
- public function test_exception_1() {
$this->expectException(stack_exception::class);
$at1 = new stack_cas_keyval([], false, false);
}
- public function test_exception_2() {
+ public function test_exception_2(): void {
+
$this->expectException(stack_exception::class);
$at1 = new stack_cas_keyval(1, false, false);
}
- public function test_exception_3() {
+ public function test_exception_3(): void {
+
$this->expectException(stack_exception::class);
$at1 = new stack_cas_keyval('x=1', false, false);
}
- public function test_exception_4() {
+ public function test_exception_4(): void {
+
$this->expectException(stack_exception::class);
$at1 = new stack_cas_keyval('x=1', null, false);
}
- public function test_exception_5() {
+ public function test_exception_5(): void {
+
$this->expectException(stack_exception::class);
$at1 = new stack_cas_keyval('x=1', 'z', false);
}
- public function test_exception_7() {
+ public function test_exception_7(): void {
+
$this->expectException(stack_exception::class);
$at1 = new stack_cas_keyval('x=1', 't', false);
}
- public function test_stack_compile_unexpected_lambda() {
+ public function test_stack_compile_unexpected_lambda(): void {
+
$this->expectException(stack_exception::class);
// This is related to issue #1279.
$tests = 'a:b+1; c:a-a(d+1);';
diff --git a/tests/caskeyval_test.php b/tests/caskeyval_test.php
index 5b3c9ff6942..4a9d4ec860b 100644
--- a/tests/caskeyval_test.php
+++ b/tests/caskeyval_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_testcase;
@@ -32,11 +39,13 @@
// Unit tests for {@link stack_cas_keyval}.
/**
+ * Add description.
* @group qtype_stack
* @covers \stack_cas_keyval
*/
-class caskeyval_test extends qtype_stack_testcase {
+final class caskeyval_test extends qtype_stack_testcase {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
public function get_valid($s, $val, $session) {
$kv = new stack_cas_keyval($s, null, 123);
$kv->instantiate();
@@ -49,7 +58,7 @@ public function get_valid($s, $val, $session) {
$kv->get_session()->get_keyval_representation());
}
- public function test_get_valid() {
+ public function test_get_valid(): void {
$cs0 = new stack_cas_session2([], null, 123);
$cs0->instantiate();
@@ -90,7 +99,8 @@ public function test_get_valid() {
}
}
- public function test_empty_case_1() {
+ public function test_empty_case_1(): void {
+
$at1 = new stack_cas_keyval('', null, 123);
$this->assertTrue($at1->get_valid());
}
@@ -98,7 +108,9 @@ public function test_empty_case_1() {
// Now here we have a problem, keyvals do not generate output values
// they just load stuff to the session, therefore you cannot get
// the instantiated values.
- public function test_equations_1() {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public function test_equations_1(): void {
+
$at1 = new stack_cas_keyval('ta1 : x=1; ta2 : x^2-2*x=1; ta3:x=1 nounor x=2', null, 123);
$at1->instantiate();
$s = $at1->get_session();
@@ -108,7 +120,8 @@ public function test_equations_1() {
$this->assertEquals($s->get_by_key('ta3')->get_evaluationform(), 'ta3:x = 1 nounor x = 2');
}
- public function test_equations_2() {
+ public function test_equations_2(): void {
+
$at1 = new stack_cas_keyval('ta1 : x=1$ ta2 : x^2-2*x=1$ ta3:x=1 nounor x=2', null, 123);
$at1->instantiate();
$s = $at1->get_session();
@@ -118,7 +131,8 @@ public function test_equations_2() {
$this->assertEquals($s->get_by_key('ta3')->get_evaluationform(), 'ta3:x = 1 nounor x = 2');
}
- public function test_keyval_session_keyval_0() {
+ public function test_keyval_session_keyval_0(): void {
+
$kvin = "";
$at1 = new stack_cas_keyval($kvin, null, 123);
$session = $at1->get_session();
@@ -126,7 +140,8 @@ public function test_keyval_session_keyval_0() {
$this->assertEquals($kvin, $kvout);
}
- public function test_keyval_session_keyval_1() {
+ public function test_keyval_session_keyval_1(): void {
+
$kvin = "a:1;\nc:3;";
$at1 = new stack_cas_keyval($kvin, null, 123);
$session = $at1->get_session();
@@ -134,7 +149,8 @@ public function test_keyval_session_keyval_1() {
$this->assertEquals($kvin, $kvout);
}
- public function test_keyval_session_keyval_2() {
+ public function test_keyval_session_keyval_2(): void {
+
// Equation and function.
$kvin = "ans1:x^2-2*x = 1;\nf(x):=x^2;\nsin(x^3);";
$at1 = new stack_cas_keyval($kvin, null, 123);
@@ -143,7 +159,8 @@ public function test_keyval_session_keyval_2() {
$this->assertEquals($kvin, $kvout);
}
- public function test_basic_logic() {
+ public function test_basic_logic(): void {
+
$tests = "t1: is(1>0);
t2: t1 and true;
t3: true or true;
@@ -164,13 +181,15 @@ public function test_basic_logic() {
}
}
- public function test_keyval_input_capture() {
+ public function test_keyval_input_capture(): void {
+
$s = 'a:x^2; ans1:a+1; ta:a^2';
$kv = new stack_cas_keyval($s, null, 123);
$this->assertFalse($kv->get_valid(['ans1']));
}
- public function test_remove_comment() {
+ public function test_remove_comment(): void {
+
$at1 = new stack_cas_keyval("a:1\n /* This is a comment \n b:2\n */\n c:3^2", null, 123);
$this->assertTrue($at1->get_valid());
$at1->instantiate();
@@ -186,13 +205,15 @@ public function test_remove_comment() {
}
}
- public function test_remove_comment_hanging() {
+ public function test_remove_comment_hanging(): void {
+
$at1 = new stack_cas_keyval("a:1\n /* This is an open comment \n b:2\n \n c:3^2", null, 123);
$this->assertFalse($at1->get_valid());
$at1->instantiate();
}
- public function test_multiline_input() {
+ public function test_multiline_input(): void {
+
$tests = "n:3;\nif is(n=3) then (\nk1:1,\nk2:2\n) else (\nk1:3,\nk2:4\n);\na:k2^2;";
$kv = new stack_cas_keyval($tests);
@@ -206,7 +227,8 @@ public function test_multiline_input() {
$this->assertEquals($expected, $s->get_keyval_representation(true));
}
- public function test_brackets_in_strings() {
+ public function test_brackets_in_strings(): void {
+
$tests = "k1:4^2;\nprefix:\"[\";\nsuffix:\"]\";";
$kv = new stack_cas_keyval($tests);
@@ -220,7 +242,8 @@ public function test_brackets_in_strings() {
$this->assertEquals($expected, $s->get_keyval_representation(true));
}
- public function test_ampersand_in_strings() {
+ public function test_ampersand_in_strings(): void {
+
$tests = 'k1:"~@r";n1:2*4;';
$kv = new stack_cas_keyval($tests);
@@ -234,7 +257,8 @@ public function test_ampersand_in_strings() {
$this->assertEquals($expected, $s->get_keyval_representation(true));
}
- public function test_ampersand_outside_strings() {
+ public function test_ampersand_outside_strings(): void {
+
$tests = 'k1:u@x;n1:2*4;';
$kv = new stack_cas_keyval($tests);
@@ -243,7 +267,7 @@ public function test_ampersand_outside_strings() {
$this->assertEquals($expected, $kv->get_errors());
}
- public function test_needs_mbstring() {
+ public function test_needs_mbstring(): void {
$tests = "x : rand([1,2,3])\ny : rand([2,3,4])\nA : matrix([x,2,1],[3,4,2],[1,y,5])\n" .
"R : get_lu_factors(lu_factor(A))\nL : R[2]\nU : R[3]\n\n/* Help for worked solutions */\n" .
@@ -268,7 +292,8 @@ public function test_needs_mbstring() {
$this->assertEquals($expected, $s->get_keyval_representation());
}
- public function test_usage() {
+ public function test_usage(): void {
+
// Notes, for global variable usage:
// The ev case where both : and = work as the definition of values.
// The block case where some variables may be listed as locals.
@@ -297,7 +322,8 @@ public function test_usage() {
$this->assertTrue(isset($usage['write']['V']));
}
- public function test_unclear_subs() {
+ public function test_unclear_subs(): void {
+
$tests = 'v:2;trig:[sin,cos][v];sub:[(sin(x))^2=1-(cos(x))^2,(cos(x))^2=1-(sin(x))^2][v];f:(trig(x))^n;'
. 'df:diff(f,x);df_simp:(subst(sub,df));ta1:expand(df_simp);';
@@ -319,7 +345,8 @@ public function test_unclear_subs() {
$this->assertEquals($expected, $s->get_keyval_representation());
}
- public function test_stack_seed_redef() {
+ public function test_stack_seed_redef(): void {
+
$tests = 'v:2;stack_seed:2';
$kv = new stack_cas_keyval($tests);
$this->assertFalse($kv->get_valid());
@@ -330,7 +357,8 @@ public function test_stack_seed_redef() {
$this->assertEquals($expected, $kv->get_errors());
}
- public function test_stack_compile() {
+ public function test_stack_compile(): void {
+
$tests = 'stack_reset_vars(true);ordergreat(i,j,k);p:matrix([-7],[2],[-3]);' .
'q:matrix([i],[j],[k]);v:dotproduct(p,q);';
$kv = new stack_cas_keyval($tests);
@@ -348,7 +376,8 @@ public function test_stack_compile() {
$this->assertEquals($expected, $compiled['contextvariables']);
}
- public function test_stack_compile_preamble_end1() {
+ public function test_stack_compile_preamble_end1(): void {
+
$tests = 'stack_reset_vars(true);n1:1;ordergreat(i,j,k);%_stack_preamble_end;' .
'p:matrix([-7],[2],[-3]);' .
'q:matrix([i],[j],[k]);v:dotproduct(p,q);';
@@ -367,7 +396,8 @@ public function test_stack_compile_preamble_end1() {
$this->assertEquals($expected, $compiled['contextvariables']);
}
- public function test_stack_compile_unexpected_lambda() {
+ public function test_stack_compile_unexpected_lambda(): void {
+
// This is related to issue #1279.
$tests = 'c:(b+1)-(b+1)(d+1);';
$kv = new stack_cas_keyval($tests);
@@ -378,7 +408,8 @@ public function test_stack_compile_unexpected_lambda() {
$this->assertEquals($expected, $kv->get_errors());
}
- public function test_stack_add_slash() {
+ public function test_stack_add_slash(): void {
+
// This is related to issue #1279.
$tests = 's1:"String with LaTeX: \(x^2\).";';
$kv = new stack_cas_keyval($tests, null, 0, '', true);
diff --git a/tests/cassession2_exception_test.php b/tests/cassession2_exception_test.php
index 35df658d293..de155b976a8 100644
--- a/tests/cassession2_exception_test.php
+++ b/tests/cassession2_exception_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use TypeError;
@@ -31,33 +38,39 @@
// Unit tests for {@link stack_cas_session} that involve exceptions.
/**
+ * Add description
* @group qtype_stack
* @covers \stack_cas_session2
*/
-class cassession2_exception_test extends qtype_stack_testcase {
+final class cassession2_exception_test extends qtype_stack_testcase {
+
+ public function test_exception_1(): void {
- public function test_exception_1() {
$this->expectException(TypeError::class);
$at1 = new stack_cas_session2("x=1", false, false);
}
- public function test_exception_2() {
+ public function test_exception_2(): void {
+
$this->expectException(stack_exception::class);
$at1 = new stack_cas_session2([], null, false);
$at1->get_valid();
}
- public function test_exception_3() {
+ public function test_exception_3(): void {
+
$this->expectException(stack_exception::class);
$at1 = new stack_cas_session2([1, 2, 3], null, false);
}
- public function test_exception_4() {
+ public function test_exception_4(): void {
+
$this->expectException(TypeError::class);
$at1 = new stack_cas_session2(null, 123, false);
}
- public function test_exception_5() {
+ public function test_exception_5(): void {
+
$pref = new stack_options();
$this->expectException(TypeError::class);
$at1 = new stack_cas_session2(null, $pref, 'abc');
diff --git a/tests/cassession2_test.php b/tests/cassession2_test.php
index 0481d095cc2..89531ddb378 100644
--- a/tests/cassession2_test.php
+++ b/tests/cassession2_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_testcase;
@@ -36,12 +43,14 @@
require_once(__DIR__ . '/../stack/cas/ast.container.class.php');
/**
+ * Add description
* @group qtype_stack
* @covers \stack_cas_session2
*/
-class cassession2_test extends qtype_stack_testcase {
+final class cassession2_test extends qtype_stack_testcase {
+
+ public function test_internal_config(): void {
- public function test_internal_config() {
// This test checks if the version number returned by Maxima matches our internal config.
$cs = ['m:MAXIMA_VERSION_NUM'];
foreach ($cs as $s) {
@@ -56,7 +65,8 @@ public function test_internal_config() {
$this->assertEquals($maximaconfig, $maximaversion);
}
- public function test_get_valid() {
+ public function test_get_valid(): void {
+
$strings = ['foo', 'bar', 'sqrt(4)'];
$casstrings = [];
@@ -71,7 +81,8 @@ public function test_get_valid() {
$this->assertTrue($session->get_valid());
}
- public function test_get_valid_false() {
+ public function test_get_valid_false(): void {
+
$strings = ['foo', 'bar', 'system(4)'];
$casstrings = [];
@@ -86,7 +97,8 @@ public function test_get_valid_false() {
$this->assertFalse($session->get_valid());
}
- public function test_instantiation_and_return_values() {
+ public function test_instantiation_and_return_values(): void {
+
$strings = [
'1+2' => '3',
'sqrt(4)' => '2',
@@ -114,7 +126,8 @@ public function test_instantiation_and_return_values() {
}
}
- public function test_keys_or_not() {
+ public function test_keys_or_not(): void {
+
// Keys are optional in the new cassession, we can extract the values
// if need be even if keys do not exist, and if you do an assignement
// it wont be visible in the return values anyway.
@@ -145,7 +158,8 @@ public function test_keys_or_not() {
}
}
- public function test_error() {
+ public function test_error(): void {
+
$simpon = stack_ast_container::make_from_teacher_source('simp:true', 'test_error()', new stack_cas_security());
$divzero = stack_ast_container::make_from_teacher_source('1/0', 'test_error()', new stack_cas_security());
$foo = stack_ast_container::make_from_teacher_source('sconcat("f","o","o")', 'test_error()', new stack_cas_security());
@@ -166,7 +180,8 @@ public function test_error() {
$this->assertEquals(['Division by zero.'], $divzero->get_errors(true));
}
- public function test_feedback() {
+ public function test_feedback(): void {
+
$simpoff = stack_ast_container::make_from_teacher_source('simp:false', 'test_answernote()', new stack_cas_security());
$validation = stack_ast_container::make_from_teacher_source('stack_validate_typeless([2/4], true, 1/2, 0, true)',
'test_answernote()', new stack_cas_security());
@@ -182,7 +197,8 @@ public function test_feedback() {
$this->assertStringContainsString('lowest terms', $validation->get_feedback());
}
- public function test_answertest_usage() {
+ public function test_answertest_usage(): void {
+
$qv = 'ta:diff(sin(x),x);';
$qv = new stack_cas_keyval($qv, null, 123);
@@ -246,7 +262,7 @@ public function test_answertest_usage() {
}
- public function test_get_display() {
+ public function test_get_display(): void {
$cs = ['a:x^2', 'b:1/(1+x^2)', 'c:e^(i*pi)'];
foreach ($cs as $s) {
@@ -264,7 +280,8 @@ public function test_get_display() {
}
- public function test_polarform_simp() {
+ public function test_polarform_simp(): void {
+
$cs = ['p0:polarform_simp(%i+1)'];
$cs[] = 'p1:polarform_simp(2)';
$cs[] = 'p2:polarform_simp(-2)';
@@ -286,7 +303,7 @@ public function test_polarform_simp() {
$this->assertEquals('%e^((%i*%pi)/2)', $s1[3]->get_value());
}
- public function test_multiplication_option_complexno_i() {
+ public function test_multiplication_option_complexno_i(): void {
$cs = ['p:a+b*%i', 'q:a+b*i', 'r:a+b*j'];
foreach ($cs as $s) {
@@ -307,7 +324,7 @@ public function test_multiplication_option_complexno_i() {
$this->assertEquals('a+b\cdot j', $r->get_display());
}
- public function test_multiplication_option_complexno_j() {
+ public function test_multiplication_option_complexno_j(): void {
$cs = ['p:a+b*%i', 'q:a+b*i', 'r:a+b*j'];
foreach ($cs as $s) {
@@ -328,7 +345,7 @@ public function test_multiplication_option_complexno_j() {
$this->assertEquals('a+b\cdot \mathrm{j}', $r->get_display());
}
- public function test_multiplication_option_complexno_symi() {
+ public function test_multiplication_option_complexno_symi(): void {
$cs = ['p:a+b*%i', 'q:a+b*i', 'r:a+b*j'];
foreach ($cs as $s) {
@@ -349,7 +366,7 @@ public function test_multiplication_option_complexno_symi() {
$this->assertEquals('a+b\cdot j', $r->get_display());
}
- public function test_multiplication_option_complexno_vector_order() {
+ public function test_multiplication_option_complexno_vector_order(): void {
$cs = ['ordergreat(i,j,k)', 'texput(i,"\\\\vec{i}")', 'texput(j,"\\\\vec{j}")', 'texput(k,"\\\\vec{k}")',
'p:j*4+3*i+5*k', 'q:j*b+a*i+c*k', ];
@@ -369,7 +386,7 @@ public function test_multiplication_option_complexno_vector_order() {
$this->assertEquals('a\cdot \vec{i}+b\cdot \vec{j}+c\cdot \vec{k}', $q->get_display());
}
- public function test_multiplication_option_complexno_symj() {
+ public function test_multiplication_option_complexno_symj(): void {
$cs = ['p:a+b*%i', 'q:a+b*i', 'r:a+b*j'];
foreach ($cs as $s) {
@@ -390,7 +407,7 @@ public function test_multiplication_option_complexno_symj() {
$this->assertEquals('a+b\cdot j', $r->get_display());
}
- public function test_multiplication_option_dot() {
+ public function test_multiplication_option_dot(): void {
$cs = ['a:x*y', 'b:x*y*z', 'c:x*(y*z)', 'd:(x*y)*z'];
foreach ($cs as $s) {
@@ -410,7 +427,7 @@ public function test_multiplication_option_dot() {
$this->assertEquals('x\cdot y\cdot z', $s1[3]->get_display());
}
- public function test_multiplication_option_none() {
+ public function test_multiplication_option_none(): void {
$cs = ['a:x*y', 'b:x*y*z', 'c:x*(y*z)', 'd:(x*y)*z'];
foreach ($cs as $s) {
@@ -430,7 +447,7 @@ public function test_multiplication_option_none() {
$this->assertEquals('x\,y\,z', $s1[3]->get_display());
}
- public function test_multiplication_option_cross() {
+ public function test_multiplication_option_cross(): void {
$cs = ['a:x*y', 'b:x*y*z', 'c:x*(y*z)', 'd:(x*y)*z'];
foreach ($cs as $s) {
@@ -451,7 +468,7 @@ public function test_multiplication_option_cross() {
}
- public function test_multiplication_option_onum() {
+ public function test_multiplication_option_onum(): void {
$s1 = [];
$cs = ['a:2*x', 'b:2*3*x', 'c:3*5^2', 'd:3*x^2', 's1:x*(-y)', 's2:3*(-4)*x*(-y)'];
@@ -495,7 +512,7 @@ public function test_multiplication_option_onum() {
$this->assertEquals('3\, \left(\frac{5}{2}\right)', $s1[5]->get_display());
}
- public function test_function_power_display() {
+ public function test_function_power_display(): void {
$cs = ['A:f(0)', 'B:f(0)^5', 'C:f(x)', 'D:f(x)^3', 'E:f(x+1)', 'F:f(x+1)^30'];
$s1 = [];
@@ -534,7 +551,7 @@ public function test_function_power_display() {
$this->assertEquals('\sin ^{50}', $s1[6]->get_display());
}
- public function test_acos_option_cosmone() {
+ public function test_acos_option_cosmone(): void {
$cs = ['a:acos(x)', 'b:asin(x)', 'c:asinh(x)', 'd:asin(x)^3', 'e:asin(x^2+1)^30'];
foreach ($cs as $s) {
@@ -556,7 +573,7 @@ public function test_acos_option_cosmone() {
// Babbage comlained around 1820 about people using this notation and people still use this notation!
}
- public function test_acos_option_acos() {
+ public function test_acos_option_acos(): void {
$cs = ['a:acos(x)', 'b:asin(x)', 'c:asinh(x)', 'd:asin(x)^3', 'e:asin(x^2+1)^30'];
foreach ($cs as $s) {
@@ -575,7 +592,7 @@ public function test_acos_option_acos() {
$this->assertEquals('{\rm asin}^{30}\left(x^2+1\right)', $s1[4]->get_display());
}
- public function test_acos_option_arccos() {
+ public function test_acos_option_arccos(): void {
$cs = ['a:acos(x)', 'b:asin(x)', 'c:asinh(x)', 'd:asin(x)^3', 'e:asin(x^2+1)^30'];
foreach ($cs as $s) {
@@ -594,7 +611,7 @@ public function test_acos_option_arccos() {
$this->assertEquals('\arcsin ^{30}\left(x^2+1\right)', $s1[4]->get_display());
}
- public function test_acos_option_arcosh() {
+ public function test_acos_option_arcosh(): void {
$cs = [
'a:acos(x)', 'b:asin(x)', 'c:asinh(x)', 'd:asin(x)^3', 'e:asin(x^2+1)^30',
@@ -618,7 +635,7 @@ public function test_acos_option_arcosh() {
$this->assertEquals('{\rm arsinh}^{70}\left(x\right)', $s1[6]->get_display());
}
- public function test_logicsymbol_option_lang() {
+ public function test_logicsymbol_option_lang(): void {
$cs = ['a:A and B', 'b:A nounand B', 'c:A and (B or C)', 'd:A nounand (B nounor C)'];
foreach ($cs as $s) {
@@ -636,7 +653,7 @@ public function test_logicsymbol_option_lang() {
$this->assertEquals('A\,{\text{ and }}\, \left(B\,{\text{ or }}\, C\right)', $s1[3]->get_display());
}
- public function test_logicsymbol_option_symbol() {
+ public function test_logicsymbol_option_symbol(): void {
$cs = ['a:A and B', 'b:A nounand B', 'c:A and (B or C)', 'd:A nounand (B nounor C)'];
foreach ($cs as $s) {
@@ -654,7 +671,7 @@ public function test_logicsymbol_option_symbol() {
$this->assertEquals('A\land \left(B\lor C\right)', $s1[3]->get_display());
}
- public function test_keyval_representation_1() {
+ public function test_keyval_representation_1(): void {
$cs = ['a:x^2', 'b:1/(1+x^2)', 'c:e^(i*pi)'];
foreach ($cs as $s) {
@@ -666,7 +683,7 @@ public function test_keyval_representation_1() {
$this->assertEquals("a:x^2;\nb:1/(1+x^2);\nc:e^(i*%pi);", $at1->get_keyval_representation());
}
- public function test_keyval_representation_2() {
+ public function test_keyval_representation_2(): void {
$cs = ['a:(-1)^2'];
foreach ($cs as $s) {
@@ -679,7 +696,7 @@ public function test_keyval_representation_2() {
$this->assertEquals('a:1;', $at1->get_keyval_representation(true));
}
- public function test_get_display_unary_minus() {
+ public function test_get_display_unary_minus(): void {
$cs = ['p1:y^3-2*y^2-8*y', 'p2:y^2-2*y-8', 'p3:y^2-2*y-0.5', 'p4:x#pm#3+y', 'p5:x+(-5+y)'];
// Notice the subtle difference in p4 & p5.
@@ -701,7 +718,7 @@ public function test_get_display_unary_minus() {
$this->assertEquals('x+\\left(-5+y\\right)', $s1[4]->get_display());
}
- public function test_string1() {
+ public function test_string1(): void {
$cs = ['s:"This is a string"'];
foreach ($cs as $s) {
@@ -712,7 +729,7 @@ public function test_string1() {
$this->assertEquals('"This is a string"', $s1[0]->get_value());
}
- public function test_qmchar() {
+ public function test_qmchar(): void {
$cs = ['s:5*?+6*?', 'A:matrix([?,1],[1,?])'];
foreach ($cs as $s) {
@@ -727,7 +744,8 @@ public function test_qmchar() {
$this->assertEquals('matrix([QMCHAR,1],[1,QMCHAR])', $s1[1]->get_value());
}
- public function test_subscript_disp() {
+ public function test_subscript_disp(): void {
+
// Fails with actual display output like '{\it pi_{025}}'.
$this->skip_if_old_maxima('5.23.2');
@@ -757,7 +775,7 @@ public function test_subscript_disp() {
$this->assertEquals($s1[4]->get_display(), '{{\pi}_{4}}^5');
}
- public function test_matrix_eigenvalues() {
+ public function test_matrix_eigenvalues(): void {
$cs = ['A:matrix([7,1,3],[5,-3,4],[5,3,-4])', 'E:first(eigenvalues(A))', 'dt:determinant(A)'];
foreach ($cs as $s) {
@@ -777,7 +795,8 @@ public function test_matrix_eigenvalues() {
}
- public function test_assignmatrixelements() {
+ public function test_assignmatrixelements(): void {
+
// Assign a value to matrix entries.
$cs = ['A:matrix([1,2],[1,1])', 'A[1,2]:3', 'B:A'];
foreach ($cs as $s) {
@@ -790,7 +809,7 @@ public function test_assignmatrixelements() {
$this->assertEquals('matrix([1,3],[1,1])', $s1[2]->get_value());
}
- public function test_simplify_false() {
+ public function test_simplify_false(): void {
$cs = ['a:2+3', 'b:ev(a,simp)'];
@@ -807,7 +826,7 @@ public function test_simplify_false() {
$this->assertEquals('5', $s1[1]->get_value());
}
- public function test_disp_control_structures() {
+ public function test_disp_control_structures(): void {
$csl = [
'p:if a>b then setelmx(0,m[k],m[j],A)',
@@ -844,7 +863,7 @@ public function test_disp_control_structures() {
$this->assertEquals('[sin,cos,log,rho,atan]', $s1[5]->get_value());
}
- public function test_redefine_variable() {
+ public function test_redefine_variable(): void {
// This example redefines the value of n.
// It should return the last value.
@@ -876,7 +895,7 @@ public function test_redefine_variable() {
$this->assertEquals('36', $s1[2]->get_display());
}
- public function test_indirect_redefinition_of_varibale() {
+ public function test_indirect_redefinition_of_varibale(): void {
// This example uses a loop to change the values of elements of C.
// However the loop returns "done", and the values of C are changed.
@@ -904,7 +923,7 @@ public function test_indirect_redefinition_of_varibale() {
$this->assertEquals('matrix([5*4+2*6,5*5+2*5],[4*4+3*6,4*5+3*5])', $s1[6]->get_value());
}
- public function test_numerical_precision() {
+ public function test_numerical_precision(): void {
$cs = ['a:1385715.257'];
foreach ($cs as $s) {
@@ -915,7 +934,7 @@ public function test_numerical_precision() {
$this->assertEquals('1385715.257', $s1[0]->get_value());
}
- public function test_rat() {
+ public function test_rat(): void {
$cs = ['a:ratsimp(sqrt(27))', 'b:rat(sqrt(27))', 'm:MAXIMA_VERSION_NUM'];
foreach ($cs as $s) {
@@ -940,7 +959,8 @@ public function test_rat() {
}
}
- public function test_ordergreat() {
+ public function test_ordergreat(): void {
+
$cs = [
'stack_reset_vars(true)', 'ordergreat(i,j,k)', 'p:matrix([-7],[2],[-3])',
'q:matrix([i],[j],[k])', 'v:dotproduct(p,q)',
@@ -954,7 +974,8 @@ public function test_ordergreat() {
$this->assertEquals('-7\cdot i+2\cdot j-3\cdot k', $s1[4]->get_display());
}
- public function test_ordergreat_2() {
+ public function test_ordergreat_2(): void {
+
$cs = ['ordergreat(a,b,c)', 'p:matrix([-7],[2],[-3])', 'q:matrix([a],[b],[c])', 'v:dotproduct(p,q)'];
foreach ($cs as $s) {
$s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []);
@@ -965,7 +986,7 @@ public function test_ordergreat_2() {
$this->assertEquals('-7\cdot a+2\cdot b-3\cdot c', $s1[3]->get_display());
}
- public function test_plot_constant_function() {
+ public function test_plot_constant_function(): void {
$cs = ['a:0', 'p:plot(a*x,[x,-2,2],[y,-2,2])'];
foreach ($cs as $s) {
@@ -978,7 +999,7 @@ public function test_plot_constant_function() {
$this->assertEquals('', trim($s1[0]->get_errors()));
}
- public function test_plot_fail() {
+ public function test_plot_fail(): void {
$cs = ['a:0', 'p:plot(a*x/0,[x,-2,2],[y,-2,2])'];
foreach ($cs as $s) {
@@ -991,7 +1012,8 @@ public function test_plot_fail() {
$this->assertFalse(strpos($s1[1]->get_value(), 'STACK auto-generated plot of 0 with parameters'));
}
- public function test_rand_selection_err_1() {
+ public function test_rand_selection_err_1(): void {
+
$cs = ['a:rand_selection(1,1)'];
foreach ($cs as $s) {
$s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []);
@@ -1002,7 +1024,8 @@ public function test_rand_selection_err_1() {
$this->assertEquals('rand_selection error: first argument must be a list or set.', $s1[0]->get_errors());
}
- public function test_rand_selection_err_2() {
+ public function test_rand_selection_err_2(): void {
+
$cs = ['a:rand_selection([a,b,c,d], 7)'];
foreach ($cs as $s) {
$s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []);
@@ -1013,7 +1036,8 @@ public function test_rand_selection_err_2() {
$this->assertEquals('rand_selection error: insuffient elements in the list/set.', $s1[0]->get_errors());
}
- public function test_rand_selection() {
+ public function test_rand_selection(): void {
+
$cs = ['a:rand_selection([a,b,c,d], 4)', 'b:sort(a)'];
foreach ($cs as $s) {
$s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []);
@@ -1023,7 +1047,8 @@ public function test_rand_selection() {
$this->assertEquals('[a,b,c,d]', $s1[1]->get_value());
}
- public function test_rand_selection_set() {
+ public function test_rand_selection_set(): void {
+
$cs = ['a:rand_selection({a,b,c,d}, 4)', 'b:sort(a)'];
foreach ($cs as $s) {
$s1[] = stack_ast_container::make_from_teacher_source($s, '', new stack_cas_security(), []);
@@ -1033,7 +1058,8 @@ public function test_rand_selection_set() {
$this->assertEquals('[a,b,c,d]', $s1[1]->get_value());
}
- public function test_trivial_rand_range() {
+ public function test_trivial_rand_range(): void {
+
// Cases should be in the form array('input', 'value', 'display').
$cases = [];
$cmds = [];
@@ -1063,7 +1089,8 @@ public function test_trivial_rand_range() {
}
}
- public function test_greek_lower() {
+ public function test_greek_lower(): void {
+
// The case gamma is separated out below, so we can skip it on old Maxima where it is a known fail.
$cs = [
'greek1:[alpha,beta,delta,epsilon]',
@@ -1091,7 +1118,8 @@ public function test_greek_lower() {
$s1[3]->get_display());
}
- public function test_greek_lower_gamma() {
+ public function test_greek_lower_gamma(): void {
+
// In old maxima, you get '\Gamma' for the display output.
$this->skip_if_old_maxima('5.23.2');
$cs = stack_ast_container::make_from_student_source('greek1:gamma', '', new stack_cas_security(), []);
@@ -1102,7 +1130,8 @@ public function test_greek_lower_gamma() {
$this->assertEquals('\gamma', $cs->get_display());
}
- public function test_greek_upper() {
+ public function test_greek_upper(): void {
+
$cs = [
'greek1:[Alpha,Beta,Gamma,Delta,Epsilon]',
'greek2:[Zeta,Eta,Theta,Iota,Kappa]',
@@ -1131,7 +1160,8 @@ public function test_greek_upper() {
$this->assertEquals('3', $s1[4]->get_value());
}
- public function test_taylor_cos_simp() {
+ public function test_taylor_cos_simp(): void {
+
$cs = [
'c1:taylor(cos(x),x,0,1)',
'c3:taylor(cos(x),x,0,3)',
@@ -1152,7 +1182,8 @@ public function test_taylor_cos_simp() {
$this->assertEquals('1-\frac{x^2}{2}+\cdots', $s1[1]->get_display());
}
- public function test_taylor_cos_nosimp() {
+ public function test_taylor_cos_nosimp(): void {
+
$cs = [
'c1:taylor(cos(x),x,0,1)',
'c3:taylor(cos(x),x,0,3)',
@@ -1173,7 +1204,8 @@ public function test_taylor_cos_nosimp() {
$this->assertEquals('1-\frac{x^2}{2}+\cdots', $s1[1]->get_display());
}
- public function test_lambda() {
+ public function test_lambda(): void {
+
$cs = [
'l1:lambda([ex], ex^3)',
'l2:[1,2,3]',
@@ -1189,7 +1221,8 @@ public function test_lambda() {
$this->assertEquals('[1,8,27]', $s1[2]->get_value());
}
- public function test_sets_simp() {
+ public function test_sets_simp(): void {
+
$cs = ['c1:{}', 'c2:{b,a,c}'];
foreach ($cs as $s) {
$s1[] = stack_ast_container::make_from_student_source($s, '', new stack_cas_security(), []);
@@ -1206,7 +1239,8 @@ public function test_sets_simp() {
$this->assertEquals('\left \{a , b , c \right \}', $s1[1]->get_display());
}
- public function test_sets_simp_false() {
+ public function test_sets_simp_false(): void {
+
$cs = ['c1:{}', 'c2:{b,a,c}'];
foreach ($cs as $s) {
$s1[] = stack_ast_container::make_from_student_source($s, '', new stack_cas_security(), []);
@@ -1223,7 +1257,7 @@ public function test_sets_simp_false() {
$this->assertEquals('\left \{b , a , c \right \}', $s1[1]->get_display());
}
- public function test_numerical_rounding() {
+ public function test_numerical_rounding(): void {
$tests = stack_numbers_test_data::get_raw_test_data();
$s1 = [];
@@ -1252,7 +1286,8 @@ public function test_numerical_rounding() {
}
}
- public function test_dispdp() {
+ public function test_dispdp(): void {
+
// @codingStandardsIgnoreStart
// Tests in the following form.
@@ -1313,7 +1348,8 @@ public function test_dispdp() {
}
}
- public function test_dispdp_systematic() {
+ public function test_dispdp_systematic(): void {
+
$cs = stack_ast_container::make_from_teacher_source("L:makelist(dispdp(10^-1+10^-k,k+1),k,12,20)",
'', new stack_cas_security(), []);
$s1[] = $cs;
@@ -1343,7 +1379,7 @@ public function test_dispdp_systematic() {
$this->assertEquals($expected, $s1[0]->get_value());
}
- public function test_dispdp_systematic_longer() {
+ public function test_dispdp_systematic_longer(): void {
$cs = stack_ast_container::make_from_teacher_source("fpprintprec:16", '', new stack_cas_security(), []);
$s1[] = $cs;
@@ -1376,7 +1412,8 @@ public function test_dispdp_systematic_longer() {
$this->assertEquals($expected, $s1[1]->get_value());
}
- public function test_dispsf() {
+ public function test_dispsf(): void {
+
// @codingStandardsIgnoreStart
// Tests in the following form.
@@ -1423,7 +1460,8 @@ public function test_dispsf() {
}
}
- public function test_significantfigures_errors() {
+ public function test_significantfigures_errors(): void {
+
$tests = [
['significantfigures(%pi/3,3)', '1.05', ''],
[
@@ -1452,7 +1490,8 @@ public function test_significantfigures_errors() {
}
}
- public function test_significantfigures_list() {
+ public function test_significantfigures_list(): void {
+
$tests = [
[
'significantfigures([0.2,0.4,0.5,0.6,0.7,0.8,1]*1.9,3)',
@@ -1474,7 +1513,8 @@ public function test_significantfigures_list() {
}
}
- public function test_sf() {
+ public function test_sf(): void {
+
// @codingStandardsIgnoreStart
// Tests in the following form.
@@ -1527,7 +1567,8 @@ public function test_sf() {
}
}
- public function test_scientific_notation() {
+ public function test_scientific_notation(): void {
+
// @codingStandardsIgnoreStart
// Tests in the following form.
@@ -1805,7 +1846,8 @@ public function test_scientific_notation() {
}
}
- public function test_pm_simp_false() {
+ public function test_pm_simp_false(): void {
+
$cs = [
'c0:a#pm#b',
'c1:x = (-b #pm# sqrt(b^2-4*a*c))/(2*a)',
@@ -1851,7 +1893,8 @@ public function test_pm_simp_false() {
$this->assertEquals('\sin ^2\left({x \pm a}\right)', $s1[9]->get_display());
}
- public function test_pm_simp_true() {
+ public function test_pm_simp_true(): void {
+
$cs = [
'c1:a#pm#b',
'c2:x=(-b #pm# sqrt(b^2-4*a*c))/(2*a)',
@@ -1897,7 +1940,8 @@ public function test_pm_simp_true() {
$this->assertEquals('\sin ^2\left({x \pm a}\right)', $s1[9]->get_display());
}
- public function test_logic_nouns() {
+ public function test_logic_nouns(): void {
+
// Nouns forms of logic operators are added by student validation.
$s1 = [];
$s1[] = stack_ast_container::make_from_teacher_source('p0:x=1 or x=2', '', new stack_cas_security(), []);
@@ -1921,7 +1965,7 @@ public function test_logic_nouns() {
$this->assertEquals('false', $s1[3]->get_value());
}
- public function test_natural_domain() {
+ public function test_natural_domain(): void {
// Cases should be in the form array('input', 'value', 'display').
$cases = [];
@@ -1955,7 +1999,7 @@ public function test_natural_domain() {
}
}
- public function test_union_tex() {
+ public function test_union_tex(): void {
// Cases should be in the form array('input value', 'display').
$cases[] = ['%union(a,b,c)', 'a \cup b \cup c'];
@@ -2000,7 +2044,7 @@ public function test_union_tex() {
}
}
- public function test_stack_disp_comma_separate() {
+ public function test_stack_disp_comma_separate(): void {
// Cases should be in the form array('input', 'value', 'display').
$cases = [];
@@ -2023,7 +2067,7 @@ public function test_stack_disp_comma_separate() {
}
}
- public function test_stack_disp_innards_ntuple() {
+ public function test_stack_disp_innards_ntuple(): void {
// Cases should be in the form array('input', 'value', 'display').
$cases = [];
@@ -2046,7 +2090,7 @@ public function test_stack_disp_innards_ntuple() {
}
}
- public function test_stack_stackintfmt() {
+ public function test_stack_stackintfmt(): void {
// Cases should be in the form array('input', 'value', 'display').
$cases = [];
@@ -2074,7 +2118,7 @@ public function test_stack_stackintfmt() {
}
}
- public function test_stack_stack_equiv_find_step() {
+ public function test_stack_stack_equiv_find_step(): void {
$r1 = [
'ta:[lg(25,5),stackeq(lg(5^2,5)),stackeq(2*lg(5,5)),stackeq(2*1),stackeq(2)]',
@@ -2111,7 +2155,8 @@ public function test_stack_stack_equiv_find_step() {
}
}
- public function test_dispvalue() {
+ public function test_dispvalue(): void {
+
// These are tests of test-case generation.
$tests = [
@@ -2153,7 +2198,8 @@ public function test_dispvalue() {
}
}
- public function test_stack_strip_percent() {
+ public function test_stack_strip_percent(): void {
+
$tests = [
'assume(x>0)',
'eq1:x^2*\'diff(y,x)+3*y*x=sin(x)/x',
@@ -2176,7 +2222,8 @@ public function test_stack_strip_percent() {
$this->assertEquals('y = (k-cos(x))/x^3', $s1[4]->get_value());
}
- public function test_stack_quantile_gamma() {
+ public function test_stack_quantile_gamma(): void {
+
// This command has lisp throw an error.
$tests = ['p:quantile_gamma(0.5,26896/81,81/164)'];
@@ -2197,7 +2244,8 @@ public function test_stack_quantile_gamma() {
$this->assertEquals('163.835395267', $actual);
}
- public function test_stack_parse_inequalities() {
+ public function test_stack_parse_inequalities(): void {
+
// This command has lisp throw an error.
$tests = ['f(x) := if x < 0 then (if x < 1 then 1 else 2) else 3;', 'v1:f(-5);', 'v2:f(4);'];
@@ -2215,7 +2263,8 @@ public function test_stack_parse_inequalities() {
$this->assertEquals('f(x):=if x < 0 then (if x < 1 then 1 else 2) else 3', $s1[0]->get_value());
}
- public function test_stack_rat() {
+ public function test_stack_rat(): void {
+
$tests = [
's1 : 8.5*sin(rat(2*pi*((0.37/1.86440677966E-4)-(5.8/0.22))))', 's2:1',
'm:MAXIMA_VERSION_NUM',
@@ -2239,7 +2288,8 @@ public function test_stack_rat() {
}
}
- public function test_stack_pmpoly() {
+ public function test_stack_pmpoly(): void {
+
$tests = [
's1:-(4*x^7)+3*x^5-2*x^3+x',
'p1:-a/b', 'p2:(-a)/b', 'p3:-(a/b)',
@@ -2277,7 +2327,8 @@ public function test_stack_pmpoly() {
$this->assertEquals('{a \pm b}', $s1[4]->get_display());
}
- public function test_stack_pm_maximaoutput() {
+ public function test_stack_pm_maximaoutput(): void {
+
$tests = ['a*b+c*d+-A*B'];
foreach ($tests as $key => $c) {
@@ -2305,7 +2356,8 @@ public function test_stack_pm_maximaoutput() {
$this->assertEquals($expected, $s1[0]->get_ast_test());
}
- public function test_stack_pm_taylor() {
+ public function test_stack_pm_taylor(): void {
+
$tests = ['ta:ev(taylor(10*cos(2*x),x,%pi/4,2),simp)'];
foreach ($tests as $key => $c) {
@@ -2336,7 +2388,8 @@ public function test_stack_pm_taylor() {
$this->assertEquals($expected, $s1[0]->get_ast_test());
}
- public function test_stack_scientific_notationp() {
+ public function test_stack_scientific_notationp(): void {
+
$truetests = [
'3*10^2',
'3.1*10^2',
@@ -2398,7 +2451,7 @@ public function test_stack_scientific_notationp() {
}
}
- public function test_stack_regex_match_exactp() {
+ public function test_stack_regex_match_exactp(): void {
$t1 = [];
$t1[] = ['regex_match_exactp("(aaa)*(b|d)c", "aaaaaabc")', 'true'];
@@ -2420,7 +2473,7 @@ public function test_stack_regex_match_exactp() {
}
}
- public function test_stack_at_units_sigfigs() {
+ public function test_stack_at_units_sigfigs(): void {
$t1 = [];
$t1[] = ['simp:false', 'false'];
@@ -2442,7 +2495,7 @@ public function test_stack_at_units_sigfigs() {
}
}
- public function test_stack_rational_numberp() {
+ public function test_stack_rational_numberp(): void {
$s1 = [];
$t1 = [];
@@ -2485,7 +2538,7 @@ public function test_stack_rational_numberp() {
}
}
- public function test_stack_numerical_not_alg_equiv_edge() {
+ public function test_stack_numerical_not_alg_equiv_edge(): void {
$s1 = [];
$t1 = [];
@@ -2508,7 +2561,7 @@ public function test_stack_numerical_not_alg_equiv_edge() {
}
}
- public function test_stack_blockexternal() {
+ public function test_stack_blockexternal(): void {
$s1 = [];
$t1 = [];
@@ -2541,7 +2594,7 @@ public function test_stack_blockexternal() {
}
}
- public function test_silent_tellsimp() {
+ public function test_silent_tellsimp(): void {
$qv = "matchdeclare(pmpatex1,true);\nmatchdeclare(pmpatex2,true);" .
"tellsimpafter((pmpatex1 #pm# pmpatex2)!,(pmpatex1^2) #pm# pmpatex2);\n" .
@@ -2554,7 +2607,8 @@ public function test_silent_tellsimp() {
$this->assertEquals("b^2#pm#c", $cs->get_value());
}
- public function test_eval_in_block() {
+ public function test_eval_in_block(): void {
+
$qv = "f:ev(2*x,x=2);\n" .
"ev(g:3*x,x=3);\n" .
"h:5*x,x=5;\n".
@@ -2573,7 +2627,8 @@ public function test_eval_in_block() {
$this->assertEquals('[4,9,25,36]', $s1->get_value());
}
- public function test_confirm_induced_timeout() {
+ public function test_confirm_induced_timeout(): void {
+
$qv = "p:1;\n" .
"for i:1 thru 2^100 do p:p+(-1)^i;\n";
$qv = new stack_cas_keyval($qv, null, 123);
@@ -2589,7 +2644,7 @@ public function test_confirm_induced_timeout() {
$this->assertEquals('CAS failed to return any data due to timeout.', $s1->get_errors());
}
- public function test_complex_number_display() {
+ public function test_complex_number_display(): void {
// These test cases get wrapped in the general display_complex(ex) function to test the default conversion.
$cases = [];
@@ -2671,7 +2726,7 @@ public function test_complex_number_display() {
}
}
- public function test_complex_number_display_options() {
+ public function test_complex_number_display_options(): void {
// These test cases get wrapped in the general display_complex(ex) function to test the default conversion.
$cases = [];
@@ -2703,7 +2758,7 @@ public function test_complex_number_display_options() {
}
}
- public function test_parens_delect_display() {
+ public function test_parens_delect_display(): void {
$cases = [];
$cases[] = ['disp_parens(a+b)+c', '\left( a+b \right)+c'];
@@ -2733,7 +2788,7 @@ public function test_parens_delect_display() {
}
}
- public function test_parens_select() {
+ public function test_parens_select(): void {
$cases = [];
$cases[] = ['select(integerp, 3)', '\color{red}{\underline{3}}'];
@@ -2764,7 +2819,7 @@ public function test_parens_select() {
}
}
- public function test_fboundp() {
+ public function test_fboundp(): void {
$cases = [];
$cases[] = ['fboundp(sinner)', 'false'];
@@ -2791,7 +2846,7 @@ public function test_fboundp() {
}
}
- public function test_diag() {
+ public function test_diag(): void {
$cases = [];
$cases[] = [
@@ -2819,7 +2874,7 @@ public function test_diag() {
}
}
- public function test_cartesian_product() {
+ public function test_cartesian_product(): void {
$cases = [];
$cases[] = [
@@ -2843,7 +2898,7 @@ public function test_cartesian_product() {
}
}
- public function test_keyword_end() {
+ public function test_keyword_end(): void {
$cases = [
'v1: (-x^2+1)/(x^2+1)^2', 'v2: 1/(x^2+1)-(2*x^2)/(x^2+1)^2', 'end:3',
@@ -2868,7 +2923,7 @@ public function test_keyword_end() {
}
- public function test_use_at() {
+ public function test_use_at(): void {
// This testcase arose as issue #762.
$cases = [
@@ -2920,7 +2975,7 @@ public function test_use_at() {
$this->assertEquals('matrix([-4],[1])', $t1->get_value());
}
- public function test_s_test() {
+ public function test_s_test(): void {
$cases = ['t1:s_assert(a,b)'];
@@ -2938,7 +2993,7 @@ public function test_s_test() {
$this->assertEquals('s_assert: STACK expected \' b \' but was given \' a \'.', $session->get_errors());
}
- public function test_let() {
+ public function test_let(): void {
// Note, the rule deliberarly does not correspond to normal mathematics!
$cases = [
@@ -2959,7 +3014,8 @@ public function test_let() {
$this->assertEquals('cos(x)^6-2*cos(x)^3+1', $p->get_value());
}
- public function test_let_matrix() {
+ public function test_let_matrix(): void {
+
$cases = ['orderless(I);',
'matchdeclare([a],true)',
'(let(I*a, a), let(I^2, I), true)',
@@ -2997,7 +3053,8 @@ public function test_let_matrix() {
$this->assertEquals('X^3-3*X^2+3*X-1', $p->get_value());
}
- public function test_stackmaximaversion() {
+ public function test_stackmaximaversion(): void {
+
// This test ensures that we are not running against different
// version number of the STACK-Maxima scripts. For example,
// old image in a server setup or a cache layer somewhere.
diff --git a/tests/castext2_internals_test.php b/tests/castext2_internals_test.php
index 2cd8a34224e..f9480167ac7 100644
--- a/tests/castext2_internals_test.php
+++ b/tests/castext2_internals_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use CTP_Block;
@@ -38,13 +45,15 @@
* @group qtype_stack
* @group qtype_stack_castext_module
*/
-class castext2_internals_test extends qtype_stack_testcase {
+final class castext2_internals_test extends qtype_stack_testcase {
/**
+ * Add description here.
* @covers \qtype_stack\CTP_Parser
* @covers \qtype_stack\CTP_Parser::parse
*/
- public function test_parser() {
+ public function test_parser(): void {
+
$parser = new CTP_Parser();
$code = '[[ if test="0"]] {#1#} {@2@}[[/if]]';
$ast = $parser->parse($code);
@@ -82,11 +91,13 @@ public function test_parser() {
}
/**
+ * Add description here.
* @covers \qtype_stack\CTP_Parser
* @covers \qtype_stack\CTP_Parser::parse
* @covers \qtype_stack\CTP_IOBlock
*/
- public function test_ioblockextensions() {
+ public function test_ioblockextensions(): void {
+
$parser = new CTP_Parser();
$code = '[[list_errors:ans1,ans2]][[ whatever : ans3 ]]';
$ast = $parser->parse($code);
@@ -103,9 +114,11 @@ public function test_ioblockextensions() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_parser_utils::math_paint
*/
- public function test_math_paint_1() {
+ public function test_math_paint_1(): void {
+
$parser = new CTP_Parser();
$code = '\({#1#}\) {@3@} \[{@5@}\] \begin{equation}{@7@} \end{equation} {#9#}';
$ast = $parser->parse($code);
@@ -124,9 +137,11 @@ public function test_math_paint_1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_parser_utils::math_paint
*/
- public function test_math_paint_2() {
+ public function test_math_paint_2(): void {
+
$parser = new CTP_Parser();
$code = '[[commonstring key="your_answer_interpreted_as"/]]
';
$code .= '[[if test="stringp(ans1)"]]{@false@}
';
diff --git a/tests/castext2_test.php b/tests/castext2_test.php
index 1538e982565..2051a6f54f7 100644
--- a/tests/castext2_test.php
+++ b/tests/castext2_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use castext2_evaluatable;
@@ -47,13 +54,14 @@
* @group qtype_stack_castext_module
* @covers \qtype_stack
*/
-class castext2_test extends qtype_stack_testcase {
+final class castext2_test extends qtype_stack_testcase {
// This function maps a given set of CASText code, CASString
// style preamble statements and STACK options to the current
// implementation and generates the end result.
// Validation is not being tested, here.
- private function evaluate(string $code, array $preamble=[], stack_options $options=null,
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
+ private function evaluate(string $code, array $preamble=[], ?stack_options $options=null,
$context='castext-test-case'): string {
$statements = [];
foreach ($preamble as $statement) {
@@ -88,16 +96,19 @@ private function evaluate(string $code, array $preamble=[], stack_options $optio
*
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_latex_injection_1() {
+ public function test_latex_injection_1(): void {
+
$input = '{@1+2@}, \[{@sqrt(2)@}\]';
$output = '\({3}\), \[{\sqrt{2}}\]';
$this->assertEquals($output, $this->evaluate($input));
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_latex_injection_2() {
+ public function test_latex_injection_2(): void {
+
$input = '{@a@}, {@c:b@}, {@3/9,simp=false@}, {@c@}, {@d@}';
// Note that last one if we are in global simp:true we just cannot know
// whether that needs to be protected.
@@ -107,9 +118,11 @@ public function test_latex_injection_2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_latex_injection_3() {
+ public function test_latex_injection_3(): void {
+
$input = '{@a@}, {@3/9@}, {@3/9,simp@}, {@a,simp=false@}, {@a,simp@}';
$preamble = ['a:3/9'];
$output = '\({\frac{3}{9}}\), \({\frac{3}{9}}\), \({\frac{1}{3}}\), \({\frac{3}{9}}\), \({\frac{1}{3}}\)';
@@ -118,18 +131,22 @@ public function test_latex_injection_3() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_latex_injection_4() {
+ public function test_latex_injection_4(): void {
+
$input = ' {@"test string"@} ';
$output = ' test string ';
$this->assertEquals($output, $this->evaluate($input));
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_latex_injection_5() {
+ public function test_latex_injection_5(): void {
+
// Issue #849, let the simplification state stay after injection if
// modified globally.
// While this is a bad way to do things and is essenttialy authoring with
@@ -146,11 +163,13 @@ public function test_latex_injection_5() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_castext2_markdownformat
* @covers \qtype_stack\castext2_parser_utils::math_paint
*/
- public function test_latex_injection_mixed_formats_1() {
+ public function test_latex_injection_mixed_formats_1(): void {
+
// The default format is raw HTML.
// The actual injection is not visible here as the markdown gets rendered, but
// the math-mode detection should be.
@@ -173,16 +192,19 @@ public function test_latex_injection_mixed_formats_1() {
*
* @covers \qtype_stack\stack_cas_castext2_raw
*/
- public function test_value_injection_1() {
+ public function test_value_injection_1(): void {
+
$input = '{#1+2#}, {#sqrt(2)#}';
$output = '3, sqrt(2)';
$this->assertEquals($output, $this->evaluate($input));
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_raw
*/
- public function test_value_injection_2() {
+ public function test_value_injection_2(): void {
+
$input = '{#a#}, {#c:b#}, {#3/9,simp=false#}, {#c#}, {#d#}';
// Note that last one if we are in global simp:true we just cannot know
// whether that needs to be protected.
@@ -192,9 +214,11 @@ public function test_value_injection_2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_raw
*/
- public function test_value_injection_3() {
+ public function test_value_injection_3(): void {
+
$input = '{#a#}, {#3/9#}, {#3/9,simp#}, {#a,simp=false#}, {#a,simp#}';
$preamble = ['a:3/9'];
$output = '3/9, 3/9, 1/3, 3/9, 1/3';
@@ -205,10 +229,12 @@ public function test_value_injection_3() {
// STACK-options level requirements 1/3:
// Tuning LaTeX-injection multiplication sign.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_multiplicationsign_dot() {
+ public function test_latex_injection_multiplicationsign_dot(): void {
+
$input = '{@a@}, {@pi*x^2@}';
$preamble = ['a:x*y*z'];
$output = '\({x\cdot y\cdot z}\), \({\pi\cdot x^2}\)';
@@ -217,10 +243,12 @@ public function test_latex_injection_multiplicationsign_dot() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_multiplicationsign_cross() {
+ public function test_latex_injection_multiplicationsign_cross(): void {
+
$input = '{@a@}, {@pi*x^2@}';
$preamble = ['a:x*y*z'];
$output = '\({x\times y\times z}\), \({\pi\times x^2}\)';
@@ -229,10 +257,12 @@ public function test_latex_injection_multiplicationsign_cross() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_multiplicationsign_none() {
+ public function test_latex_injection_multiplicationsign_none(): void {
+
$input = '{@a@}, {@pi*x^2@}';
$preamble = ['a:x*y*z'];
$output = '\({x\,y\,z}\), \({\pi\,x^2}\)';
@@ -243,10 +273,12 @@ public function test_latex_injection_multiplicationsign_none() {
// STACK-option level requirements 2/3:
// Tuning LaTeX-injection inverse trigonometric functions.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_inversetrig_acos() {
+ public function test_latex_injection_inversetrig_acos(): void {
+
$input = '\({@acos(alpha)@}, {@asin(alpha)@}, {@a@}\)';
$preamble = ['a:asech(alpha)'];
$output = '\({{\rm acos}\left( \alpha \right)}, {{\rm asin}\left( \alpha \right)}, {{\rm asech}\left( \alpha \right)}\)';
@@ -255,10 +287,12 @@ public function test_latex_injection_inversetrig_acos() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_inversetrig_cos_1() {
+ public function test_latex_injection_inversetrig_cos_1(): void {
+
$input = '\({@acos(alpha)@}, {@asin(alpha)@}, {@a@}\)';
$preamble = ['a:asech(alpha)'];
$output = '\({\cos^{-1}\left( \alpha \right)}, {\sin^{-1}\left( \alpha \right)}, {{\rm sech}^{-1}\left( \alpha \right)}\)';
@@ -267,10 +301,12 @@ public function test_latex_injection_inversetrig_cos_1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_inversetrig_arccos() {
+ public function test_latex_injection_inversetrig_arccos(): void {
+
$input = '\({@acos(alpha)@}, {@asin(alpha)@}, {@a@}\)';
$preamble = ['a:asech(alpha)'];
$output = '\({\arccos \left( \alpha \right)}, {\arcsin \left( \alpha \right)}, {{\rm arcsech}\left( \alpha \right)}\)';
@@ -281,10 +317,12 @@ public function test_latex_injection_inversetrig_arccos() {
// STACK-option level requirements 3/3:
// Tuning LaTeX-injection matrix parenthesis.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_matrixparens_brackets() {
+ public function test_latex_injection_matrixparens_brackets(): void {
+
$input = '{@matrix([1,0],[0,1])@}';
$preamble = [];
$output = '\({\left[\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}\right]}\)';
@@ -293,10 +331,12 @@ public function test_latex_injection_matrixparens_brackets() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_matrixparens_parens() {
+ public function test_latex_injection_matrixparens_parens(): void {
+
$input = '{@matrix([1,0],[0,1])@}';
$preamble = [];
$output = '\({\left(\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}\right)}\)';
@@ -305,10 +345,12 @@ public function test_latex_injection_matrixparens_parens() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_matrixparens_braces() {
+ public function test_latex_injection_matrixparens_braces(): void {
+
$input = '{@matrix([1,0],[0,1])@}';
$preamble = [];
$output = '\({\left\{\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}\right\}}\)';
@@ -317,10 +359,12 @@ public function test_latex_injection_matrixparens_braces() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_matrixparens_none() {
+ public function test_latex_injection_matrixparens_none(): void {
+
$input = '{@matrix([1,0],[0,1])@}';
$preamble = [];
$output = '\({\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}}\)';
@@ -329,10 +373,12 @@ public function test_latex_injection_matrixparens_none() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_injection_matrixparens_pipe() {
+ public function test_latex_injection_matrixparens_pipe(): void {
+
$input = '{@matrix([1,0],[0,1])@}';
$preamble = [];
$output = '\({\left|\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \end{array}\right|}\)';
@@ -341,10 +387,12 @@ public function test_latex_injection_matrixparens_pipe() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_latex_matrixparens_indirect_lmxchar() {
+ public function test_latex_matrixparens_indirect_lmxchar(): void {
+
$input = '\[ f(x) := \left\{ {@(lmxchar:"", f)@} \right. \]';
$preamble = ['f:matrix([4*x+4, x<1],[-x^2-4*x-8, x>=1])'];
$output = '\[ f(x) := \left\{ {\begin{array}{cc} 4\cdot x+4 & x < 1 \\\\ ' .
@@ -362,7 +410,8 @@ public function test_latex_matrixparens_indirect_lmxchar() {
*
* @covers \qtype_stack\stack_cas_castext2_define
*/
- public function test_blocks_define() {
+ public function test_blocks_define(): void {
+
$input = '{#a#}, [[ define a="a+1" a="a*a" b="3/9" c="3/9,simp"/]] {#a#} {#b#} {#b,simp#} {#c#}';
$preamble = ['a:x'];
$output = 'x, (x+1)*(x+1) 3/9 1/3 1/3';
@@ -378,7 +427,8 @@ public function test_blocks_define() {
*
* @covers \qtype_stack\stack_cas_castext2_if
*/
- public function test_blocks_if_1() {
+ public function test_blocks_if_1(): void {
+
$input = '{#a#}, [[ if test="a=x" ]]yes[[ else ]]no[[define a="3"/]][[/if]], [[ if test="a=3"]]maybe[[/ if ]]';
$preamble = ['a:x'];
$output = 'x, yes, ';
@@ -387,9 +437,11 @@ public function test_blocks_if_1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_if
*/
- public function test_blocks_if_2() {
+ public function test_blocks_if_2(): void {
+
$input = '{#a#}, [[ if test="a=x" ]]yes[[define a="3"/]][[ else ]]no[[/if]], [[ if test="a=3"]]maybe[[/ if ]]';
$preamble = ['a:x'];
$output = 'x, yes, maybe';
@@ -398,9 +450,11 @@ public function test_blocks_if_2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_if
*/
- public function test_blocks_if_3() {
+ public function test_blocks_if_3(): void {
+
$input = '{#a#}, [[ if test="a=x" ]]yes[[define a="3"/]][[ else ]]no[[/if]], ' .
'[[ if test="a=x"]]no[[elif test="a=3"]]maybe[[/ if ]]';
$preamble = ['a:x'];
@@ -410,9 +464,11 @@ public function test_blocks_if_3() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_if
*/
- public function test_blocks_if_4() {
+ public function test_blocks_if_4(): void {
+
$input = '{#a#}, [[ if test="a=x" ]]yes[[if test="b=y"]][[define b="x"/]][[/if]][[ else ]]no[[/if]], {#b#}';
$preamble = ['a:x', 'b:y'];
$output = 'x, yes, x';
@@ -433,7 +489,8 @@ public function test_blocks_if_4() {
*
* @covers \qtype_stack\stack_cas_castext2_foreach
*/
- public function test_blocks_foreach_1() {
+ public function test_blocks_foreach_1(): void {
+
$input = '[[ foreach foo="a"]][[ foreach bar="foo"]]{#bar#}, [[/foreach]] - [[/foreach]]';
$preamble = ['a:[[1,1+1,1+1+1],[1,2,3]]'];
$output = '1, 1+1, 1+1+1, - 1, 2, 3, - ';
@@ -442,9 +499,11 @@ public function test_blocks_foreach_1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_foreach
*/
- public function test_blocks_foreach_2() {
+ public function test_blocks_foreach_2(): void {
+
$input = '[[ foreach foo="a"]][[ foreach bar="foo"]]{#bar#}, [[/foreach]] - [[/foreach]]';
$preamble = ['a:[{1,1+1,1+1+1},{3,2,1}]'];
$output = '1, 2, 3, - 1, 2, 3, - ';
@@ -453,9 +512,11 @@ public function test_blocks_foreach_2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_foreach
*/
- public function test_blocks_foreach_3() {
+ public function test_blocks_foreach_3(): void {
+
$input = '[[ foreach foo="a"]][[ foreach bar="foo,simp"]]{#bar#}, [[/foreach]] - [[/foreach]]';
$preamble = ['a:[[1,1+1,1+1+1],[1,2,3]]'];
$output = '1, 2, 3, - 1, 2, 3, - ';
@@ -464,9 +525,11 @@ public function test_blocks_foreach_3() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_foreach
*/
- public function test_blocks_foreach_4() {
+ public function test_blocks_foreach_4(): void {
+
$input = '[[ foreach foo="a" bar="b"]]{@foo^bar@}, [[/foreach]]';
$preamble = ['a:[1,2,3,4]', 'b:[x,y,z]'];
$output = '\({1^{x}}\), \({2^{y}}\), \({3^{z}}\), ';
@@ -481,7 +544,8 @@ public function test_blocks_foreach_4() {
*
* @covers \qtype_stack\stack_cas_castext2_comment
*/
- public function test_blocks_comment() {
+ public function test_blocks_comment(): void {
+
$input = '1[[ comment]] [[ foreach bar="foo"]] {#y@} [[/comment]]2';
$output = '12';
$this->assertEquals($output, $this->evaluate($input));
@@ -494,16 +558,19 @@ public function test_blocks_comment() {
*
* @covers \qtype_stack\stack_cas_castext2_todo
*/
- public function test_blocks_todo() {
+ public function test_blocks_todo(): void {
+
$input = '1[[ todo]] [[ foreach bar="foo"]] {#y@} [[/todo]]2';
$output = '12';
$this->assertEquals($output, $this->evaluate($input));
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_hint
*/
- public function test_blocks_hint() {
+ public function test_blocks_hint(): void {
+
$input = "1[[hint title=\"Show solution\"]][[if test='is(1>0)']]Solution[[/if]][[/hint]]2";
$output = '1Show solution
' .
'Solution2';
@@ -511,9 +578,11 @@ public function test_blocks_hint() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_hint
*/
- public function test_blocks_hint_hint() {
+ public function test_blocks_hint_hint(): void {
+
$input = "[[hint title=\"Show solution\"]][[hint title=\"Go on....\"]]Solution[[/hint]][[/hint]]";
$output = 'Show solution
' .
'' .
@@ -529,7 +598,8 @@ public function test_blocks_hint_hint() {
*
* @covers \qtype_stack\stack_cas_castext2_escape
*/
- public function test_blocks_escape() {
+ public function test_blocks_escape(): void {
+
$input = '1[[ escape]] [[ foreach bar="foo"]] {#y@} [[/escape]]2';
$output = '1 [[ foreach bar="foo"]] {#y@} 2';
$this->assertEquals($output, $this->evaluate($input));
@@ -541,7 +611,8 @@ public function test_blocks_escape() {
* @covers \qtype_stack\CTP_Parser
* @covers \qtype_stack\stack_cas_castext2_escape
*/
- public function test_blocks_escape_space_end() {
+ public function test_blocks_escape_space_end(): void {
+
$input = '1[[ escape ]] [[ foreach bar="foo"]] {#y@} [[/escape]]2';
$output = '1 [[ foreach bar="foo"]] {#y@} 2';
$this->assertEquals($output, $this->evaluate($input));
@@ -553,7 +624,8 @@ public function test_blocks_escape_space_end() {
* @covers \qtype_stack\CTP_Parser
* @covers \qtype_stack\stack_cas_castext2_escape
*/
- public function test_blocks_escape_space_none() {
+ public function test_blocks_escape_space_none(): void {
+
$input = '1[[escape]] [[ foreach bar="foo"]] {#y@} [[/escape]]2';
$output = '1 [[ foreach bar="foo"]] {#y@} 2';
$this->assertEquals($output, $this->evaluate($input));
@@ -562,10 +634,12 @@ public function test_blocks_escape_space_none() {
// Low level tuning, features that are not strictly CASText:
// Use of texput().
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_keyval
*/
- public function test_texput_1() {
+ public function test_texput_1(): void {
+
$input = '\({@foo@}\)';
$preamble = ['texput(foo, "\\\\frac{foo}{bar}")'];
$output = '\({\frac{foo}{bar}}\)';
@@ -573,10 +647,12 @@ public function test_texput_1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_texput_2() {
+ public function test_texput_2(): void {
+
$input = '{@x^2+foo(a,sqrt(b))@}';
$preamble = [
'footex(e):=block([a,b],[a,b]:args(e),sconcat(tex1(a)," \\\\rightarrow ",tex1(b)))',
@@ -588,9 +664,11 @@ public function test_texput_2() {
// Check stackfltfmt for presentation of floating point numbers.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_stackfltfmt() {
+ public function test_stackfltfmt(): void {
+
$input = '{@a@}, {@(stackfltfmt:"~f",a)@}';
// Note that 0.000012 has rounding in clisp which is not the point of this test.
// And 0.000013 has rounding in SBCL/GCL.
@@ -602,9 +680,11 @@ public function test_stackfltfmt() {
// Check stackintfmt for presentation of integers.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_stackintfmt() {
+ public function test_stackintfmt(): void {
+
$input = '{@(stackintfmt:"~:r",a)@}, {@(stackintfmt:"~@R",a)@}';
$preamble = ['a:1998'];
$output = '\({\text{one thousand nine hundred ninety-eighth}}\), \({MCMXCVIII}\)';
@@ -616,9 +696,11 @@ public function test_stackintfmt() {
// Inline fractions using stack_disp_fractions("i").
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_stack_disp_fractions() {
+ public function test_stack_disp_fractions(): void {
+
$input = '{@(stack_disp_fractions("i"),a/b)@}, {@(stack_disp_fractions("d"),a/b)@}';
$output = '\({{a}/{b}}\), \({\frac{a}{b}}\)';
$this->assertEquals($output, $this->evaluate($input));
@@ -626,9 +708,11 @@ public function test_stack_disp_fractions() {
// JavaScript string generation.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_jsstring
*/
- public function test_jsstring() {
+ public function test_jsstring(): void {
+
$input = 'var feedback = [[jsstring]]Something \({@sqrt(2)@}\) {@sqrt(2)@}.[[/jsstring]];';
$output = 'var feedback = "Something \\\\({\\\\sqrt{2}}\\\\) \\\\({\\\\sqrt{2}}\\\\).";';
$this->assertEquals($output, $this->evaluate($input));
@@ -641,10 +725,12 @@ public function test_jsstring() {
// Inline castext.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_keyval
* @covers \qtype_stack\stack_cas_castext2_castext
*/
- public function test_inline_castext() {
+ public function test_inline_castext(): void {
+
$keyval = 'B:castext("B");sq:castext("{@sqrt(2)@}");';
// The inline castext compilation currently only happens for keyvals, not for
// singular statements so we need to do something special to get this done.
@@ -665,10 +751,12 @@ public function test_inline_castext() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_keyval
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_inline_castext_normal_injection() {
+ public function test_inline_castext_normal_injection(): void {
+
$keyval = 'B:castext("B");sq:castext("{@sqrt(2)@}");';
// The inline castext compilation currently only happens for keyvals, not for
// singular statements so we need to do something special to get this done.
@@ -690,19 +778,23 @@ public function test_inline_castext_normal_injection() {
// Inline castext inline castext, not something you see in many places.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_special_root
*/
- public function test_inline_castext_inline() {
+ public function test_inline_castext_inline(): void {
+
$input = 'A [[castext evaluated="castext(\\"B\\")"/]] C, [[castext evaluated="castext(\\"{@sqrt(2)@}\\")"/]]';
$output = 'A B C, \\({\\sqrt{2}}\\)';
$this->assertEquals($output, $this->evaluate($input));
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_keyval
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_inline_castext_error() {
+ public function test_inline_castext_error(): void {
+
$keyval = 'S:1;T:castext(A_11);';
// The inline castext compilation currently only happens for keyvals, not for
// singular statements so we need to do something special to get this done.
@@ -728,9 +820,11 @@ public function test_inline_castext_error() {
// Test common string population.
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_commonstring
*/
- public function test_commonsstring() {
+ public function test_commonsstring(): void {
+
$preamble = ['simp:false', 'a:52+x-x', 'b:"text"', 'c:sqrt(5)', 'simp:true'];
// The string "stackversionerror" just happens to have multiple named parameters so we use it,
// feel free to use any other if things change.
@@ -740,7 +834,8 @@ public function test_commonsstring() {
$this->assertEquals($output, $this->evaluate($input, $preamble));
}
- public function test_plot_if() {
+ public function test_plot_if(): void {
+
// This test case caused an error in Maxima 5.45.0.
// The fix to this error is the use of ex:%_ce_expedite(ex) in the plot function to remove %_C.
// However, we need to actively evaluate the %_C functions at the point we remove them.
@@ -753,19 +848,22 @@ public function test_plot_if() {
$this->assertTrue(strpos($this->evaluate($input), '!ploturl!stackplot') > 0);
}
- public function test_templates_1() {
+ public function test_templates_1(): void {
+
$input = '[[template name="foobar"/]]';
$output = 'Warning no template defined with name "foobar"';
$this->assertEquals($output, $this->evaluate($input));
}
- public function test_templates_2() {
+ public function test_templates_2(): void {
+
$input = '[[template name="foobar" mode="ignore missing"/]]';
$output = '';
$this->assertEquals($output, $this->evaluate($input));
}
- public function test_templates_3() {
+ public function test_templates_3(): void {
+
$preamble = ['a:1'];
$input = '[[template name="foobar"]]FOOBAR{#a#}[[/template]][[template name="foobar"/]]' .
'[[define a="2"/]] [[template name="foobar"/]]';
@@ -773,19 +871,22 @@ public function test_templates_3() {
$this->assertEquals($output, $this->evaluate($input, $preamble));
}
- public function test_templates_4() {
+ public function test_templates_4(): void {
+
$input = '[[template name="foobar" mode="default"]]default[[/template]]';
$output = 'default';
$this->assertEquals($output, $this->evaluate($input));
}
- public function test_templates_5() {
+ public function test_templates_5(): void {
+
$input = '[[template name="foobar"]]override[[/template]]X[[template name="foobar" mode="default"]]default[[/template]]';
$output = 'Xoverride';
$this->assertEquals($output, $this->evaluate($input));
}
- public function test_maplist_labda() {
+ public function test_maplist_labda(): void {
+
$input = '{@maplist(lambda([ex], x^ex), [1,2,3,4])@}';
$output = '\({\left[ x , x^2 , x^3 , x^4 \right]}\)';
$this->assertEquals($output, $this->evaluate($input));
diff --git a/tests/castext_exception_test.php b/tests/castext_exception_test.php
index 9a0553f8eb8..98ae7412cc2 100644
--- a/tests/castext_exception_test.php
+++ b/tests/castext_exception_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use TypeError;
@@ -35,22 +42,27 @@
// The closest to the original is the castext2_evaluatable class.
/**
+ * Add description here.
* @group qtype_stack
*/
-class castext_exception_test extends qtype_stack_testcase {
+final class castext_exception_test extends qtype_stack_testcase {
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
*/
- public function test_exception_1() {
+ public function test_exception_1(): void {
+
$this->expectException(TypeError::class);
$at1 = castext2_evaluatable::make_from_source([], null);
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
*/
- public function test_exception_2() {
+ public function test_exception_2(): void {
+
$this->expectException(TypeError::class);
$at1 = castext2_evaluatable::make_from_source("Hello world", [1]);
}
diff --git a/tests/castext_test.php b/tests/castext_test.php
index 21abf911c35..6209660a73a 100644
--- a/tests/castext_test.php
+++ b/tests/castext_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use castext2_evaluatable;
@@ -40,7 +47,6 @@
require_once(__DIR__ . '/../stack/cas/secure_loader.class.php');
require_once(__DIR__ . '/../lang/multilang.php');
-
// Unit tests for {@link stack_cas_text}.
// Castext2 has no such class the repalcement is castext2_evaluatable
// which instead of being given a cassession is expected to be placed
@@ -48,11 +54,13 @@
// the same session.
/**
+ * Add description here.
* @group qtype_stack
* @group qtype_stack_castext_module
*/
-class castext_test extends qtype_stack_testcase {
+final class castext_test extends qtype_stack_testcase {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
public function basic_castext_instantiation($strin, $sa, $val, $disp) {
if (is_array($sa)) {
@@ -82,9 +90,10 @@ public function basic_castext_instantiation($strin, $sa, $val, $disp) {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
*/
- public function test_basic_castext_instantiation() {
+ public function test_basic_castext_instantiation(): void {
$a1 = ['a:x^2', 'b:(x+1)^2'];
$a2 = ['a:x^2)', 'b:(x+1)^2'];
@@ -129,9 +138,11 @@ public function test_basic_castext_instantiation() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
*/
- public function test_validation_error_castext_text() {
+ public function test_validation_error_castext_text(): void {
+
$a = [];
$cs = [];
foreach ($a as $var) {
@@ -156,9 +167,11 @@ public function test_validation_error_castext_text() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
*/
- public function test_runtime_error_castext_text() {
+ public function test_runtime_error_castext_text(): void {
+
$a = [];
$cs = [];
foreach ($a as $var) {
@@ -182,10 +195,12 @@ public function test_runtime_error_castext_text() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
* @covers \qtype_stack\stack_cas_keyval::get_valid
*/
- public function test_validation_error_castext_session() {
+ public function test_validation_error_castext_session(): void {
+
$a = ['a:x+1)^2'];
$cs = [];
foreach ($a as $var) {
@@ -211,9 +226,11 @@ public function test_validation_error_castext_session() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2
*/
- public function test_runtime_error_castext_session() {
+ public function test_runtime_error_castext_session(): void {
+
$a = ['a:1/0'];
$cs = [];
foreach ($a as $var) {
@@ -237,9 +254,11 @@ public function test_runtime_error_castext_session() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_if
*/
- public function test_if_block() {
+ public function test_if_block(): void {
+
$a1 = ['a:true', 'b:is(1>2)', 'c:false'];
// From iss309.
$c = '[[ if test="false" ]]Alpha[[ elif test="true"]]Beta[[ elif test="false"]]Gamma'
@@ -271,9 +290,11 @@ public function test_if_block() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_if
*/
- public function test_if_block_error() {
+ public function test_if_block_error(): void {
+
// NOTE... These syntax error tests should be removed. All blocks either work or they do not
// if they do not work you see them not being replaced in the output. The old parser
// spent way too much time figuring out if a opening block closed or not and that
@@ -303,9 +324,11 @@ public function test_if_block_error() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_if
*/
- public function test_broken_block_error() {
+ public function test_broken_block_error(): void {
+
$a = ['a:true', 'b:is(1>2)'];
$cs = [];
foreach ($a as $var) {
@@ -320,9 +343,11 @@ public function test_broken_block_error() {
}
/**
+ * Add description here.
* @covers \qtype_stack\CTP_Parser
*/
- public function test_broken_block_error2() {
+ public function test_broken_block_error2(): void {
+
$a = ['a:true', 'b:is(1>2)'];
$cs = [];
foreach ($a as $var) {
@@ -339,9 +364,11 @@ public function test_broken_block_error2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_define
*/
- public function test_define_block() {
+ public function test_define_block(): void {
+
$a1 = ['a:2'];
$cases = [
@@ -355,9 +382,11 @@ public function test_define_block() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_foreach
*/
- public function test_foreach_block() {
+ public function test_foreach_block(): void {
+
$a1 = ['a:[1,2,3]', 'b:{4,5,6,7}'];
$cases = [
@@ -377,9 +406,11 @@ public function test_foreach_block() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_comment
*/
- public function test_comment_block_define() {
+ public function test_comment_block_define(): void {
+
$a1 = ['a:2'];
$cases = [
@@ -404,7 +435,8 @@ public function test_comment_block_define() {
*
* @covers \qtype_stack\castext2_evaluatable
*/
- public function test_not_confused_by_pluginfile() {
+ public function test_not_confused_by_pluginfile(): void {
+
$c = 'Here {@x@} is some @@PLUGINFILE@@ {@x + 1@} some input';
$ct = castext2_evaluatable::make_from_source($c, 'test-case');
$this->assertTrue($ct->get_valid());
@@ -414,9 +446,11 @@ public function test_not_confused_by_pluginfile() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable
*/
- public function test_not_confused_by_pluginfile_real_example() {
+ public function test_not_confused_by_pluginfile_real_example(): void {
+
$realexample = '';
$ct = castext2_evaluatable::make_from_source($realexample, 'test-case');
@@ -427,9 +461,11 @@ public function test_not_confused_by_pluginfile_real_example() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_raw_casstrings() {
+ public function test_get_all_raw_casstrings(): void {
+
$raw = 'Take {@x^2+2*x@} and then {@sin(z^2)@}.';
$raws = castext2_parser_utils::get_casstrings($raw);
$session = new stack_cas_session2($raws);
@@ -439,9 +475,11 @@ public function test_get_all_raw_casstrings() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_raw_casstrings_if() {
+ public function test_get_all_raw_casstrings_if(): void {
+
$raw = 'Take {@x^2+2*x@} and then [[ if test="true"]]{@sin(z^2)@}[[/if]].';
$raws = castext2_parser_utils::get_casstrings($raw);
$session = new stack_cas_session2($raws);
@@ -453,9 +491,11 @@ public function test_get_all_raw_casstrings_if() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_raw_casstrings_foreach() {
+ public function test_get_all_raw_casstrings_foreach(): void {
+
$raw = 'Take {@x^2+2*x@} and then[[ foreach t="[1,2,3]"]] {@t@}[[/foreach]].';
$raws = castext2_parser_utils::get_casstrings($raw);
$session = new stack_cas_session2($raws);
@@ -474,9 +514,11 @@ public function test_get_all_raw_casstrings_foreach() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_raw_casstrings_empty() {
+ public function test_get_all_raw_casstrings_empty(): void {
+
$raw = 'Take some text without cas commands.';
$raws = castext2_parser_utils::get_casstrings($raw);
$session = new stack_cas_session2($raws);
@@ -486,9 +528,10 @@ public function test_get_all_raw_casstrings_empty() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_raw_casstrings_session() {
+ public function test_get_all_raw_casstrings_session(): void {
$sa = ['p:diff(sans,x)', 'q = int(tans,x)'];
foreach ($sa as $s) {
@@ -508,9 +551,11 @@ public function test_get_all_raw_casstrings_session() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_todo_tags_null() {
+ public function test_get_all_todo_tags_null(): void {
+
$raw = '';
$this->assertFalse(castext2_parser_utils::has_todoblocks($raw));
$tags = castext2_parser_utils::get_todoblocks($raw);
@@ -519,9 +564,11 @@ public function test_get_all_todo_tags_null() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_todo_tags_none() {
+ public function test_get_all_todo_tags_none(): void {
+
$raw = 'Take {@ 1/(1+x^2) @} and then {@sin(z^2)@}.';
$this->assertFalse(castext2_parser_utils::has_todoblocks($raw));
$tags = castext2_parser_utils::get_todoblocks($raw);
@@ -530,9 +577,11 @@ public function test_get_all_todo_tags_none() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_todo_tags_empty() {
+ public function test_get_all_todo_tags_empty(): void {
+
$raw = 'Take {@ 1/(1+x^2) @} and then {@sin(z^2)@}. [[todo]]Fix me[[/todo]]';
$this->assertTrue(castext2_parser_utils::has_todoblocks($raw));
$tags = castext2_parser_utils::get_todoblocks($raw);
@@ -541,9 +590,11 @@ public function test_get_all_todo_tags_empty() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_todo_tags_order() {
+ public function test_get_all_todo_tags_order(): void {
+
$raw = 'Take {@ 1/(1+x^2) @} and then {@sin(z^2)@}. [[todo tags="something,draft"]]Fix me[[/todo]]';
$this->assertTrue(castext2_parser_utils::has_todoblocks($raw));
$tags = castext2_parser_utils::get_todoblocks($raw);
@@ -552,9 +603,11 @@ public function test_get_all_todo_tags_order() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_session2::get_keyval_representation
*/
- public function test_get_all_todo_tags_multiple() {
+ public function test_get_all_todo_tags_multiple(): void {
+
$raw = 'Take {@ 1/(1+x^2) @} and then {@sin(z^2)@}. [[todo tags="something,draft"]]Fix me[[/todo]]';
$raw .= '[[todo tags="draft,additional"]]Don not forget this as well[[/todo]]';
$this->assertTrue(castext2_parser_utils::has_todoblocks($raw));
@@ -564,9 +617,11 @@ public function test_get_all_todo_tags_multiple() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_redefine_variables() {
+ public function test_redefine_variables(): void {
+
// Notice this means that within a session the value of n has to be returned at every stage....
$at1 = castext2_evaluatable::make_from_source(
'Let \(n\) be defined by \({@n:3@}\). Now add one to get \({@n:n+1@}\) and square the result \({@n:n^2@}\).',
@@ -578,9 +633,11 @@ public function test_redefine_variables() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_maths::process_display_castext
*/
- public function test_fact_sheets() {
+ public function test_fact_sheets(): void {
+
$cs2 = new stack_cas_session2([], null, 0);
$at1 = castext2_evaluatable::make_from_source("[[facts:calc_diff_linearity_rule]]", 'test-case');
$cs2->add_statement($at1);
@@ -592,9 +649,11 @@ public function test_fact_sheets() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_assignmatrixelements() {
+ public function test_assignmatrixelements(): void {
+
// Assign a value to matrix entries.
$cs = ['A:matrix([1,2],[1,1])', 'A[1,2]:3'];
@@ -611,10 +670,12 @@ public function test_assignmatrixelements() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_assignmatrixelements_p1() {
+ public function test_assignmatrixelements_p1(): void {
+
// Assign a value to matrix entries.
$cs = ['A:matrix([1,2],[1,1])', 'A[1,2]:3'];
@@ -633,10 +694,12 @@ public function test_assignmatrixelements_p1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_options
*/
- public function test_assignmatrixelements_p2() {
+ public function test_assignmatrixelements_p2(): void {
+
// Assign a value to matrix entries.
$cs = ['A:matrix([1,2],[1,1])', 'A[1,2]:3'];
@@ -655,9 +718,11 @@ public function test_assignmatrixelements_p2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_plot() {
+ public function test_plot(): void {
+
$a2 = ['p:x^3'];
$s2 = [];
foreach ($a2 as $s) {
@@ -680,9 +745,10 @@ public function test_plot() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_plot_alttext() {
+ public function test_plot_alttext(): void {
$a2 = ['p:sin(x)'];
$s2 = [];
@@ -702,9 +768,11 @@ public function test_plot_alttext() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_plot_alttext_html() {
+ public function test_plot_alttext_html(): void {
+
$s2 = [];
$cs2 = new stack_cas_session2($s2, null, 0);
@@ -717,9 +785,10 @@ public function test_plot_alttext_html() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_plot_alttext_error() {
+ public function test_plot_alttext_error(): void {
$a2 = ['p:sin(x)'];
$s2 = [];
@@ -740,9 +809,10 @@ public function test_plot_alttext_error() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_plot_small_margin() {
+ public function test_plot_small_margin(): void {
$a2 = ['p:sin(x)'];
$s2 = [];
@@ -761,9 +831,10 @@ public function test_plot_small_margin() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_plot_nottags() {
+ public function test_plot_nottags(): void {
$a2 = ['p:sin(x)'];
$s2 = [];
@@ -782,9 +853,10 @@ public function test_plot_nottags() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_plot_option_error() {
+ public function test_plot_option_error(): void {
$cs2 = new stack_cas_session2([], null, 0);
@@ -799,18 +871,20 @@ public function test_plot_option_error() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
*/
- public function test_currency_1() {
+ public function test_currency_1(): void {
$at1 = castext2_evaluatable::make_from_source('This is system cost \$100,000 to create.', 'test-case');
$this->assertTrue($at1->get_valid());
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
*/
- public function test_forbidden_words() {
+ public function test_forbidden_words(): void {
$at1 = castext2_evaluatable::make_from_source('This is system cost {@system("rm /tmp/test")@} to create.',
'test-case');
@@ -819,9 +893,11 @@ public function test_forbidden_words() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_parser_utils::math_paint
*/
- public function test_mathdelimiters1() {
+ public function test_mathdelimiters1(): void {
+
$a2 = ['a:2'];
$s2 = [];
foreach ($a2 as $s) {
@@ -838,9 +914,11 @@ public function test_mathdelimiters1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_parser_utils::math_paint
*/
- public function test_mathdelimiters2() {
+ public function test_mathdelimiters2(): void {
+
$a2 = ['a:x^2/(1+x^2)^3', 'p:diff(a,x)'];
$s2 = [];
foreach ($a2 as $s) {
@@ -860,9 +938,11 @@ public function test_mathdelimiters2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_decimalplaces() {
+ public function test_disp_decimalplaces(): void {
+
// The function dispdp only holds the number of decimal places to display. It does not do rounding.
// Use dispsf for rounding.
$a2 = ['a:float(%e)', 'b:3.99999'];
@@ -882,9 +962,11 @@ public function test_disp_decimalplaces() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_decimalplaces2() {
+ public function test_disp_decimalplaces2(): void {
+
$a2 = ['a:float(%e)', 'b:-3.99999'];
$s2 = [];
foreach ($a2 as $s) {
@@ -903,9 +985,11 @@ public function test_disp_decimalplaces2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_decimalplaces_error() {
+ public function test_disp_decimalplaces_error(): void {
+
$a2 = ['a:float(%e)', 'b:-3.99999'];
$s2 = [];
foreach ($a2 as $s) {
@@ -924,9 +1008,11 @@ public function test_disp_decimalplaces_error() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_mult_blank() {
+ public function test_disp_mult_blank(): void {
+
$a2 = ['make_multsgn("blank")', 'b:x*y'];
$s2 = [];
foreach ($a2 as $s) {
@@ -944,9 +1030,11 @@ public function test_disp_mult_blank() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_mult_dot() {
+ public function test_disp_mult_dot(): void {
+
$a2 = ['make_multsgn("dot")', 'b:x*y'];
$s2 = [];
foreach ($a2 as $s) {
@@ -964,9 +1052,11 @@ public function test_disp_mult_dot() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_mult_cross() {
+ public function test_disp_mult_cross(): void {
+
$a2 = ['make_multsgn("cross")', 'b:x*y'];
$s2 = [];
foreach ($a2 as $s) {
@@ -984,9 +1074,11 @@ public function test_disp_mult_cross() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_mult_switch() {
+ public function test_disp_mult_switch(): void {
+
$a2 = ['make_multsgn("dot")'];
$s2 = [];
foreach ($a2 as $s) {
@@ -1006,9 +1098,11 @@ public function test_disp_mult_switch() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_equiv_natural_domain() {
+ public function test_disp_equiv_natural_domain(): void {
+
$a2 = ['ta:[1/(x-1)+1/(x+1),2*x/(x^2-1)]'];
$s2 = [];
foreach ($a2 as $s) {
@@ -1037,9 +1131,11 @@ public function test_disp_equiv_natural_domain() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_ode1() {
+ public function test_disp_ode1(): void {
+
$at1 = new stack_cas_keyval("p1:'diff(y,x,2)+2*y = 0;p2:ev('diff(y,x,2),simp)+2*ev('diff(y,x,2,z,3),simp) = 0;",
null, 123);
$this->assertTrue($at1->get_valid());
@@ -1058,9 +1154,11 @@ public function test_disp_ode1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_ode2() {
+ public function test_disp_ode2(): void {
+
$vars = "derivabbrev:true;p1:'diff(y,x,2)+2*y = 0;p2:ev('diff(y,x,2),simp)+2*ev('diff(y,x,2,z,3),simp) = 0;";
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -1077,9 +1175,11 @@ public function test_disp_ode2() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_int() {
+ public function test_disp_int(): void {
+
$vars = "foo:'int(f(x),x)";
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -1096,9 +1196,11 @@ public function test_disp_int() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_strings_in_castext() {
+ public function test_strings_in_castext(): void {
+
$vars = "st1:[\"\;\sin(x^2)\",\"\;\cos(x^2)\"]\n/* And a comment: with LaTeX \;\sin(x) */
\n a:3;";
$at1 = new stack_cas_keyval($vars, null, 123);
@@ -1115,9 +1217,11 @@ public function test_strings_in_castext() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_strings_in_castext_escaped() {
+ public function test_strings_in_castext_escaped(): void {
+
$vars = 'st:"This is a string with escaped \" strings...."';
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -1133,9 +1237,11 @@ public function test_strings_in_castext_escaped() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_strings_in_castext_translated() {
+ public function test_strings_in_castext_translated(): void {
+
$vars = 'st:a and "!AND!"';
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -1158,9 +1264,11 @@ public function test_strings_in_castext_translated() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_strings_only() {
+ public function test_strings_only(): void {
+
$s = '{@"This is a string"@} whereas this is empty |{@""@}|. Not quite empty |{@" "@}|.';
$at2 = castext2_evaluatable::make_from_source($s, 'test-case');
@@ -1174,9 +1282,11 @@ public function test_strings_only() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_strings_only_latex() {
+ public function test_strings_only_latex(): void {
+
// Remember the quotes below are escaped!
$s = '{@"This is a string with LaTeX in it \\\\(\\\\pi\\\\)."@}';
@@ -1191,9 +1301,11 @@ public function test_strings_only_latex() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_strings_embeded() {
+ public function test_strings_embeded(): void {
+
$s = '{@"This is a string"+x^2@}.';
$at2 = castext2_evaluatable::make_from_source($s, 'test-case');
@@ -1207,9 +1319,11 @@ public function test_strings_embeded() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_float_default() {
+ public function test_numerical_display_float_default(): void {
+
// The number 0.000001 used to be tested, but it was giving weird results.
// On some versions of Maxima, including the latest, it comes back as
// 10.0e-7, instead of 1.0e-6. Other versions get it right. I did not like
@@ -1227,9 +1341,11 @@ public function test_numerical_display_float_default() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_float_decimal() {
+ public function test_numerical_display_float_decimal(): void {
+
$st = 'Decimal numbers {@0.1@}, {@0.01@}, {@0.001@}, {@0.0001@}, {@0.00001@}, {@0.000001@}.';
$a2 = ['stackfltfmt:"~f"'];
@@ -1250,9 +1366,11 @@ public function test_numerical_display_float_decimal() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_float_scientific() {
+ public function test_numerical_display_float_scientific(): void {
+
// The number 0.000001 is handled below, so we can skip on old Maxima where it fails.
$st = 'Decimal numbers {@0.1@}, {@0.01@}, {@0.001@}, {@0.0001@}, {@0.00001@}.';
@@ -1274,9 +1392,11 @@ public function test_numerical_display_float_scientific() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_float_scientific_small() {
+ public function test_numerical_display_float_scientific_small(): void {
+
// On old Maxima, you get back \(9.999999999999999e-7\).
$this->skip_if_old_maxima('5.32.1');
@@ -1303,9 +1423,11 @@ public function test_numerical_display_float_scientific_small() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_1() {
+ public function test_numerical_display_1(): void {
+
$s = 'The decimal number {@n:73@} is written in base \(2\) as {@(stackintfmt:"~2r",n)@}, in base \(7\) ' .
'as {@(stackintfmt:"~7r",n)@}, in scientific notation as {@(stackintfmt:"~e",n)@} ' .
'and in rhetoric as {@(stackintfmt:"~r",n)@}.';
@@ -1322,9 +1444,11 @@ public function test_numerical_display_1() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_binary() {
+ public function test_numerical_display_binary(): void {
+
$st = 'The number {@73@} is written in base \(2\).';
$a2 = ['stackintfmt:"~b"'];
@@ -1346,9 +1470,11 @@ public function test_numerical_display_binary() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_ampersand_roman() {
+ public function test_numerical_display_ampersand_roman(): void {
+
// This test makes sure the castext parser to allows @ within strings within the castext.
$st = 'The number {@(stackintfmt:"~@r",14)@} is written in Roman numerals.';
$s2 = [];
@@ -1366,9 +1492,11 @@ public function test_numerical_display_ampersand_roman() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_roman() {
+ public function test_numerical_display_roman(): void {
+
$st = 'The number {@14@} is written in Roman numerals.';
$a2 = ['stackintfmt:"~@r"'];
@@ -1390,9 +1518,11 @@ public function test_numerical_display_roman() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_numerical_display_commas() {
+ public function test_numerical_display_commas(): void {
+
$st = 'The number {@3.1415@} is written with commas. ';
$st .= 'Sets {@{1.2, 4, 5, 3.123}@} and lists {@[1.2, 4, 5, 3.123]@}';
@@ -1417,9 +1547,11 @@ public function test_numerical_display_commas() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_inline_fractions() {
+ public function test_inline_fractions(): void {
+
$s = '{@(stack_disp_fractions("i"), 1/x)@} {@(stack_disp_fractions("d"), 1/x)@} {@(stack_disp_fractions("i"), 1/x)@}';
$at2 = castext2_evaluatable::make_from_source($s, 'test-case');
@@ -1432,9 +1564,11 @@ public function test_inline_fractions() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_inline_fractions_all() {
+ public function test_inline_fractions_all(): void {
+
$st = '{@1/x@}, {@1/x^2@}, {@1/(a+x)@}, {@1/(2*a)@}, {@1/sin(x+y)@}.';
$a2 = ['stack_disp_fractions("i")'];
@@ -1454,9 +1588,11 @@ public function test_inline_fractions_all() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_disp_greek() {
+ public function test_disp_greek(): void {
+
$a2 = ['a:Delta', 'b:sin(Delta^2)', 'c:delta', 't:theta'];
$s2 = [];
foreach ($a2 as $s) {
@@ -1477,9 +1613,11 @@ public function test_disp_greek() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_subscripts() {
+ public function test_subscripts(): void {
+
$a2 = ['a:texsub(v, 2*alpha)', 'b:texsub(v, texsub(m, n))'];
$s2 = [];
foreach ($a2 as $s) {
@@ -1501,9 +1639,11 @@ public function test_subscripts() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
*/
- public function test_maxima_arrays() {
+ public function test_maxima_arrays(): void {
+
$a2 = ['p1:a[2]', 'p2:a[n+1]', 'p3:a[b_c]'];
$s2 = [];
foreach ($a2 as $s) {
@@ -1526,10 +1666,12 @@ public function test_maxima_arrays() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_length() {
+ public function test_length(): void {
+
$a2 = ['f(x):=length(x)', 'b:[1,2,3]', 'c:f(b)'];
$s2 = [];
foreach ($a2 as $s) {
@@ -1548,10 +1690,12 @@ public function test_length() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_lambda() {
+ public function test_lambda(): void {
+
$a2 = [
'sfc: lambda([x,n],significantfigures(x,n))',
'n:[3.1234,1]', 'm:apply(sfc,n)',
@@ -1576,10 +1720,12 @@ public function test_lambda() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_apply() {
+ public function test_apply(): void {
+
$a2 = ['p1:apply("+",[x,y,z]);'];
$s2 = [];
foreach ($a2 as $s) {
@@ -1601,10 +1747,12 @@ public function test_apply() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_stackintfmt() {
+ public function test_stackintfmt(): void {
+
// Note, we have set up one pattern as CAS strings because we cannot have @ symbols in CAStext at this point.
// This will be fixed in castext2 (stateful).
$a2 = ['n:1234', 'str1:"~@R"'];
@@ -1642,10 +1790,12 @@ public function test_stackintfmt() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_stack_disp_comma_separate() {
+ public function test_stack_disp_comma_separate(): void {
+
$st = '{@stack_disp_comma_separate([a,b,c])@} and {#stack_disp_comma_separate([a,b,c])#}.';
$s2 = [];
@@ -1660,9 +1810,11 @@ public function test_stack_disp_comma_separate() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_jsxgraph
*/
- public function test_stack_jsxgraph_statestore() {
+ public function test_stack_jsxgraph_statestore(): void {
+
$st = '[[jsxgraph input-ref-stateStore="stateRef"]]' .
'var board = JXG.JSXGraph.initBoard(divid, {axis: true, showCopyright: false});' .
'var p = board.create(\'point\', [4, 3]);' .
@@ -1675,9 +1827,11 @@ public function test_stack_jsxgraph_statestore() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_geogebra
*/
- public function test_stack_geogebra_statestore() {
+ public function test_stack_geogebra_statestore(): void {
+
// Eigenen test schreibenXXX.
$st = '[[geogebra input-ref-stateStore="stateRef"]]' .
'[[/geogebra]]';
@@ -1687,10 +1841,12 @@ public function test_stack_geogebra_statestore() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_stack_var_makelist() {
+ public function test_stack_var_makelist(): void {
+
$a2 = [
'vars0:stack_var_makelist(k, 5)',
'vars1:rest(stack_var_makelist(k, 6))',
@@ -1714,10 +1870,12 @@ public function test_stack_var_makelist() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_stack_simp_false_true() {
+ public function test_stack_simp_false_true(): void {
+
$a2 = [
'simp:false',
'p1:1+1',
@@ -1743,10 +1901,12 @@ public function test_stack_simp_false_true() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_stack_simp_false_true_false() {
+ public function test_stack_simp_false_true_false(): void {
+
// In STACK v<4.3 authors often control simp within a session.
$a2 = [
'simp:false',
@@ -1774,10 +1934,12 @@ public function test_stack_simp_false_true_false() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_stack_simp_false_castext() {
+ public function test_stack_simp_false_castext(): void {
+
// Check all the forms raised in issue #849.
$a2 = ['p1:1+1'];
$s2 = [];
@@ -1803,10 +1965,12 @@ public function test_stack_simp_false_castext() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_ast_container
*/
- public function test_stack_beta_function_arg() {
+ public function test_stack_beta_function_arg(): void {
+
$a2 = [
'n:1932;',
'f(alfa):=block(x:ifactors(alfa), y:makelist(0,length(x)), ' .
@@ -1832,10 +1996,12 @@ public function test_stack_beta_function_arg() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_orderless() {
+ public function test_orderless(): void {
+
// The unorder() function is not supported due to the way STACK interacts with Maxima.
$vars = "orderless(b);\np1:a+b+c;";
$at1 = new stack_cas_keyval($vars, null, 123);
@@ -1863,10 +2029,12 @@ public function test_orderless() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_complex_numbers() {
+ public function test_display_complex_numbers(): void {
+
// Typically with simp:true this does not display as a+bi.
$vars = "p1:a+b*%i;";
$at1 = new stack_cas_keyval($vars, null, 123);
@@ -1882,10 +2050,12 @@ public function test_display_complex_numbers() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_polarform() {
+ public function test_display_polarform(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
@@ -1904,10 +2074,12 @@ public function test_display_polarform() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_logic() {
+ public function test_display_logic(): void {
+
$vars = 'make_logic("lang");';
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -1955,10 +2127,12 @@ public function test_display_logic() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_tables() {
+ public function test_display_tables(): void {
+
$vars = 'T0:table([x,x^3],[-1,-1],[0,0],[1,1],[2,8],[3,27]);';
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -2022,10 +2196,12 @@ public function test_display_tables() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_equation_match_brackets() {
+ public function test_display_equation_match_brackets(): void {
+
$vars = "p1:x+1;\np2:expand(p1^3);";
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -2040,10 +2216,12 @@ public function test_display_equation_match_brackets() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_apply() {
+ public function test_display_apply(): void {
+
$vars = "ans1:transpose(matrix([1,1,0,0])); ans2:transpose(matrix([0,1,1,0])); ans3:transpose(matrix([0,0,1,1])); " .
"ans4:transpose(matrix([1,0,1,1])); /* The standard basis for R^4 */ " .
"SB:setify(maplist(transpose,apply(matrix,args(ident(4))))); /* Form a matrix of the student's vectors.*/ " .
@@ -2066,10 +2244,12 @@ public function test_display_apply() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_texput_complex_function() {
+ public function test_texput_complex_function(): void {
+
$vars = 'texput(u,lambda([ex],if length(ex)<4 then return("\\bigcup_{?=?}^{?} ? ") else' .
'sconcat("\\bigcup_{" ,tex1(second(ex)), " = ", tex1(third(ex)), "}^{", tex1(fourth(ex)), ' .
'"} ", tex1(first(ex)))));';
@@ -2086,10 +2266,12 @@ public function test_texput_complex_function() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_texput_hat() {
+ public function test_texput_hat(): void {
+
$vars = 'texput(hat, lambda([ex], sconcat("\\\\hat{", tex1(first(ex)), "}")));';
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -2104,10 +2286,12 @@ public function test_texput_hat() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_tex_aligned() {
+ public function test_tex_aligned(): void {
+
$vars = '';
$at1 = new stack_cas_keyval($vars, null, 123);
$this->assertTrue($at1->get_valid());
@@ -2124,10 +2308,12 @@ public function test_tex_aligned() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_tree() {
+ public function test_display_tree(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
@@ -2195,10 +2381,12 @@ public function test_display_tree() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_tree_texput() {
+ public function test_display_tree_texput(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
@@ -2219,10 +2407,12 @@ public function test_display_tree_texput() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_constants_texput() {
+ public function test_display_constants_texput(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
@@ -2240,10 +2430,12 @@ public function test_display_constants_texput() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_display_tree_strings() {
+ public function test_display_tree_strings(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
@@ -2263,10 +2455,12 @@ public function test_display_tree_strings() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_stack_csv_formatter() {
+ public function test_stack_csv_formatter(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
@@ -2304,10 +2498,12 @@ public function test_stack_csv_formatter() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_stack_lang() {
+ public function test_stack_lang(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
@@ -2338,10 +2534,12 @@ public function test_stack_lang() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_stack_pick_lang() {
+ public function test_stack_pick_lang(): void {
+
global $SESSION;
// Choose something not English, Australian or Finnish!
$SESSION->forcelang = 'cn';
@@ -2366,10 +2564,12 @@ public function test_stack_pick_lang() {
}
/**
+ * Add description here.
* @covers \qtype_stack\castext2_evaluatable::make_from_source
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_stack_pick_seed() {
+ public function test_stack_pick_seed(): void {
+
$a2 = [];
$s2 = [];
foreach ($a2 as $s) {
@@ -2391,10 +2591,12 @@ public function test_stack_pick_seed() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_include_local() {
+ public function test_include_local(): void {
+
$options = new stack_options();
$vars = "stack_include_contrib(\"validators.mac\");";
@@ -2412,10 +2614,12 @@ public function test_include_local() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_unary_minus_zeros() {
+ public function test_unary_minus_zeros(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
$cs2 = new stack_cas_session2([], $options, 123456);
@@ -2431,10 +2635,12 @@ public function test_unary_minus_zeros() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_make_mult_sgn_stackunits() {
+ public function test_make_mult_sgn_stackunits(): void {
+
$options = new stack_options();
$options->set_option('simplify', false);
$cs2 = new stack_cas_session2([], $options, 123456);
@@ -2453,10 +2659,12 @@ public function test_make_mult_sgn_stackunits() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_unexpected_lambda() {
+ public function test_unexpected_lambda(): void {
+
$a2 = ['a:b+1', 'c:a-a(d+1)'];
$s2 = [];
foreach ($a2 as $s) {
@@ -2477,10 +2685,12 @@ public function test_unexpected_lambda() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_format_moodle() {
+ public function test_format_moodle(): void {
+
$a2 = ['p1:diff(sin(x^2),x)'];
$s2 = [];
foreach ($a2 as $s) {
@@ -2512,10 +2722,12 @@ public function test_format_moodle() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_format_moodle_parsons() {
+ public function test_format_moodle_parsons(): void {
+
$a2 = ['thm:"The Great and Wonderful Theorem"',
'proof_steps:[["s1","Proof step 1"],["s2","Proof step 2"]]', ];
$s2 = [];
@@ -2548,10 +2760,12 @@ public function test_format_moodle_parsons() {
}
/**
+ * Add description here.
* @covers \qtype_stack\stack_cas_castext2_latex
* @covers \qtype_stack\stack_cas_keyval
*/
- public function test_sqrtdispflag() {
+ public function test_sqrtdispflag(): void {
+
// Test 1.
$a2 = ['p1:1+sqrt(x)'];
$s2 = [];
@@ -2584,7 +2798,7 @@ public function test_sqrtdispflag() {
$options = new stack_options();
$options->set_option('simplify', true);
$cs2 = new stack_cas_session2($s2, $options, 7);
-
+
$txtinput = '{@p1@}, {@block([sqrtdispflag],sqrtdispflag:false,p1)@}, {@p1@}';
// None of the expressions use ^(1/2) because the sqrtdispflag:false is a local variable.
$expected = '\({\sqrt{x}+1}\), \({\sqrt{x}+1}\), \({\sqrt{x}+1}\)';
diff --git a/tests/connection_test.php b/tests/connection_test.php
index 4231da0a133..e629fb8698b 100644
--- a/tests/connection_test.php
+++ b/tests/connection_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_testcase;
@@ -27,12 +34,14 @@
/**
+ * Add description here.
* @group qtype_stack
* @covers \stack_connection_helper
*/
-class connection_test extends qtype_stack_testcase {
+final class connection_test extends qtype_stack_testcase {
+
+ public function test_compute_true(): void {
- public function test_compute_true() {
$connection = stack_connection_helper::make();
$strin = 'cab:block([],print("[STACKSTART Locals= [ 0=[ error= ["), cte("p",errcatch(diff(x^n,x))),'
.' print("] ]"), return(true));';
@@ -46,7 +55,8 @@ public function test_compute_true() {
$this->assertEquals($expected, $return);
}
- public function test_compute_dispvalue() {
+ public function test_compute_dispvalue(): void {
+
$connection = stack_connection_helper::make();
$strin = 'cab:block([],print("[STACKSTART Locals= [ 0=[ error= ["), cte("p",errcatch(dispdp(1,3))),'
.' print("] ]"), return(true));';
@@ -60,7 +70,8 @@ public function test_compute_dispvalue() {
$this->assertEquals($expected, $return);
}
- public function test_compute_dispvalue_units() {
+ public function test_compute_dispvalue_units(): void {
+
$connection = stack_connection_helper::make();
$strin = 'cab:block([],print("[STACKSTART Locals= [ 0=[ error= ["), cte("p",errcatch(stackunits(dispsf(30,4),kg))),'
.' print("] ]"), return(true));';
@@ -74,10 +85,11 @@ public function test_compute_dispvalue_units() {
$this->assertEquals($expected, $return);
}
- /*
+ /**
* Note, with this test on SBCL the timeout can create a runaway process.
*/
- public function test_compute_miss_formed_command() {
+ public function test_compute_miss_formed_command(): void {
+
$connection = stack_connection_helper::make();
// This will induce a timeout on the CAS because we don't have a well formed CAS statement.
$strin = 'cab:block([],print("[STACKSTART ;';
diff --git a/tests/docslib_test.php b/tests/docslib_test.php
index 907d0731008..bdc2e790288 100644
--- a/tests/docslib_test.php
+++ b/tests/docslib_test.php
@@ -20,28 +20,34 @@
defined('MOODLE_INTERNAL') || die();
-// Unit tests for the documentation library functions.
-//
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+/**
+ * Unit tests for the documentation library functions.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
require_once(__DIR__ . '/../doc/docslib.php');
require_once(__DIR__ . '/fixtures/test_base.php');
/**
+ * Add description here.
* @group qtype_stack
* @covers \qtype_stack
*/
-class docslib_test extends qtype_stack_testcase {
+final class docslib_test extends qtype_stack_testcase {
+
+ public function test_stack_docs_title_from_filename(): void {
- public function test_stack_docs_title_from_filename() {
$this->assertEquals('About', stack_docs_title_from_filename('About'));
$this->assertEquals('Some folder', stack_docs_title_from_filename('Some_folder'));
$this->assertEquals('Documentation', stack_docs_title_from_filename('Documentation.md'));
$this->assertEquals('Future plans', stack_docs_title_from_filename('Future_plans.md'));
}
- public function test_stack_docs_index() {
+ public function test_stack_docs_index(): void {
+
global $CFG;
$this->assertEquals(str_replace('WWWROOT', $CFG->wwwroot, '' .
@@ -50,7 +56,8 @@ public function test_stack_docs_index() {
'LTI' .
'- ' .
'Mathjax
' .
- '- Maxima installation
' .
+ '- ' .
+ 'Maxima installation
' .
'- Migration
' .
'- ' .
'Optimising Maxima
' .
@@ -73,7 +80,8 @@ public function test_stack_docs_index() {
$CFG->wwwroot . '/question/type/stack/doc.php/Students'));
}
- public function test_stack_docs_render_markdown() {
+ public function test_stack_docs_render_markdown(): void {
+
global $CFG;
require_once($CFG->libdir . '/environmentlib.php');
$currentversion = normalize_version(get_config('', 'release'));
@@ -106,14 +114,16 @@ public function test_stack_docs_render_markdown() {
}
}
- public function test_stack_docs_render_markdown_with_proof() {
+ public function test_stack_docs_render_markdown_with_proof(): void {
+
$md = 'H1. Assume that \(3 \cdot 2^{172} + 1\) is a perfect square.
';
$ex = $md . "\n";
$this->assert_content_with_maths_equals($ex,
stack_docs_render_markdown($md));
}
- public function test_stack_docs_render_markdown_with_table() {
+ public function test_stack_docs_render_markdown_with_table(): void {
+
global $CFG;
require_once($CFG->libdir . '/environmentlib.php');
$currentversion = normalize_version(get_config('', 'release'));
diff --git a/tests/editform_test.php b/tests/editform_test.php
index 0e5e063c9ff..61d8cf02e68 100644
--- a/tests/editform_test.php
+++ b/tests/editform_test.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * Subclass of qtype_stack_edit_form_testable that is easier to use in unit tests.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
defined('MOODLE_INTERNAL') || die();
@@ -22,17 +30,14 @@
require_once($CFG->dirroot . '/question/engine/tests/helpers.php');
require_once(__DIR__ . '/../edit_stack_form.php');
-// Subclass of qtype_stack_edit_form_testable that is easier to use in unit tests.
-//
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
-
/**
+ * Subclass of qtype_stack_edit_form_testable that is easier to use in unit tests.
* @group qtype_stack
* @covers \qtype_stack_edit_form
*/
-class editform_test_class extends \qtype_stack_edit_form {
+final class editform_test_class extends \qtype_stack_edit_form {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
public function __construct($questiontext, $specificfeedback, $quizmoduleid) {
global $USER;
// ISS1325 - Use quiz context rather than system context as
@@ -76,13 +81,15 @@ public function __construct($questiontext, $specificfeedback, $quizmoduleid) {
/**
* Unit tests for Stack question editing form.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @group qtype_stack
* @covers \qtype_stack_edit_form
*/
-class editform_test extends \advanced_testcase {
+final class editform_test extends \advanced_testcase {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
protected function get_form($questiontext, $specificfeedback) {
$this->setAdminUser();
$this->resetAfterTest();
@@ -94,7 +101,8 @@ protected function get_form($questiontext, $specificfeedback) {
return new editform_test_class($questiontext, $specificfeedback, $quizmoduleid);
}
- public function test_get_input_names_from_question_text_default() {
+ public function test_get_input_names_from_question_text_default(): void {
+
$form = $this->get_form(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT,
\qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK);
$qtype = new \qtype_stack();
@@ -103,7 +111,8 @@ public function test_get_input_names_from_question_text_default() {
$qtype->get_input_names_from_question_text(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT));
}
- public function test_get_prt_names_from_question_default() {
+ public function test_get_prt_names_from_question_default(): void {
+
$form = $this->get_form(\qtype_stack_edit_form::DEFAULT_QUESTION_TEXT,
\qtype_stack_edit_form::DEFAULT_SPECIFIC_FEEDBACK);
$qtype = new \qtype_stack();
diff --git a/tests/fact_sheets_test.php b/tests/fact_sheets_test.php
index fb95047bb2d..bddfab3019e 100644
--- a/tests/fact_sheets_test.php
+++ b/tests/fact_sheets_test.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
namespace qtype_stack;
use qtype_stack_testcase;
@@ -27,23 +34,27 @@
// Unit tests for {@link stack_fact_sheets}.
/**
+ * Add description here.
* @group qtype_stack
* @covers \stack_fact_sheets
*/
-class fact_sheets_test extends qtype_stack_testcase {
+final class fact_sheets_test extends qtype_stack_testcase {
+
+ public function test_basic_castext_instantiation(): void {
- public function test_basic_castext_instantiation() {
$this->assertEquals([], stack_fact_sheets::get_unrecognised_tags('Hello world'));
}
- public function test_trap_bad_fact_sheet_names() {
+ public function test_trap_bad_fact_sheet_names(): void {
+
$this->assertEquals([0 => 'bad_hint', 1 => 'badder_hint'],
stack_fact_sheets::get_unrecognised_tags(
"This is some CAStext with a [[facts:bad_hint]] " .
"and yet another [[facts:badder_hint]]"));
}
- public function test_legacy_convert() {
+ public function test_legacy_convert(): void {
+
$this->assertEquals("An [[facts:old_hint]] and [[facts:older_hint]].",
stack_fact_sheets::convert_legacy_tags("An old_hint and older_hint ."));
}
diff --git a/tests/fixtures/answertestfixtures.class.php b/tests/fixtures/answertestfixtures.class.php
index fb08687dfcb..b6f263d8062 100644
--- a/tests/fixtures/answertestfixtures.class.php
+++ b/tests/fixtures/answertestfixtures.class.php
@@ -21,6 +21,7 @@
* correctly, and second it serves to document the expected behaviour of answer
* tests, which is useful for learning how they work.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -29,13 +30,21 @@
require_once('equivfixtures.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_answertest_test_data {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const NAME = 0;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const OPTIONS = 1;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const SANS = 2;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const TANS = 3;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const SCORE = 4;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const ANSNOTE = 5;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const NOTES = 6;
/**
@@ -54,6 +63,7 @@ class stack_answertest_test_data {
* Comments on this test.
* Header row in the table (optional).
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdata = [
['AlgEquiv', '', '1/0', '1', -1, 'ATAlgEquiv_STACKERROR_SAns.', ''],
@@ -2755,11 +2765,13 @@ class stack_answertest_test_data {
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data() {
$equiv = new stack_equiv_test_data();
return array_merge(self::$rawdata, $equiv->get_answertestfixtures());
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_available_tests() {
$availabletests = [];
foreach (self::$rawdata as $test) {
@@ -2768,6 +2780,7 @@ public static function get_available_tests() {
return $availabletests;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function test_from_raw($data) {
$test = new stdClass();
@@ -2781,6 +2794,7 @@ public static function test_from_raw($data) {
return $test;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_all() {
$tests = [];
$rawdata = self::get_raw_test_data();
@@ -2790,6 +2804,7 @@ public static function get_all() {
return $tests;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_tests_for($anstest) {
$tests = [];
$rawdata = self::get_raw_test_data();
@@ -2802,6 +2817,7 @@ public static function get_tests_for($anstest) {
return $tests;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function run_test($test) {
$sans = stack_ast_container::make_from_teacher_source($test->studentanswer, '', new stack_cas_security());
$tans = stack_ast_container::make_from_teacher_source($test->teacheranswer, '', new stack_cas_security());
diff --git a/tests/fixtures/apifixtures.class.php b/tests/fixtures/apifixtures.class.php
index 3dffd7eae80..81554492f95 100644
--- a/tests/fixtures/apifixtures.class.php
+++ b/tests/fixtures/apifixtures.class.php
@@ -17,11 +17,14 @@
/**
*
+ * @package qtype_stack
* @copyright 2024 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_api_test_data {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static array $questiondata = [
'matrices' =>
'
@@ -1732,15 +1735,18 @@ class stack_api_test_data {
',
];
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static array $answers = [
'matrices_correct' => '{"ans1_sub_0_0": "35", "ans1_sub_0_1": "30", "ans1_sub_1_0": "28", "ans1_sub_1_1": "24"}',
'multiple_mixed' => '{"ans1": "3", "ans2": "1", "ans3": "0", "ans4": "0"}',
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_question_string(string $name): string {
return self::$questiondata[$name];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_answer_string(string $name): string {
return self::$answers[$name];
}
diff --git a/tests/fixtures/ast_filter_test_base.php b/tests/fixtures/ast_filter_test_base.php
index f820ffeba9c..b3a119ed5a8 100644
--- a/tests/fixtures/ast_filter_test_base.php
+++ b/tests/fixtures/ast_filter_test_base.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../locallib.php');
@@ -30,6 +37,7 @@
* see what happened when they were created and that things still work
* the same.
*
+ * @package qtype_stack
* @copyright 2019 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -98,6 +106,7 @@ public function expect(string $input, string $result, $notes=[],
}
/**
+ * Add description here
* @param MP_Node $ast
*/
public function assert_marked_invalid($ast) {
@@ -115,6 +124,7 @@ public function assert_marked_invalid($ast) {
}
/**
+ * Add description here
* @param MP_Node $ast
*/
public function assert_not_marked_invalid($ast) {
diff --git a/tests/fixtures/equivfixtures.class.php b/tests/fixtures/equivfixtures.class.php
index b28379843d7..78c658f8f45 100644
--- a/tests/fixtures/equivfixtures.class.php
+++ b/tests/fixtures/equivfixtures.class.php
@@ -15,16 +15,21 @@
// along with Stack. If not, see .
/**
+ * Add description here!
+ * @package qtype_stack
* @copyright 2017 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_equiv_test_data {
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $rawdata;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
public $answertestfixtures;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __construct() {
$samplearguments = [];
@@ -1641,6 +1646,7 @@ public function __construct() {
$this->rawdata = $samplearguments;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_answertestfixtures() {
// Reformulate the data into answer test fixtures.
$answertestfixtures = [];
diff --git a/tests/fixtures/inputfixtures.class.php b/tests/fixtures/inputfixtures.class.php
index 0bec4949dc6..87a9c7ed428 100644
--- a/tests/fixtures/inputfixtures.class.php
+++ b/tests/fixtures/inputfixtures.class.php
@@ -19,6 +19,7 @@
*
* This helps us verify how STACK "validates" strings supplied by the student.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -27,20 +28,31 @@
require_once(__DIR__ . '/../../stack/cas/cassession2.class.php');
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_inputvalidation_test_data {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const RAWSTRING = 0;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const PHPVALID = 1;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const PHPCASSTRING = 2;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const CASVALID = 3;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const DISPLAY = 4;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const ANSNOTES = 5;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const NOTES = 6;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const BRITISH = 1;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const CONTINENTIAL = 2;
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdata = [
['123', 'php_true', '123', 'cas_true', '123', '', ""],
@@ -692,6 +704,7 @@ function at a point \(f(x)\). Maybe a 'gocha' for the question author....",
],
];
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdataunits = [
['123', 'php_true', '123', 'cas_true', '123', 'Units_SA_no_units', "Units"],
['9.81*m/s^2', 'php_true', 'dispdp(9.81,2)*m/s^2', 'cas_true', '9.81\, {\mathrm{m}}/{\mathrm{s}^2}', '', ""],
@@ -738,6 +751,7 @@ function at a point \(f(x)\). Maybe a 'gocha' for the question author....",
],
];
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdatadecimals = [
[
0 => '123',
@@ -818,18 +832,22 @@ function at a point \(f(x)\). Maybe a 'gocha' for the question author....",
],
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data() {
return self::$rawdata;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data_units() {
return self::$rawdataunits;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data_decimals() {
return self::$rawdatadecimals;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function test_from_raw($data, $validationmethod) {
$test = new stdClass();
@@ -852,6 +870,7 @@ public static function test_from_raw($data, $validationmethod) {
return $test;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function test_decimals_from_raw($data, $decimals) {
$test = new stdClass();
@@ -877,6 +896,7 @@ public static function test_decimals_from_raw($data, $decimals) {
return $test;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_all() {
$tests = [];
foreach (self::$rawdata as $data) {
@@ -888,6 +908,7 @@ public static function get_all() {
return $tests;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function run_test($test) {
// @codingStandardsIgnoreStart
diff --git a/tests/fixtures/maximacorrectiveparser.class.php b/tests/fixtures/maximacorrectiveparser.class.php
index 9ae9fec1f27..a829ee4fcc3 100644
--- a/tests/fixtures/maximacorrectiveparser.class.php
+++ b/tests/fixtures/maximacorrectiveparser.class.php
@@ -21,18 +21,24 @@
* correctly, and second it serves to document the expected behaviour of answer
* tests, which is useful for learning how they work.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class maxima_corrective_parser_test_data {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const RAWINPUT = 0; // What a student might type.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const PARSED = 1; // What we expect to get from maxima corrective parser.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const EXPECTNOTES = 2; // Expected array of answer notes.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const EXPECTERRS = 3; // Expected array of errors.
-
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdata = [
['2x', '2*x', [0 => 'missing_stars'], []],
['sin(x)a', 'sin(x)*a', [0 => 'missing_stars'], []],
@@ -99,10 +105,12 @@ class maxima_corrective_parser_test_data {
],
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data() {
return self::$rawdata;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function test_from_raw($data) {
$test = new stdClass();
$test->rawinput = $data[self::RAWINPUT];
@@ -115,6 +123,7 @@ public static function test_from_raw($data) {
return $test;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function run_test($test) {
$notes = [];
$errors = [];
diff --git a/tests/fixtures/numbersfixtures.class.php b/tests/fixtures/numbersfixtures.class.php
index 635930bc4fc..74cbbe145f3 100644
--- a/tests/fixtures/numbersfixtures.class.php
+++ b/tests/fixtures/numbersfixtures.class.php
@@ -18,14 +18,17 @@
* This script provides test cases for the numerical rounding tests.
*
*
+ * @package qtype_stack
* @copyright 2016 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_numbers_test_data {
// In this text digits are 1-9 and 0 is not a digit.
// array("string", lower, upper, decimal places, dispvalue, err).
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdata = [
["0", 1, 1, 0, '"~a"', '0', ''], // Decision: zero has one significant digit.
@@ -69,6 +72,7 @@ class stack_numbers_test_data {
];
// Use the format array("string", lower, upper, decimal places).
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdatautils = [
// Scientific notation.
@@ -92,10 +96,12 @@ class stack_numbers_test_data {
["3434...34*34", 4, 4, 0, '"~a"'],
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data() {
return self::$rawdata;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data_utils() {
return self::$rawdatautils;
}
diff --git a/tests/fixtures/subscriptsfixtures.class.php b/tests/fixtures/subscriptsfixtures.class.php
index 656c68fa67b..cbd57f662a0 100644
--- a/tests/fixtures/subscriptsfixtures.class.php
+++ b/tests/fixtures/subscriptsfixtures.class.php
@@ -17,24 +17,34 @@
/**
* This script checks display of subscript elements.
*
+ * @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class stack_subscripts_test_data {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const RAWINPUT = 0; // What a student might type.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const MAXIMA = 1; // Correct maxima syntax, as extended by STACK.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const MAXIMASIMP = 2; // Correct maxima syntax, as extended by STACK, with simp:true.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const TEX = 3; // TeX output from stack_disp.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const TEXSIMP = 4; // TeX output from stack_disp with simp:true.
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const NOTES = 5;
- /* Raw data should be in the following form.
+ /**
+ * Raw data should be in the following form.
* Input, as a raw (but syntactically valid, string.
* Maxima representation
* TeX string
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdata = [
['Delta*v_x', 'Delta*v_x', '!', '\Delta\,{v}_{x}', '!'],
['Delta*v_x0', 'Delta*v_x0', '!', '\Delta\,{v}_{x_{0}}', '!'],
@@ -115,6 +125,7 @@ class stack_subscripts_test_data {
['F_1x', 'F_1x', '!', '{F}_{\text{1x}}', '!'],
];
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected static $rawdatalegacy = [
['Delta*v_x', 'Delta*v_x', '!', '\Delta\,{v}_{x}', '!'],
['Delta*v_x0', 'Delta*v_x0', '!', '\Delta\,{v}_{{\it x_0}}', '!'],
@@ -189,14 +200,17 @@ class stack_subscripts_test_data {
['F_1x', 'F_1x', '!', '{F}_{\text{1x}}', '!'],
];
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data() {
return self::$rawdata;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function get_raw_test_data_legacy() {
return self::$rawdatalegacy;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function test_from_raw($data) {
$test = new stdClass();
$test->rawinput = $data[self::RAWINPUT];
@@ -215,6 +229,7 @@ public static function test_from_raw($data) {
return $test;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function run_test($test, $simp) {
$sec = new stack_cas_security();
diff --git a/tests/fixtures/test_base.php b/tests/fixtures/test_base.php
index 4ab3f6fd15f..ac1030d9dd6 100644
--- a/tests/fixtures/test_base.php
+++ b/tests/fixtures/test_base.php
@@ -14,6 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * Add description here!
+ * @package qtype_stack
+ * @copyright 2024 University of Edinburgh.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
global $CFG;
@@ -26,18 +33,22 @@
* needs to call maxima will work (providing you have set up the neccessary
* defines in phpunit.xml.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class qtype_stack_testcase extends advanced_testcase {
- /* Different underlying versions of LISP (behind Maxima) have different results,
+ /**
+ * Different underlying versions of LISP (behind Maxima) have different results,
* especially with the floating point routines upon which Maxima relies.
*
* This must only be CLISP or SBCL.
*/
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $lisp = 'SBCL';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function setUp(): void {
parent::setUp();
@@ -210,7 +221,7 @@ public function assert_equals_ignore_spaces_and_e(string $expected, string $actu
$this->assertEquals($e, $a);
}
- // phpcs:ignore moodle.NamingConventions.ValidFunctionName.LowercaseMethod
+ // phpcs:ignore moodle.NamingConventions.ValidFunctionName.LowercaseMethod, moodle.Commenting.MissingDocblock.Function
public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void {
// TO-DO remove this once Moodle 3.11 is the lowest supported version.
if (method_exists('advanced_testcase', 'assertMatchesRegularExpression')) {
@@ -221,7 +232,7 @@ public static function assertMatchesRegularExpression(string $pattern, string $s
}
// phpcs:enable
- // phpcs:ignore moodle.NamingConventions.ValidFunctionName.LowercaseMethod
+ // phpcs:ignore moodle.NamingConventions.ValidFunctionName.LowercaseMethod, moodle.Commenting.MissingDocblock.Function
public static function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = ''): void {
// TO-DO remove this once Moodle 3.11 is the lowest supported version.
if (method_exists('advanced_testcase', 'assertDoesNotMatchRegularExpression')) {
@@ -239,22 +250,27 @@ public static function assertDoesNotMatchRegularExpression(string $pattern, stri
*
* Sets up the Maxima connection, and provides some additional asserts.
*
+ * @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class qtype_stack_walkthrough_test_base extends \qbehaviour_walkthrough_test_base {
+ // phpcs:ignore moodle.Commenting.VariableComment.Missing
protected $currentoutput = null;
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function setUp(): void {
parent::setUp();
qtype_stack_testcase::setup_test_maxima_connection($this);
$this->resetAfterTest();
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function render() {
$this->currentoutput = $this->quba->render_question($this->slot, $this->displayoptions);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function get_tag_matcher($tag, $attributes) {
return [
'tag' => $tag,
@@ -262,6 +278,7 @@ protected function get_tag_matcher($tag, $attributes) {
];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_prt_score($index, $score, $penalty, $finalsubmit = false) {
$question = $this->quba->get_question($this->slot);
$attempt = $this->quba->get_question_attempt($this->slot);
@@ -294,6 +311,7 @@ protected function check_prt_score($index, $score, $penalty, $finalsubmit = fals
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_answer_note($index, $note) {
$question = $this->quba->get_question($this->slot);
$attempt = $this->quba->get_question_attempt($this->slot);
@@ -303,6 +321,7 @@ protected function check_answer_note($index, $note) {
$this->assertEquals($note, implode(' | ', $result->get_answernotes()));
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_response_summary($note) {
$question = $this->quba->get_question($this->slot);
$attempt = $this->quba->get_question_attempt($this->slot);
@@ -310,7 +329,7 @@ protected function check_response_summary($note) {
$this->assertEquals($note, $qs->get_new_response_summary());
}
- /*
+ /**
* This function is needed because Maxima versions generate different error messages.
*/
protected function check_response_summary_contains($note) {
@@ -320,6 +339,7 @@ protected function check_response_summary_contains($note) {
$this->assertTrue((strpos($qs->get_new_response_summary(), $note) !== false));
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_contains_text_input($name, $value = null, $enabled = true) {
$attributes = [
'type' => 'text',
@@ -344,6 +364,7 @@ protected function check_output_contains_text_input($name, $value = null, $enabl
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_contains_textarea_input($name, $content = null, $enabled = true) {
$attributes = [
'name' => $this->quba->get_field_prefix($this->slot) . $name,
@@ -368,6 +389,7 @@ protected function check_output_contains_textarea_input($name, $content = null,
}
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_contains_input_validation($name) {
$id = $this->quba->get_question_attempt($this->slot)->get_qt_field_name($name . '_val');
$this->assertMatchesRegularExpression('~]*\bclass="stackinputfeedback standard")(?=[^>]*\bid="' .
@@ -376,6 +398,7 @@ protected function check_output_contains_input_validation($name) {
'Input validation for ' . $name . ' not found in ' . $this->currentoutput);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_contains_input_validation_compact($name) {
$id = $this->quba->get_question_attempt($this->slot)->get_qt_field_name($name . '_val');
$this->assertMatchesRegularExpression('~]*\bclass="stackinputfeedback compact")(?=[^>]*\bid="' .
@@ -384,6 +407,7 @@ protected function check_output_contains_input_validation_compact($name) {
'Input validation for ' . $name . ' not found in ' . $this->currentoutput);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_does_not_contain_any_input_validation() {
$this->assertDoesNotMatchRegularExpression('~]*\bclass="stackinputfeedback standard(?:(?! empty)[^"])*"~',
$this->currentoutput, 'Input validation should not be present in ' . $this->currentoutput);
@@ -391,6 +415,7 @@ protected function check_output_does_not_contain_any_input_validation() {
$this->currentoutput, 'Input validation should not be present in ' . $this->currentoutput);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_does_not_contain_input_validation($name = null) {
if (!$name) {
$this->check_output_does_not_contain_any_input_validation();
@@ -403,6 +428,7 @@ protected function check_output_does_not_contain_input_validation($name = null)
'Input validation for ' . $name . ' should not be present in ' . $this->currentoutput);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_contains_prt_feedback($name = null) {
$class = 'stackprtfeedback';
if ($name) {
@@ -412,6 +438,7 @@ protected function check_output_contains_prt_feedback($name = null) {
'PRT feedback for ' . $name . ' not found in ' . $this->currentoutput);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_does_not_contain_prt_feedback($name = null) {
$class = 'stackprtfeedback';
if ($name) {
@@ -421,22 +448,26 @@ protected function check_output_does_not_contain_prt_feedback($name = null) {
'PRT feedback for ' . $name . ' should not be present in ' . $this->currentoutput);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_does_not_contain_stray_placeholders() {
$this->assertDoesNotMatchRegularExpression('~\[\[|\]\]~', $this->currentoutput, 'Not all placehoders were replaced.');
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_contains_lang_string($identifier, $component = '', $a = null) {
$string = get_string($identifier, $component, $a);
$this->assertStringContainsString($string, $this->currentoutput,
'Expected string ' . $string . ' not found in ' . $this->currentoutput);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_does_not_contain_lang_string($identifier, $component = '', $a = null) {
$string = get_string($identifier, $component, $a);
$this->assertStringNotContainsString($string, $this->currentoutput,
'The string ' . $string . ' should not be present in ' . $this->currentoutput);
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function check_output_does_not_contain_text($str) {
$this->assertStringNotContainsString($str, $this->currentoutput,
'The string ' . $str . ' should not be present in ' . $this->currentoutput);
@@ -478,7 +509,7 @@ protected function assert_same_select_html($expected, $actual) {
$this->assertEquals($expected, $actual);
}
- // phpcs:ignore moodle.NamingConventions.ValidFunctionName.LowercaseMethod
+ // phpcs:ignore moodle.NamingConventions.ValidFunctionName.LowercaseMethod, moodle.Commenting.MissingDocblock.Function
public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void {
// TO-DO remove this once Moodle 3.11 is the lowest supported version.
if (method_exists('advanced_testcase', 'assertMatchesRegularExpression')) {
@@ -489,8 +520,8 @@ public static function assertMatchesRegularExpression(string $pattern, string $s
}
// phpcs:enable
- // phpcs:ignore moodle.NamingConventions.ValidFunctionName.LowercaseMethod
- public static function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = '') : void {
+ // phpcs:ignore moodle.NamingConventions.ValidFunctionName.LowercaseMethod, moodle.Commenting.MissingDocblock.Function
+ public static function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = ''): void {
// TO-DO remove this once Moodle 3.11 is the lowest supported version.
if (method_exists('advanced_testcase', 'assertDoesNotMatchRegularExpression')) {
parent::assertDoesNotMatchRegularExpression($pattern, $string, $message);
diff --git a/tests/fixtures/test_maxima_configuration.php b/tests/fixtures/test_maxima_configuration.php
index 0284a59ef86..0b691f23557 100644
--- a/tests/fixtures/test_maxima_configuration.php
+++ b/tests/fixtures/test_maxima_configuration.php
@@ -29,10 +29,12 @@
/**
* Helper class for setting up the STACK configuration for automated tests.
*
+ * @package qtype_stack
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class qtype_stack_test_config {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function is_test_config_available() {
// Either the platform is already non-default (e.g.
// because auto-optimse worked during install, or
diff --git a/tests/generator/behat_qtype_stack_generator.php b/tests/generator/behat_qtype_stack_generator.php
index 53fa9a6cf36..ff1440adc47 100644
--- a/tests/generator/behat_qtype_stack_generator.php
+++ b/tests/generator/behat_qtype_stack_generator.php
@@ -28,6 +28,7 @@
*/
class behat_qtype_stack_generator extends behat_generator_base {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
protected function get_creatable_entities(): array {
return [
'Deployed variants' => [
diff --git a/tests/graphlayout_test.php b/tests/graphlayout_test.php
index fb3706777f8..962b0580557 100644
--- a/tests/graphlayout_test.php
+++ b/tests/graphlayout_test.php
@@ -14,6 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see .
+/**
+ * Unit tests for stack_abstract_graph and friends.
+ *
+ * @package qtype_stack
+ * @copyright 2013 The Open Unviersity.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ * @group qtype_stack
+ * @covers \stack_abstract_graph
+ */
+
namespace qtype_stack;
use stack_abstract_graph;
@@ -23,23 +33,20 @@
require_once(__DIR__ . '/../stack/graphlayout/graph.php');
-// Unit tests for stack_abstract_graph and friends.
-//
-// @copyright 2013 The Open Unviersity.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
-
/**
+ * Unit tests for stack_abstract_graph and friends.
* @group qtype_stack
* @covers \stack_abstract_graph
*/
-class graphlayout_test extends basic_testcase {
+final class graphlayout_test extends basic_testcase {
/**
* This graph has 4 nodes and should look like:
* /\
* \
*/
- public function test_simple_graph() {
+ public function test_simple_graph(): void {
+
$graph = new stack_abstract_graph();
$graph->add_node(1, '', 2, 3, '=1', '=0');
$graph->add_node(2, '', null, 4, '+0.1', '-0.1');
@@ -76,7 +83,8 @@ public function test_simple_graph() {
* This is quite a common pattern in STACK questions.
* Also, here we test layout out a graph where the root node is not first.
*/
- public function test_linear_graph() {
+ public function test_linear_graph(): void {
+
$graph = new stack_abstract_graph();
$graph->add_node(2, '', null, null, '+0.1', '-0.1');
$graph->add_node(1, '', 2, 2, '=1', '=0');
@@ -100,7 +108,8 @@ public function test_linear_graph() {
/**
* This graph has 1 node and contains a loop. We verify it is detected.
*/
- public function test_loop_detection() {
+ public function test_loop_detection(): void {
+
$graph = new stack_abstract_graph();
$graph->add_node(1, '', 1, 1, '=1', '=0');
$graph->layout();
@@ -121,7 +130,8 @@ public function test_loop_detection() {
/**
* This graph has 2 distinct nodes. We verify that they are both detected as roots.
*/
- public function test_two_roots() {
+ public function test_two_roots(): void {
+
$graph = new stack_abstract_graph();
$graph->add_node(1, '', null, null, '=1', '=0');
$graph->add_node(2, '', null, null, '=1', '=0');
@@ -142,7 +152,8 @@ public function test_two_roots() {
/**
* This graph has a link to a non-existent node. We verify that throws an exception.
*/
- public function test_missing_node() {
+ public function test_missing_node(): void {
+
$this->expectException(\coding_exception::class);
$graph = new stack_abstract_graph();
$graph->add_node(1, '', null, 2, '=1', '=0');
@@ -153,7 +164,8 @@ public function test_missing_node() {
/**
* This graph has a link to a non-existent node. We verify that throws an exception.
*/
- public function test_get_suggested_node_names() {
+ public function test_get_suggested_node_names(): void {
+
$graph = new stack_abstract_graph();
$graph->add_node(1, '', 2, 3);
$graph->add_node(2, '', 7, null);
diff --git a/tests/helper.php b/tests/helper.php
index bd035177b8e..3ad07505b43 100644
--- a/tests/helper.php
+++ b/tests/helper.php
@@ -14,24 +14,28 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * Test helper code for the Stack question type.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '../../stack/potentialresponsetreestate.class.php');
-// Test helper code for the Stack question type.
-//
-// @package qtype_stack.
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
-
-/**
- * @group qtype_stack
- */
-class qtype_stack_test_helper extends question_test_helper {
+// phpcs:ignore moodle.Commenting.MissingDocblock.Class
+final class qtype_stack_test_helper extends question_test_helper {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const DEFAULT_CORRECT_FEEDBACK = 'Correct answer, well done.
';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const DEFAULT_PARTIALLYCORRECT_FEEDBACK = 'Your answer is partially correct.
';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Constant
const DEFAULT_INCORRECT_FEEDBACK = 'Incorrect answer.
';
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_test_questions() {
return [
'test0', // One input, one PRT, not randomised. 1 + 1 = 2.
@@ -150,6 +154,7 @@ protected static function make_a_stack_question() {
}
/**
+ * Add description here.
* @return qtype_stack_question a very elementary question.
*/
public static function make_stack_question_test0() {
@@ -211,6 +216,7 @@ public static function make_stack_question_test0() {
}
/**
+ * Add description here.
* @return qtype_stack_question the question from the test1.xml file.
*/
public static function make_stack_question_test1() {
@@ -263,6 +269,7 @@ public static function make_stack_question_test1() {
return $q;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_stack_question_form_data_test1() {
$formform = new stdClass();
@@ -368,6 +375,7 @@ public function get_stack_question_form_data_test1() {
}
/**
+ * Add description here.
* @return qtype_stack_question the question from the test2.xml file.
*/
public static function make_stack_question_test2() {
@@ -408,6 +416,7 @@ public static function make_stack_question_test2() {
}
/**
+ * Add description here.
* @return qtype_stack_question the question from the test3.xml file.
*/
public static function make_stack_question_test3() {
@@ -627,6 +636,7 @@ public static function make_stack_question_test3() {
}
/**
+ * Add description here.
* @return qtype_stack_question the question from the test3.xml file.
*/
public static function make_stack_question_test3_penalty0_1() {
@@ -848,6 +858,7 @@ public static function make_stack_question_test3_penalty0_1() {
}
/**
+ * Add description here.
* @return qtype_stack_question the question from the test4.xml file.
*/
public static function make_stack_question_test4() {
@@ -907,6 +918,7 @@ public static function make_stack_question_test4() {
}
/**
+ * Add description here.
* @return qtype_stack_question in which the expected answer in the true/false input is generated from the question variables...
* and the question variables define the scores in the PRT.
*/
@@ -965,6 +977,7 @@ public static function make_stack_question_test_boolean() {
}
/**
+ * Add description here.
* @return qtype_stack_question the question from the test8.xml file.
*/
public static function make_stack_question_test8() {
@@ -1080,6 +1093,7 @@ public static function make_stack_question_test8() {
}
/**
+ * Add description here.
* @return qtype_stack_question the question from the test9.xml file.
*/
public static function make_stack_question_test9() {
@@ -1169,6 +1183,7 @@ public static function make_stack_question_test9() {
}
/**
+ * Add description here.
* @return qtype_stack_question.
*/
public static function make_stack_question_divide() {
@@ -1227,6 +1242,7 @@ public static function make_stack_question_divide() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question using a numerical precision answertest.
*/
public static function make_stack_question_numsigfigs() {
@@ -1285,6 +1301,7 @@ public static function make_stack_question_numsigfigs() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question using a numerical precision answertest, with trailing zeros.
*/
public static function make_stack_question_numsigfigszeros() {
@@ -1343,6 +1360,7 @@ public static function make_stack_question_numsigfigszeros() {
}
/**
+ * Add description here.
* @return qtype_stack_question the question which uses numerical precision feedback variables.
*/
public static function make_stack_question_numdpsfeedbackvars() {
@@ -1404,6 +1422,7 @@ public static function make_stack_question_numdpsfeedbackvars() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question using a numerical precision answertest.
*/
public static function make_stack_question_units() {
@@ -1464,6 +1483,7 @@ public static function make_stack_question_units() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question using a numerical precision answertest.
*/
public static function make_stack_question_unitsoptions() {
@@ -1524,6 +1544,7 @@ public static function make_stack_question_unitsoptions() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question using a units and algebraic input.
*/
public static function make_stack_question_unitsmulti() {
@@ -1587,6 +1608,7 @@ public static function make_stack_question_unitsmulti() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question using equivalence reasoning to solve a quadratic equation.
*/
public static function make_stack_question_equiv_quad() {
@@ -1647,6 +1669,7 @@ public static function make_stack_question_equiv_quad() {
}
/**
+ * Add description here.
* @return qtype_stack_question with two PRTs with different values.
*/
public static function make_stack_question_1input2prts() {
@@ -1739,6 +1762,7 @@ public static function make_stack_question_1input2prts() {
}
/**
+ * Add description here.
* @return qtype_stack_question a information item, rather than a question.
*/
public static function make_stack_question_information() {
@@ -1758,6 +1782,7 @@ public static function make_stack_question_information() {
}
/**
+ * Add description here.
* @return qtype_stack_question with variable grades
*/
public static function get_stack_question_data_variable_grade() {
@@ -1872,6 +1897,7 @@ public static function get_stack_question_data_variable_grade() {
}
/**
+ * Add description here.
* @return qtype_stack_question a 'survey' item. Inputs, but no grading.
*/
public static function make_stack_question_survey() {
@@ -1893,6 +1919,7 @@ public static function make_stack_question_survey() {
}
/**
+ * Add description here.
* @return qtype_stack_question a very elementary question assuming single letter variables.
*/
public static function make_stack_question_single_char_vars() {
@@ -1950,6 +1977,7 @@ public static function make_stack_question_single_char_vars() {
return $q;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make_stack_question_runtime_prt_err() {
$q = self::make_a_stack_question();
@@ -2055,6 +2083,7 @@ public static function make_stack_question_runtime_prt_err() {
return $q;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make_stack_question_runtime_ses_err() {
$q = self::make_a_stack_question();
@@ -2108,6 +2137,7 @@ public static function make_stack_question_runtime_ses_err() {
return $q;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public static function make_stack_question_runtime_cas_err() {
$q = self::make_a_stack_question();
@@ -2162,6 +2192,7 @@ public static function make_stack_question_runtime_cas_err() {
}
/**
+ * Add description here.
* @return stdClass the question from the test0.xml file.
*/
public static function get_stack_question_data_test0() {
@@ -2276,6 +2307,7 @@ public static function get_stack_question_data_test0() {
}
/**
+ * Add description here.
* @return stdClass the question from the test3.xml file.
*/
public static function get_stack_question_data_test3() {
@@ -2614,6 +2646,7 @@ public static function get_stack_question_data_test3() {
return $qdata;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function get_stack_question_form_data_test3() {
$formform = new stdClass();
@@ -3069,6 +3102,7 @@ public function get_stack_question_form_data_test3() {
}
/**
+ * Add description here.
* @return qtype_stack_question a very elementary question.
*/
public static function make_stack_question_checkbox_all_empty() {
@@ -3132,6 +3166,7 @@ public static function make_stack_question_checkbox_all_empty() {
}
/**
+ * Add description here.
* @return qtype_stack_question a checkbox question using %union, which was problematic
*/
public static function make_stack_question_checkbox_union() {
@@ -3192,6 +3227,7 @@ public static function make_stack_question_checkbox_union() {
}
/**
+ * Add description here.
* @return qtype_stack_question a checkbox question using %union, which was problematic
*/
public static function make_stack_question_checkbox_noun_diff() {
@@ -3252,6 +3288,7 @@ public static function make_stack_question_checkbox_noun_diff() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question which tests checking for addrow in an older question.
*/
public static function make_stack_question_addrow() {
@@ -3314,6 +3351,7 @@ public static function make_stack_question_addrow() {
}
/**
+ * Add description here.
* @return qtype_stack_question.
*/
public static function make_stack_question_mul() {
@@ -3373,6 +3411,7 @@ public static function make_stack_question_mul() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question which uses ATStringSloppy.
*/
public static function make_stack_question_stringsloppy() {
@@ -3457,6 +3496,7 @@ public static function make_stack_question_stringsloppy() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question which uses ATSRegExp.
*/
public static function make_stack_question_sregexp() {
@@ -3520,6 +3560,7 @@ public static function make_stack_question_sregexp() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question which uses ATSRegExp.
*/
public static function make_stack_question_feedbackstyle() {
@@ -3658,6 +3699,7 @@ public static function make_stack_question_feedbackstyle() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question which tests context variables.
*/
public static function make_stack_question_contextvars() {
@@ -3745,6 +3787,7 @@ public static function make_stack_question_contextvars() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question which tests mismatched languages.
*/
public static function make_stack_question_multilang() {
@@ -3837,6 +3880,7 @@ public static function make_stack_question_multilang() {
}
/**
+ * Add description here.
* @return qtype_stack_question a question which tests language blocks.
*/
public static function make_stack_question_lang_blocks() {
@@ -3903,6 +3947,7 @@ public static function make_stack_question_lang_blocks() {
}
/**
+ * Add description here.
* @return qtype_stack_question.
*/
public static function make_stack_question_block_locals() {
@@ -3964,6 +4009,7 @@ public static function make_stack_question_block_locals() {
}
/**
+ * Add description here.
* @return qtype_stack_question.
*/
public static function make_stack_question_validator() {
@@ -4037,6 +4083,7 @@ public static function make_stack_question_validator() {
}
/**
+ * Add description here.
* @return qtype_stack_question.
*/
public static function make_stack_question_feedback() {
@@ -4159,6 +4206,7 @@ public static function make_stack_question_feedback() {
}
/**
+ * Add description here.
* @return qtype_stack_question.
*/
public static function make_stack_question_ordergreat() {
@@ -4225,6 +4273,7 @@ public static function make_stack_question_ordergreat() {
}
/**
+ * Add description here.
* @return qtype_stack_question.
*/
public static function make_stack_question_exdowncase() {
@@ -4313,6 +4362,7 @@ public static function make_stack_question_exdowncase() {
}
/**
+ * Add description here.
* @return qtype_stack_question.
*/
public static function make_stack_question_bailout() {
diff --git a/tests/input_algebraic_test.php b/tests/input_algebraic_test.php
index 500d78503b0..f2e16745230 100644
--- a/tests/input_algebraic_test.php
+++ b/tests/input_algebraic_test.php
@@ -31,18 +31,19 @@
require_once(__DIR__ . '/../stack/input/factory.class.php');
-// Unit tests for stack_algebra_input.
-//
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
-
/**
+ * Unit tests for stack_algebra_input.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
* @group qtype_stack
* @covers \stack_algebraic_input
*/
-class input_algebraic_test extends qtype_stack_testcase {
+final class input_algebraic_test extends qtype_stack_testcase {
+
+ public function test_internal_validate_parameter(): void {
- public function test_internal_validate_parameter() {
$el = stack_input_factory::make('algebraic', 'input', 'x^2');
$this->assertTrue($el->validate_parameter('boxWidth', 30));
$this->assertFalse($el->validate_parameter('boxWidth', -10));
@@ -54,7 +55,8 @@ public function test_internal_validate_parameter() {
$this->assertFalse($el->validate_parameter('showValidation', 5));
}
- public function test_render_blank() {
+ public function test_render_blank(): void {
+
$el = stack_input_factory::make('algebraic', 'ans1', 'x^2');
$this->assertEquals('set_parameter('options', 'allowempty');
@@ -76,7 +79,8 @@ public function test_render_blank_allowempty() {
'stack1__ans1', false, null));
}
- public function test_render_zero() {
+ public function test_render_zero(): void {
+
$el = stack_input_factory::make('algebraic', 'ans1', '0');
$this->assertEquals('assertEquals('assertEquals('assertEquals('assertEquals(
'set_parameter('boxWidth', 30);
$this->assertEquals('set_parameter('syntaxHint', 'Remove me');
$el->set_parameter('syntaxAttribute', 1);
@@ -150,7 +160,8 @@ public function test_render_placeholder() {
'stack1__sans1', false, null));
}
- public function test_syntaxhint() {
+ public function test_syntaxhint(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '[a, b, c]');
$el->set_parameter('syntaxHint', '[?, ?, ?]');
@@ -172,7 +183,8 @@ public function test_syntaxhint() {
'You should replace these with a specific value.', $state->errors);
}
- public function test_validate_student_response_algebraic_1() {
+ public function test_validate_student_response_algebraic_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)');
$state = $el->validate_student_response(['sans1' => 'x^2'], $options, 'x^2/(1+x^2)', new stack_cas_security());
@@ -207,7 +219,8 @@ public function test_validate_student_response_algebraic_1() {
$this->assertEquals($vr, $el->replace_validation_tags($state, 'sans1', '[[validation:sans1]]'));
}
- public function test_validate_student_response_algebraic_2() {
+ public function test_validate_student_response_algebraic_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)');
$state = $el->validate_student_response(['sans1' => '2x(1+x^2)'], $options, 'x^2/(1+x^2)', new stack_cas_security());
@@ -225,7 +238,8 @@ public function test_validate_student_response_algebraic_2() {
$this->assertEquals($vr, $el->replace_validation_tags($state, 'sans1', '[[validation:sans1]]'));
}
- public function test_validate_student_response_algebraic_3() {
+ public function test_validate_student_response_algebraic_3(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)');
$el->set_parameter('insertStars', 1);
@@ -237,7 +251,8 @@ public function test_validate_student_response_algebraic_3() {
$this->assertEquals(stack_input::SCORE, $state->status);
}
- public function test_validate_student_response_algebraic_4() {
+ public function test_validate_student_response_algebraic_4(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)');
$el->set_parameter('insertStars', 1);
@@ -248,7 +263,8 @@ public function test_validate_student_response_algebraic_4() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_algebraic_5() {
+ public function test_validate_student_response_algebraic_5(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)');
$el->set_parameter('insertStars', 1);
@@ -258,7 +274,8 @@ public function test_validate_student_response_algebraic_5() {
$this->assertEquals('missing_stars | Variable_function | forbiddenVariable', $state->note);
}
- public function test_validate_student_response_algebraic_6() {
+ public function test_validate_student_response_algebraic_6(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)');
$el->set_parameter('insertStars', 1);
@@ -268,7 +285,8 @@ public function test_validate_student_response_algebraic_6() {
$this->assertEquals('forbiddenFunction', $state->note);
}
- public function test_validate_student_response_algebraic_7() {
+ public function test_validate_student_response_algebraic_7(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)');
$el->set_parameter('insertStars', 0);
@@ -278,7 +296,8 @@ public function test_validate_student_response_algebraic_7() {
$this->assertEquals('missing_stars | Variable_function | forbiddenVariable', $state->note);
}
- public function test_validate_student_response_algebraic_8() {
+ public function test_validate_student_response_algebraic_8(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2+1/3');
$el->set_parameter('forbidFloats', true);
@@ -288,7 +307,8 @@ public function test_validate_student_response_algebraic_8() {
$this->assertEquals('Illegal_floats', $state->note);
}
- public function test_validate_student_response_algebraic_9() {
+ public function test_validate_student_response_algebraic_9(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '1validate_student_response(['sans1' => '1get_teacher_answer_display('1validate_student_response(['sans1' => 'not false xor not(false)'], $options,
@@ -318,7 +339,8 @@ public function test_validate_student_response_algebraic_10() {
'{\rm not}\left( \mathbf{False} \right) \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_algebraic_11() {
+ public function test_validate_student_response_algebraic_11(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'i*(x+1) + j*(2*x+3) + k*(3*x+4)');
$el->set_parameter('insertStars', 5);
@@ -385,7 +407,8 @@ public function test_validate_student_response_algebraic_11() {
$state->contentsdisplayed);
}
- public function test_validate_student_response_too_long() {
+ public function test_validate_student_response_too_long(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2/(1+x^2)');
$sa = '1' . str_repeat('0', 32768);
@@ -396,7 +419,8 @@ public function test_validate_student_response_too_long() {
$this->assertEquals('Your input is longer than permitted by STACK.', $state->errors);
}
- public function test_validate_student_response_ex() {
+ public function test_validate_student_response_ex(): void {
+
// The variable ex is used an argument to some Maxima functions and as a local variable.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '3*ex+2*ey+5*ez');
@@ -421,7 +445,8 @@ public function test_validate_student_response_ex() {
$this->assertEquals($vr, $el->replace_validation_tags($state, 'sans1', '[[validation:sans1]]'));
}
- public function test_validate_student_lowest_terms_1() {
+ public function test_validate_student_lowest_terms_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '12/4');
$el->set_parameter('lowestTerms', true);
@@ -431,7 +456,8 @@ public function test_validate_student_lowest_terms_1() {
$this->assertEquals('Lowest_Terms', $state->note);
}
- public function test_validate_student_lowest_terms_2() {
+ public function test_validate_student_lowest_terms_2(): void {
+
// This test checks the unary minus is *not* in lowest terms.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '-10/-1');
@@ -442,7 +468,8 @@ public function test_validate_student_lowest_terms_2() {
$this->assertEquals('Lowest_Terms', $state->note);
}
- public function test_validate_student_response_with_minus_zero() {
+ public function test_validate_student_response_with_minus_zero(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
$el->set_parameter('forbidFloats', false);
@@ -466,7 +493,8 @@ public function test_validate_student_response_with_minus_zero() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_with_rationalized() {
+ public function test_validate_student_response_with_rationalized(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
$el->set_parameter('options', 'rationalized');
@@ -479,7 +507,8 @@ public function test_validate_student_response_with_rationalized() {
'', $state->errors);
}
- public function test_validate_student_response_subscripts() {
+ public function test_validate_student_response_subscripts(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'rho*z*V/(4*pi*epsilon[0]*(R^2+z^2)^(3/2))');
$state = $el->validate_student_response(['sans1' => 'rho*z*V/(4*pi*epsilon[0]*(R^2+z^2)^(3/2))'],
@@ -489,7 +518,8 @@ public function test_validate_student_response_subscripts() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_subscript_compare() {
+ public function test_validate_student_response_subscript_compare(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x_1');
@@ -518,7 +548,8 @@ public function test_validate_student_response_subscript_compare() {
$this->assertEquals('\[ x_{1} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_trigexp_1() {
+ public function test_validate_student_response_trigexp_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'sin(ab)^2');
$state = $el->validate_student_response(['sans1' => 'sin^2(ab)'], $options, 'sin(ab)^2',
@@ -529,7 +560,8 @@ public function test_validate_student_response_trigexp_1() {
$this->assertEquals('missing_stars | trigexp', $state->note);
}
- public function test_validate_student_response_insertstars_true_1() {
+ public function test_validate_student_response_insertstars_true_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*x');
$el->set_parameter('insertStars', 1);
@@ -540,7 +572,8 @@ public function test_validate_student_response_insertstars_true_1() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_insertstars_false_1() {
+ public function test_validate_student_response_insertstars_false_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*x');
$el->set_parameter('insertStars', 0);
@@ -550,7 +583,8 @@ public function test_validate_student_response_insertstars_false_1() {
$this->assertEquals('missing_stars', $state->note);
}
- public function test_validate_student_response_insertstars_sqrt_1() {
+ public function test_validate_student_response_insertstars_sqrt_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*sqrt(2)/3');
$el->set_parameter('insertStars', 1);
@@ -566,7 +600,8 @@ public function test_validate_student_response_insertstars_sqrt_1() {
$el->get_teacher_answer_display('2*sqrt(2)/3', '\frac{2\cdot \sqrt{2}}{3}'));
}
- public function test_validate_student_response_sametype_true_1() {
+ public function test_validate_student_response_sametype_true_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*x');
$el->set_parameter('sameType', false);
@@ -577,7 +612,8 @@ public function test_validate_student_response_sametype_true_1() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_sametype_true_2() {
+ public function test_validate_student_response_sametype_true_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'y=2*x');
$el->set_parameter('sameType', false);
@@ -588,7 +624,8 @@ public function test_validate_student_response_sametype_true_2() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_sametype_false_1() {
+ public function test_validate_student_response_sametype_false_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'y=2*x');
$el->set_parameter('sameType', true);
@@ -598,7 +635,8 @@ public function test_validate_student_response_sametype_false_1() {
$this->assertEquals('SA_not_equation', $state->note);
}
- public function test_validate_student_response_sametype_false_2() {
+ public function test_validate_student_response_sametype_false_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'm*x+c');
$el->set_parameter('sameType', true);
@@ -608,7 +646,8 @@ public function test_validate_student_response_sametype_false_2() {
$this->assertEquals("ATAlgEquiv_TA_not_equation", $state->note);
}
- public function test_validate_student_response_sametype_false_3() {
+ public function test_validate_student_response_sametype_false_3(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '{1,2}');
$el->set_parameter('sameType', true);
@@ -618,7 +657,8 @@ public function test_validate_student_response_sametype_false_3() {
$this->assertEquals('SA_not_set', $state->note);
}
- public function test_validate_student_response_sametype_false_4() {
+ public function test_validate_student_response_sametype_false_4(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x');
$el->set_parameter('sameType', true);
@@ -628,7 +668,8 @@ public function test_validate_student_response_sametype_false_4() {
$this->assertEquals('SA_not_expression', $state->note);
}
- public function test_validate_student_response_sametype_subscripts_true_valid() {
+ public function test_validate_student_response_sametype_subscripts_true_valid(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'mu_0*(I_0-I_1)');
$el->set_parameter('sameType', true);
@@ -645,7 +686,8 @@ public function test_validate_student_response_sametype_subscripts_true_valid()
}
}
- public function test_validate_student_response_sametype_subscripts_true_invalid() {
+ public function test_validate_student_response_sametype_subscripts_true_invalid(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'mu_0*(I_0-I_1)');
$el->set_parameter('sameType', true);
@@ -664,7 +706,8 @@ public function test_validate_student_response_sametype_subscripts_true_invalid(
}
}
- public function test_validate_student_response_display_1() {
+ public function test_validate_student_response_display_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '-3*x^2-4');
$el->set_parameter('insertStars', 1);
@@ -679,7 +722,8 @@ public function test_validate_student_response_display_1() {
$this->assertEquals('\[ -3\cdot x^2-4 \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_display_2() {
+ public function test_validate_student_response_display_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '(3*x+1)*(x+ab)');
$el->set_parameter('insertStars', 1);
@@ -690,7 +734,8 @@ public function test_validate_student_response_display_2() {
$this->assertEquals('\[ \left(3\cdot x+1\right)\cdot \left(x+{\it ab}\right) \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_display_3() {
+ public function test_validate_student_response_display_3(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 's^(24*r)');
$el->set_parameter('insertStars', 1);
@@ -703,7 +748,8 @@ public function test_validate_student_response_display_3() {
$this->assertEquals('\[ s^{r^{24}} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_display_noundiff() {
+ public function test_validate_student_response_display_noundiff(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'noundiff(y/x^2,x,1)-(2*y)/x = x^3*sin(3*x)');
$el->set_parameter('insertStars', 1);
@@ -718,7 +764,8 @@ public function test_validate_student_response_display_noundiff() {
'\sin \left( 3\cdot x \right) \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_extra_evaluation() {
+ public function test_validate_student_response_extra_evaluation(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'noundiff(y/x^2,x,1)-(2*y)/x = x^3*sin(3*x)');
$el->set_parameter('sameType', false);
@@ -733,7 +780,8 @@ public function test_validate_student_response_extra_evaluation() {
$state->contentsdisplayed);
}
- public function test_validate_student_response_single_var_chars_on() {
+ public function test_validate_student_response_single_var_chars_on(): void {
+
// Check the single variable character option is tested.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '(3*x+1)*(x+ab)');
@@ -748,7 +796,8 @@ public function test_validate_student_response_single_var_chars_on() {
$this->assertEquals('\( \left[ a , b , x \right]\) ', $state->lvars);
}
- public function test_validate_student_response_single_var_chars_off() {
+ public function test_validate_student_response_single_var_chars_off(): void {
+
// Check the single variable character option is tested.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '(3x+1)*(x+ab)');
@@ -763,7 +812,8 @@ public function test_validate_student_response_single_var_chars_off() {
$this->assertEquals('\( \left[ {\it ab} , x \right]\) ', $state->lvars);
}
- public function test_validate_student_response_single_var_chars_div() {
+ public function test_validate_student_response_single_var_chars_div(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '0set_parameter('insertStars', 2);
@@ -777,7 +827,8 @@ public function test_validate_student_response_single_var_chars_div() {
$this->assertEquals('\( \left[ d , v \right]\) ', $state->lvars);
}
- public function test_validate_student_response_allowwords_false() {
+ public function test_validate_student_response_allowwords_false(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*x');
$state = $el->validate_student_response(['sans1' => 'unknownfunction(x^2+1)+3*x'], $options, '2*x',
@@ -785,7 +836,8 @@ public function test_validate_student_response_allowwords_false() {
$this->assertEquals(stack_input::INVALID, $state->status);
}
- public function test_validate_student_response_allowwords_true() {
+ public function test_validate_student_response_allowwords_true(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*x');
$el->set_parameter('allowWords', 'pop, funney1, unknownfunction');
@@ -796,7 +848,8 @@ public function test_validate_student_response_allowwords_true() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_allowwords_402() {
+ public function test_validate_student_response_allowwords_402(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*x');
@@ -813,7 +866,8 @@ public function test_validate_student_response_allowwords_402() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_forbidwords_none() {
+ public function test_validate_student_response_forbidwords_none(): void {
+
// Some functions are converted to "noun" forms.
// When we give feedback "your last answer was..." we want the correct forms, not the "nounint" alternatives.
$options = new stack_options();
@@ -828,7 +882,8 @@ public function test_validate_student_response_forbidwords_none() {
$this->assertEquals('\( \left[ c , x \right]\) ', $state->lvars);
}
- public function test_validate_student_response_forbidwords_true() {
+ public function test_validate_student_response_forbidwords_true(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*x');
$el->set_parameter('forbidWords', 'int, diff');
@@ -843,7 +898,8 @@ public function test_validate_student_response_forbidwords_true() {
$this->assertEquals('int(x^2+1,x)+c', $state->contentsdisplayed);
}
- public function test_validate_student_response_forbidwords_int() {
+ public function test_validate_student_response_forbidwords_int(): void {
+
// We need this as an alias.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'int(x^2+1,x)+c');
@@ -857,7 +913,8 @@ public function test_validate_student_response_forbidwords_int() {
$this->assertEquals('\( \left[ c , x \right]\) ', $state->lvars);
}
- public function test_validate_student_response_forbidwords_int_true() {
+ public function test_validate_student_response_forbidwords_int_true(): void {
+
// We need this as an alias.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*x');
@@ -871,7 +928,8 @@ public function test_validate_student_response_forbidwords_int_true() {
$this->assertEquals('integrate(x^2+1,x)+c', $state->contentsdisplayed);
}
- public function test_validate_student_response_single_variable() {
+ public function test_validate_student_response_single_variable(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'cos(a*x)/(x*(ln(x)))');
// Assuming single character variable names.
@@ -886,7 +944,8 @@ public function test_validate_student_response_single_variable() {
$state->contentsdisplayed);
}
- public function test_validate_student_response_single_variable_xx() {
+ public function test_validate_student_response_single_variable_xx(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x');
// Assuming single character variable names.
@@ -898,7 +957,8 @@ public function test_validate_student_response_single_variable_xx() {
$this->assertEquals('\[ x\cdot x \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_single_variable_subscripts() {
+ public function test_validate_student_response_single_variable_subscripts(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'a*b_c*d');
// Assuming single character variable names.
@@ -912,7 +972,8 @@ public function test_validate_student_response_single_variable_subscripts() {
$this->assertEquals('\[ a\cdot {b}_{{\it cd}} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_single_variable_subscripts2() {
+ public function test_validate_student_response_single_variable_subscripts2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'a*v_max');
// Assuming single character variable names.
@@ -926,7 +987,8 @@ public function test_validate_student_response_single_variable_subscripts2() {
$this->assertEquals('\[ a\cdot {v}_{{\it max}} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_single_variable_trigexp() {
+ public function test_validate_student_response_single_variable_trigexp(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'sin(ab)^2');
// Assuming single character variable names.
@@ -940,7 +1002,8 @@ public function test_validate_student_response_single_variable_trigexp() {
$this->assertEquals('\[ \sin ^2\left(a\cdot b\right) \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_single_variable_trigexp_2() {
+ public function test_validate_student_response_single_variable_trigexp_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'sin(ab)^2');
// Assuming single character variable names.
@@ -954,7 +1017,8 @@ public function test_validate_student_response_single_variable_trigexp_2() {
$this->assertEquals('missing_stars | trigexp', $state->note);
}
- public function test_validate_student_response_functions_variable() {
+ public function test_validate_student_response_functions_variable(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'a/(a*(x+1)+2)');
@@ -964,7 +1028,8 @@ public function test_validate_student_response_functions_variable() {
$this->assertEquals("missing_stars | Variable_function", $state->note);
}
- public function test_validate_student_response_simp_1() {
+ public function test_validate_student_response_simp_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '[1,4,9,16,25,36,49,64]');
$el->set_parameter('options', 'simp');
@@ -979,7 +1044,8 @@ public function test_validate_student_response_simp_1() {
$state->contentsdisplayed);
}
- public function test_validate_student_response_simp_float_1() {
+ public function test_validate_student_response_simp_float_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '7.0');
$el->set_parameter('forbidFloats', false);
@@ -995,7 +1061,8 @@ public function test_validate_student_response_simp_float_1() {
$state->contentsdisplayed);
}
- public function test_validate_student_response_simp_float_2() {
+ public function test_validate_student_response_simp_float_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '7.0');
$el->set_parameter('forbidFloats', false);
@@ -1012,7 +1079,8 @@ public function test_validate_student_response_simp_float_2() {
$state->contentsdisplayed);
}
- public function test_validate_lg_1() {
+ public function test_validate_lg_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'lg(27,3)');
$state = $el->validate_student_response(['sans1' => 'lg(27,3)'], $options, 'lg(27,3)', new stack_cas_security());
@@ -1025,7 +1093,8 @@ public function test_validate_lg_1() {
$el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed));
}
- public function test_validate_lg_10() {
+ public function test_validate_lg_10(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'lg(23,10)');
$state = $el->validate_student_response(['sans1' => 'lg(23,10)'], $options, 'lg(23,10)', new stack_cas_security());
@@ -1038,7 +1107,8 @@ public function test_validate_lg_10() {
$el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed));
}
- public function test_validate_lg_10b() {
+ public function test_validate_lg_10b(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'lg(19)');
$state = $el->validate_student_response(['sans1' => 'lg(19)'], $options, 'lg(19)', new stack_cas_security());
@@ -1051,7 +1121,8 @@ public function test_validate_lg_10b() {
$el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed));
}
- public function test_validate_ln() {
+ public function test_validate_ln(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '3 ln 19');
$el->set_parameter('insertStars', 4);
@@ -1062,7 +1133,8 @@ public function test_validate_ln() {
$this->assertEquals('3 ln 19', $state->contentsdisplayed);
}
- public function test_validate_set_1() {
+ public function test_validate_set_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '{a,b,c}');
$state = $el->validate_student_response(['sans1' => '{a,b,c}'], $options, '{a,b,c}', new stack_cas_security());
@@ -1071,7 +1143,8 @@ public function test_validate_set_1() {
$this->assertEquals('\[ \left \{a , b , c \right \} \]', $state->contentsdisplayed);
}
- public function test_validate_or_1() {
+ public function test_validate_or_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x=1 or x=1');
$state = $el->validate_student_response(['sans1' => 'x=1 or x=1'], $options, 'x=1 or x=1',
@@ -1081,7 +1154,8 @@ public function test_validate_or_1() {
$this->assertEquals('\[ x=1\,{\text{ or }}\, x=1 \]', $state->contentsdisplayed);
}
- public function test_validate_units() {
+ public function test_validate_units(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '9');
$state = $el->validate_student_response(['sans1' => '9*hz'], $options, '9', new stack_cas_security());
@@ -1091,7 +1165,8 @@ public function test_validate_units() {
$this->assertEquals('\[ 9\cdot {\it hz} \]', $state->contentsdisplayed);
}
- public function test_validate_string_same_type() {
+ public function test_validate_string_same_type(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '"A random string"');
$el->set_parameter('sameType', true);
@@ -1102,7 +1177,8 @@ public function test_validate_string_same_type() {
$this->assertEquals('\[ \text{Hello world} \]', $state->contentsdisplayed);
}
- public function test_validate_string_same_type_lt() {
+ public function test_validate_string_same_type_lt(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '"A random string"');
$el->set_parameter('sameType', true);
@@ -1113,7 +1189,8 @@ public function test_validate_string_same_type_lt() {
$this->assertEquals('\[ \text{Hello < world} \]', $state->contentsdisplayed);
}
- public function test_validate_string_same_type_invalid1() {
+ public function test_validate_string_same_type_invalid1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^2');
$el->set_parameter('sameType', true);
@@ -1123,7 +1200,8 @@ public function test_validate_string_same_type_invalid1() {
$this->assertEquals('\[ \text{Hello world} \]', $state->contentsdisplayed);
}
- public function test_validate_string_same_type_invalid2() {
+ public function test_validate_string_same_type_invalid2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '"A random string"');
$el->set_parameter('sameType', true);
@@ -1134,7 +1212,8 @@ public function test_validate_string_same_type_invalid2() {
$this->assertEquals('\[ x^2 \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_with_allowempty() {
+ public function test_validate_student_response_with_allowempty(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
$el->set_parameter('options', 'allowempty');
@@ -1148,7 +1227,8 @@ public function test_validate_student_response_with_allowempty() {
$el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed));
}
- public function test_validate_student_response_with_allowempty_stars() {
+ public function test_validate_student_response_with_allowempty_stars(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
$el->set_parameter('options', 'allowempty');
@@ -1182,7 +1262,8 @@ public function test_validate_student_response_with_allowempty_stars() {
$el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed));
}
- public function test_validate_string_same_type_invalid_division_zero() {
+ public function test_validate_string_same_type_invalid_division_zero(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^3');
$el->set_parameter('sameType', true);
@@ -1192,7 +1273,8 @@ public function test_validate_string_same_type_invalid_division_zero() {
$this->assertEquals('\[ \frac{x}{0} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_star_space_1() {
+ public function test_validate_student_response_star_space_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)');
$el->set_parameter('insertStars', 1);
@@ -1209,7 +1291,8 @@ public function test_validate_student_response_star_space_1() {
$el->get_teacher_answer_display('3*sin(a*b)', '3\\, \\sin(a \cdot b)'));
}
- public function test_validate_student_response_star_space_2() {
+ public function test_validate_student_response_star_space_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)');
$el->set_parameter('insertStars', 2);
@@ -1222,7 +1305,8 @@ public function test_validate_student_response_star_space_2() {
'3*sin(a_b).', $state->errors);
}
- public function test_validate_student_response_star_space_3() {
+ public function test_validate_student_response_star_space_3(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)');
$el->set_parameter('insertStars', 3);
@@ -1237,7 +1321,8 @@ public function test_validate_student_response_star_space_3() {
$state->errors);
}
- public function test_validate_student_response_star_space_4() {
+ public function test_validate_student_response_star_space_4(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)');
$el->set_parameter('insertStars', 4);
@@ -1249,7 +1334,8 @@ public function test_validate_student_response_star_space_4() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_star_space_5() {
+ public function test_validate_student_response_star_space_5(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '3*sin(a*b)');
$el->set_parameter('insertStars', 5);
@@ -1261,7 +1347,8 @@ public function test_validate_student_response_star_space_5() {
$this->assertEquals('', $state->errors);
}
- public function test_validate_student_response_almost_cardano() {
+ public function test_validate_student_response_almost_cardano(): void {
+
// This has a double +- in the input.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x=-b+-sqrt(b*c^2-a)');
@@ -1275,7 +1362,8 @@ public function test_validate_student_response_almost_cardano() {
'{\left({-q \pm \sqrt{q^2-p^3}}\right)}^{\frac{1}{3}} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_prefixpm() {
+ public function test_validate_student_response_prefixpm(): void {
+
// This has a prefix +- in the input.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x= +- b');
@@ -1292,7 +1380,8 @@ public function test_validate_student_response_prefixpm() {
. 'x = +-b
, would be correct.', $el->get_teacher_answer_display('x= #pm# b', 'x= \pm b'));
}
- public function test_validate_student_response_pm_expr() {
+ public function test_validate_student_response_pm_expr(): void {
+
// This has an expression with more than one +- in the input.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'a +- b +- c');
@@ -1308,7 +1397,8 @@ public function test_validate_student_response_pm_expr() {
. 'a+-b+-c
, would be correct.', $el->get_teacher_answer_display('a#pm#b#pm#c', '{a \pm b \pm c}'));
}
- public function test_validate_student_response_pm_eq() {
+ public function test_validate_student_response_pm_eq(): void {
+
// This has an expression with more than one +- in an equation in the input.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x +- a = y +- b');
@@ -1325,7 +1415,8 @@ public function test_validate_student_response_pm_eq() {
$el->get_teacher_answer_display('x #pm# a = y #pm# b', '{x \pm a}={y \pm b}'));
}
- public function test_validate_student_response_without_pm() {
+ public function test_validate_student_response_without_pm(): void {
+
// This has an expression without +- in the input.
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x-3');
@@ -1338,7 +1429,8 @@ public function test_validate_student_response_without_pm() {
$this->assertEquals('\[ x-3 \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_with_align_right() {
+ public function test_validate_student_response_with_align_right(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
$el->set_parameter('options', 'align:right');
@@ -1359,7 +1451,8 @@ public function test_validate_student_response_with_align_right() {
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_with_monospace() {
+ public function test_validate_student_response_with_monospace(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
$el->set_parameter('options', 'align:right, monospace');
@@ -1381,7 +1474,8 @@ public function test_validate_student_response_with_monospace() {
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_with_no_monospace_default_on() {
+ public function test_validate_student_response_with_no_monospace_default_on(): void {
+
$options = new stack_options();
set_config('inputmonospace', '0,1,2', 'qtype_stack');
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
@@ -1404,7 +1498,8 @@ public function test_validate_student_response_with_no_monospace_default_on() {
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_with_no_monospace_single_default_on() {
+ public function test_validate_student_response_with_no_monospace_single_default_on(): void {
+
$options = new stack_options();
set_config('inputmonospace', '0', 'qtype_stack');
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
@@ -1427,7 +1522,8 @@ public function test_validate_student_response_with_no_monospace_single_default_
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_with_no_monospace_default_off() {
+ public function test_validate_student_response_with_no_monospace_default_off(): void {
+
$options = new stack_options();
set_config('inputmonospace', '1,2', 'qtype_stack');
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
@@ -1450,7 +1546,8 @@ public function test_validate_student_response_with_no_monospace_default_off() {
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_with_monospace_true_default_off() {
+ public function test_validate_student_response_with_monospace_true_default_off(): void {
+
$options = new stack_options();
set_config('inputmonospace', '1,2', 'qtype_stack');
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
@@ -1473,7 +1570,8 @@ public function test_validate_student_response_with_monospace_true_default_off()
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_with_monospace_false_default_on() {
+ public function test_validate_student_response_with_monospace_false_default_on(): void {
+
$options = new stack_options();
set_config('inputmonospace', '0,1,2', 'qtype_stack');
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
@@ -1496,7 +1594,8 @@ public function test_validate_student_response_with_monospace_false_default_on()
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_with_monospace_false_default_off() {
+ public function test_validate_student_response_with_monospace_false_default_off(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
$el->set_parameter('options', 'align:right, monospace:false');
@@ -1518,7 +1617,8 @@ public function test_validate_student_response_with_monospace_false_default_off(
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_with_monospace_default_on() {
+ public function test_validate_student_response_with_monospace_default_on(): void {
+
$options = new stack_options();
set_config('inputmonospace', '0', 'qtype_stack');
$el = stack_input_factory::make('algebraic', 'sans1', '1/2');
@@ -1541,7 +1641,8 @@ public function test_validate_student_response_with_monospace_default_on() {
$el->render($state, 'stack1__ans1', false, null));
}
- public function test_validate_student_response_noununits() {
+ public function test_validate_student_response_noununits(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '9.81*m/s');
$el->set_parameter('forbidFloats', false);
@@ -1573,7 +1674,8 @@ public function test_validate_student_response_noununits() {
$el->get_teacher_answer_display($state->contentsmodified, $state->contentsdisplayed));
}
- public function test_validate_student_response_subtlesurds() {
+ public function test_validate_student_response_subtlesurds(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'ans1', '((-1)+sqrt(11))/10');
@@ -1608,7 +1710,8 @@ public function test_validate_student_response_subtlesurds() {
$this->assertEquals('', $state->note);
}
- public function test_validate_student_response_subtlefrac() {
+ public function test_validate_student_response_subtlefrac(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'ans1', '-a/b');
@@ -1636,7 +1739,8 @@ public function test_validate_student_response_subtlefrac() {
$this->assertEquals('', $state->note);
}
- public function test_validate_student_response_subtle_pm() {
+ public function test_validate_student_response_subtle_pm(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'ans1', '-a/b');
@@ -1651,7 +1755,8 @@ public function test_validate_student_response_subtle_pm() {
$this->assertEquals('', $state->note);
}
- public function test_validate_student_response_realsets_sametype_1() {
+ public function test_validate_student_response_realsets_sametype_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '%union(oo(1,2),(3,4))');
$el->set_parameter('sameType', true);
@@ -1669,7 +1774,8 @@ public function test_validate_student_response_realsets_sametype_1() {
$this->assertEquals('', $state->note);
}
- public function test_validate_student_response_realsets_sametype_2() {
+ public function test_validate_student_response_realsets_sametype_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '{3,4,5}');
$el->set_parameter('sameType', true);
@@ -1692,7 +1798,8 @@ public function test_validate_student_response_realsets_sametype_2() {
'\[ \left[ 3,\, 4\right) \]');
}
- public function test_validate_student_response_realsets_sametype_err() {
+ public function test_validate_student_response_realsets_sametype_err(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})');
$el->set_parameter('sameType', true);
@@ -1779,7 +1886,8 @@ public function test_validate_student_response_realsets_sametype_err() {
'\[ \left( -\infty ,\, -4\right) \cup x^2 \]');
}
- public function test_validate_student_response_realsets_sametype_ok() {
+ public function test_validate_student_response_realsets_sametype_ok(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})');
$el->set_parameter('sameType', true);
@@ -1795,7 +1903,8 @@ public function test_validate_student_response_realsets_sametype_ok() {
'\[ \left( a,\, b\right] \]');
}
- public function test_validate_student_response_root() {
+ public function test_validate_student_response_root(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'x^(1/n)');
$el->set_parameter('sameType', true);
@@ -1811,7 +1920,8 @@ public function test_validate_student_response_root() {
'\[ \sqrt[n]{x} \]');
}
- public function test_validate_student_response_tex() {
+ public function test_validate_student_response_tex(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '{}');
@@ -1826,7 +1936,8 @@ public function test_validate_student_response_tex() {
'\[x^2\]');
}
- public function test_validate_student_response_xss_1() {
+ public function test_validate_student_response_xss_1(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})');
@@ -1853,7 +1964,8 @@ public function test_validate_student_response_xss_1() {
$this->assertEquals($ta, $state->contentsdisplayed);
}
- public function test_validate_student_response_xss_2() {
+ public function test_validate_student_response_xss_2(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})');
@@ -1879,7 +1991,8 @@ public function test_validate_student_response_xss_2() {
$this->assertEquals($ua, $state->contentsdisplayed);
}
- public function test_validate_student_response_xss_3() {
+ public function test_validate_student_response_xss_3(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '%union({3,4,5})');
@@ -1924,7 +2037,8 @@ public function test_validate_student_response_xss_3() {
$this->assertEquals($ua, $state->contentsdisplayed);
}
- public function test_validate_student_response_xss_4() {
+ public function test_validate_student_response_xss_4(): void {
+
$options = new stack_options();
$ta = '"Hello world"';
$el = stack_input_factory::make('algebraic', 'sans1', $ta);
@@ -2007,7 +2121,8 @@ public function test_validate_student_response_xss_4() {
$this->assertEquals($cd, $state->contentsdisplayed);
}
- public function test_validate_hideanswer() {
+ public function test_validate_hideanswer(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'state', '[x^2]');
$el->set_parameter('options', 'hideanswer');
@@ -2019,7 +2134,8 @@ public function test_validate_hideanswer() {
$this->assertEquals('', $el->get_teacher_answer_display("[SOME JSON]", "\[ \text{[SOME MORE JSON]} \]"));
}
- public function test_validate_student_response_ntuple() {
+ public function test_validate_student_response_ntuple(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', 'ntuple(1,-1)');
$el->set_parameter('sameType', true);
@@ -2037,7 +2153,8 @@ public function test_validate_student_response_ntuple() {
$el->get_teacher_answer_display('ntuple(1,-1)', '\left(1, -1\right)'));
}
- public function test_validate_student_response_ntuple_forbid() {
+ public function test_validate_student_response_ntuple_forbid(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '[1,2]');
$el->set_parameter('forbidWords', 'ntuple');
@@ -2051,7 +2168,8 @@ public function test_validate_student_response_ntuple_forbid() {
$this->assertEquals('Coordinates are not permitted in this input.', $state->errors);
}
- public function test_validate_student_response_no_dot_dot() {
+ public function test_validate_student_response_no_dot_dot(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '3.14*2.78');
$el->set_parameter('forbidFloats', false);
@@ -2066,7 +2184,8 @@ public function test_validate_student_response_no_dot_dot() {
'use normal multiplication "*" instead for the same result. 3.14 . 2.78', $state->errors);
}
- public function test_validate_consolidatesubscripts() {
+ public function test_validate_consolidatesubscripts(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'state', 'M_1');
$el->set_parameter('options', 'consolidatesubscripts');
@@ -2077,7 +2196,8 @@ public function test_validate_consolidatesubscripts() {
$this->assertEquals('\[ M_{1} \]', $state->contentsdisplayed);
}
- public function test_validate_checkvars() {
+ public function test_validate_checkvars(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'ans2', 'a+b+c');
@@ -2110,7 +2230,8 @@ public function test_validate_checkvars() {
'These variables are missing: a, b, c.', $state->errors);
}
- public function test_invalid_validator_name() {
+ public function test_invalid_validator_name(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'state', 'x^2');
$el->set_parameter('options', 'validator:bad%functionname');
@@ -2123,7 +2244,8 @@ public function test_invalid_validator_name() {
$el->get_errors());
}
- public function test_missing_validator_() {
+ public function test_missing_validator_(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'state', 'x^2');
$el->set_parameter('options', 'validator:missingfunction');
@@ -2139,7 +2261,8 @@ public function test_missing_validator_() {
$state->errors);
}
- public function test_validate_student_response_conjugate() {
+ public function test_validate_student_response_conjugate(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '2*conjugate(x)');
$state = $el->validate_student_response(['sans1' => 'conjugate(x)'], $options, 'conjugate(x)',
@@ -2170,7 +2293,8 @@ public function test_validate_student_response_conjugate() {
$this->assertEquals('\( \left[ x \right]\) ', $state->lvars);
}
- public function test_decimal_output_0() {
+ public function test_decimal_output_0(): void {
+
$options = new stack_options();
$options->set_option('decimals', ',');
$el = stack_input_factory::make('algebraic', 'state', '{3.1415,2.71}', $options);
@@ -2196,7 +2320,8 @@ public function test_decimal_output_0() {
$el->get_teacher_answer_display('{3.1415,2.71}', '\{3{,}1415 ; 2{,}7100 \right \}'));
}
- public function test_decimal_output_1() {
+ public function test_decimal_output_1(): void {
+
$options = new stack_options();
$options->set_option('decimals', ',');
$el = stack_input_factory::make('algebraic', 'state', '{3.1415,2.71}', $options);
@@ -2216,7 +2341,8 @@ public function test_decimal_output_1() {
$el->get_teacher_answer_display('{3.1415,2.71}', '\{3{,}1415 ; 2{,}71 \right \}'));
}
- public function test_decimal_output_2() {
+ public function test_decimal_output_2(): void {
+
$options = new stack_options();
$options->set_option('decimals', ',');
$el = stack_input_factory::make('algebraic', 'state', '{3.1415,2.71}', $options);
@@ -2231,7 +2357,8 @@ public function test_decimal_output_2() {
$this->assertEquals('', $state->errors);
}
- public function test_decimal_output_3() {
+ public function test_decimal_output_3(): void {
+
$options = new stack_options();
$options->set_option('decimals', ',');
$el = stack_input_factory::make('algebraic', 'state', '{3.14,2.7100}', $options);
@@ -2246,7 +2373,8 @@ public function test_decimal_output_3() {
$this->assertEquals('', $state->errors);
}
- public function test_decimal_output_4() {
+ public function test_decimal_output_4(): void {
+
$options = new stack_options();
$options->set_option('decimals', '.');
$options->set_option('scientificnotation', 'E');
@@ -2261,7 +2389,8 @@ public function test_decimal_output_4() {
$this->assertEquals('', $state->errors);
}
- public function test_decimal_output_5() {
+ public function test_decimal_output_5(): void {
+
$options = new stack_options();
$options->set_option('decimals', ',');
$options->set_option('scientificnotation', 'E');
@@ -2276,7 +2405,8 @@ public function test_decimal_output_5() {
$this->assertEquals('', $state->errors);
}
- public function test_decimal_output_matrix_1() {
+ public function test_decimal_output_matrix_1(): void {
+
$options = new stack_options();
$options->set_option('decimals', ',');
// Teacher must use correct syntax.
@@ -2300,7 +2430,8 @@ public function test_decimal_output_matrix_1() {
$this->assertEquals('', $state->errors);
}
- public function test_decimal_output_matrix_2() {
+ public function test_decimal_output_matrix_2(): void {
+
$options = new stack_options();
$options->set_option('decimals', ',');
// Teacher must use correct syntax.
@@ -2318,7 +2449,8 @@ public function test_decimal_output_matrix_2() {
$this->assertEquals('forbiddenCharDecimal', $state->note);
}
- public function test_validate__string() {
+ public function test_validate__string(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '"A random string"');
$state = $el->validate_student_response(['sans1' => '"Lots of stuff:!$%^&*?@;"'],
@@ -2328,7 +2460,8 @@ public function test_validate__string() {
$this->assertEquals('\[ \text{Lots of stuff:!\$\%^&*?@;} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_single_var_chars_unicode_superscript() {
+ public function test_validate_student_response_single_var_chars_unicode_superscript(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('algebraic', 'sans1', '');
$el->set_parameter('insertStars', 2);
@@ -2344,7 +2477,8 @@ public function test_validate_student_response_single_var_chars_unicode_superscr
$this->assertEquals('', $state->lvars);
}
- public function test_validate_student_response_km() {
+ public function test_validate_student_response_km(): void {
+
// This needs to be available as a variable.
// However, km is a function in the descriptive package. See issue #1331.
$options = new stack_options();
diff --git a/tests/input_boolean_rendering_test.php b/tests/input_boolean_rendering_test.php
index c99d9e78df2..04e1e3b3b60 100644
--- a/tests/input_boolean_rendering_test.php
+++ b/tests/input_boolean_rendering_test.php
@@ -29,18 +29,20 @@
require_once(__DIR__ . '/../stack/input/boolean/boolean.class.php');
require_once(__DIR__ . '/fixtures/test_base.php');
-// Unit tests for stack_boolean_input_test.
-//
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
-
/**
+ * Unit tests for stack_boolean_input_test.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
* @group qtype_stack
* @covers \stack_boolean_input
*/
-class input_boolean_rendering_test extends question_testcase {
+final class input_boolean_rendering_test extends question_testcase {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
protected function expected_choices() {
+
return [
stack_boolean_input::F => stack_string('false'),
stack_boolean_input::T => stack_string('true'),
@@ -48,7 +50,8 @@ protected function expected_choices() {
];
}
- public function test_render_not_answered() {
+ public function test_render_not_answered(): void {
+
$el = stack_input_factory::make('boolean', 'ans1', stack_boolean_input::T);
$this->assert(new \question_contains_select_expectation(
'stack1__ans1', $this->expected_choices(), stack_boolean_input::NA),
@@ -57,7 +60,8 @@ public function test_render_not_answered() {
'stack1__ans1', false, null));
}
- public function test_render_true() {
+ public function test_render_true(): void {
+
$el = stack_input_factory::make('boolean', 'ans2', stack_boolean_input::T);
$this->assert(new \question_contains_select_expectation('stack1__ans2', $this->expected_choices(),
stack_boolean_input::T), $el->render(new stack_input_state(
@@ -65,7 +69,8 @@ public function test_render_true() {
'stack1__ans2', false, null));
}
- public function test_render_false() {
+ public function test_render_false(): void {
+
$el = stack_input_factory::make('boolean', 'ans3', stack_boolean_input::T);
$this->assert(new \question_contains_select_expectation('stack1__ans3', $this->expected_choices(),
stack_boolean_input::F), $el->render(new stack_input_state(
@@ -73,7 +78,8 @@ public function test_render_false() {
'stack1__ans3', false, null));
}
- public function test_render_disabled() {
+ public function test_render_disabled(): void {
+
$el = stack_input_factory::make('boolean', 'input', stack_boolean_input::T);
$this->assert(new \question_contains_select_expectation('stack1__ans1', $this->expected_choices(),
stack_boolean_input::NA, false), $el->render(new stack_input_state(
diff --git a/tests/input_boolean_validation_test.php b/tests/input_boolean_validation_test.php
index 043180a2651..8f2617097ae 100644
--- a/tests/input_boolean_validation_test.php
+++ b/tests/input_boolean_validation_test.php
@@ -29,17 +29,19 @@
require_once(__DIR__ . '/../stack/input/boolean/boolean.class.php');
require_once(__DIR__ . '/fixtures/test_base.php');
-// Unit tests for stack_boolean_input_test.
-//
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
-
/**
+ * Unit tests for stack_boolean_input_test.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
* @group qtype_stack
* @covers \stack_boolean_input
*/
-class input_boolean_validation_test extends qtype_stack_testcase {
- public function test_validate_student_response_true() {
+final class input_boolean_validation_test extends qtype_stack_testcase {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.Function
+ public function test_validate_student_response_true(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('boolean', 'sans1', 'true');
$state = $el->validate_student_response(['sans1' => 'true'], $options, 'true', new stack_cas_security());
@@ -48,7 +50,8 @@ public function test_validate_student_response_true() {
$this->assertEquals('\[ \mathbf{True} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_false() {
+ public function test_validate_student_response_false(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('boolean', 'sans1', 'true');
$state = $el->validate_student_response(['sans1' => 'false'], $options, 'true', new stack_cas_security());
@@ -57,7 +60,8 @@ public function test_validate_student_response_false() {
$this->assertEquals('\[ \mathbf{False} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_na() {
+ public function test_validate_student_response_na(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('boolean', 'sans1', 'true');
$state = $el->validate_student_response([], $options, 'true', new stack_cas_security());
@@ -66,7 +70,8 @@ public function test_validate_student_response_na() {
$this->assertEquals('', $state->contentsdisplayed);
}
- public function test_validate_student_response_error() {
+ public function test_validate_student_response_error(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('boolean', 'sans1', 'true');
$state = $el->validate_student_response(['sans1' => 'frog'], $options, 'true', new stack_cas_security());
@@ -75,7 +80,8 @@ public function test_validate_student_response_error() {
$this->assertEquals('frog', $state->contentsdisplayed);
}
- public function test_validate_student_response_emptyanswer() {
+ public function test_validate_student_response_emptyanswer(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('boolean', 'sans1', 'EMPTYANSWER');
$state = $el->validate_student_response(['sans1' => 'true'], $options, 'true', new stack_cas_security());
@@ -84,7 +90,8 @@ public function test_validate_student_response_emptyanswer() {
$this->assertEquals('\[ \mathbf{True} \]', $state->contentsdisplayed);
}
- public function test_validate_student_response_emptyanswer_option_sa() {
+ public function test_validate_student_response_emptyanswer_option_sa(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('boolean', 'sans1', 'true');
$el->set_parameter('options', 'allowempty');
@@ -93,7 +100,8 @@ public function test_validate_student_response_emptyanswer_option_sa() {
$this->assertEquals('EMPTYANSWER', $state->contentsmodified);
}
- public function test_validate_student_response_emptyanswer_option_ta() {
+ public function test_validate_student_response_emptyanswer_option_ta(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('boolean', 'sans1', 'EMPTYANSWER');
$el->set_parameter('options', 'allowempty');
@@ -102,7 +110,8 @@ public function test_validate_student_response_emptyanswer_option_ta() {
$this->assertEquals('EMPTYANSWER', $state->contentsmodified);
}
- public function test_validate_hideanswer() {
+ public function test_validate_hideanswer(): void {
+
$options = new stack_options();
$el = stack_input_factory::make('boolean', 'state', 'false');
$el->set_parameter('options', 'hideanswer');
diff --git a/tests/input_checkbox_test.php b/tests/input_checkbox_test.php
index 00f857a3784..046ba5e8ffe 100644
--- a/tests/input_checkbox_test.php
+++ b/tests/input_checkbox_test.php
@@ -30,18 +30,20 @@
require_once(__DIR__ . '/fixtures/test_base.php');
require_once(__DIR__ . '/../stack/input/factory.class.php');
-// Unit tests for stack_checkbox_input.
-//
-// @copyright 2012 The Open University.
-// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
-
/**
+ * Unit tests for stack_checkbox_input.
+ *
+ * @package qtype_stack
+ * @copyright 2012 The Open University.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
* @group qtype_stack
* @covers \stack_checkbox_input
*/
-class input_checkbox_test extends qtype_stack_testcase {
+final class input_checkbox_test extends qtype_stack_testcase {
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
protected function expected_choices() {
+
return [
'' => stack_string('notanswered'),
'1' => 'x+1',
@@ -50,7 +52,9 @@ protected function expected_choices() {
];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
protected function expected_choices_latex() {
+
return [
'' => stack_string('notanswered'),
'1' => 'x+1',
@@ -59,16 +63,20 @@ protected function expected_choices_latex() {
];
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
protected function make_checkbox($parameters = []) {
$el = stack_input_factory::make('checkbox', 'ans1', $this->make_ta(), null, $parameters);
return $el;
}
+ // phpcs:ignore moodle.Commenting.MissingDocblock.MissingTestcaseMethodDescription
protected function make_ta() {
+
return '[[x+1,true],[x+2,false],[sin(pi*n),false]]';
}
- public function test_simple_checkbox() {
+ public function test_simple_checkbox(): void {
+
// @codingStandardsIgnoreStart
$el = stack_input_factory::make('checkbox', 'ans1', '[[1+x,true],[2+y,false]]', null, array());
// @codingStandardsIgnoreEnd
@@ -86,7 +94,8 @@ public function test_simple_checkbox() {
$this->assertEquals($expected, $el->get_teacher_answer_display(false, false));
}
- public function test_simple_casstring_checkbox() {
+ public function test_simple_casstring_checkbox(): void {
+
// @codingStandardsIgnoreStart
$el = stack_input_factory::make('checkbox', 'ans1', '[[1+x,true],[2+y,false]]',
null, array('options' => 'casstring'));
@@ -101,7 +110,8 @@ public function test_simple_casstring_checkbox() {
stack_input::SCORE, [''], '', '', '', '', ''), 'stack1__ans1', false, null));
}
- public function test_bad_teacheranswer() {
+ public function test_bad_teacheranswer(): void {
+
$el = $this->make_checkbox();
$el->adapt_to_model_answer('[x]');
$expected = '