protected function SynonymsTermMergeWebTestCase::assertSynonymsIntegration in Term Merge 7
Supportive method.
Assert expected results after doing any test actions.
Parameters
array $terms: Array of terms as returned by $this->createTerms(). Those term trunks that have merged any branch terms with "Synonyms" option on, besides all normal keys should have property 'synonyms' which should be an array of expected synonyms of this term
string $message: Assert message to be shown on test results page
2 calls to SynonymsTermMergeWebTestCase::assertSynonymsIntegration()
- SynonymsTermMergeWebTestCase::testTermMergeAction in ./
term_merge.test - Test the action 'term_merge_action' in terms of integration with Synonyms.
- SynonymsTermMergeWebTestCase::testTermMergeBatch in ./
term_merge.test - Test Term Merge batch in terms of integration with Synonyms module.
File
- ./
term_merge.test, line 1461 - Test the Term Merge module.
Class
- SynonymsTermMergeWebTestCase
- Test the integration between Term Merge module and Synonyms module.
Code
protected function assertSynonymsIntegration($terms, $message) {
foreach ($terms as $term) {
// Getting an array of synonyms according to Synonyms module.
$context = array();
$synonyms = synonyms_get_raw(entity_load_unchanged('taxonomy_term', $term->tid), array(), 'synonyms', 'taxonomy_term', $context);
$expected_synonyms = isset($term->synonyms) ? $term->synonyms : array();
// Comparing $synonyms to $expected_synonyms.
if (count($expected_synonyms) != count(array_intersect($expected_synonyms, $synonyms))) {
$this
->fail($message);
return;
}
}
// If we got here, then all expected synonyms were found.
$this
->pass($message);
}