Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
Apache/2.4.59 (Debian)
: 10.2.73.233 | : 3.139.86.53
Cant Read [ /etc/named.conf ]
5.6.40-64+0~20230107.71+debian10~1.gbp673146
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
baltic /
web /
modules /
simpletest /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
drupal_autoload_test
[ DIR ]
drwxr-xr-x
drupal_system_listing_compatib...
[ DIR ]
drwxr-xr-x
drupal_system_listing_incompat...
[ DIR ]
drwxr-xr-x
psr_0_test
[ DIR ]
drwxr-xr-x
psr_4_test
[ DIR ]
drwxr-xr-x
themes
[ DIR ]
drwxr-xr-x
upgrade
[ DIR ]
drwxr-xr-x
actions.test
5.7
KB
-rw-r--r--
actions_loop_test.info
268
B
-rw-r--r--
actions_loop_test.install
206
B
-rw-r--r--
actions_loop_test.module
2.54
KB
-rw-r--r--
ajax.test
26.15
KB
-rw-r--r--
ajax_forms_test.info
267
B
-rw-r--r--
ajax_forms_test.module
16.56
KB
-rw-r--r--
ajax_test.info
261
B
-rw-r--r--
ajax_test.module
1.84
KB
-rw-r--r--
batch.test
16.49
KB
-rw-r--r--
batch_test.callbacks.inc
3.92
KB
-rw-r--r--
batch_test.info
265
B
-rw-r--r--
batch_test.module
13.32
KB
-rw-r--r--
bootstrap.test
28.68
KB
-rw-r--r--
cache.test
15.38
KB
-rw-r--r--
common.test
130.72
KB
-rw-r--r--
common_test.css
79
B
-rw-r--r--
common_test.info
341
B
-rw-r--r--
common_test.module
7.25
KB
-rw-r--r--
common_test.print.css
79
B
-rw-r--r--
common_test_cron_helper.info
295
B
-rw-r--r--
common_test_cron_helper.module
362
B
-rw-r--r--
common_test_info.txt
334
B
-rw-r--r--
database_test.info
269
B
-rw-r--r--
database_test.install
5.72
KB
-rw-r--r--
database_test.module
6.51
KB
-rw-r--r--
database_test.test
144.13
KB
-rw-r--r--
entity_cache_test.info
319
B
-rw-r--r--
entity_cache_test.module
873
B
-rw-r--r--
entity_cache_test_dependency.i...
295
B
-rw-r--r--
entity_cache_test_dependency.m...
305
B
-rw-r--r--
entity_crud.test
1.86
KB
-rw-r--r--
entity_crud_hook_test.info
273
B
-rw-r--r--
entity_crud_hook_test.module
6
KB
-rw-r--r--
entity_crud_hook_test.test
12.47
KB
-rw-r--r--
entity_query.test
65.62
KB
-rw-r--r--
entity_query_access_test.info
289
B
-rw-r--r--
entity_query_access_test.modul...
1.5
KB
-rw-r--r--
error.test
4.58
KB
-rw-r--r--
error_test.info
273
B
-rw-r--r--
error_test.module
1.89
KB
-rw-r--r--
file.test
109.29
KB
-rw-r--r--
file_test.info
291
B
-rw-r--r--
file_test.module
12.23
KB
-rw-r--r--
filetransfer.test
4.44
KB
-rw-r--r--
filter_test.info
263
B
-rw-r--r--
filter_test.module
1.68
KB
-rw-r--r--
form.test
89.19
KB
-rw-r--r--
form_test.file.inc
1.4
KB
-rw-r--r--
form_test.info
262
B
-rw-r--r--
form_test.module
57.65
KB
-rw-r--r--
graph.test
6.23
KB
-rw-r--r--
http.php
897
B
-rw-r--r--
https.php
860
B
-rw-r--r--
image.test
18.89
KB
-rw-r--r--
image_test.info
265
B
-rw-r--r--
image_test.module
3.17
KB
-rw-r--r--
lock.test
2.56
KB
-rw-r--r--
mail.test
18.8
KB
-rw-r--r--
menu.test
71.63
KB
-rw-r--r--
menu_test.info
268
B
-rw-r--r--
menu_test.module
17.93
KB
-rw-r--r--
module.test
14.59
KB
-rw-r--r--
module_test.file.inc
203
B
-rw-r--r--
module_test.info
268
B
-rw-r--r--
module_test.install
930
B
-rw-r--r--
module_test.module
3.76
KB
-rw-r--r--
pager.test
5.36
KB
-rw-r--r--
password.test
3.44
KB
-rw-r--r--
path.test
13.27
KB
-rw-r--r--
path_test.info
268
B
-rw-r--r--
path_test.module
410
B
-rw-r--r--
registry.test
4.66
KB
-rw-r--r--
requirements1_test.info
313
B
-rw-r--r--
requirements1_test.install
505
B
-rw-r--r--
requirements1_test.module
111
B
-rw-r--r--
requirements2_test.info
392
B
-rw-r--r--
requirements2_test.module
130
B
-rw-r--r--
schema.test
13.45
KB
-rw-r--r--
session.test
22.8
KB
-rw-r--r--
session_test.info
268
B
-rw-r--r--
session_test.module
5.45
KB
-rw-r--r--
system.base.css
143
B
-rw-r--r--
system_dependencies_test.info
322
B
-rw-r--r--
system_dependencies_test.modul...
6
B
-rw-r--r--
system_incompatible_core_versi...
368
B
-rw-r--r--
system_incompatible_core_versi...
6
B
-rw-r--r--
system_incompatible_core_versi...
300
B
-rw-r--r--
system_incompatible_core_versi...
6
B
-rw-r--r--
system_incompatible_module_ver...
442
B
-rw-r--r--
system_incompatible_module_ver...
6
B
-rw-r--r--
system_incompatible_module_ver...
298
B
-rw-r--r--
system_incompatible_module_ver...
6
B
-rw-r--r--
system_test.info
286
B
-rw-r--r--
system_test.module
14.43
KB
-rw-r--r--
tablesort.test
4.67
KB
-rw-r--r--
taxonomy_test.info
305
B
-rw-r--r--
taxonomy_test.install
747
B
-rw-r--r--
taxonomy_test.module
2.65
KB
-rw-r--r--
theme.test
25.37
KB
-rw-r--r--
theme_test.inc
372
B
-rw-r--r--
theme_test.info
266
B
-rw-r--r--
theme_test.module
4.17
KB
-rw-r--r--
theme_test.template_test.tpl.p...
66
B
-rw-r--r--
unicode.test
10.89
KB
-rw-r--r--
update.test
4.69
KB
-rw-r--r--
update_script_test.info
275
B
-rw-r--r--
update_script_test.install
1.29
KB
-rw-r--r--
update_script_test.module
419
B
-rw-r--r--
update_test_1.info
261
B
-rw-r--r--
update_test_1.install
1.59
KB
-rw-r--r--
update_test_1.module
6
B
-rw-r--r--
update_test_2.info
261
B
-rw-r--r--
update_test_2.install
1.18
KB
-rw-r--r--
update_test_2.module
6
B
-rw-r--r--
update_test_3.info
261
B
-rw-r--r--
update_test_3.install
436
B
-rw-r--r--
update_test_3.module
6
B
-rw-r--r--
url_alter_test.info
272
B
-rw-r--r--
url_alter_test.install
267
B
-rw-r--r--
url_alter_test.module
1.75
KB
-rw-r--r--
xmlrpc.test
9.61
KB
-rw-r--r--
xmlrpc_test.info
303
B
-rw-r--r--
xmlrpc_test.module
3.1
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : theme.test
<?php /** * @file * Tests for the theme API. */ /** * Unit tests for the Theme API. */ class ThemeTestCase extends DrupalWebTestCase { protected $profile = 'testing'; public static function getInfo() { return array( 'name' => 'Theme API', 'description' => 'Test low-level theme functions.', 'group' => 'Theme', ); } function setUp() { parent::setUp('theme_test'); theme_enable(array('test_theme')); } /** * Test function theme_get_suggestions() for SA-CORE-2009-003. */ function testThemeSuggestions() { // Set the front page as something random otherwise the CLI // test runner fails. variable_set('site_frontpage', 'nobody-home'); $args = array('node', '1', 'edit'); $suggestions = theme_get_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1', 'page__node__edit'), 'Found expected node edit page suggestions'); // Check attack vectors. $args = array('node', '\\1'); $suggestions = theme_get_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid \\ from suggestions'); $args = array('node', '1/'); $suggestions = theme_get_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid / from suggestions'); $args = array('node', "1\0"); $suggestions = theme_get_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid \\0 from suggestions'); // Define path with hyphens to be used to generate suggestions. $args = array('node', '1', 'hyphen-path'); $result = array('page__node', 'page__node__%', 'page__node__1', 'page__node__hyphen_path'); $suggestions = theme_get_suggestions($args, 'page'); $this->assertEqual($suggestions, $result, 'Found expected page suggestions for paths containing hyphens.'); } /** * Ensures preprocess functions run even for suggestion implementations. * * The theme hook used by this test has its base preprocess function in a * separate file, so this test also ensures that that file is correctly loaded * when needed. */ function testPreprocessForSuggestions() { // Test with both an unprimed and primed theme registry. drupal_theme_rebuild(); for ($i = 0; $i < 2; $i++) { $this->drupalGet('theme-test/suggestion'); $this->assertText('Theme hook implementor=test_theme_theme_test__suggestion(). Foo=template_preprocess_theme_test', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.'); } } /** * Ensure page-front template suggestion is added when on front page. */ function testFrontPageThemeSuggestion() { $q = $_GET['q']; // Set $_GET['q'] to node because theme_get_suggestions() will query it to // see if we are on the front page. $_GET['q'] = variable_get('site_frontpage', 'node'); $suggestions = theme_get_suggestions(explode('/', $_GET['q']), 'page'); // Set it back to not annoy the batch runner. $_GET['q'] = $q; $this->assertTrue(in_array('page__front', $suggestions), 'Front page template was suggested.'); } /** * Ensures theme hook_*_alter() implementations can run before anything is rendered. */ function testAlter() { $this->drupalGet('theme-test/alter'); $this->assertText('The altered data is test_theme_theme_test_alter_alter was invoked.', 'The theme was able to implement an alter hook during page building before anything was rendered.'); } /** * Ensures a theme's .info file is able to override a module CSS file from being added to the page. * * @see test_theme.info */ function testCSSOverride() { // Reuse the same page as in testPreprocessForSuggestions(). We're testing // what is output to the HTML HEAD based on what is in a theme's .info file, // so it doesn't matter what page we get, as long as it is themed with the // test theme. First we test with CSS aggregation disabled. variable_set('preprocess_css', 0); $this->drupalGet('theme-test/suggestion'); $this->assertNoText('system.base.css', 'The theme\'s .info file is able to override a module CSS file from being added to the page.'); // Also test with aggregation enabled, simply ensuring no PHP errors are // triggered during drupal_build_css_cache() when a source file doesn't // exist. Then allow remaining tests to continue with aggregation disabled // by default. variable_set('preprocess_css', 1); $this->drupalGet('theme-test/suggestion'); variable_set('preprocess_css', 0); } /** * Ensures the theme registry is rebuilt when modules are disabled/enabled. */ function testRegistryRebuild() { $this->assertIdentical(theme('theme_test_foo', array('foo' => 'a')), 'a', 'The theme registry contains theme_test_foo.'); module_disable(array('theme_test'), FALSE); $this->assertIdentical(theme('theme_test_foo', array('foo' => 'b')), '', 'The theme registry does not contain theme_test_foo, because the module is disabled.'); module_enable(array('theme_test'), FALSE); $this->assertIdentical(theme('theme_test_foo', array('foo' => 'c')), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.'); } /** * Test the list_themes() function. */ function testListThemes() { $themes = list_themes(); // Check if drupal_theme_access() retrieves enabled themes properly from list_themes(). $this->assertTrue(drupal_theme_access('test_theme'), 'Enabled theme detected'); // Check if list_themes() returns disabled themes. $this->assertTrue(array_key_exists('test_basetheme', $themes), 'Disabled theme detected'); // Check for base theme and subtheme lists. $base_theme_list = array('test_basetheme' => 'Theme test base theme'); $sub_theme_list = array('test_subtheme' => 'Theme test subtheme'); $this->assertIdentical($themes['test_basetheme']->sub_themes, $sub_theme_list, 'Base theme\'s object includes list of subthemes.'); $this->assertIdentical($themes['test_subtheme']->base_themes, $base_theme_list, 'Subtheme\'s object includes list of base themes.'); // Check for theme engine in subtheme. $this->assertIdentical($themes['test_subtheme']->engine, 'phptemplate', 'Subtheme\'s object includes the theme engine.'); // Check for theme engine prefix. $this->assertIdentical($themes['test_basetheme']->prefix, 'phptemplate', 'Base theme\'s object includes the theme engine prefix.'); $this->assertIdentical($themes['test_subtheme']->prefix, 'phptemplate', 'Subtheme\'s object includes the theme engine prefix.'); } /** * Test the theme_get_setting() function. */ function testThemeGetSetting() { $GLOBALS['theme_key'] = 'test_theme'; $this->assertIdentical(theme_get_setting('theme_test_setting'), 'default value', 'theme_get_setting() uses the default theme automatically.'); $this->assertNotEqual(theme_get_setting('subtheme_override', 'test_basetheme'), theme_get_setting('subtheme_override', 'test_subtheme'), 'Base theme\'s default settings values can be overridden by subtheme.'); $this->assertIdentical(theme_get_setting('basetheme_only', 'test_subtheme'), 'base theme value', 'Base theme\'s default settings values are inherited by subtheme.'); } /** * Test the drupal_add_region_content() function. */ function testDrupalAddRegionContent() { $this->drupalGet('theme-test/drupal-add-region-content'); $this->assertText('Hello'); $this->assertText('World'); } } /** * Unit tests for theme_table(). */ class ThemeTableTestCase extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'Theme Table', 'description' => 'Tests built-in theme functions.', 'group' => 'Theme', ); } /** * Tableheader.js provides 'sticky' table headers, and is included by default. */ function testThemeTableStickyHeaders() { $header = array('one', 'two', 'three'); $rows = array(array(1,2,3), array(4,5,6), array(7,8,9)); $this->content = theme('table', array('header' => $header, 'rows' => $rows)); $js = drupal_add_js(); $this->assertTrue(isset($js['misc/tableheader.js']), 'tableheader.js was included when $sticky = TRUE.'); $this->assertRaw('sticky-enabled', 'Table has a class of sticky-enabled when $sticky = TRUE.'); drupal_static_reset('drupal_add_js'); } /** * If $sticky is FALSE, no tableheader.js should be included. */ function testThemeTableNoStickyHeaders() { $header = array('one', 'two', 'three'); $rows = array(array(1,2,3), array(4,5,6), array(7,8,9)); $attributes = array(); $caption = NULL; $colgroups = array(); $this->content = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes, 'caption' => $caption, 'colgroups' => $colgroups, 'sticky' => FALSE)); $js = drupal_add_js(); $this->assertFalse(isset($js['misc/tableheader.js']), 'tableheader.js was not included because $sticky = FALSE.'); $this->assertNoRaw('sticky-enabled', 'Table does not have a class of sticky-enabled because $sticky = FALSE.'); drupal_static_reset('drupal_add_js'); } /** * Tests that the table header is printed correctly even if there are no rows, * and that the empty text is displayed correctly. */ function testThemeTableWithEmptyMessage() { $header = array( t('Header 1'), array( 'data' => t('Header 2'), 'colspan' => 2, ), ); $this->content = theme('table', array('header' => $header, 'rows' => array(), 'empty' => t('No strings available.'))); $this->assertRaw('<tr class="odd"><td colspan="3" class="empty message">No strings available.</td>', 'Correct colspan was set on empty message.'); $this->assertRaw('<thead><tr><th>Header 1</th>', 'Table header was printed.'); } /** * Tests that the 'no_striping' option works correctly. */ function testThemeTableWithNoStriping() { $rows = array( array( 'data' => array(1), 'no_striping' => TRUE, ), ); $this->content = theme('table', array('rows' => $rows)); $this->assertNoRaw('class="odd"', 'Odd/even classes were not added because $no_striping = TRUE.'); $this->assertNoRaw('no_striping', 'No invalid no_striping HTML attribute was printed.'); } } /** * Unit tests for theme_item_list(). */ class ThemeItemListUnitTest extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'Theme item list', 'description' => 'Test the theme_item_list() function.', 'group' => 'Theme', ); } /** * Test item list rendering. */ function testItemList() { $items = array('a', array('data' => 'b', 'children' => array('c' => 'c', 'd' => 'd', 'e' => 'e')), 'f'); $expected = '<div class="item-list"><ul><li class="first">a</li> <li>b<div class="item-list"><ul><li class="first">c</li> <li>d</li> <li class="last">e</li> </ul></div></li> <li class="last">f</li> </ul></div>'; $output = theme('item_list', array('items' => $items)); $this->assertIdentical($expected, $output, 'Item list is rendered correctly.'); } } /** * Unit tests for theme_links(). */ class ThemeLinksTest extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'Links', 'description' => 'Test the theme_links() function and rendering groups of links.', 'group' => 'Theme', ); } /** * Test the use of drupal_pre_render_links() on a nested array of links. */ function testDrupalPreRenderLinks() { // Define the base array to be rendered, containing a variety of different // kinds of links. $base_array = array( '#theme' => 'links', '#pre_render' => array('drupal_pre_render_links'), '#links' => array( 'parent_link' => array( 'title' => 'Parent link original', 'href' => 'parent-link-original', ), ), 'first_child' => array( '#theme' => 'links', '#links' => array( // This should be rendered if 'first_child' is rendered separately, // but ignored if the parent is being rendered (since it duplicates // one of the parent's links). 'parent_link' => array( 'title' => 'Parent link copy', 'href' => 'parent-link-copy', ), // This should always be rendered. 'first_child_link' => array( 'title' => 'First child link', 'href' => 'first-child-link', ), ), ), // This should always be rendered as part of the parent. 'second_child' => array( '#theme' => 'links', '#links' => array( 'second_child_link' => array( 'title' => 'Second child link', 'href' => 'second-child-link', ), ), ), // This should never be rendered, since the user does not have access to // it. 'third_child' => array( '#theme' => 'links', '#links' => array( 'third_child_link' => array( 'title' => 'Third child link', 'href' => 'third-child-link', ), ), '#access' => FALSE, ), ); // Start with a fresh copy of the base array, and try rendering the entire // thing. We expect a single <ul> with appropriate links contained within // it. $render_array = $base_array; $html = drupal_render($render_array); $dom = new DOMDocument(); $dom->loadHTML($html); $this->assertEqual($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEqual($list_elements->length, 3, 'Three "li" tags found in the rendered HTML.'); $this->assertEqual($list_elements->item(0)->nodeValue, 'Parent link original', 'First expected link found.'); $this->assertEqual($list_elements->item(1)->nodeValue, 'First child link', 'Second expected link found.'); $this->assertEqual($list_elements->item(2)->nodeValue, 'Second child link', 'Third expected link found.'); $this->assertIdentical(strpos($html, 'Parent link copy'), FALSE, '"Parent link copy" link not found.'); $this->assertIdentical(strpos($html, 'Third child link'), FALSE, '"Third child link" link not found.'); // Now render 'first_child', followed by the rest of the links, and make // sure we get two separate <ul>'s with the appropriate links contained // within each. $render_array = $base_array; $child_html = drupal_render($render_array['first_child']); $parent_html = drupal_render($render_array); // First check the child HTML. $dom = new DOMDocument(); $dom->loadHTML($child_html); $this->assertEqual($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered child HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEqual($list_elements->length, 2, 'Two "li" tags found in the rendered child HTML.'); $this->assertEqual($list_elements->item(0)->nodeValue, 'Parent link copy', 'First expected link found.'); $this->assertEqual($list_elements->item(1)->nodeValue, 'First child link', 'Second expected link found.'); // Then check the parent HTML. $dom = new DOMDocument(); $dom->loadHTML($parent_html); $this->assertEqual($dom->getElementsByTagName('ul')->length, 1, 'One "ul" tag found in the rendered parent HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEqual($list_elements->length, 2, 'Two "li" tags found in the rendered parent HTML.'); $this->assertEqual($list_elements->item(0)->nodeValue, 'Parent link original', 'First expected link found.'); $this->assertEqual($list_elements->item(1)->nodeValue, 'Second child link', 'Second expected link found.'); $this->assertIdentical(strpos($parent_html, 'First child link'), FALSE, '"First child link" link not found.'); $this->assertIdentical(strpos($parent_html, 'Third child link'), FALSE, '"Third child link" link not found.'); } } /** * Functional test for initialization of the theme system in hook_init(). */ class ThemeHookInitTestCase extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'Theme initialization in hook_init()', 'description' => 'Tests that the theme system can be correctly initialized in hook_init().', 'group' => 'Theme', ); } function setUp() { parent::setUp('theme_test'); } /** * Test that the theme system can generate output when called by hook_init(). */ function testThemeInitializationHookInit() { $this->drupalGet('theme-test/hook-init'); $this->assertRaw('Themed output generated in hook_init()', 'Themed output generated in hook_init() correctly appears on the page.'); $this->assertRaw('bartik/css/style.css', "The default theme's CSS appears on the page when the theme system is initialized in hook_init()."); } } /** * Tests autocompletion not loading registry. */ class ThemeFastTestCase extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'Theme fast initialization', 'description' => 'Test that autocompletion does not load the registry.', 'group' => 'Theme' ); } function setUp() { parent::setUp('theme_test'); $this->account = $this->drupalCreateUser(array('access user profiles')); } /** * Tests access to user autocompletion and verify the correct results. */ function testUserAutocomplete() { $this->drupalLogin($this->account); $this->drupalGet('user/autocomplete/' . $this->account->name); $this->assertText('registry not initialized', 'The registry was not initialized'); } } /** * Tests the markup of core render element types passed to drupal_render(). */ class RenderElementTypesTestCase extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'Render element types', 'description' => 'Tests the markup of core render element types passed to drupal_render().', 'group' => 'Theme', ); } /** * Asserts that an array of elements is rendered properly. * * @param array $elements * An array of associative arrays describing render elements and their * expected markup. Each item in $elements must contain the following: * - 'name': This human readable description will be displayed on the test * results page. * - 'value': This is the render element to test. * - 'expected': This is the expected markup for the element in 'value'. */ function assertElements($elements) { foreach($elements as $element) { $this->assertIdentical(drupal_render($element['value']), $element['expected'], '"' . $element['name'] . '" input rendered correctly by drupal_render().'); } } /** * Tests system #type 'container'. */ function testContainer() { $elements = array( // Basic container with no attributes. array( 'name' => "#type 'container' with no HTML attributes", 'value' => array( '#type' => 'container', 'child' => array( '#markup' => 'foo', ), ), 'expected' => '<div>foo</div>', ), // Container with a class. array( 'name' => "#type 'container' with a class HTML attribute", 'value' => array( '#type' => 'container', 'child' => array( '#markup' => 'foo', ), '#attributes' => array( 'class' => 'bar', ), ), 'expected' => '<div class="bar">foo</div>', ), ); $this->assertElements($elements); } /** * Tests system #type 'html_tag'. */ function testHtmlTag() { $elements = array( // Test auto-closure meta tag generation. array( 'name' => "#type 'html_tag' auto-closure meta tag generation", 'value' => array( '#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array( 'name' => 'description', 'content' => 'Drupal test', ), ), 'expected' => '<meta name="description" content="Drupal test" />' . "\n", ), // Test title tag generation. array( 'name' => "#type 'html_tag' title tag generation", 'value' => array( '#type' => 'html_tag', '#tag' => 'title', '#value' => 'title test', ), 'expected' => '<title>title test</title>' . "\n", ), ); $this->assertElements($elements); } } /** * Tests for the ThemeRegistry class. */ class ThemeRegistryTestCase extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'ThemeRegistry', 'description' => 'Tests the behavior of the ThemeRegistry class', 'group' => 'Theme', ); } function setUp() { parent::setUp('theme_test'); } /** * Tests the behavior of the theme registry class. */ function testRaceCondition() { $_SERVER['REQUEST_METHOD'] = 'GET'; $cid = 'test_theme_registry'; // Directly instantiate the theme registry, this will cause a base cache // entry to be written in __construct(). $registry = new ThemeRegistry($cid, 'cache'); $this->assertTrue(cache_get($cid), 'Cache entry was created.'); // Trigger a cache miss for an offset. $this->assertTrue($registry['theme_test_template_test'], 'Offset was returned correctly from the theme registry.'); // This will cause the ThemeRegistry class to write an updated version of // the cache entry when it is destroyed, usually at the end of the request. // Before that happens, manually delete the cache entry we created earlier // so that the new entry is written from scratch. cache_clear_all($cid, 'cache'); // Destroy the class so that it triggers a cache write for the offset. unset($registry); $this->assertTrue(cache_get($cid), 'Cache entry was created.'); // Create a new instance of the class. Confirm that both the offset // requested previously, and one that has not yet been requested are both // available. $registry = new ThemeRegistry($cid, 'cache'); $this->assertTrue($registry['theme_test_template_test'], 'Offset was returned correctly from the theme registry'); $this->assertTrue($registry['theme_test_template_test_2'], 'Offset was returned correctly from the theme registry'); } } /** * Tests for theme debug markup. */ class ThemeDebugMarkupTestCase extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'Theme debug markup', 'description' => 'Tests theme debug markup output.', 'group' => 'Theme', ); } function setUp() { parent::setUp('theme_test', 'node'); theme_enable(array('test_theme')); } /** * Tests debug markup added to template output. */ function testDebugOutput() { variable_set('theme_default', 'test_theme'); // Enable the debug output. variable_set('theme_debug', TRUE); $registry = theme_get_registry(); $extension = '.tpl.php'; // Populate array of templates. $templates = drupal_find_theme_templates($registry, $extension, drupal_get_path('theme', 'test_theme')); $templates += drupal_find_theme_templates($registry, $extension, drupal_get_path('module', 'node')); // Create a node and test different features of the debug markup. $node = $this->drupalCreateNode(); $this->drupalGet('node/' . $node->nid); $this->assertRaw('<!-- THEME DEBUG -->', 'Theme debug markup found in theme output when debug is enabled.'); $this->assertRaw("CALL: theme('node')", 'Theme call information found.'); $this->assertRaw('x node--1' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node' . $extension, 'Suggested template files found in order and node ID specific template shown as current template.'); $template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension; $this->assertRaw("BEGIN OUTPUT from '$template_filename'", 'Full path to current template file found.'); // Create another node and make sure the template suggestions shown in the // debug markup are correct. $node2 = $this->drupalCreateNode(); $this->drupalGet('node/' . $node2->nid); $this->assertRaw('* node--2' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' x node' . $extension, 'Suggested template files found in order and base template shown as current template.'); // Create another node and make sure the template suggestions shown in the // debug markup are correct. $node3 = $this->drupalCreateNode(); $build = array('#theme' => 'node__foo__bar'); $build += node_view($node3); $output = drupal_render($build); $this->assertTrue(strpos($output, "CALL: theme('node__foo__bar')") !== FALSE, 'Theme call information found.'); $this->assertTrue(strpos($output, '* node--foo--bar' . $extension . PHP_EOL . ' * node--foo' . $extension . PHP_EOL . ' * node--3' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.'); // Disable theme debug. variable_set('theme_debug', FALSE); $this->drupalGet('node/' . $node->nid); $this->assertNoRaw('<!-- THEME DEBUG -->', 'Theme debug markup not found in theme output when debug is disabled.'); } }
Close