You are here

protected function AbstractSynonymsProviderFieldWebTestCase::assertSynonymsExtract in Synonyms 7

Test synonymsExtract() method.

Parameters

array $items: Array of field items to be saved in tested term

array $standard: Expected return of synonymsExtract() method

string $message: Any custom message to be added to the standard one and passed to SimpleTest assertion method

5 calls to AbstractSynonymsProviderFieldWebTestCase::assertSynonymsExtract()
CommercePriceSynonymsBehaviorWebTestCase::testCommercePrice in synonyms_commerce/synonyms_commerce.test
Test synonyms extraction for 'commerce_price' field type.
CommerceProductReferenceSynonymsBehaviorWebTestCase::testCommerceProductReference in synonyms_commerce/synonyms_commerce.test
Test synonyms extraction for 'commerce_product_reference' field type.
EntityReferenceSynonymsBehaviorWebTestCase::testEntityReference in synonyms_provider_field/synonyms_provider_field.test
Test synonyms extraction for 'entityreference' field type.
TaxonomySynonymsBehaviorWebTestCase::testTaxonomyTermReference in synonyms_provider_field/synonyms_provider_field.test
Test synonyms extraction for 'taxonomy_term_reference' field type.
TextSynonymsBehaviorWebTestCase::testText in synonyms_provider_field/synonyms_provider_field.test
Test synonyms extraction for 'text' field type.

File

synonyms_provider_field/synonyms_provider_field.test, line 34
Tests for the Synonyms field provider module.

Class

AbstractSynonymsProviderFieldWebTestCase
Base class for all tests that test field-based Synonyms providers.

Code

protected function assertSynonymsExtract($items, $standard, $message = '') {
  $term = (object) array(
    'name' => $this
      ->randomName(),
    'vid' => $this->vocabulary->vid,
  );
  $term->{$this->fields['enabled']['field']['field_name']} = $items;
  taxonomy_term_save($term);
  $synonyms = $this->behavior_implementation['object']
    ->extractSynonyms($term);
  $this
    ->assertTrue(count(array_intersect($standard, $synonyms)) == count($standard), $this->behavior_implementation['class'] . '::extractSynonyms() passed: ' . $message);

  // Cleaning up.
  taxonomy_term_delete($term->tid);
}