| Línea 24... |
Línea 24... |
| 24 |
*
|
24 |
*
|
| 25 |
* @package qbank_editquestion
|
25 |
* @package qbank_editquestion
|
| 26 |
* @copyright 2021 Catalyst IT Australia Pty Ltd
|
26 |
* @copyright 2021 Catalyst IT Australia Pty Ltd
|
| 27 |
* @author Safat Shahin <safatshahin@catalyst-au.net>
|
27 |
* @author Safat Shahin <safatshahin@catalyst-au.net>
|
| 28 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
28 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| - |
|
29 |
*
|
| 29 |
* @coversDefaultClass \core_question\local\bank\question_version_status
|
30 |
* @covers \core_question\local\bank\question_version_status
|
| 30 |
* @coversDefaultClass \qbank_editquestion\external\update_question_version_status
|
31 |
* @coversDefaultClass \qbank_editquestion\external\update_question_version_status
|
| 31 |
* @coversDefaultClass \qbank_editquestion\editquestion_helper
|
- |
|
| 32 |
*/
|
32 |
*/
|
| 33 |
class update_question_version_status_test extends \advanced_testcase {
|
33 |
class update_question_version_status_test extends \advanced_testcase {
|
| Línea 34... |
Línea 34... |
| 34 |
|
34 |
|
| 35 |
/** @var \stdClass course record. */
|
35 |
/** @var \stdClass course record. */
|
| Línea 51... |
Línea 51... |
| 51 |
|
51 |
|
| 52 |
/**
|
52 |
/**
|
| 53 |
* Test if the submit status webservice changes the status of the question.
|
53 |
* Test if the submit status webservice changes the status of the question.
|
| 54 |
*
|
54 |
*
|
| 55 |
* @covers ::execute
|
55 |
* @covers ::execute
|
| 56 |
* @covers ::get_question_status_string
|
56 |
* @covers \qbank_editquestion\editquestion_helper::get_question_status_string
|
| 57 |
*/
|
57 |
*/
|
| 58 |
public function test_submit_status_updates_the_question_status() {
|
58 |
public function test_submit_status_updates_the_question_status(): void {
|
| 59 |
global $DB;
|
59 |
global $DB;
|
| 60 |
$this->resetAfterTest();
|
60 |
$this->resetAfterTest();
|
| 61 |
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
61 |
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
| 62 |
$cat = $questiongenerator->create_question_category();
|
62 |
$cat = $questiongenerator->create_question_category();
|
| Línea 71... |
Línea 71... |
| 71 |
/**
|
71 |
/**
|
| 72 |
* Test submit status webservice only takes an existing parameter status.
|
72 |
* Test submit status webservice only takes an existing parameter status.
|
| 73 |
*
|
73 |
*
|
| 74 |
* @covers ::execute
|
74 |
* @covers ::execute
|
| 75 |
*/
|
75 |
*/
|
| 76 |
public function test_submit_status_error() {
|
76 |
public function test_submit_status_error(): void {
|
| 77 |
global $DB;
|
77 |
global $DB;
|
| 78 |
$this->resetAfterTest();
|
78 |
$this->resetAfterTest();
|
| 79 |
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
79 |
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
| 80 |
$cat = $questiongenerator->create_question_category();
|
80 |
$cat = $questiongenerator->create_question_category();
|
| 81 |
$numq = $questiongenerator->create_question('essay', null,
|
81 |
$numq = $questiongenerator->create_question('essay', null,
|
| Línea 94... |
Línea 94... |
| 94 |
/**
|
94 |
/**
|
| 95 |
* Test that updating the status does not create a new version.
|
95 |
* Test that updating the status does not create a new version.
|
| 96 |
*
|
96 |
*
|
| 97 |
* @covers ::execute
|
97 |
* @covers ::execute
|
| 98 |
*/
|
98 |
*/
|
| 99 |
public function test_submit_status_does_not_create_a_new_version() {
|
99 |
public function test_submit_status_does_not_create_a_new_version(): void {
|
| 100 |
global $DB;
|
100 |
global $DB;
|
| 101 |
$this->resetAfterTest();
|
101 |
$this->resetAfterTest();
|
| Línea 102... |
Línea 102... |
| 102 |
|
102 |
|
| 103 |
// Find out the start count in 'question_versions' table.
|
103 |
// Find out the start count in 'question_versions' table.
|