You are here

public function SearchByPageIntlTest::setUp in Search by Page 6

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

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. A temporary files directory is created with the same name as the database prefix.

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

File

tests/search_by_page.test, line 3027
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', 'i18n', 'i18nstrings', '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',
    'administer all languages',
    'administer translations',
  ));
  $this
    ->drupalLogin($this->superuser);

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

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