You are here

public function NodeRecurTestCase::setUp in Node recur 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()

7 calls to NodeRecurTestCase::setUp()
NodeRecurAdminTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.
NodeRecurDateISOTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.
NodeRecurDateTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.
NodeRecurDateUNIXTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.
NodeRecurEndDateTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.

... See full list

7 methods override NodeRecurTestCase::setUp()
NodeRecurAdminTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.
NodeRecurDateISOTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.
NodeRecurDateTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.
NodeRecurDateUNIXTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.
NodeRecurEndDateTestCase::setUp in tests/node_recur.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

tests/node_recur.test, line 12

Class

NodeRecurTestCase
Functionality tests for node recur

Code

public function setUp() {
  parent::setUp(array(
    'node_recur',
  ));

  // Create node types to work with
  $this
    ->drupalCreateContentType(array(
    'type' => 'repeating_node',
    'name' => 'repeating node',
  ));
  $this
    ->drupalCreateContentType(array(
    'type' => 'basic_node',
    'name' => 'basic node',
  ));

  // Create and log in our privileged user.
  $this->privileged_user = $this
    ->drupalCreateUser(array(
    'recur all nodes',
    'administer nodes',
    'administer fields',
    'administer content types',
    'create basic_node content',
    'edit any basic_node content',
    'create repeating_node content',
    'edit any repeating_node content',
  ));
  $this
    ->drupalLogin($this->privileged_user);
  $this
    ->drupalGet('node/add');
  $this
    ->assertText(t('repeating node'));
  $this
    ->assertText(t('basic node'));

  // Date field
  $edit = array();
  $edit["fields[_add_new_field][label]"] = 'Date Simple';
  $edit["fields[_add_new_field][field_name]"] = 'date_simple';
  $edit["fields[_add_new_field][type]"] = 'datetime';
  $edit["fields[_add_new_field][widget_type]"] = 'date_text';
  $this
    ->drupalPost('admin/structure/types/manage/repeating_node/fields', $edit, t('Save'));
  $this
    ->drupalPost(NULL, array(), t('Save field settings'));

  // Add UNIX Date Field
  $edit = array();
  $edit["fields[_add_new_field][label]"] = 'Date UNIX';
  $edit["fields[_add_new_field][field_name]"] = 'date_unix';
  $edit["fields[_add_new_field][type]"] = 'datestamp';
  $edit["fields[_add_new_field][widget_type]"] = 'date_text';
  $this
    ->drupalPost('admin/structure/types/manage/repeating_node/fields', $edit, t('Save'));
  $this
    ->drupalPost(NULL, array(), t('Save field settings'));

  // Add ISO date Field
  $edit = array();
  $edit["fields[_add_new_field][label]"] = 'Date ISO';
  $edit["fields[_add_new_field][field_name]"] = 'date_iso';
  $edit["fields[_add_new_field][type]"] = 'date';
  $edit["fields[_add_new_field][widget_type]"] = 'date_text';
  $this
    ->drupalPost('admin/structure/types/manage/repeating_node/fields', $edit, t('Save'));
  $this
    ->drupalPost(NULL, array(), t('Save field settings'));
  $edit = array();
  $edit["fields[_add_new_field][label]"] = 'Date Range';
  $edit["fields[_add_new_field][field_name]"] = 'date_range';
  $edit["fields[_add_new_field][type]"] = 'date';
  $edit["fields[_add_new_field][widget_type]"] = 'date_text';
  $this
    ->drupalPost('admin/structure/types/manage/repeating_node/fields', $edit, t('Save'));
  $this
    ->drupalPost(NULL, array(
    'field[settings][enddate_get]' => 1,
  ), t('Save field settings'));
}