mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-84152 tests: Remove extraneous / in external file URL generation
This commit is contained in:
parent
a843eab495
commit
99aac9532a
@ -622,7 +622,7 @@ abstract class advanced_testcase extends base_testcase {
|
||||
}
|
||||
return TEST_EXTERNAL_FILES_HTTPS_URL . $path;
|
||||
}
|
||||
return "https://download.moodle.org/unittest/{$path}";
|
||||
return "https://download.moodle.org/unittest{$path}";
|
||||
}
|
||||
|
||||
if (defined('TEST_EXTERNAL_FILES_HTTP_URL')) {
|
||||
@ -631,7 +631,7 @@ abstract class advanced_testcase extends base_testcase {
|
||||
}
|
||||
return TEST_EXTERNAL_FILES_HTTP_URL . $path;
|
||||
}
|
||||
return "http://download.moodle.org/unittest/{$path}";
|
||||
return "http://download.moodle.org/unittest{$path}";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -292,6 +292,30 @@ final class advanced_test extends \advanced_testcase {
|
||||
$this->assertInstanceOf('testing_data_generator', $generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Some basic tests for the getExternalTestFileUrl() method.
|
||||
*/
|
||||
public function test_external_file_url(): void {
|
||||
$url = self::getExternalTestFileUrl('testfile.txt');
|
||||
// There should only be a // after the protocol.
|
||||
$this->assertCount(2, explode('//', $url));
|
||||
|
||||
if (defined('TEST_EXTERNAL_FILES_HTTP_URL')) {
|
||||
$this->assertStringContainsString(TEST_EXTERNAL_FILES_HTTP_URL, $url);
|
||||
} else {
|
||||
$this->assertStringContainsString('http://download.moodle.org/unittest', $url);
|
||||
}
|
||||
|
||||
$url = self::getExternalTestFileUrl('testfile.txt', true);
|
||||
$this->assertCount(2, explode('//', $url));
|
||||
|
||||
if (defined('TEST_EXTERNAL_FILES_HTTPS_URL')) {
|
||||
$this->assertStringContainsString(TEST_EXTERNAL_FILES_HTTPS_URL, $url);
|
||||
} else {
|
||||
$this->assertStringContainsString('https://download.moodle.org/unittest', $url);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_database_mock1(): void {
|
||||
global $DB;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user