You are here

public function EntityBackgroundAPITest::testEntityBackgroundTestAPI in Entity background 7

Test basic APIs.

File

tests/entity_background.test, line 104
Test classes for Entity backgrounds.

Class

EntityBackgroundAPITest
Class EntityBackgroundAPITest

Code

public function testEntityBackgroundTestAPI() {

  // Assert returned array values.
  $image_plugin = entity_background_get_background_plugin('image');
  $this
    ->assertEqual($image_plugin['name'], 'image');
  $this
    ->assertEqual($image_plugin['handler'], 'entity_background_image_decorator');

  // Assert returned selector.
  $selector = entity_background_get_selector('node');
  $this
    ->assertEqual($selector, '.page-node-[entity-id]');

  // Assert selectors and hook_entity_background_selectors_alter.
  $selectors = entity_background_selectors();
  $this
    ->assertEqual($selectors['custom_entity'], 'custom-entity-');

  // Assert field groups
  $groups = entity_background_selection_list();
  $this
    ->assertEqual($groups['group_eb_image'], 'Image');

  // Assert group name. Should be converted from group_eb_image to image.
  $plugin_name = entity_background_get_plugin_from_group_name('group_eb_image');
  $this
    ->assertEqual($plugin_name, 'image');
}