You are here

protected function ThunderMetaTagTrait::checkMetaTag in Thunder 8.4

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

Check single meta tag on page.

Parameters

string $name: Meta tag name.

string $value: Meta tag value.

1 call to ThunderMetaTagTrait::checkMetaTag()
ThunderMetaTagTrait::checkMetaTags in tests/src/FunctionalJavascript/ThunderMetaTagTrait.php
Verify that meta tag values defined in configuration are properly set.

File

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

Class

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

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

protected function checkMetaTag($name, $value) {
  $htmlValue = htmlentities($value);
  $checkXPath = "@content='{$htmlValue}'";
  if (strpos($value, 'LIKE:') === 0) {
    $valueToCheck = substr($htmlValue, strlen('LIKE:'));
    $checkXPath = "contains(@content, '{$valueToCheck}')";
  }
  $this
    ->assertSession()
    ->elementExists('xpath', "//head/meta[(@name='{$name}' or @property='{$name}') and {$checkXPath}]");
}