Skip to content

Commit

Permalink
Working on tests. I just need a clean point to merge from.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crell committed Jul 13, 2010
1 parent 04aa811 commit cb97e5c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin.module
Expand Up @@ -51,7 +51,7 @@ function plugin_get_info($type, $plugin = NULL) {
$info_key = 'plugin_info_' . $type;

if (empty($plugin_info[$type])) {
if ($cache = cache_get($info_key)) {
if (FALSE && $cache = cache_get($info_key)) {
$plugin_info[$type] = $cache->data;
}
else {
Expand Down
12 changes: 10 additions & 2 deletions plugin.test
Expand Up @@ -37,41 +37,49 @@ class PluginTestCase extends DrupalWebTestCase {
/**
* Confirm that test plugins register properly from the alter hook.
*/
function testAlterHookRegistration() {
/*function testAlterHookRegistration() {
$plugins = plugin_get_info('fancystring');

$plugin_names = array_keys($plugins);
$this->assertTrue(in_array('rot', $plugin_names), t('Plugin type is registered from type-specific alter hook'));
}
*/

/**
* Confirm that test plugins register properly from an info file.
*/
function testInfoRegistration() {
/*function testInfoRegistration() {
$plugins = plugin_get_info('fancystring');

$plugin_names = array_keys($plugins);
$this->assertTrue(in_array('uppercase', $plugin_names), t('Plugin type is registered from info file'));
}
*/


/**
* Confirm that we get the right controller for a given plugin type.
*/
/*
function testController() {
$controller = plugin_controller('fancystring');

$this->assertTrue($controller instanceof PluginControllerVariableReuse, t('Correct controller class returned.'));
}

*/

/**
* Confirm that if there is no default configuration, we get nothing.
*/
/*
function testDefaultPlugin() {
$plugin = plugin('fancystring');

$this->assertTrue($plugin instanceof FancyStringDummy, t('Correct plugin class returned.'));
}

*/

}

Expand Down
2 changes: 1 addition & 1 deletion plugin_test/plugin_test.info
Expand Up @@ -2,5 +2,5 @@ name = Plugin Test
description = Test module for plugins
core = 7.x
files[] = plugin_test.module
hidden = TRUE
;hidden = TRUE
dependencies[] = plugin
32 changes: 31 additions & 1 deletion plugin_test/plugin_test.module
@@ -1,5 +1,35 @@
<?php

/**
* Implements hook_menu().
*
* This is just a dummy for testing things faster than unit tests can, because
* unit tests are horrifically slow due to the installer being slow as hell.
*/
function plugin_test_menu() {
$items['plugin'] = array(
'title' => 'Plugin test',
'page callback' => 'plugin_test_page',
'access arguments' => array('access content'),

);

return $items;
}

/**
* Dummy page callback for testing things faster than unit tests can.
*/
function plugin_test_page() {
$plugins = plugin_get_info('fancystring');

$plugin_names = array_keys($plugins);

dpm($plugin_names);

return 'x';
}

/**
* Implements hook_plugin_type_info().
*/
Expand All @@ -22,7 +52,7 @@ function plugin_test_plugin_type_info() {
*
* I think we actually deprecated the generic function...
*/
function plugin_test_plugin_info() {
function plugin_test_plugin_fancystring_info() {

$plugins['dummy'] = array(
'title' => t('Dummy'),
Expand Down

0 comments on commit cb97e5c

Please sign in to comment.