diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-05-04 08:15:12 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2018-05-04 08:15:12 +0300 |
commit | 18ad4f7f04d01b90fb9fc1d623585b5033092ed8 (patch) | |
tree | 256d6b3628c3d39b7d911f35698636d331194109 /plugins/UserCountry/tests/Integration | |
parent | 453e3fbdabbf8c72264a3e15e2650cfad99b06b2 (diff) |
GeoIP2 implementation as a plugin (#12699)
* require geoip2/geoip2 composer package
* Determine region name based on Location Provider
* Adds empty GeoIp2 plugin
* move location_region column definition to GeoIp2 plugin
so it's get changed as soon as the plugin is activated
* Adds GeoIP2 location providers
* ignore GeoIP2 mmdb files
* Adds script to generate GeoIP2 test databases
* Adds Command to convert region codes from FIPS to ISO for old log table records
* Adds GeoIP2 AutoUpdater
* Use GeoIP2 in tests
* update test files
* code fixes
* adds tests
* rename old GeoIP providers to Legacy
* Let GeoIP autoupdater UI handle GeoIp2 as well
* convert region codes to ISO in API after switch to GeoIP2
* do not show GeoIP providers if GeoIP2 plugin is enabled an no GeoIP Legacy provider is still in use
* small fixes
* review changes
* Use correct region translations
* Show correct message if no database can be found
* if log tables have been converted, use archive date to check if region codes still need to be converted to iso
* fix tests
* Improves extracting GeoIP2 databases
* Adjust GeoLocation diagnostics
* readds old taiwan fixes
* Assume all third party location providers as 'recommended'
* Download database over HTTPS
* remove outdated comment (see https://github.com/matomo-org/matomo/issues/12411)
* Remove indication that Geoip2 may be slow, since we found it should be quite fast and this should not be an issue in theory
* skip detection if IP is empty & do not try convert IP to IPv4
* remove downloaded file if an error occurs while extracting
* command should be runnable multiple times
* use ISO codes for suggested region codes
* reload after wizard success
* Drop table if exists.
* Fix two translation keys.
* add special region handling for UK
* update system test
* update UI files
* submodule update
* update test files
Diffstat (limited to 'plugins/UserCountry/tests/Integration')
-rw-r--r-- | plugins/UserCountry/tests/Integration/APITest.php | 4 | ||||
-rw-r--r-- | plugins/UserCountry/tests/Integration/VisitorGeolocatorTest.php | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/UserCountry/tests/Integration/APITest.php b/plugins/UserCountry/tests/Integration/APITest.php index a424048258..689f1e0867 100644 --- a/plugins/UserCountry/tests/Integration/APITest.php +++ b/plugins/UserCountry/tests/Integration/APITest.php @@ -12,6 +12,7 @@ use Piwik\Access; use Piwik\Common; use Piwik\Config; use Piwik\Plugins\UserCountry\API; +use Piwik\Plugins\GeoIp2\LocationProvider\GeoIp2; use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\Plugins\UserCountry\LocationProvider\DefaultProvider; use Piwik\Tests\Framework\TestCase\IntegrationTestCase; @@ -41,7 +42,8 @@ class APITest extends IntegrationTestCase public function test_setLocationProvider() { - $locationProvider = LocationProvider\GeoIp\Php::ID; + GeoIp2::$geoIPDatabaseDir = 'tests/lib/geoip-files'; + $locationProvider = GeoIp2\Php::ID; $this->api->setLocationProvider($locationProvider); $this->assertEquals($locationProvider, Common::getCurrentLocationProviderId()); diff --git a/plugins/UserCountry/tests/Integration/VisitorGeolocatorTest.php b/plugins/UserCountry/tests/Integration/VisitorGeolocatorTest.php index c9e6891f54..8e2a4c0d64 100644 --- a/plugins/UserCountry/tests/Integration/VisitorGeolocatorTest.php +++ b/plugins/UserCountry/tests/Integration/VisitorGeolocatorTest.php @@ -364,7 +364,7 @@ class VisitorGeolocatorTest extends IntegrationTestCase protected function getProviderMock() { return $this->getMockBuilder('\Piwik\Plugins\UserCountry\LocationProvider') - ->setMethods(array('getId', 'getLocation', 'isAvailable', 'isWorking', 'getSupportedLocationInfo')) + ->setMethods(array('getId', 'getInfo', 'getLocation', 'isAvailable', 'isWorking', 'getSupportedLocationInfo')) ->disableOriginalConstructor() ->getMock(); } |