Línea 33... |
Línea 33... |
33 |
* @category test
|
33 |
* @category test
|
34 |
* @copyright 2009 The Open University
|
34 |
* @copyright 2009 The Open University
|
35 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
35 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
36 |
*/
|
36 |
*/
|
37 |
class questionattemptstep_db_test extends \data_loading_method_test_base {
|
37 |
class questionattemptstep_db_test extends \data_loading_method_test_base {
|
38 |
public function test_load_with_data() {
|
38 |
public function test_load_with_data(): void {
|
39 |
$records = new question_test_recordset(array(
|
39 |
$records = new question_test_recordset(array(
|
40 |
array('attemptstepid', 'questionattemptid', 'sequencenumber', 'state', 'fraction', 'timecreated', 'userid', 'name', 'value', 'qtype', 'contextid'),
|
40 |
array('attemptstepid', 'questionattemptid', 'sequencenumber', 'state', 'fraction', 'timecreated', 'userid', 'name', 'value', 'qtype', 'contextid'),
|
41 |
array( 1, 1, 0, 'todo', null, 1256228502, 13, null, null, 'description', 1),
|
41 |
array( 1, 1, 0, 'todo', null, 1256228502, 13, null, null, 'description', 1),
|
42 |
array( 2, 1, 1, 'complete', null, 1256228505, 13, 'x', 'a', 'description', 1),
|
42 |
array( 2, 1, 1, 'complete', null, 1256228505, 13, 'x', 'a', 'description', 1),
|
43 |
array( 2, 1, 1, 'complete', null, 1256228505, 13, '_y', '_b', 'description', 1),
|
43 |
array( 2, 1, 1, 'complete', null, 1256228505, 13, '_y', '_b', 'description', 1),
|
Línea 52... |
Línea 52... |
52 |
$this->assertEquals(1256228505, $step->get_timecreated());
|
52 |
$this->assertEquals(1256228505, $step->get_timecreated());
|
53 |
$this->assertEquals(13, $step->get_user_id());
|
53 |
$this->assertEquals(13, $step->get_user_id());
|
54 |
$this->assertEquals(array('x' => 'a', '_y' => '_b', '-z' => '!c', '-_t' => '!_d'), $step->get_all_data());
|
54 |
$this->assertEquals(array('x' => 'a', '_y' => '_b', '-z' => '!c', '-_t' => '!_d'), $step->get_all_data());
|
55 |
}
|
55 |
}
|
Línea 56... |
Línea 56... |
56 |
|
56 |
|
57 |
public function test_load_without_data() {
|
57 |
public function test_load_without_data(): void {
|
58 |
$records = new question_test_recordset(array(
|
58 |
$records = new question_test_recordset(array(
|
59 |
array('attemptstepid', 'questionattemptid', 'sequencenumber', 'state', 'fraction', 'timecreated', 'userid', 'name', 'value', 'contextid'),
|
59 |
array('attemptstepid', 'questionattemptid', 'sequencenumber', 'state', 'fraction', 'timecreated', 'userid', 'name', 'value', 'contextid'),
|
60 |
array( 2, 1, 1, 'complete', null, 1256228505, 13, null, null, 1),
|
60 |
array( 2, 1, 1, 'complete', null, 1256228505, 13, null, null, 1),
|
Línea 66... |
Línea 66... |
66 |
$this->assertEquals(1256228505, $step->get_timecreated());
|
66 |
$this->assertEquals(1256228505, $step->get_timecreated());
|
67 |
$this->assertEquals(13, $step->get_user_id());
|
67 |
$this->assertEquals(13, $step->get_user_id());
|
68 |
$this->assertEquals(array(), $step->get_all_data());
|
68 |
$this->assertEquals(array(), $step->get_all_data());
|
69 |
}
|
69 |
}
|
Línea 70... |
Línea 70... |
70 |
|
70 |
|
71 |
public function test_load_dont_be_too_greedy() {
|
71 |
public function test_load_dont_be_too_greedy(): void {
|
72 |
$records = new question_test_recordset(array(
|
72 |
$records = new question_test_recordset(array(
|
73 |
array('attemptstepid', 'questionattemptid', 'sequencenumber', 'state', 'fraction', 'timecreated', 'userid', 'name', 'value', 'contextid'),
|
73 |
array('attemptstepid', 'questionattemptid', 'sequencenumber', 'state', 'fraction', 'timecreated', 'userid', 'name', 'value', 'contextid'),
|
74 |
array( 1, 1, 0, 'todo', null, 1256228502, 13, 'x', 'right', 1),
|
74 |
array( 1, 1, 0, 'todo', null, 1256228502, 13, 'x', 'right', 1),
|
75 |
array( 2, 2, 0, 'complete', null, 1256228505, 13, 'x', 'wrong', 1),
|
75 |
array( 2, 2, 0, 'complete', null, 1256228505, 13, 'x', 'wrong', 1),
|