You are here

function SearchByPageAttachTest::setDisplayOptions in Search by Page 7

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/search_by_page.test
Tests that attachments are searched, and permissions, and display options.

File

tests/search_by_page.test, line 2400
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.

Code

function setDisplayOptions($pre_title, $sep, $use_desc, $env) {
  $this
    ->drupalPost('admin/config/search/search_by_page/edit/' . $env, array(
    'sbp_attach_prepend_node_title' => $pre_title,
    'sbp_attach_title_sep' => $sep,
    'sbp_attach_use_description' => $use_desc,
  ), 'Save configuration');

  // Reset variables, because Drupal doesn't realize they could be
  // reset within the same PHP session... sigh.
  cache_clear_all('variables', 'cache_bootstrap');
  variable_initialize();

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