You are here

protected function EckTestHelper::addSiteLanguage in Entity Construction Kit (ECK) 7.2

Add a locale to the site.

Parameters

string $langcode: The language code to be enabled.

1 call to EckTestHelper::addSiteLanguage()
EckTestHelper::setupLocales in tests/EckTestHelper.test
Set up a basic starting point for the locales.

File

tests/EckTestHelper.test, line 250
The EckTestHelper class.

Class

EckTestHelper
Helper logic for the other ECK tests.

Code

protected function addSiteLanguage($langcode) {

  // Load the language-add page.
  $this
    ->drupalGet('admin/config/regional/language/add');
  $this
    ->assertResponse(200, 'Loaded the language-add admin page.');

  // Submit the language-add form.
  $args = array(
    'langcode' => $langcode,
  );
  $this
    ->drupalPost(NULL, $args, t('Add language'));
  $this
    ->assertResponse(200);

  // Verify that the browser was returned to the main languages admin page.
  $this
    ->assertEqual($this
    ->getUrl(), url('admin/config/regional/language', array(
    'absolute' => TRUE,
  )), 'Redirected back to the main languages admin page.');

  // Clear the language list cache so it can be reloaded.
  drupal_static_reset('language_list');

  // Get all language definitions.
  $languages = language_list();
  $language = $languages[$langcode]->name;
  $this
    ->assertText(strip_tags(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array(
    '%language' => t($language),
    '@locale-help' => url('admin/help/locale'),
  ))), 'A new language has been added.');
}