Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 45... Línea 45...
45
    /**
45
    /**
46
     * Tests user_picture::fields.
46
     * Tests user_picture::fields.
47
     *
47
     *
48
     * @deprecated since Moodle 3.11 MDL-45242
48
     * @deprecated since Moodle 3.11 MDL-45242
49
     */
49
     */
50
    public function test_fields_aliasing() {
50
    public function test_fields_aliasing(): void {
51
        $fields = user_picture::fields();
51
        $fields = user_picture::fields();
52
        $fields = array_map('trim', explode(',', $fields));
52
        $fields = array_map('trim', explode(',', $fields));
53
        $this->assertTrue(in_array('id', $fields));
53
        $this->assertTrue(in_array('id', $fields));
Línea 54... Línea 54...
54
 
54
 
Línea 80... Línea 80...
80
    }
80
    }
Línea 81... Línea 81...
81
 
81
 
82
    /**
82
    /**
83
     * Tests user_picture::unalias.
83
     * Tests user_picture::unalias.
84
     */
84
     */
85
    public function test_fields_unaliasing() {
85
    public function test_fields_unaliasing(): void {
86
        $fields = implode(',', \core_user\fields::get_picture_fields());
86
        $fields = implode(',', \core_user\fields::get_picture_fields());
Línea 87... Línea 87...
87
        $fields = array_map('trim', explode(',', $fields));
87
        $fields = array_map('trim', explode(',', $fields));
88
 
88
 
Línea 107... Línea 107...
107
    }
107
    }
Línea 108... Línea 108...
108
 
108
 
109
    /**
109
    /**
110
     * Tests user_picture::unalias with null values.
110
     * Tests user_picture::unalias with null values.
111
     */
111
     */
112
    public function test_fields_unaliasing_null() {
112
    public function test_fields_unaliasing_null(): void {
113
        $fields = implode(',', \core_user\fields::get_picture_fields());
113
        $fields = implode(',', \core_user\fields::get_picture_fields());
Línea 114... Línea 114...
114
        $fields = array_map('trim', explode(',', $fields));
114
        $fields = array_map('trim', explode(',', $fields));
115
 
115
 
Línea 133... Línea 133...
133
            }
133
            }
134
        }
134
        }
135
        $this->assertSame('Value of custom1', $returned->custom1);
135
        $this->assertSame('Value of custom1', $returned->custom1);
136
    }
136
    }
Línea 137... Línea 137...
137
 
137
 
138
    public function test_get_url() {
138
    public function test_get_url(): void {
Línea 139... Línea 139...
139
        global $DB, $CFG, $USER;
139
        global $DB, $CFG, $USER;
Línea 140... Línea 140...
140
 
140
 
Línea 319... Línea 319...
319
 
319
 
320
        $up3 = new user_picture($user3);
320
        $up3 = new user_picture($user3);
321
        $this->assertSame($CFG->wwwroot.'/theme/image.php?theme=classic&component=core&rev=1&image=u%2Ff2', $up3->get_url($page, $renderer)->out(false));
321
        $this->assertSame($CFG->wwwroot.'/theme/image.php?theme=classic&component=core&rev=1&image=u%2Ff2', $up3->get_url($page, $renderer)->out(false));
Línea 322... Línea 322...
322
    }
322
    }
323
 
323
 
324
    public function test_empty_menu() {
324
    public function test_empty_menu(): void {
325
        $emptymenu = new custom_menu();
325
        $emptymenu = new custom_menu();
326
        $this->assertInstanceOf(custom_menu::class, $emptymenu);
326
        $this->assertInstanceOf(custom_menu::class, $emptymenu);
Línea 327... Línea 327...
327
        $this->assertFalse($emptymenu->has_children());
327
        $this->assertFalse($emptymenu->has_children());
328
    }
328
    }
329
 
329
 
330
    public function test_basic_syntax() {
330
    public function test_basic_syntax(): void {
331
        $definition = <<<EOF
331
        $definition = <<<EOF
332
Moodle community|http://moodle.org
332
Moodle community|http://moodle.org
Línea 370... Línea 370...
370
        $this->assertFalse($subitem->has_children());
370
        $this->assertFalse($subitem->has_children());
371
        $this->assertSame('Hosting', $subitem->get_text());
371
        $this->assertSame('Hosting', $subitem->get_text());
372
        $this->assertSame('Commercial hosting', $subitem->get_title());
372
        $this->assertSame('Commercial hosting', $subitem->get_title());
373
    }
373
    }
Línea 374... Línea 374...
374
 
374
 
375
    public function test_custommenu_mulitlang() {
375
    public function test_custommenu_mulitlang(): void {
376
        $definition = <<<EOF
376
        $definition = <<<EOF
377
Start|http://school.info
377
Start|http://school.info
378
Info
378
Info
379
-English|http://school.info/en|Information in English|en
379
-English|http://school.info/en|Information in English|en
Línea 447... Línea 447...
447
            }
447
            }
