Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-qtype_stack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-qtype_stack
Commits
83d1d6f5
Commit
83d1d6f5
authored
7 years ago
by
Tim Hunt
Browse files
Options
Downloads
Patches
Plain Diff
Unlock the session before running question tests
Hence, exectue the tests after output has started.
parent
cc1375cf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
questiontestrun.php
+12
-10
12 additions, 10 deletions
questiontestrun.php
with
12 additions
and
10 deletions
questiontestrun.php
+
12
−
10
View file @
83d1d6f5
...
@@ -103,16 +103,6 @@ flush();
...
@@ -103,16 +103,6 @@ flush();
// Load the list of test cases.
// Load the list of test cases.
$testscases
=
question_bank
::
get_qtype
(
'stack'
)
->
load_question_tests
(
$question
->
id
);
$testscases
=
question_bank
::
get_qtype
(
'stack'
)
->
load_question_tests
(
$question
->
id
);
// Execute the tests.
$testresults
=
array
();
$allpassed
=
true
;
foreach
(
$testscases
as
$key
=>
$testcase
)
{
$testresults
[
$key
]
=
$testcase
->
test_question
(
$quba
,
$question
,
$seed
);
if
(
!
$testresults
[
$key
]
->
passed
())
{
$allpassed
=
false
;
}
}
$deployfeedback
=
optional_param
(
'deployfeedback'
,
null
,
PARAM_TEXT
);
$deployfeedback
=
optional_param
(
'deployfeedback'
,
null
,
PARAM_TEXT
);
if
(
!
is_null
(
$deployfeedback
))
{
if
(
!
is_null
(
$deployfeedback
))
{
echo
html_writer
::
tag
(
'p'
,
$deployfeedback
,
array
(
'class'
=>
'overallresult pass'
));
echo
html_writer
::
tag
(
'p'
,
$deployfeedback
,
array
(
'class'
=>
'overallresult pass'
));
...
@@ -277,6 +267,18 @@ if (!(empty($question->deployedseeds)) && $canedit) {
...
@@ -277,6 +267,18 @@ if (!(empty($question->deployedseeds)) && $canedit) {
// Display the controls to add another question test.
// Display the controls to add another question test.
echo
$OUTPUT
->
heading
(
stack_string
(
'questiontests'
),
2
);
echo
$OUTPUT
->
heading
(
stack_string
(
'questiontests'
),
2
);
\core\session\manager
::
write_close
();
// Execute the tests.
$testresults
=
array
();
$allpassed
=
true
;
foreach
(
$testscases
as
$key
=>
$testcase
)
{
$testresults
[
$key
]
=
$testcase
->
test_question
(
$quba
,
$question
,
$seed
);
if
(
!
$testresults
[
$key
]
->
passed
())
{
$allpassed
=
false
;
}
}
// Display the test results.
// Display the test results.
$addlabel
=
stack_string
(
'addanothertestcase'
,
'qtype_stack'
);
$addlabel
=
stack_string
(
'addanothertestcase'
,
'qtype_stack'
);
if
(
empty
(
$testresults
))
{
if
(
empty
(
$testresults
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment