You are here

public function MetatagCoreWithI18nOutputTest::testI18nOutputTranslationsDisabled in Metatag 7

Verify that no output translation records are generated when it's disabled.

File

tests/MetatagCoreWithI18nOutputTest.test, line 117
Tests for Metatag for when i18n is enabled and actively being used.

Class

MetatagCoreWithI18nOutputTest
Tests for Metatag for when i18n is enabled and actively being used.

Code

public function testI18nOutputTranslationsDisabled() {

  // Make sure output translations are disabled.
  $this
    ->toggleOutputTranslations(FALSE);

  // Plan out the different translation string tests.
  $string_en = 'Welcome to the homepage!';
  $string_fr = 'Bonjour pour le homepage!';
  $string_context = 'output:frontpage:title';
  $this
    ->searchTranslationPage('', $string_context);

  // Confirm the string is not present yet.
  $this
    ->searchTranslationPage($string_en, $string_context, FALSE);

  // Load the front page's meta tags.
  $instance = 'global:frontpage';
  $config = metatag_config_load($instance);

  // Set something specific as the homepage.
  $config->config['title']['value'] = $string_en;
  metatag_config_save($config);

  // Load the front page.
  $this
    ->drupalGet('');
  $this
    ->assertResponse(200, 'Loaded the homepage.');

  // Confirm the page's title is what we set it to.
  $this
    ->assertTitle($string_en);

  // Confirm the string is still not translatable.
  $this
    ->searchTranslationPage($string_en, $string_context, FALSE);

  // Make doubly sure there are no output translations.
  $lids = $this
    ->getTranslationsByContext($string_context);
  $this
    ->assertEqual($lids, array());
}