You are here

public function MetatagCoreWithSearchApiTest::testAlter in Metatag 7

Test that the alter callback indexes the keywords.

File

tests/MetatagCoreWithSearchApiTest.test, line 125
Tests for the Search API integration.

Class

MetatagCoreWithSearchApiTest
Tests for the Search API integration.

Code

public function testAlter() {

  // Add a node with keywords.
  $node = $this
    ->drupalCreateNode();
  $keywords = 'puppies, rainbows';
  $values = array(
    'metatags[' . LANGUAGE_NONE . '][keywords][value]' => $keywords,
  );
  $this
    ->drupalPost('node/' . $node->nid . '/edit', $values, 'Save');

  // Index the node.
  $this
    ->drupalPost("admin/config/search/search_api/index/{$this->indexId}", array(), 'Index now');

  // Check whether the keywords have been indexed.
  $this
    ->assertIdentical(variable_get('metatag_search_test_keywords', FALSE), $keywords);
}