Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
/**
18
 * factor_sms unit tests.
19
 *
20
 * @package   core
21
 * @author    Mikhail Golenkov <mikhailgolenkov@catalyst-au.net>
22
 * @copyright 2020 Catalyst IT
23
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
namespace core\aws;
27
 
28
/**
29
 * Testcase for the list of AWS regions admin setting.
30
 *
31
 * @package    core
32
 * @author     Mikhail Golenkov <mikhailgolenkov@catalyst-au.net>
33
 * @copyright  2020 Catalyst IT
34
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 * @covers     \core\aws\admin_settings_aws_region
36
 */
37
class admin_settings_aws_region_test extends \advanced_testcase {
38
 
39
    /**
40
     * Cleanup after all tests are executed.
41
     *
42
     * @return void
43
     */
44
    public function tearDown(): void {
45
        $admin = admin_get_root();
46
        $admin->purge_children(true);
47
    }
48
    /**
49
     * Test that output_html() method works and returns HTML string with expected content.
50
     */
51
    public function test_output_html(): void {
52
        $this->resetAfterTest();
53
        $setting = new admin_settings_aws_region('test_aws_region',
54
            'Test visible name', 'Test description', 'Test default setting');
55
        $html = $setting->output_html('');
56
        $this->assertTrue(str_contains($html, 'Test visible name'));
57
        $this->assertTrue(str_contains($html, 'Test description'));
58
        $this->assertTrue(str_contains($html, 'Default: Test default setting'));
59
        $this->assertTrue(str_contains($html,
60
            '<input type="text" list="s__test_aws_region" name="s__test_aws_region" value=""'));
61
        $this->assertTrue(str_contains($html, '<datalist id="s__test_aws_region">'));
62
        $this->assertTrue(str_contains($html, '<option value="'));
63
    }
64
}