You are here

public function GeoLocationTest::testGetGeoLocatorId in GeoIP API 8.2

Test getGeoLocatorId.

@covers ::getGeoLocatorId

File

tests/src/Unit/GeoLocationTest.php, line 27

Class

GeoLocationTest
Tests the geolocator plugin manager.

Namespace

Drupal\Tests\geoip\Unit

Code

public function testGetGeoLocatorId() {
  $geolocators_manager = $this
    ->prophesize(GeoLocatorManager::class);
  $config = $this
    ->prophesize(ImmutableConfig::class);
  $config
    ->get('debug')
    ->willReturn(FALSE);
  $config
    ->get('plugin_id')
    ->willReturn('local');
  $config_factory = $this
    ->prophesize(ConfigFactoryInterface::class);
  $config_factory
    ->get('geoip.geolocation')
    ->willReturn($config
    ->reveal());
  $cache_backend = $this
    ->prophesize(CacheBackendInterface::class);
  $geolocation = new GeoLocation($geolocators_manager
    ->reveal(), $config_factory
    ->reveal(), $cache_backend
    ->reveal());
  $this
    ->assertEquals('local', $geolocation
    ->getGeoLocatorId());
}