MDL-86495 core: Improve PHPUnit for IPLookup

This commit is contained in:
Huong Nguyen
2025-09-16 08:42:05 +07:00
parent e7aac3341b
commit 2d0b3a0dde
2 changed files with 0 additions and 15 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;
}
/**
-10
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
@@ -52,17 +50,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;
parent::tearDown();
}
/**
* Test IPv4 address
*