Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
namespace core_courseformat\output\local\overview;
18
 
19
/**
20
 * Tests for courseformat
21
 *
22
 * @package    core_courseformat
23
 * @category   test
24
 * @copyright  2025 Ferran Recio <ferran@moodle.com>
25
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26
 * @covers     \core_courseformat\output\local\overview\missingoverviewnotice
27
 */
28
final class missingoverviewnotice_test extends \advanced_testcase {
29
    /**
30
     * Test overview integrations.
31
     *
32
     * @covers ::export_for_template
33
     * @covers ::activity_has_overview_integration
34
     * @dataProvider overview_integrations_provider
35
     * @param string $modname
36
     * @param bool $expectempty
37
     */
38
    public function test_overview_integrations(
39
        string $modname,
40
        bool $expectempty,
41
    ): void {
42
        global $PAGE;
43
 
44
        $this->resetAfterTest();
45
 
46
        $renderer = $PAGE->get_renderer('core');
47
        $course = $this->getDataGenerator()->create_course();
48
 
49
        $missingoverviewnotice = new missingoverviewnotice($course, $modname);
50
        $export = $missingoverviewnotice->export_for_template($renderer);
51
 
52
        if ($expectempty) {
53
            $this->assertEquals((object) [], $export);
54
        } else {
55
            $this->assertNotEquals((object) [], $export);
56
        }
57
    }
58
 
59
    /**
60
     * Data provider for test_overview_integrations.
61
     *
62
     * @return array
63
     */
64
    public static function overview_integrations_provider(): array {
65
        return [
66
            'assign' => ['modname' => 'assign', 'expectempty' => true],
67
            'bigbluebuttonbn' => ['modname' => 'bigbluebuttonbn', 'expectempty' => false],
68
            'book' => ['modname' => 'book', 'expectempty' => false],
69
            'choice' => ['modname' => 'choice', 'expectempty' => false],
70
            'data' => ['modname' => 'data', 'expectempty' => false],
71
            'feedback' => ['modname' => 'feedback', 'expectempty' => true],
72
            'folder' => ['modname' => 'folder', 'expectempty' => false],
73
            'forum' => ['modname' => 'forum', 'expectempty' => false],
74
            'glossary' => ['modname' => 'glossary', 'expectempty' => false],
75
            'h5pactivity' => ['modname' => 'h5pactivity', 'expectempty' => false],
76
            'imscp' => ['modname' => 'imscp', 'expectempty' => false],
77
            'label' => ['modname' => 'label', 'expectempty' => false],
78
            'lesson' => ['modname' => 'lesson', 'expectempty' => false],
79
            'lti' => ['modname' => 'lti', 'expectempty' => false],
80
            'page' => ['modname' => 'page', 'expectempty' => false],
81
            'qbank' => ['modname' => 'qbank', 'expectempty' => false],
82
            'quiz' => ['modname' => 'quiz', 'expectempty' => false],
83
            'resource' => ['modname' => 'resource', 'expectempty' => true],
84
            'scorm' => ['modname' => 'scorm', 'expectempty' => false],
85
            'url' => ['modname' => 'url', 'expectempty' => false],
86
            'wiki' => ['modname' => 'wiki', 'expectempty' => false],
87
            'workshop' => ['modname' => 'workshop', 'expectempty' => true],
88
        ];
89
    }
90
}