Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 40... Línea 40...
40
     * Tests the save and load functionality.
40
     * Tests the save and load functionality.
41
     *
41
     *
42
     * @author Jason den Dulk
42
     * @author Jason den Dulk
43
     * @covers \core_courseformat
43
     * @covers \core_courseformat
44
     */
44
     */
45
    public function test_courseformat_saveandload() {
45
    public function test_courseformat_saveandload(): void {
46
        $this->resetAfterTest();
46
        $this->resetAfterTest();
Línea 47... Línea 47...
47
 
47
 
48
        $courseformatoptiondata = (object) [
48
        $courseformatoptiondata = (object) [
49
            "hideoddsections" => 1,
49
            "hideoddsections" => 1,
Línea 63... Línea 63...
63
        $savedcourseformatoptiondata = $courseformat->get_format_options();
63
        $savedcourseformatoptiondata = $courseformat->get_format_options();
Línea 64... Línea 64...
64
 
64
 
65
        $this->assertEqualsCanonicalizing($courseformatoptiondata, (object) $savedcourseformatoptiondata);
65
        $this->assertEqualsCanonicalizing($courseformatoptiondata, (object) $savedcourseformatoptiondata);
Línea 66... Línea 66...
66
    }
66
    }
67
 
67
 
68
    public function test_available_hook() {
68
    public function test_available_hook(): void {
Línea 69... Línea 69...
69
        global $DB;
69
        global $DB;
70
        $this->resetAfterTest();
70
        $this->resetAfterTest();
Línea 182... Línea 182...
182
    }
182
    }
Línea 183... Línea 183...
183
 
183
 
184
    /**
184
    /**
185
     * Test for supports_news() with a course format plugin that doesn't define 'news_items' in default blocks.
185
     * Test for supports_news() with a course format plugin that doesn't define 'news_items' in default blocks.
186
     */
186
     */
187
    public function test_supports_news() {
187
    public function test_supports_news(): void {
188
        $this->resetAfterTest();
188
        $this->resetAfterTest();
189
        $format = course_get_format((object)['format' => 'testformat']);
189
        $format = course_get_format((object)['format' => 'testformat']);
190
        $this->assertFalse($format->supports_news());
190
        $this->assertFalse($format->supports_news());
Línea 191... Línea 191...
191
    }
191
    }
192
 
192
 
193
    /**
193
    /**
194
     * Test for supports_news() for old course format plugins that defines 'news_items' in default blocks.
194
     * Test for supports_news() for old course format plugins that defines 'news_items' in default blocks.
195
     */
195
     */
196
    public function test_supports_news_legacy() {
196
    public function test_supports_news_legacy(): void {
197
        $this->resetAfterTest();
197
        $this->resetAfterTest();
198
        $format = course_get_format((object)['format' => 'testlegacy']);
198
        $format = course_get_format((object)['format' => 'testlegacy']);
Línea 261... Línea 261...
261
     * @dataProvider get_output_classname_provider
261
     * @dataProvider get_output_classname_provider
262
     * @param string $find the class to find
262
     * @param string $find the class to find
263
     * @param string $result the expected result classname
263
     * @param string $result the expected result classname
264
     * @param bool $exception if the method will raise an exception
264
     * @param bool $exception if the method will raise an exception
265
     */
265
     */
266
    public function test_get_output_classname($find, $result, $exception) {
266
    public function test_get_output_classname($find, $result, $exception): void {
267
        $this->resetAfterTest();
267
        $this->resetAfterTest();
Línea 268... Línea 268...
268
 
268
 
269
        $course = $this->getDataGenerator()->create_course(['format' => 'theunittest']);
269
        $course = $this->getDataGenerator()->create_course(['format' => 'theunittest']);
Línea 305... Línea 305...
305
    /**
305
    /**
306
     * Test for the default delete format data behaviour.
306
     * Test for the default delete format data behaviour.
307
     *
307
     *
308
     * @covers ::get_sections_preferences
308
     * @covers ::get_sections_preferences
309
     */
309
     */
310
    public function test_get_sections_preferences() {
310
    public function test_get_sections_preferences(): void {
311
        $this->resetAfterTest();
311
        $this->resetAfterTest();
312
        $generator = $this->getDataGenerator();
312
        $generator = $this->getDataGenerator();
313
        $course = $generator->create_course();
313
        $course = $generator->create_course();
314
        $user = $generator->create_and_enrol($course, 'student');
314
        $user = $generator->create_and_enrol($course, 'student');
Línea 339... Línea 339...
339
    /**
339
    /**
340
     * Test for the default delete format data behaviour.
340
     * Test for the default delete format data behaviour.
341
     *
341
     *
342
     * @covers ::set_sections_preference
342
     * @covers ::set_sections_preference
343
     */
343
     */
344
    public function test_set_sections_preference() {
344
    public function test_set_sections_preference(): void {
345
        $this->resetAfterTest();
345
        $this->resetAfterTest();
346
        $generator = $this->getDataGenerator();
346
        $generator = $this->getDataGenerator();
347
        $course = $generator->create_course();
347
        $course = $generator->create_course();
348
        $user = $generator->create_and_enrol($course, 'student');
348
        $user = $generator->create_and_enrol($course, 'student');
Línea 464... Línea 464...
464
     *
464
     *
465
     * @covers ::delete_format_data
465
     * @covers ::delete_format_data
466
     * @dataProvider delete_format_data_provider
466
     * @dataProvider delete_format_data_provider
467
     * @param bool $usehook if it should use course_delete to trigger $format->delete_format_data as a hook
467
     * @param bool $usehook if it should use course_delete to trigger $format->delete_format_data as a hook
468
     */
468
     */
469
    public function test_delete_format_data(bool $usehook) {
469
    public function test_delete_format_data(bool $usehook): void {
470
        global $DB;
470
        global $DB;
Línea 471... Línea 471...
471
 
471
 
Línea 472... Línea 472...
472
        $this->resetAfterTest();
472
        $this->resetAfterTest();
Línea 530... Línea 530...
530
 
530
 
531
    /**
531
    /**
532
     * Test duplicate_section()
532
     * Test duplicate_section()
533
     * @covers ::duplicate_section
533
     * @covers ::duplicate_section
534
     */
534
     */
535
    public function test_duplicate_section() {
535
    public function test_duplicate_section(): void {
Línea 536... Línea 536...
536
        global $DB;
536
        global $DB;
537
 
537
 
Línea 643... Línea 643...
643
     * @dataProvider move_section_after_provider
643
     * @dataProvider move_section_after_provider
644
     * @param string $movesection the reference of the section to move
644
     * @param string $movesection the reference of the section to move
645
     * @param string $destination the reference of the destination section
645
     * @param string $destination the reference of the destination section
646
     * @param string[] $order the references of the final section order
646
     * @param string[] $order the references of the final section order
647
     */
647
     */
648
    public function test_move_section_after(string $movesection, string $destination, array $order) {
648
    public function test_move_section_after(string $movesection, string $destination, array $order): void {
649
        global $DB;
649
        global $DB;
Línea 650... Línea 650...
650
 
650
 
Línea 651... Línea 651...
651
        $this->resetAfterTest();
651
        $this->resetAfterTest();
Línea 768... Línea 768...
768
     * @dataProvider get_non_ajax_cm_action_url_provider
768
     * @dataProvider get_non_ajax_cm_action_url_provider
769
     * @param string $action the ajax action name
769
     * @param string $action the ajax action name
770
     * @param string $expectedparam the expected param to check
770
     * @param string $expectedparam the expected param to check
771
     * @param string $exception if an exception is expected
771
     * @param string $exception if an exception is expected
772
     */
772
     */
773
    public function test_get_non_ajax_cm_action_url(string $action, string $expectedparam, bool $exception) {
773
    public function test_get_non_ajax_cm_action_url(string $action, string $expectedparam, bool $exception): void {
774
        global $DB;
774
        global $DB;
Línea 775... Línea 775...
775
 
775
 
Línea 776... Línea 776...
776
        $this->resetAfterTest();
776
        $this->resetAfterTest();