You are here

protected function MetatagHreflangWithEntityTranslationTest::assertHreflangFields in Metatag 7

Assert that the appropriate hreflang meta tag fields are present.

Parameters

string $form_langcode: The langcode of the current form. Defaults to LANGUAGE_NONE, which is what is used on an empty node/add form.

2 calls to MetatagHreflangWithEntityTranslationTest::assertHreflangFields()
MetatagHreflangWithEntityTranslationTest::testFormFields in metatag_hreflang/tests/MetatagHreflangWithEntityTranslationTest.test
Confirm each locale has a field and shows the appropriate default value.
MetatagHreflangWithEntityTranslationTest::testOutput in metatag_hreflang/tests/MetatagHreflangWithEntityTranslationTest.test
Confirm that the meta tags output are correct.

File

metatag_hreflang/tests/MetatagHreflangWithEntityTranslationTest.test, line 115
Tests for hreflang handle when Entity Translation is used.

Class

MetatagHreflangWithEntityTranslationTest
Tests for hreflang handle when Entity Translation is used.

Code

protected function assertHreflangFields($form_langcode = LANGUAGE_NONE) {

  // The x-default field has a specific default.
  $this
    ->assertFieldByName("metatags[{$form_langcode}][hreflang_xdefault][value]", "[node:url-original]", 'Found the hreflang=x-default meta tag and it has the correct default value.');

  // Confirm each of the support locales has its own field and the appropriate
  // default value.
  foreach ($this
    ->supportedLocales() as $langcode) {
    $this
      ->assertFieldByName("metatags[{$form_langcode}][hreflang_{$langcode}][default]", "[node:url-{$langcode}]", format_string('Found the hreflang field for the "%lang" locale and it has the correct default value.', array(
      '%lang' => $langcode,
    )));
  }
}