You are here

public function ThunderMetaTagTrait::checkMetaTags in Thunder 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::checkMetaTags()
  2. 8.2 tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::checkMetaTags()
  3. 8.3 tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::checkMetaTags()
  4. 6.2.x tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::checkMetaTags()
  5. 6.0.x tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::checkMetaTags()
  6. 6.1.x tests/src/FunctionalJavascript/ThunderMetaTagTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMetaTagTrait::checkMetaTags()

Verify that meta tag values defined in configuration are properly set.

Parameters

array $metaTagConfiguration: Meta tag configuration.

2 calls to ThunderMetaTagTrait::checkMetaTags()
MetaInformationTest::testArticleMetaTags in tests/src/FunctionalJavascript/MetaInformationTest.php
Test Meta Tag default configuration and custom configuration for article.
ModuleIntegrationTest::testFacebookMetaTags in tests/src/FunctionalJavascript/ModuleIntegrationTest.php
Testing integration of "metatag_facebook" module.

File

tests/src/FunctionalJavascript/ThunderMetaTagTrait.php, line 42

Class

ThunderMetaTagTrait
Trait for manipulation of meta tag configuration and meta tags on page.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function checkMetaTags(array $metaTagConfiguration) {

  // Check on article are custom meta tags properly populated.
  foreach ($metaTagConfiguration as $metaTagName => $value) {
    $metaTag = explode(' ', $metaTagName);
    if ($metaTag[1] == 'title') {
      $this
        ->assertSession()
        ->elementContains('xpath', '//head/title', $value);
    }
    else {
      $this
        ->checkMetaTag($metaTag[1], $value);
    }
  }
}