You are here

function MicrodataFieldTestCase::setUp in Microdata 7

Implements DrupalWebTestCase::setUp().

Overrides DrupalWebTestCase::setUp

4 calls to MicrodataFieldTestCase::setUp()
DateTestCase::setUp in modules/date/date.test
Implements DrupalWebTestCase::setUp().
EmailTestCase::setUp in modules/email/email.test
Implements DrupalWebTestCase::setUp().
MicrodataCompoundFieldsTestCase::setUp in ./microdata.test
Implements DrupalWebTestCase::setUp().
MicrodataReferenceFieldsTestCase::setUp in ./microdata.test
Implements DrupalWebTestCase::setUp().
4 methods override MicrodataFieldTestCase::setUp()
DateTestCase::setUp in modules/date/date.test
Implements DrupalWebTestCase::setUp().
EmailTestCase::setUp in modules/email/email.test
Implements DrupalWebTestCase::setUp().
MicrodataCompoundFieldsTestCase::setUp in ./microdata.test
Implements DrupalWebTestCase::setUp().
MicrodataReferenceFieldsTestCase::setUp in ./microdata.test
Implements DrupalWebTestCase::setUp().

File

./microdata.test, line 28
Tests for microdata.module.

Class

MicrodataFieldTestCase
Abstract class for testing Markup

Code

function setUp() {

  // Caller may have passed in modules to enable.
  $modules = func_get_args();
  if (isset($modules[0]) && is_array($modules[0])) {
    $modules = $modules[0];
  }
  $modules[] = 'microdata';
  parent::setUp($modules);

  // Create a user to post the image.
  $permissions = array(
    'edit own article content',
    'revert revisions',
    'administer content types',
  );
  $admin_user = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($admin_user);

  // Save the fields and instances.
  foreach ($this
    ->getFields() as $field) {
    field_create_field($field);
  }
  foreach ($this
    ->getInstances() as $instance) {
    field_create_instance($instance);
  }

  // Save the mappings.
  $mappings = $this
    ->getMapping();
  foreach ($mappings as $entity_type => $bundle_mappings) {
    foreach ($bundle_mappings as $bundle_type => $mapping) {
      microdata_save_mapping($entity_type, $bundle_type, $mapping);
    }
  }
}