You are here

public function PanelizerTestHelper::addSiteLanguage in Panelizer 7.3

Add a locale to the site.

This assumes the Locale module is enabled.

1 call to PanelizerTestHelper::addSiteLanguage()
PanelizerTestHelper::setupLocales in tests/panelizer.helper.test
Enable some extra languages.

File

tests/panelizer.helper.test, line 135
Test integration for the panelizer module.

Class

PanelizerTestHelper
This will be extended by other tests to simplify them and make the code more reusable.

Code

public 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.');
}