MDL-37655 phpunit: Avoid having multiple testcase classes in 1 file
Note that there wasn't any case of multiple testcase classes in 1 file. All the cases reported in the issue were false positives caused but other "mock/fixture" files being named _test. So all this issue does is: 1) rename any _test suffixed class in test files, because we are going to start renaming a lot of test classes to _test. 2) ensure that the 2 test case classes modified in this issue, are already observing the filename = classname rule that will be implemented soon (and verigy it works).
This commit is contained in:
@@ -145,7 +145,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
$this->expectOutputRegex($ouputregex);
|
||||
|
||||
$finder = new tool_httpreplace_url_finder_test();
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course((object) [
|
||||
@@ -216,7 +216,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
public function test_http_link_stats($content, $domain, $expectedcount) {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$finder = new tool_httpreplace_url_finder_test();
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course((object) [
|
||||
@@ -237,7 +237,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
$this->expectOutputRegex('/^$/');
|
||||
|
||||
$finder = new tool_httpreplace_url_finder_test();
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course((object) [
|
||||
@@ -269,7 +269,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
$CFG->wwwroot = preg_replace('/^https:/', 'http:', $CFG->wwwroot);
|
||||
$this->expectOutputRegex('/^$/');
|
||||
|
||||
$finder = new tool_httpreplace_url_finder_test();
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course((object) [
|
||||
@@ -292,7 +292,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
|
||||
set_config('test_upgrade_http_links', '<img src="http://somesite/someimage.png" />');
|
||||
|
||||
$finder = new tool_httpreplace_url_finder_test();
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
ob_start();
|
||||
$results = $finder->upgrade_http_links();
|
||||
$output = ob_get_contents();
|
||||
@@ -318,7 +318,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
|
||||
set_config('renames', json_encode($renames), 'tool_httpsreplace');
|
||||
|
||||
$finder = new tool_httpreplace_url_finder_test();
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course((object) [
|
||||
@@ -353,7 +353,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
$original2 .= '<img src="http://example.com/image' . ($i + 15 ) . '.png">';
|
||||
$expected2 .= '<img src="https://example.com/image' . ($i + 15) . '.png">';
|
||||
}
|
||||
$finder = new tool_httpreplace_url_finder_test();
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
$course1 = $generator->create_course((object) ['summary' => $original1]);
|
||||
@@ -397,7 +397,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
$columnamequoted = $dbman->generator->getEncQuoted('where');
|
||||
$DB->execute("INSERT INTO {reserved_words_temp} ($columnamequoted) VALUES (?)", [$content]);
|
||||
|
||||
$finder = new tool_httpreplace_url_finder_test();
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
$finder->upgrade_http_links();
|
||||
|
||||
$record = $DB->get_record('reserved_words_temp', []);
|
||||
@@ -408,13 +408,13 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Class tool_httpreplace_url_finder_test for testing replace tool without calling curl
|
||||
* Class tool_httpreplace_url_finder_mock for testing replace tool without calling curl
|
||||
*
|
||||
* @package tool_httpsreplace
|
||||
* @copyright 2017 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_httpreplace_url_finder_test extends \tool_httpsreplace\url_finder {
|
||||
class tool_httpreplace_url_finder_mock extends \tool_httpsreplace\url_finder {
|
||||
/**
|
||||
* Check if url is available (check hardcoded for unittests)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user