diff options
author | Paul Goodchild <paulgoodchild@users.noreply.github.com> | 2020-05-06 17:24:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 17:24:52 +0300 |
commit | 19da8de9ec77d847e931ddbcfc8b470afe3d5ae8 (patch) | |
tree | 6b92c603d2f6a06d1cfe97dea7ce6086de508343 /tests | |
parent | 1978c177e388833bfbeffce5537e3febd2d98b01 (diff) |
Begin functions cleaning, starting with GEO. (#2670)
* cleanup geo functions
* add support for CloudFlare's Country GEO header without the need for IP resolution and database
* ensure flag URL always returns a string, instead of false on failure as the result is always used as a string (without validation)
* add helper yours_get_db() so we don't need to use "global $ydb" throughout and it ensures that ydb is always initialised correctly and hasn't ever been changed to something incompatible.
* simplify debug get log
* tidy up code and phpdocs for functions-plugins
* cleanup & phpdocs for parts of functions.php
Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests/geoip/geoip.php | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/tests/geoip/geoip.php b/tests/tests/geoip/geoip.php index 4514981b..cb9513c2 100644 --- a/tests/tests/geoip/geoip.php +++ b/tests/tests/geoip/geoip.php @@ -39,13 +39,12 @@ class GeoIP_Tests extends PHPUnit_Framework_TestCase { * Check a few code return a string when getting their country flag */ public function test_country_images() { - $this->assertInternalType('string', yourls_geo_get_flag('AU')); // something like http://yourls/includes/geo/flags/flag_au.gif + $this->assertInternalType('string', yourls_geo_get_flag('AU')); // something like http://yourls/includes/geo/flags/flag_au.gif $this->assertInternalType('string', yourls_geo_get_flag('FR')); - $this->assertInternalType('string', yourls_geo_get_flag('')); // something like http://yourls/includes/geo/flags/flag_.gif - $this->assertFalse(yourls_geo_get_flag('OMGLOL')); + $this->assertInternalType('string', yourls_geo_get_flag('')); // something like http://yourls/includes/geo/flags/flag_.gif + $this->assertInternalType('string', yourls_geo_get_flag('OMGLOL')); // fall back to default '' } - - + /** * Data provider : array of arrays of ( 'ip', 'country code' ) in IPv4 notation */ |