You are here

public function ImageLinkFormatterTestCase::setUp in Image Link Formatter 7

Enable modules and create user with specific permissions.

By default Test Cases are carried on the 'page' content type.

Overrides DrupalWebTestCase::setUp

1 call to ImageLinkFormatterTestCase::setUp()
ImageLinkFormatterFieldUITestCase::setUp in ./image_link_formatter.test
Enable modules and create user with specific permissions.
1 method overrides ImageLinkFormatterTestCase::setUp()
ImageLinkFormatterFieldUITestCase::setUp in ./image_link_formatter.test
Enable modules and create user with specific permissions.

File

./image_link_formatter.test, line 53
Test the Image Link Formatter module.

Class

ImageLinkFormatterTestCase
Provides common functionality for the Image Link Formatter test classes.

Code

public function setUp() {

  // Merge inherited classes modules, see FieldUITestCase for an example.
  $modules = func_get_args();
  if (isset($modules[0]) && is_array($modules[0])) {
    $modules = $modules[0];
  }
  $modules[] = 'image_link_formatter';

  // Initialize the permissions required for the tests.
  $this->permissions = array_merge($this->permissions, array(
    'access content',
    // Permissions needed by createNodeWithLinkImage, see its Doc comment.
    'create ' . $this->bundle . ' content',
    'edit own ' . $this->bundle . ' content',
  ));
  parent::setUp($modules);

  // Authenticate test user.
  $this->privilegedUser = $this
    ->drupalCreateUser($this->permissions);
  $this
    ->drupalLogin($this->privilegedUser);

  // Initialize field names if they have not been overriden.
  if (empty($this->fieldLinkName)) {
    $this->fieldLinkName = strtolower($this
      ->randomName());
  }
  if (empty($this->fieldImageName)) {
    $this->fieldImageName = strtolower($this
      ->randomName());
  }
}