You are here

function BeanTestPlugins::testBeanLoadPlugin in Bean (for Drupal 7) 7

Test loading of the plugin.

File

tests/BeanTestPlugins.test, line 27
A class for testing the plugin API.

Class

BeanTestPlugins
Test the plugin API.

Code

function testBeanLoadPlugin() {

  // Load the class.
  $plugin_class = bean_load_plugin_class('test_bean');
  $plugin_class_name = get_class($plugin_class);

  // Plugin should be implement the BeanTypePluginInterface interface.
  if (bean_check_plugin_class($plugin_class_name)) {
    $this
      ->pass(t('Bean type should use the BeanTypePluginInterface interface'));
  }
  else {
    $this
      ->fail(t('Bean type should use the BeanTypePluginInterface interface'));
  }

  // Verify that a bean plugin with an invalid class does not load.
  $this
    ->assertFalse(bean_load_plugin_class('test_no_bean'), t('Bean type should not load with an invalid class'));
  $this
    ->assertFalse(bean_load_plugin_class('test_wrong_class'), t('Bean type should not load with an invalid class'));
}