You are here

public function ViewsAtomTestCase::setUp in Views Atom 6

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/views_atom.test, line 21
Simple tests for views_atom

Class

ViewsAtomTestCase
Tests basic set up for publishing and consuming

Code

public function setUp() {
  parent::setUp('autoload', 'content', 'node', 'views', 'views_atom', 'views_atom_test');

  // Build the list of required administration permissions. Additional
  // permissions can be passed as an array into setUp()'s second parameter.
  if (isset($args[1]) && is_array($args[1])) {
    $permissions = $args[1];
  }
  else {
    $permissions = array();
  }
  $permissions[] = 'access content';
  $permissions[] = 'administer site configuration';
  $permissions[] = 'administer content types';
  $permissions[] = 'administer nodes';
  $permissions[] = 'administer taxonomy';
  $permissions[] = 'administer users';

  // Create an admin user and log in.
  $user = $this->admin_user = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($this->admin_user);

  // Create a few content types
  $num_node_types = rand(4, 16);
  $i = 0;
  while ($i <= $num_node_types) {
    $i++;
    $node_type = new stdClass();
    $node_type->type = $this
      ->randomName(8);
    $node_type->name = $this
      ->randomName(8);
    $node_type->module = 'views_atom';
    $node_type->description = $this
      ->randomName(140);
    $node_type->has_title = 1;
    $node_type->title_label = 'title';
    $node_type->has_body = 1;
    $node_type->body_label = 'body';
    $node_type->min_word_count = 0;
    $node_type->help = '';
    $node_type->custom = TRUE;
    $node_type->modified = TRUE;
    $node_type->locked = FALSE;
    $node_type->orig_type = $node_type->type;
    node_type_save($node_type);
  }
  $node_types = node_get_types('names');
}