You are here

function EntityEmbedTestBase::setUp in Entity Embed 7.3

Same name and namespace in other branches
  1. 7 entity_embed.test \EntityEmbedTestBase::setUp()
  2. 7.2 entity_embed.test \EntityEmbedTestBase::setUp()

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

8 calls to EntityEmbedTestBase::setUp()
EmbedButtonAdminTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.
EntityEmbedDialogTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.
EntityEmbedFilterTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.
EntityEmbedHooksTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.
EntityReferenceFieldFormatterTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.

... See full list

8 methods override EntityEmbedTestBase::setUp()
EmbedButtonAdminTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.
EntityEmbedDialogTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.
EntityEmbedFilterTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.
EntityEmbedHooksTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.
EntityReferenceFieldFormatterTest::setUp in ./entity_embed.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

./entity_embed.test, line 21
Test integration for the entity_embed module.

Class

EntityEmbedTestBase
@file Test integration for the entity_embed module.

Code

function setUp() {
  $modules = func_get_args();
  if (isset($modules[0]) && is_array($modules[0])) {
    $modules = $modules[0];
  }
  $modules[] = 'entity_embed';
  $modules[] = 'node';
  parent::setUp($modules);

  // Create a page content type.
  $this
    ->drupalCreateContentType(array(
    'type' => 'page',
    'name' => 'Basic page',
  ));

  // Create Filtered HTML text format and enable entity_embed filter.
  $format = new stdClass();
  $format->format = 'custom_format';
  $format->name = 'Custom format';
  $format->filters = array(
    'entity_embed' => array(
      'status' => 1,
    ),
  );
  $format->editor = 'ckeditor';
  $format->editor_settings = array(
    'toolbar' => array(
      0 => array(
        0 => array(
          'name' => 'Entity Embed',
          'items' => array(
            0 => 'node',
          ),
        ),
      ),
    ),
  );
  filter_format_save($format);

  // Reset permissions so that permissions for the filter are available.
  $this
    ->checkPermissions(array(), TRUE);

  // Create a user with required permissions.
  $this->webUser = $this
    ->drupalCreateUser(array(
    'access content',
    'create page content',
    'use text format custom_format',
  ));
  $this
    ->drupalLogin($this->webUser);

  // Create a sample node to be embedded.
  $settings = array();
  $settings['type'] = 'page';
  $settings['title'] = 'Embed Test Node';
  $settings['body'] = array(
    LANGUAGE_NONE => array(
      array(
        'value' => 'This node is to be used for embedding in other nodes.',
        'format' => 'custom_format',
      ),
    ),
  );
  $this->node = $this
    ->drupalCreateNode($settings);
}