Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 22... Línea 22...
22
 * @package    core
22
 * @package    core
23
 * @subpackage course
23
 * @subpackage course
24
 * @copyright  2021 Ilya Tregubov <ilya@moodle.com>
24
 * @copyright  2021 Ilya Tregubov <ilya@moodle.com>
25
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26
 */
26
 */
27
class state_test extends \advanced_testcase {
27
final class state_test extends \advanced_testcase {
Línea 28... Línea 28...
28
 
28
 
29
    /**
29
    /**
30
     * Setup to ensure that fixtures are loaded.
30
     * Setup to ensure that fixtures are loaded.
31
     */
31
     */
Línea 39... Línea 39...
39
 
39
 
40
    /**
40
    /**
41
     * Test the behaviour of state::export_for_template().
41
     * Test the behaviour of state::export_for_template().
42
     *
42
     *
-
 
43
     * @dataProvider state_provider
-
 
44
     * @covers \core_courseformat\output\local\state\course
43
     * @dataProvider state_provider
45
     * @covers \core_courseformat\output\local\state\section
44
     * @covers \core_courseformat\output\local\state
46
     * @covers \core_courseformat\output\local\state\cm
45
     *
47
     *
46
     * @param string $format The course format of the course where the method will be executed.
48
     * @param string $format The course format of the course where the method will be executed.
47
     */
49
     */
48
    public function test_state(string $format = 'topics'): void {
50
    public function test_state(string $format = 'topics'): void {
Línea 107... Línea 109...
107
        $this->assertEquals($numsections, $result->course->numsections);
109
        $this->assertEquals($numsections, $result->course->numsections);
108
        $this->assertFalse($result->course->editmode);
110
        $this->assertFalse($result->course->editmode);
109
        $sections = $modinfo->get_section_info_all();
111
        $sections = $modinfo->get_section_info_all();
Línea 110... Línea 112...
110
 
112
 
111
        foreach ($sections as $key => $section) {
-
 
112
            $this->assertEquals($section->id, $result->course->sectionlist[$key]);
113
        foreach ($sections as $key => $section) {
-
 
114
            if (!$issocialformat || $format == 'theunittest') {
113
            if (!$issocialformat || $format == 'theunittest') {
115
                $this->assertEquals($section->id, $result->course->sectionlist[$key]);
114
                if (!empty($section->uservisible)) {
116
                if (!empty($section->uservisible)) {
115
                    $sectionstate = new $sectionclass($courseformat, $section);
117
                    $sectionstate = new $sectionclass($courseformat, $section);
116
                    $result->section[$key] = $sectionstate->export_for_template($renderer);
118
                    $result->section[$key] = $sectionstate->export_for_template($renderer);
117
                    $this->assertEquals($section->id, $result->section[$key]->id);
119
                    $this->assertEquals($section->id, $result->section[$key]->id);
Línea 147... Línea 149...
147
    /**
149
    /**
148
     * Data provider for test_state().
150
     * Data provider for test_state().
149
     *
151
     *
150
     * @return array
152
     * @return array
151
     */
153
     */
152
    public function state_provider(): array {
154
    public static function state_provider(): array {
153
        return [
155
        return [
154
            // COURSEFORMAT. Test behaviour depending on course formats.
156
            // COURSEFORMAT. Test behaviour depending on course formats.
155
            'Single activity format' => [
157
            'Single activity format' => [
156
                'format' => 'singleactivity',
158
                'format' => 'singleactivity',
157
            ],
159
            ],