You are here

public function BEF_TestCase::setUp in Better Exposed Filters 7

Same name and namespace in other branches
  1. 8.3 tests/better_exposed_filters.test \BEF_TestCase::setUp()
  2. 6.3 tests/better_exposed_filters.test \BEF_TestCase::setUp()
  3. 6 tests/better_exposed_filters.test \BEF_TestCase::setUp()
  4. 6.2 tests/better_exposed_filters.test \BEF_TestCase::setUp()

After setup() runs, the test suite will have access to:

  • $this->privileged_user: User with 'administer views' privileges.
  • $this->view_name: A view with:
    • node->title, node->status and node->type exposed filters
    • node->title as a displayed field

Overrides DrupalWebTestCase::setUp

File

tests/better_exposed_filters.test, line 33
Tests for the Better Exposed Filters module @author mikeker

Class

BEF_TestCase
Functional test for Better Exposed Filters

Code

public function setUp() {
  parent::setUp('views', 'views_ui', 'better_exposed_filters');

  // Enable any modules required for the test
  // @TODO: Is there a better way?  Hopefully...
  $this->views_version = substr(views_api_version(), 0, 1);

  // User with edit views perms
  $this->privileged_user = $this
    ->drupalCreateUser(array(
    'access content',
    'administer views',
  ));
  $this
    ->drupalLogin($this->privileged_user);

  // Build a basic view
  $this->view_name = $this
    ->randomName(8);
  $this
    ->drupalPost('admin/build/views/add', array(
    'name' => $this->view_name,
  ), 'Next');

  // Add filters to the default display
  $this
    ->_befAddFilter('node.title');
  $this
    ->_befAddFilter('node.status');
  $this
    ->_befAddFilter('node.type');

  // Add field to default display
  $this
    ->_befAddField('node.title');
  $this
    ->_befSaveView();
}