You are here

public function ViewsExposedGroupsTestBase::setUp in Views exposed groups 7.2

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()

2 calls to ViewsExposedGroupsTestBase::setUp()
ViewsExposedGroupsExposedOperatorTest::setUp in tests/views_exposed_groups_op.test
Sets up a Drupal site for running functional and integration tests.
ViewsExposedGroupsInheritedPropertiesTest::setUp in tests/views_exposed_groups_inherit.test
Sets up a Drupal site for running functional and integration tests.
2 methods override ViewsExposedGroupsTestBase::setUp()
ViewsExposedGroupsExposedOperatorTest::setUp in tests/views_exposed_groups_op.test
Sets up a Drupal site for running functional and integration tests.
ViewsExposedGroupsInheritedPropertiesTest::setUp in tests/views_exposed_groups_inherit.test
Sets up a Drupal site for running functional and integration tests.

File

tests/views_exposed_groups.test, line 44
Views Exposed Groups UI Test.

Class

ViewsExposedGroupsTestBase
Base test class for views_exposed_groups module tests.

Code

public function setUp(array $modules = []) {
  $default_modules = [
    'ctools',
    'views',
    'views_ui',
    'views_exposed_groups',
  ];
  $modules = array_merge($modules, $default_modules);
  parent::setUp($modules);

  // Creates several random nodes for the view.
  $this->testNodes = $this
    ->createNodes();

  // Creates some user accounts to test with.
  $this->privilegedUser = $this
    ->drupalCreateUser([
    'access administration pages',
    'access content',
    'administer site configuration',
    'administer views',
    'bypass node access',
  ]);
  $this->unprivilegedUser = $this
    ->drupalCreateUser([
    'access content',
  ]);

  // Sets some nice-to-have views configuration.
  variable_set('views_ui_show_advanced_help_warning', '0');
  variable_set('views_ui_show_master_display', '1');
  variable_set('views_ui_show_advanced_column', '1');

  // Adds a view to use for testing.
  $this->defaultView = $this
    ->makeDefaultView();
  views_save_view($this->defaultView);
}