You are here

public function SearchByPageTester::setUpEnvironments in Search by Page 6

Same name and namespace in other branches
  1. 7 tests/search_by_page.test \SearchByPageTester::setUpEnvironments()

Creates two environments for Search by Page.

18 calls to SearchByPageTester::setUpEnvironments()
SearchbyPageAttachCCK2Test::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
SearchByPageAttachCCKTest::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
SearchbyPageAttachNotReadable::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
SearchbyPageAttachReindexTest::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
SearchbyPageAttachUploads2Test::setUp in tests/search_by_page.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

... See full list

File

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

Class

SearchByPageTester
Base class for testing Search by Page.

Code

public function setUpEnvironments() {
  $user = $this
    ->drupalCreateUser(array(
    'administer search by page',
    'access administration pages',
    'administer site configuration',
  ));
  $this
    ->drupalLogin($user);

  // Clear out any existing search environments that may have been defined.
  $envs = search_by_page_list_environments();
  foreach ($envs as $env) {
    module_invoke_all('sbp_delete_environment', $env);
  }

  // Define two new environments. They should have ID numbers 1 and 2.
  $this->envinfo1 = array(
    'environment_name' => 'env1',
    'set_as_default' => 1,
    'page_title' => t('Search page 1 title'),
    'block_title' => t('Search block 1 title'),
    'field_label' => t('Search field 1 label'),
    'button_label' => t('Search button 1 label'),
    'page_path' => 'search_path_1',
    'exclude_tags' => 'tagtoexclude',
  );
  $this
    ->drupalPost('admin/settings/search_by_page/add', $this->envinfo1, 'Save configuration');
  $this->envid1 = 1;
  $this->envinfo2 = array(
    'environment_name' => 'env2',
    'set_as_default' => 2,
    'page_title' => t('Search page 2 title'),
    'block_title' => t('Search block 2 title'),
    'field_label' => t('Search field 2 label'),
    'button_label' => t('Search button 2 label'),
    'page_path' => 'search_path_2',
  );
  $this
    ->drupalPost('admin/settings/search_by_page/add', $this->envinfo2, 'Save configuration');
  $this->envid2 = 2;

  // Reset the SimpleTest permissions cache.
  $this
    ->checkPermissions(array(), TRUE);
  $this
    ->drupalLogout();
}