You are here

public function SearchByPageIntlTest::setUp in Search by Page 7

Same name and namespace in other branches
  1. 6 tests/search_by_page.test \SearchByPageIntlTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides DrupalWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

File

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

Class

SearchByPageIntlTest
Environment internationalization test.

Code

public function setUp() {
  parent::setUp('locale', 'translation', 'search', 'search_by_page', 'variable', 'i18n', 'i18n_string', 'sbp_paths', 'sbp_test', 'block');
  $this
    ->setUpEnvironments();
  $this->superuser = $this
    ->drupalCreateUser(array(
    'administer blocks',
    'access administration pages',
    'administer search',
    'administer search by page',
    'search content',
    'access content',
    $this
      ->searchPerm($this->envinfo1),
    'administer site configuration',
    'administer permissions',
    'administer languages',
    'translate interface',
    'translate user-defined strings',
    'translate admin strings',
  ));
  $this
    ->drupalLogin($this->superuser);

  // Set up the languages, environments, path, and block. Run cron.
  $this
    ->setUpLanguages();
  $this
    ->setUpPath();
  $this
    ->drupalPost('admin/structure/block', array(
    'blocks[search_by_page_' . $this->envid1 . '][region]' => 'content',
  ), 'Save blocks');
  cache_clear_all('variables', 'cache_bootstrap');
  variable_initialize();
  drupal_static_reset();

  // Visit the foreign-language search page to trigger the page title getting
  // added to the translation interface.
  $langs = language_list();
  $lang = $langs[$this->lang_to_use];
  $this
    ->drupalGet($this->envinfo1['page_path'], array(
    'language' => $lang,
  ));

  // Run cron to index.
  $this
    ->doCronrun();
  $this
    ->drupalLogin($this->superuser);
}