You are here

function DrupalTagsHandlingTestCase::assertTags in SimpleTest 7

Helper function: asserts that the ending array of tags is what we wanted.

2 calls to DrupalTagsHandlingTestCase::assertTags()
DrupalTagsHandlingTestCase::testDrupalExplodeTags in tests/common.test
Explode a series of tags.
DrupalTagsHandlingTestCase::testDrupalImplodeTags in tests/common.test
Implode a series of tags.

File

tests/common.test, line 440
Tests for common.inc functionality.

Class

DrupalTagsHandlingTestCase
Test drupal_explode_tags() and drupal_implode_tags().

Code

function assertTags($tags) {
  $original = $this->validTags;
  foreach ($tags as $tag) {
    $key = array_search($tag, $original);
    $this
      ->assertTrue($key, t('Make sure tag %tag shows up in the final tags array (originally %original)', array(
      '%tag' => $tag,
      '%original' => $key,
    )));
    unset($original[$key]);
  }
  foreach ($original as $leftover) {
    $this
      ->fail(t('Leftover tag %leftover was left over.', array(
      '%leftover' => $leftover,
    )));
  }
}