You are here

function SearchByPageAttachTest::setDisplayOptions in Search by Page 8

Sets display options for Search by Page Attachments.

Parameters

$pre_title: TRUE to prepend node title, FALSE to not do so.

$sep: Separator to use between node title and file name.

$use_desc: TRUE to replace file name with description, FALSE to not do so.

$env: ID of Search by Page environment to use.

1 call to SearchByPageAttachTest::setDisplayOptions()
SearchByPageAttachTest::testSearchAttach in tests/src/Functional/search_by_page.test
Tests that attachments are searched, and permissions, and display options.

File

tests/src/Functional/search_by_page.test, line 2086
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageAttachTest
Functionality test 1 for Search by Page Attachments.

Namespace

Drupal\Tests\search_by_page\Functional

Code

function setDisplayOptions($pre_title, $sep, $use_desc, $env) {
  $this
    ->drupalPostForm('admin/config/search/search_by_page/edit/' . $env, array(
    'search_by_page_attach_prepend_node_title' => $pre_title,
    'search_by_page_attach_title_sep' => $sep,
    'search_by_page_attach_use_description' => $use_desc,
  ), 'Save configuration');

  // Reset variables, because Drupal doesn't realize they could be
  // reset within the same PHP session... sigh.
  \Drupal::service('cache.bootstrap')
    ->invalidateAll();
  variable_initialize();

  // Verify settings
  $this
    ->assertEqual(search_by_page_setting_get('search_by_page_attach_prepend_node_title', $env, 0), $pre_title, 'Prepend node title is set correctly');
  $this
    ->assertEqual(search_by_page_setting_get('search_by_page_attach_use_description', $env, 0), $use_desc, 'Use description is set correctly');
  $this
    ->assertEqual(search_by_page_setting_get('search_by_page_attach_title_sep', $env, "/"), $sep, 'Separator is set correctly');
}