function DrupalTagsHandlingTestCase::assertTags in Drupal 7
Helper function: asserts that the ending array of tags is what we wanted.
2 calls to DrupalTagsHandlingTestCase::assertTags()
- DrupalTagsHandlingTestCase::testDrupalExplodeTags in modules/
simpletest/ tests/ common.test - Explode a series of tags.
- DrupalTagsHandlingTestCase::testDrupalImplodeTags in modules/
simpletest/ tests/ common.test - Implode a series of tags.
File
- modules/
simpletest/ tests/ common.test, line 682 - 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, 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,
)));
}
}