You are here

public function CurrentSearchTestCase::currentSearchEnableBlock in Facet API 7.2

Same name and namespace in other branches
  1. 7 contrib/current_search/tests/current_search.test \CurrentSearchTestCase::currentSearchEnableBlock()

Enables a current search block via the UI.

3 calls to CurrentSearchTestCase::currentSearchEnableBlock()
CurrentSearchBugFixTestCase::testMultipleBlocks in contrib/current_search/tests/current_search.test
Tests bug fixed at http://drupal.org/node/1668980.
CurrentSearchBugFixTestCase::testPluralTranslation in contrib/current_search/tests/current_search.test
Tests bug fixed at http://drupal.org/node/1728496.
CurrentSearchInterfaceTestCase::testEnableBlock in contrib/current_search/tests/current_search.test

File

contrib/current_search/tests/current_search.test, line 23
Test cases for the Current Search Blocks module.

Class

CurrentSearchTestCase
Base class for all Current Search Blocks test cases.

Code

public function currentSearchEnableBlock($name = 'standard') {

  // Capture current user, switch to admin user if necessary.
  $account = $this->loggedInUser;
  if ($account != $this->adminUser) {
    $this
      ->drupalLogin($this->adminUser);
  }

  // Enables the facet in the "sidebar_first" region.
  $edit = array(
    'blocks[current_search_' . $name . '][region]' => 'sidebar_first',
  );
  $this
    ->drupalPost('admin/structure/block', $edit, t('Save blocks'));

  // Log back in as original user if necessary.
  if ($account != $this->adminUser) {
    if ($account) {
      $this
        ->drupalLogin($account);
    }
    else {
      $this
        ->drupalLogout();
    }
  }
}