Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 33... Línea 33...
33
 * @copyright 2013 David Mudrak <david@moodle.com>
33
 * @copyright 2013 David Mudrak <david@moodle.com>
34
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 */
35
 */
36
class installer_test extends \advanced_testcase {
36
class installer_test extends \advanced_testcase {
Línea 37... Línea 37...
37
 
37
 
38
    public function test_get_addons_repository_url() {
38
    public function test_get_addons_repository_url(): void {
39
        $installer = testable_tool_installaddon_installer::instance();
39
        $installer = testable_tool_installaddon_installer::instance();
40
        $url = $installer->get_addons_repository_url();
40
        $url = $installer->get_addons_repository_url();
41
        $query = parse_url($url, PHP_URL_QUERY);
41
        $query = parse_url($url, PHP_URL_QUERY);
42
        $this->assertEquals(1, preg_match('~^site=(.+)$~', $query, $matches));
42
        $this->assertEquals(1, preg_match('~^site=(.+)$~', $query, $matches));
Línea 47... Línea 47...
47
        $this->assertSame('Nasty site', $site['fullname']);
47
        $this->assertSame('Nasty site', $site['fullname']);
48
        $this->assertSame('file:///etc/passwd', $site['url']);
48
        $this->assertSame('file:///etc/passwd', $site['url']);
49
        $this->assertSame("2.5'; DROP TABLE mdl_user; --", $site['majorversion']);
49
        $this->assertSame("2.5'; DROP TABLE mdl_user; --", $site['majorversion']);
50
    }
50
    }
Línea 51... Línea 51...
51
 
51
 
52
    public function test_decode_remote_request() {
52
    public function test_decode_remote_request(): void {
Línea 53... Línea 53...
53
        $installer = testable_tool_installaddon_installer::instance();
53
        $installer = testable_tool_installaddon_installer::instance();
54
 
54
 
55
        $request = base64_encode(json_encode(array(
55
        $request = base64_encode(json_encode(array(
Línea 105... Línea 105...
105
            'version' => 2012123190,
105
            'version' => 2012123190,
106
        )));
106
        )));
107
        $this->assertSame(false, $installer->testable_decode_remote_request($request));
107
        $this->assertSame(false, $installer->testable_decode_remote_request($request));
108
    }
108
    }
Línea 109... Línea 109...
109
 
109
 
110
    public function test_detect_plugin_component() {
110
    public function test_detect_plugin_component(): void {
Línea 111... Línea 111...
111
        global $CFG;
111
        global $CFG;
Línea 112... Línea 112...
112
 
112
 
Línea 117... Línea 117...
117
 
117
 
118
        $zipfile = $CFG->libdir.'/tests/fixtures/update_validator/zips/invalidroot.zip';
118
        $zipfile = $CFG->libdir.'/tests/fixtures/update_validator/zips/invalidroot.zip';
119
        $this->assertFalse($installer->detect_plugin_component($zipfile));
119
        $this->assertFalse($installer->detect_plugin_component($zipfile));
Línea 120... Línea 120...
120
    }
120
    }
121
 
121
 
Línea 122... Línea 122...
122
    public function test_detect_plugin_component_from_versionphp() {
122
    public function test_detect_plugin_component_from_versionphp(): void {
123
        global $CFG;
123
        global $CFG;
Línea 134... Línea 134...
134
 
134
 
135
        $versionphp = file_get_contents($fixtures.'/nocomponent/baz/version.php');
135
        $versionphp = file_get_contents($fixtures.'/nocomponent/baz/version.php');
136
        $this->assertFalse($installer->testable_detect_plugin_component_from_versionphp($versionphp));
136
        $this->assertFalse($installer->testable_detect_plugin_component_from_versionphp($versionphp));
Línea 137... Línea 137...
137
    }
137
    }
138
 
138
 
Línea 139... Línea 139...
139
    public function test_make_installfromzip_storage() {
139
    public function test_make_installfromzip_storage(): void {
140
        $installer = testable_tool_installaddon_installer::instance();
140
        $installer = testable_tool_installaddon_installer::instance();
141
 
141