function AutocompleteTagsUnitTest::assertTags

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

2 calls to AutocompleteTagsUnitTest::assertTags()
AutocompleteTagsUnitTest::testDrupalExplodeTags in drupal/core/modules/system/lib/Drupal/system/Tests/Common/AutocompleteTagsUnitTest.php
Explodes a series of tags.
AutocompleteTagsUnitTest::testDrupalImplodeTags in drupal/core/modules/system/lib/Drupal/system/Tests/Common/AutocompleteTagsUnitTest.php
Implodes a series of tags.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/AutocompleteTagsUnitTest.php, line 56
Definition of Drupal\system\Tests\Common\AutocompleteTagsUnitTest.

Class

AutocompleteTagsUnitTest
Tests drupal_explode_tags() and drupal_implode_tags().

Namespace

Drupal\system\Tests\Common

Code

function assertTags($tags) {
  $original = $this->validTags;
  foreach ($tags as $tag) {
    $key = array_search($tag, $original);
    $this
      ->assertTrue($key, format_string('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(format_string('Leftover tag %leftover was left over.', array(
      '%leftover' => $leftover,
    )));
  }
}