You are here

function SearchByPageAttachUploadsTest::setDisplayOptions in Search by Page 6

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.

2 calls to SearchByPageAttachUploadsTest::setDisplayOptions()
SearchByPageAttachCCKTest::testSearchAttach in tests/search_by_page.test
Tests that attachments are searched, and display options.
SearchByPageAttachUploadsTest::testSearchAttach in tests/search_by_page.test
Tests that attachments are searched, and permissions, and display options.

File

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

Class

SearchByPageAttachUploadsTest
Functionality test 1 for Search by Page Attachments with Uploads module.

Code

function setDisplayOptions($pre_title, $sep, $use_desc, $env) {
  $this
    ->drupalPost('admin/settings/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');
  variable_init();

  // 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');
}