448
        }
448
        }
449
        return $str;
449
        return $str;
450
    }
450
    }
Línea 451... Línea 451...
451
 
451
 
452
    public function test_prepare() {
452
    public function test_prepare(): void {
453
        $expecteda = array('<span class="current-page">1</span>',
453
        $expecteda = array('<span class="current-page">1</span>',
454
            '<a href="index.php?page=1">2</a>',
454
            '<a href="index.php?page=1">2</a>',
455
            '<a href="index.php?page=2">3</a>',
455
            '<a href="index.php?page=2">3</a>',
456
            '<a href="index.php?page=3">4</a>',
456
            '<a href="index.php?page=3">4</a>',
Línea 476... Línea 476...
476
 
476
 
477
        $this->assertEquals($expecteda, $pbara->pagelinks);
477
        $this->assertEquals($expecteda, $pbara->pagelinks);
478
        $this->assertEquals($expectedb, $pbarb->pagelinks);
478
        $this->assertEquals($expectedb, $pbarb->pagelinks);
Línea 479... Línea 479...
479
    }
479
    }
480
 
480
 
Línea 481... Línea 481...
481
    public function test_pix_icon() {
481
    public function test_pix_icon(): void {
Línea 482... Línea 482...
482
        $this->resetAfterTest();
482
        $this->resetAfterTest();
Línea 508... Línea 508...
508
    }
508
    }
Línea 509... Línea 509...
509
 
509
 
510
    /**
510
    /**
511
     * Test for checking the template context data for the single_select element.
511
     * Test for checking the template context data for the single_select element.
512
     */
512
     */
513
    public function test_single_select() {
513
    public function test_single_select(): void {
Línea 514... Línea 514...
514
        global $PAGE;
514
        global $PAGE;
515
 
515
 
516
        $fakename = 'fakename';
516
        $fakename = 'fakename';
Línea 588... Línea 588...
588
    }
588
    }
589
    /**
589
    /**
590
     * Test for checking the template context data for the single_select element.
590
     * Test for checking the template context data for the single_select element.
591
     * @covers \single_button
591
     * @covers \single_button
592
     */
592
     */
593
    public function test_single_button() {
593
    public function test_single_button(): void {
594
        global $PAGE;
594
        global $PAGE;
595
        $url = new \moodle_url('/');
595
        $url = new \moodle_url('/');
596
        $realname = 'realname';
596
        $realname = 'realname';
597
        $attributes = [
597
        $attributes = [
598
            'data-dummy' => 'dummy',
598
            'data-dummy' => 'dummy',
Línea 620... Línea 620...
620
 
620
 
621
    /**
621
    /**
622
     * Test for checking the template context data for the single_select element legacy API.
622
     * Test for checking the template context data for the single_select element legacy API.
623
     * @covers \single_button
623
     * @covers \single_button
624
     */
624
     */
625
    public function test_single_button_deprecated() {
625
    public function test_single_button_deprecated(): void {
626
        global $PAGE;
626
        global $PAGE;
627
        $url = new \moodle_url('/');
627
        $url = new \moodle_url('/');
628
        $realname = 'realname';
628
        $realname = 'realname';
629
        $attributes = [
629
        $attributes = [
Línea 667... Línea 667...
667
    }
667
    }
Línea 668... Línea 668...
668
 
668
 
669
    /**
669
    /**
670
     * Test for checking the template context data for the url_select element.
670
     * Test for checking the template context data for the url_select element.
671
     */
671
     */
672
    public function test_url_select() {
672
    public function test_url_select(): void {
Línea 673... Línea 673...
673
        global $PAGE;
673
        global $PAGE;
674
 
674
 
675
        $fakename = 'fakename';
675
        $fakename = 'fakename';
Línea 769... Línea 769...
769
     *
769
     *
770
     * @dataProvider block_contents_is_fake_provider
770
     * @dataProvider block_contents_is_fake_provider
771
     * @param mixed $value Value for the data-block attribute
771
     * @param mixed $value Value for the data-block attribute
772
     * @param boolean $expected The expected result
772
     * @param boolean $expected The expected result
773
     */
773
     */
774
    public function test_block_contents_is_fake($value, $expected) {
774
    public function test_block_contents_is_fake($value, $expected): void {
775
        $bc = new block_contents(array());
775
        $bc = new block_contents(array());
776
        if ($value !== false) {
776
        if ($value !== false) {
777
            $bc->attributes['data-block'] = $value;
777
            $bc->attributes['data-block'] = $value;
778
        }
778
        }
779
        $this->assertEquals($expected, $bc->is_fake());
779
        $this->assertEquals($expected, $bc->is_fake());