MDL-86495 core: Improve PHPUnit for IPLookup

This commit is contained in:
Huong Nguyen
2025-09-16 08:51:51 +07:00
parent 4ce0bb6ebf
commit 8580cb89d8
2 changed files with 0 additions and 14 deletions
-5
View File
@@ -55,8 +55,6 @@ final class geoip_test extends \advanced_testcase {
$this->markTestSkipped('External geo tests are disabled.');
}
$this->resetAfterTest();
// Store the old value to restore later.
$oldvalue = $CFG->geopluginapikey;
$CFG->geopluginapikey = TEST_GEOIP_APIKEY;
$this->setup_geoip2file();
@@ -75,9 +73,6 @@ final class geoip_test extends \advanced_testcase {
$this->assertIsString($result['title'][0]);
$this->assertIsString($result['title'][1]);
$this->assertNull($result['error']);
// Restore the old value.
$CFG->geopluginapikey = $oldvalue;
}
/**
-9
View File
@@ -25,8 +25,6 @@ namespace core;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class geoplugin_test extends \advanced_testcase {
/** @var string Current Geoplugin API key. */
private string $currentgeopluginapikey = '';
/**
* Load required test libraries
@@ -50,16 +48,9 @@ final class geoplugin_test extends \advanced_testcase {
if (!defined('TEST_GEOIP_APIKEY') || empty(TEST_GEOIP_APIKEY)) {
$this->markTestSkipped('External geo tests are disabled.');
}
// Store the old value to restore later.
$this->currentgeopluginapikey = $CFG->geopluginapikey;
$CFG->geopluginapikey = TEST_GEOIP_APIKEY;
}
protected function tearDown(): void {
global $CFG;
$CFG->geopluginapikey = $this->currentgeopluginapikey;
}
/**
* Test IPv4 address
*