| Línea 32... |
Línea 32... |
| 32 |
* @copyright 2021 Catalyst IT Australia Pty Ltd
|
32 |
* @copyright 2021 Catalyst IT Australia Pty Ltd
|
| 33 |
* @author Safat Shahin <safatshahin@catalyst-au.net>
|
33 |
* @author Safat Shahin <safatshahin@catalyst-au.net>
|
| 34 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
34 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 35 |
* @covers \mod_quiz\question\bank\qbank_helper
|
35 |
* @covers \mod_quiz\question\bank\qbank_helper
|
| 36 |
*/
|
36 |
*/
|
| 37 |
class quiz_question_version_test extends \advanced_testcase {
|
37 |
final class quiz_question_version_test extends \advanced_testcase {
|
| 38 |
use \quiz_question_helper_test_trait;
|
38 |
use \quiz_question_helper_test_trait;
|
| Línea 39... |
Línea 39... |
| 39 |
|
39 |
|
| 40 |
/** @var \stdClass user record. */
|
40 |
/** @var \stdClass user record. */
|
| Línea 95... |
Línea 95... |
| 95 |
$slots = $structure->get_slots();
|
95 |
$slots = $structure->get_slots();
|
| 96 |
$slot = reset($slots);
|
96 |
$slot = reset($slots);
|
| 97 |
$this->assertEquals(4, $slot->version);
|
97 |
$this->assertEquals(4, $slot->version);
|
| 98 |
// Now change the version using the external service.
|
98 |
// Now change the version using the external service.
|
| 99 |
$versions = qbank_helper::get_version_options($slot->questionid);
|
99 |
$versions = qbank_helper::get_version_options($slot->questionid);
|
| - |
|
100 |
$this->assertDebuggingCalled();
|
| 100 |
// We don't want the current version.
|
101 |
// We don't want the current version.
|
| 101 |
$selectversions = [];
|
102 |
$selectversions = [];
|
| 102 |
foreach ($versions as $version) {
|
103 |
foreach ($versions as $version) {
|
| 103 |
if ($version->version === $slot->version) {
|
104 |
if ($version->version === $slot->version) {
|
| 104 |
continue;
|
105 |
continue;
|
| Línea 155... |
Línea 156... |
| 155 |
$structure = \mod_quiz\structure::create_for_quiz($quizobj);
|
156 |
$structure = \mod_quiz\structure::create_for_quiz($quizobj);
|
| 156 |
$slots = $structure->get_slots();
|
157 |
$slots = $structure->get_slots();
|
| 157 |
$slot = reset($slots);
|
158 |
$slot = reset($slots);
|
| 158 |
// Now change the version using the external service.
|
159 |
// Now change the version using the external service.
|
| 159 |
$versions = qbank_helper::get_version_options($slot->questionid);
|
160 |
$versions = qbank_helper::get_version_options($slot->questionid);
|
| - |
|
161 |
$this->assertDebuggingCalled();
|
| 160 |
// We dont want the current version.
|
162 |
// We dont want the current version.
|
| 161 |
$selectversions = [];
|
163 |
$selectversions = [];
|
| 162 |
foreach ($versions as $version) {
|
164 |
foreach ($versions as $version) {
|
| 163 |
if ($version->version === $slot->version) {
|
165 |
if ($version->version === $slot->version) {
|
| 164 |
continue;
|
166 |
continue;
|