You are here

public function GeoLocatorPluginTest::testLocal in GeoIP API 8.2

Tests the Local plugin (MaxMindDB).

File

tests/src/Kernel/GeoLocatorPluginTest.php, line 46

Class

GeoLocatorPluginTest
Tests the default GeoLocator plugins.

Namespace

Drupal\Tests\geoip\Kernel

Code

public function testLocal() {
  $file = file_unmanaged_copy(__DIR__ . '/../../fixtures/GeoLite2-Country.mmdb', 'public://GeoLite2-Country.mmdb');
  $this
    ->config('geoip.geolocation')
    ->set('plugin_id', 'local')
    ->save();
  $this
    ->assertEquals('US', $this->container
    ->get('geoip.geolocation')
    ->geolocate('75.86.161.59'));
}