Issue #953336 by sun: Fixed Contributed modules are not able to test theme-related functionality.

merge-requests/26/head
webchick 2011-12-11 00:12:37 -06:00
parent a258803789
commit 11d884bee7
14 changed files with 62 additions and 4 deletions

View File

@ -764,6 +764,10 @@ class BlockHiddenRegionTestCase extends DrupalWebTestCase {
);
}
function setUp() {
parent::setUp(array('block_test'));
}
/**
* Tests that hidden regions do not inherit blocks when a theme is enabled.
*/

View File

@ -5,6 +5,14 @@
* Provide test blocks.
*/
/**
* Implements hook_system_theme_info().
*/
function block_test_system_theme_info() {
$themes['block_test_theme'] = drupal_get_path('module', 'block_test') . '/themes/block_test_theme/block_test_theme.info';
return $themes;
}
/**
* Implements hook_block_info().
*/

View File

@ -9,6 +9,8 @@
* Unit tests for the Theme API.
*/
class ThemeUnitTest extends DrupalWebTestCase {
protected $profile = 'testing';
public static function getInfo() {
return array(
'name' => 'Theme API',

View File

@ -1,5 +1,13 @@
<?php
/**
* Implements hook_system_theme_info().
*/
function theme_test_system_theme_info() {
$themes['test_theme'] = drupal_get_path('module', 'theme_test') . '/themes/test_theme/test_theme.info';
return $themes;
}
/**
* Implements hook_menu().
*/

View File

@ -1906,6 +1906,25 @@ function hook_module_implements_alter(&$implementations, $hook) {
}
}
/**
* Return additional themes provided by modules.
*
* Only use this hook for testing purposes. Use a hidden MYMODULE_test.module
* to implement this hook. Testing themes should be hidden, too.
*
* This hook is invoked from _system_rebuild_theme_data() and allows modules to
* register additional themes outside of the regular 'themes' directories of a
* Drupal installation.
*
* @return
* An associative array. Each key is the system name of a theme and each value
* is the corresponding path to the theme's .info file.
*/
function hook_system_theme_info() {
$themes['mymodule_test_theme'] = drupal_get_path('module', 'mymodule') . '/mymodule_test_theme/mymodule_test_theme.info';
return $themes;
}
/**
* Alter the information parsed from module and theme .info files
*

View File

@ -2472,6 +2472,18 @@ function _system_update_bootstrap_status() {
function _system_rebuild_theme_data() {
// Find themes
$themes = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info$/', 'themes');
// Allow modules to add further themes.
if ($module_themes = module_invoke_all('system_theme_info')) {
foreach ($module_themes as $name => $uri) {
// @see file_scan_directory()
$themes[$name] = (object) array(
'uri' => $uri,
'filename' => pathinfo($uri, PATHINFO_FILENAME),
'name' => $name,
);
}
}
// Find theme engines
$engines = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.engine$/', 'themes/engines');

View File

@ -1,5 +1,14 @@
<?php
/**
* Implements hook_system_theme_info().
*/
function update_test_system_theme_info() {
$themes['update_test_basetheme'] = drupal_get_path('module', 'update_test') . '/themes/update_test_basetheme/update_test_basetheme.info';
$themes['update_test_subtheme'] = drupal_get_path('module', 'update_test') . '/themes/update_test_subtheme/update_test_subtheme.info';
return $themes;
}
/**
* Implements hook_menu().
*/

View File

@ -1,4 +0,0 @@
The themes in this subdirectory are all used by the Drupal core testing
framework. They are not functioning themes that could be used on a real site
and are hidden in the administrative user interface.