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
a03b5295
Commit
a03b5295
authored
1 year ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
WIP: stub file for unit testing parsons block.
parent
c2c6b629
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/parsons_block_test.php
+70
-0
70 additions, 0 deletions
tests/parsons_block_test.php
with
70 additions
and
0 deletions
tests/parsons_block_test.php
0 → 100644
+
70
−
0
View file @
a03b5295
<?php
// This file is part of Stack - http://stack.maths.ed.ac.uk/
//
// Stack is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Stack is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.
namespace
qtype_stack
;
use
castext2_evaluatable
;
use
castext2_parser_utils
;
use
qtype_stack_testcase
;
use
stack_ast_container
;
use
stack_cas_keyval
;
use
stack_cas_security
;
use
stack_cas_session2
;
use
stack_maths
;
use
stack_options
;
use
stack_secure_loader
;
use
stack_multilang
;
use
function
stack_ast_container_silent\is_int
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
require_once
(
__DIR__
.
'/../locallib.php'
);
require_once
(
__DIR__
.
'/fixtures/test_base.php'
);
require_once
(
__DIR__
.
'/../stack/cas/castext2/castext2_evaluatable.class.php'
);
require_once
(
__DIR__
.
'/../stack/cas/castext2/utils.php'
);
require_once
(
__DIR__
.
'/../stack/cas/keyval.class.php'
);
require_once
(
__DIR__
.
'/../stack/cas/cassession2.class.php'
);
require_once
(
__DIR__
.
'/../stack/cas/secure_loader.class.php'
);
require_once
(
__DIR__
.
'/../lang/multilang.php'
);
// Unit tests for {@link stack_cas_castext2_parsons}.
/**
* @group qtype_stack
* @group qtype_stack_castext_module
*/
class
parsons_block_test
extends
qtype_stack_testcase
{
/**
* @covers \qtype_stack\stack_cas_castext2_parsons
*/
public
function
test_get_all_raw_casstrings
()
{
$raw
=
'[[parsons]]{'
.
'"1":"Assume that \\(n\\) is odd.",'
.
'"2":"Then there exists an \\(m\\in\\mathbb{Z}\\) such that \\(n=2m+1\\).", '
.
'"3":"\\[ n^2 = (2m+1)^2 = 2(2m^2+2m)+1.\\]", '
.
'"4":"Define \\(M=2m^2+2m\\in\\mathbb{Z}\\) then \\(n^2=2M+1\\).", '
.
'} [[/parsons]]'
;
$expected
=
'<div style="width:100%;height:480px;" id="stack-iframe-holder-1"></div>'
;
$at1
=
castext2_evaluatable
::
make_from_source
(
$raw
,
'test-case'
);
$session
=
new
stack_cas_session2
([
$at1
]);
$session
->
instantiate
();
$this
->
assertEquals
(
$expected
,
$at1
->
get_rendered
());
}
}
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