You are here

private function TagadelicTaxonomyTestCase::assertTagHasWeight in Tagadelic 7.2

1 call to TagadelicTaxonomyTestCase::assertTagHasWeight()
TagadelicTaxonomyTestCase::testHasWeightedTags in tests/tagadelic_taxonomy.test

File

tests/tagadelic_taxonomy.test, line 297

Class

TagadelicTaxonomyTestCase

Code

private function assertTagHasWeight($name, $weight, $message = '', $group = 'Other') {
  $truthiness = FALSE;
  $class = '';
  $xpath = $this
    ->xpath("//*/ul[@class='tag-cloud']/li/a[contains(text(),'{$name}')]");
  if (!empty($xpath)) {
    $attributes = $xpath[0]
      ->attributes();
    $class = $attributes["class"];
    if ($class == "level{$weight}") {
      $truthiness = TRUE;
    }
  }
  if (empty($message)) {
    $message = "No tag with name '{$name}' and class 'level{$weight}' found. Tag with '{$name}' has class '{$class}'";
  }
  return $this
    ->assertTrue($truthiness, $message, $group = 'Other');
}