You are here

public function LinkitsearchPluginTaxonomyTermTestCase::testGroupbyBundle in Linkit 7.3

Test group by bundle.

The actual grouping is made by the javascript later on. We just test that the resons contains group info.

File

test/linkit_search_plugin_taxonomy_term.test, line 104
Tests for Linkit search plugin taxonomy term.

Class

LinkitsearchPluginTaxonomyTermTestCase
Test the the taxonomy term search plugin.

Code

public function testGroupbyBundle() {

  // Create demo vocabulary.
  $vocabulary_1 = $this
    ->createVocabulary();
  $vocabulary_2 = $this
    ->createVocabulary();

  // Create demo terms.
  $term_1 = $this
    ->createTerm($vocabulary_1);
  $term_2 = $this
    ->createTerm($vocabulary_1);
  $term_3 = $this
    ->createTerm($vocabulary_2);
  $term_4 = $this
    ->createTerm($vocabulary_2);

  // Update the profile to group by bundle.
  $this->_profile->data['entity:taxonomy_term']['group_by_bundle'] = 1;
  $this
    ->updateProfile();

  // Call the autocomplete helper method.
  $this
    ->autocompleteCall();

  // Assert that the bundle title appear in the response.
  $this
    ->assertRaw('"group":"Taxonomy term - ' . $vocabulary_1->name, 'Bundle name in group was found in the result array.');
  $this
    ->assertRaw('"group":"Taxonomy term - ' . $vocabulary_1->name, 'Bundle name in group was found in the result array.');
}