Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 32... Línea 32...
32
 *
32
 *
33
 * @package   qformat_multianswer
33
 * @package   qformat_multianswer
34
 * @copyright 2012 The Open University
34
 * @copyright 2012 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 multianswerformat_test extends \question_testcase {
37
final class multianswerformat_test extends \question_testcase {
Línea 38... Línea 38...
38
 
38
 
39
    public function test_import(): void {
39
    public function test_import(): void {
Línea 40... Línea 40...
40
        $lines = file(__DIR__ . '/fixtures/questions.multianswer.txt');
40
        $lines = file(self::get_fixture_path(__NAMESPACE__, 'questions.multianswer.txt'));
41
 
41
 
Línea 42... Línea 42...
42
        $importer = new qformat_multianswer();
42
        $importer = new qformat_multianswer();
Línea 71... Línea 71...
71
        $this->assertEquals('multichoice', $qs[0]->options->questions[4]->qtype);
71
        $this->assertEquals('multichoice', $qs[0]->options->questions[4]->qtype);
72
        $this->assertEquals('shortanswer', $qs[0]->options->questions[5]->qtype);
72
        $this->assertEquals('shortanswer', $qs[0]->options->questions[5]->qtype);
73
    }
73
    }
Línea 74... Línea 74...
74
 
74
 
75
    public function test_read_brokencloze_1(): void {
75
    public function test_read_brokencloze_1(): void {
76
        $lines = file(__DIR__ . '/fixtures/broken_multianswer_1.txt');
76
        $lines = file(self::get_fixture_path(__NAMESPACE__, 'broken_multianswer_1.txt'));
Línea 77... Línea 77...
77
        $importer = new qformat_multianswer();
77
        $importer = new qformat_multianswer();
78
 
78
 
79
        // The importer echoes some errors, so we need to capture and check that.
79
        // The importer echoes some errors, so we need to capture and check that.
Línea 90... Línea 90...
90
        // No question  have been imported.
90
        // No question  have been imported.
91
        $this->assertCount(0, $questions);
91
        $this->assertCount(0, $questions);
92
    }
92
    }
Línea 93... Línea 93...
93
 
93
 
94
    public function test_read_brokencloze_2(): void {
94
    public function test_read_brokencloze_2(): void {
95
        $lines = file(__DIR__ . '/fixtures/broken_multianswer_2.txt');
95
        $lines = file(self::get_fixture_path(__NAMESPACE__, 'broken_multianswer_2.txt'));
Línea 96... Línea 96...
96
        $importer = new qformat_multianswer();
96
        $importer = new qformat_multianswer();
97
 
97
 
98
        // The importer echoes some errors, so we need to capture and check that.
98
        // The importer echoes some errors, so we need to capture and check that.
Línea 110... Línea 110...
110
        // No question  have been imported.
110
        // No question  have been imported.
111
        $this->assertCount(0, $questions);
111
        $this->assertCount(0, $questions);
112
    }
112
    }
Línea 113... Línea 113...
113
 
113
 
114
    public function test_read_brokencloze_3(): void {
114
    public function test_read_brokencloze_3(): void {
115
        $lines = file(__DIR__ . '/fixtures/broken_multianswer_3.txt');
115
        $lines = file(self::get_fixture_path(__NAMESPACE__, 'broken_multianswer_3.txt'));
Línea 116... Línea 116...
116
        $importer = new qformat_multianswer();
116
        $importer = new qformat_multianswer();
117
 
117
 
118
        // The importer echoes some errors, so we need to capture and check that.
118
        // The importer echoes some errors, so we need to capture and check that.
Línea 129... Línea 129...
129
        // No question  have been imported.
129
        // No question  have been imported.
130
        $this->assertCount(0, $questions);
130
        $this->assertCount(0, $questions);
131
    }
131
    }
Línea 132... Línea 132...
132
 
132
 
133
    public function test_read_brokencloze_4(): void {
133
    public function test_read_brokencloze_4(): void {
134
        $lines = file(__DIR__ . '/fixtures/broken_multianswer_4.txt');
134
        $lines = file(self::get_fixture_path(__NAMESPACE__, 'broken_multianswer_4.txt'));
Línea 135... Línea 135...
135
        $importer = new qformat_multianswer();
135
        $importer = new qformat_multianswer();
136
 
136
 
137
        // The importer echoes some errors, so we need to capture and check that.
137
        // The importer echoes some errors, so we need to capture and check that.