You are here

function geoipLanguageTestCase::testMappingCrud in GeoIP API 7

Same name and namespace in other branches
  1. 6 geoip_language/geoip_language.test \geoipLanguageTestCase::testMappingCrud()

File

geoip_language/geoip_language.test, line 81
Test suite for geoip_language.module

Class

geoipLanguageTestCase
@file Test suite for geoip_language.module

Code

function testMappingCrud() {
  $mappings = geoip_language_mappings(TRUE);
  $this
    ->assertFalse(array_key_exists('US', $mappings), t('No mapping for US'));
  $this
    ->drupalPost('admin/settings/language/geoip', array(
    'country' => 'US',
    'language' => 'en',
  ), t('Add mapping'), array(
    'language' => $GLOBALS['language'],
  ));
  $mappings = geoip_language_mappings(TRUE);
  $this
    ->assertEqual($mappings['US'], 'en', t('Mapping created for US => en'));
  $this
    ->drupalPost('admin/settings/language/geoip/delete/US', array(), t('Delete'));
  $mappings = geoip_language_mappings(TRUE);
  $this
    ->assertFalse(array_key_exists('US', $mappings), t('US mapping deleted.'));
}