diff options
Diffstat (limited to 'modules/simpletest/tests')
121 files changed, 775 insertions, 192 deletions
diff --git a/modules/simpletest/tests/actions.test b/modules/simpletest/tests/actions.test index 8e0220d4f..23587f0c5 100644 --- a/modules/simpletest/tests/actions.test +++ b/modules/simpletest/tests/actions.test @@ -1,5 +1,4 @@ <?php -// $Id$ class ActionsConfigurationTestCase extends DrupalWebTestCase { public static function getInfo() { diff --git a/modules/simpletest/tests/actions_loop_test.info b/modules/simpletest/tests/actions_loop_test.info index ca33145fd..4350d3dbc 100644 --- a/modules/simpletest/tests/actions_loop_test.info +++ b/modules/simpletest/tests/actions_loop_test.info @@ -1,4 +1,3 @@ -; $Id$ name = Actions loop test description = Support module for action loop testing. package = Testing diff --git a/modules/simpletest/tests/actions_loop_test.install b/modules/simpletest/tests/actions_loop_test.install index b0cd66708..b22fd85ab 100644 --- a/modules/simpletest/tests/actions_loop_test.install +++ b/modules/simpletest/tests/actions_loop_test.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_install(). diff --git a/modules/simpletest/tests/actions_loop_test.module b/modules/simpletest/tests/actions_loop_test.module index 9c966c3e0..77764907b 100644 --- a/modules/simpletest/tests/actions_loop_test.module +++ b/modules/simpletest/tests/actions_loop_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_trigger_info(). diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test index 2a2469334..957979249 100644 --- a/modules/simpletest/tests/ajax.test +++ b/modules/simpletest/tests/ajax.test @@ -1,5 +1,4 @@ <?php -// $Id$ class AJAXTestCase extends DrupalWebTestCase { function setUp() { @@ -11,9 +10,9 @@ class AJAXTestCase extends DrupalWebTestCase { } /** - * Assert that a command with the required properties exists within the array of AJAX commands returned by the server. + * Assert that a command with the required properties exists within the array of Ajax commands returned by the server. * - * The AJAX framework, via the ajax_deliver() and ajax_render() functions, + * The Ajax framework, via the ajax_deliver() and ajax_render() functions, * returns an array of commands. This array sometimes includes commands * automatically provided by the framework in addition to commands returned by * a particular page callback. During testing, we're usually interested that a @@ -28,7 +27,7 @@ class AJAXTestCase extends DrupalWebTestCase { * additional settings that aren't part of $needle. * * @param $haystack - * An array of AJAX commands returned by the server. + * An array of Ajax commands returned by the server. * @param $needle * Array of info we're expecting in one of those commands. * @param $message @@ -56,7 +55,7 @@ class AJAXTestCase extends DrupalWebTestCase { } /** - * Tests primary AJAX framework functions. + * Tests primary Ajax framework functions. */ class AJAXFrameworkTestCase extends AJAXTestCase { protected $profile = 'testing'; @@ -87,7 +86,7 @@ class AJAXFrameworkTestCase extends AJAXTestCase { ); $this->assertCommand($commands, $expected, t('ajax_render() loads settings added with drupal_add_js().')); - // Verify that AJAX settings are loaded for #type 'link'. + // Verify that Ajax settings are loaded for #type 'link'. $this->drupalGet('ajax-test/link'); $settings = $this->drupalGetSettings(); $this->assertEqual($settings['ajax']['ajax-link']['url'], url('filter/tips')); @@ -120,7 +119,7 @@ class AJAXFrameworkTestCase extends AJAXTestCase { } /** - * Tests AJAX framework commands. + * Tests Ajax framework commands. */ class AJAXCommandsTestCase extends AJAXTestCase { public static function getInfo() { @@ -132,7 +131,7 @@ class AJAXCommandsTestCase extends AJAXTestCase { } /** - * Test the various AJAX Commands. + * Test the various Ajax Commands. */ function testAJAXCommands() { $form_path = 'ajax_forms_test_ajax_commands_form'; @@ -324,7 +323,7 @@ class AJAXFormValuesTestCase extends AJAXTestCase { } /** - * Tests that AJAX-enabled forms work when multiple instances of the same form are on a page. + * Tests that Ajax-enabled forms work when multiple instances of the same form are on a page. */ class AJAXMultiFormTestCase extends AJAXTestCase { public static function getInfo() { @@ -338,7 +337,7 @@ class AJAXMultiFormTestCase extends AJAXTestCase { function setUp() { parent::setUp(array('form_test')); - // Create a multi-valued field for 'page' nodes to use for AJAX testing. + // Create a multi-valued field for 'page' nodes to use for Ajax testing. $field_name = 'field_ajax_test'; $field = array( 'field_name' => $field_name, @@ -363,7 +362,7 @@ class AJAXMultiFormTestCase extends AJAXTestCase { */ function testMultiForm() { // HTML IDs for elements within the field are potentially modified with - // each AJAX submission, but these variables are stable and help target the + // each Ajax submission, but these variables are stable and help target the // desired elements. $field_name = 'field_ajax_test'; $field_xpaths = array( @@ -399,7 +398,7 @@ class AJAXMultiFormTestCase extends AJAXTestCase { } /** - * Miscellaneous AJAX tests using ajax_test module. + * Miscellaneous Ajax tests using ajax_test module. */ class AJAXElementValidation extends AJAXTestCase { public static function getInfo() { @@ -411,12 +410,12 @@ class AJAXElementValidation extends AJAXTestCase { } /** - * Try to post an AJAX change to a form that has a validated element. + * Try to post an Ajax change to a form that has a validated element. * - * The drivertext field is AJAX-enabled. An additional field is not, but + * The drivertext field is Ajax-enabled. An additional field is not, but * is set to be a required field. In this test the required field is not * filled in, and we want to see if the activation of the "drivertext" - * AJAX-enabled field fails due to the required field being empty. + * Ajax-enabled field fails due to the required field being empty. */ function testAJAXElementValidation() { $web_user = $this->drupalCreateUser(); diff --git a/modules/simpletest/tests/ajax_forms_test.info b/modules/simpletest/tests/ajax_forms_test.info index d682bfac5..c1d7dd4bd 100644 --- a/modules/simpletest/tests/ajax_forms_test.info +++ b/modules/simpletest/tests/ajax_forms_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "AJAX form test mock module" description = "Test for AJAX form calls." core = 7.x diff --git a/modules/simpletest/tests/ajax_forms_test.module b/modules/simpletest/tests/ajax_forms_test.module index 21784dfa3..d38cbbb90 100644 --- a/modules/simpletest/tests/ajax_forms_test.module +++ b/modules/simpletest/tests/ajax_forms_test.module @@ -1,9 +1,8 @@ <?php -// $Id$ /** * @file - * Simpletest mock module for AJAX forms testing. + * Simpletest mock module for Ajax forms testing. */ /** @@ -67,7 +66,7 @@ function ajax_forms_test_simple_form($form, &$form_state) { } /** - * AJAX callback triggered by select. + * Ajax callback triggered by select. */ function ajax_forms_test_simple_form_select_callback($form, $form_state) { $commands = array(); @@ -77,7 +76,7 @@ function ajax_forms_test_simple_form_select_callback($form, $form_state) { } /** - * AJAX callback triggered by checkbox. + * Ajax callback triggered by checkbox. */ function ajax_forms_test_simple_form_checkbox_callback($form, $form_state) { $commands = array(); @@ -88,7 +87,7 @@ function ajax_forms_test_simple_form_checkbox_callback($form, $form_state) { /** - * Form to display the AJAX Commands. + * Form to display the Ajax Commands. * @param $form * @param $form_state * @return unknown_type @@ -154,7 +153,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { ), ); - // Shows the AJAX 'css' command. + // Shows the Ajax 'css' command. $form['css_command_example'] = array( '#value' => t("Set the the '#box' div to be blue."), '#type' => 'submit', @@ -165,7 +164,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { ); - // Shows the AJAX 'data' command. But there is no use of this information, + // Shows the Ajax 'data' command. But there is no use of this information, // as this would require a javascript client to use the data. $form['data_command_example'] = array( '#value' => t("AJAX data command: Issue command."), @@ -176,7 +175,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="data_div">Data attached to this div.</div>', ); - // Shows the AJAX 'invoke' command. + // Shows the Ajax 'invoke' command. $form['invoke_command_example'] = array( '#value' => t("AJAX invoke command: Invoke addClass() method."), '#type' => 'submit', @@ -186,7 +185,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="invoke_div">Original contents</div>', ); - // Shows the AJAX 'html' command. + // Shows the Ajax 'html' command. $form['html_command_example'] = array( '#value' => t("AJAX html: Replace the HTML in a selector."), '#type' => 'submit', @@ -196,7 +195,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="html_div">Original contents</div>', ); - // Shows the AJAX 'insert' command. + // Shows the Ajax 'insert' command. $form['insert_command_example'] = array( '#value' => t("AJAX insert: Let client insert based on #ajax['method']."), '#type' => 'submit', @@ -207,7 +206,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="insert_div">Original contents</div>', ); - // Shows the AJAX 'prepend' command. + // Shows the Ajax 'prepend' command. $form['prepend_command_example'] = array( '#value' => t("AJAX 'prepend': Click to prepend something"), '#type' => 'submit', @@ -217,7 +216,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="prepend_div">Something will be prepended to this div. </div>', ); - // Shows the AJAX 'remove' command. + // Shows the Ajax 'remove' command. $form['remove_command_example'] = array( '#value' => t("AJAX 'remove': Click to remove text"), '#type' => 'submit', @@ -227,7 +226,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="remove_div"><div id="remove_text">text to be removed</div></div>', ); - // Shows the AJAX 'restripe' command. + // Shows the Ajax 'restripe' command. $form['restripe_command_example'] = array( '#type' => 'submit', '#value' => t("AJAX 'restripe' command"), @@ -242,7 +241,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { </div>', ); - // Demonstrates the AJAX 'settings' command. The 'settings' command has + // Demonstrates the Ajax 'settings' command. The 'settings' command has // nothing visual to "show", but it can be tested via SimpleTest and via // Firebug. $form['settings_command_example'] = array( @@ -262,7 +261,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { } /** - * AJAX callback for 'after'. + * Ajax callback for 'after'. */ function ajax_forms_test_advanced_commands_after_callback($form, $form_state) { $selector = '#after_div'; @@ -273,7 +272,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, $form_state) { } /** - * AJAX callback for 'alert'. + * Ajax callback for 'alert'. */ function ajax_forms_test_advanced_commands_alert_callback($form, $form_state) { $commands = array(); @@ -282,7 +281,7 @@ function ajax_forms_test_advanced_commands_alert_callback($form, $form_state) { } /** - * AJAX callback for 'append'. + * Ajax callback for 'append'. */ function ajax_forms_test_advanced_commands_append_callback($form, $form_state) { $selector = '#append_div'; @@ -292,7 +291,7 @@ function ajax_forms_test_advanced_commands_append_callback($form, $form_state) { } /** - * AJAX callback for 'before'. + * Ajax callback for 'before'. */ function ajax_forms_test_advanced_commands_before_callback($form, $form_state) { $selector = '#before_div'; @@ -303,14 +302,14 @@ function ajax_forms_test_advanced_commands_before_callback($form, $form_state) { } /** - * AJAX callback for 'changed'. + * Ajax callback for 'changed'. */ function ajax_forms_test_advanced_commands_changed_callback($form, $form_state) { $commands[] = ajax_command_changed('#changed_div'); return array('#type' => 'ajax', '#commands' => $commands); } /** - * AJAX callback for 'changed' with asterisk marking inner div. + * Ajax callback for 'changed' with asterisk marking inner div. */ function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, $form_state) { $commands = array(); @@ -319,7 +318,7 @@ function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, $for } /** - * AJAX callback for 'css'. + * Ajax callback for 'css'. */ function ajax_forms_test_advanced_commands_css_callback($form, $form_state) { $selector = '#css_div'; @@ -331,7 +330,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, $form_state) { } /** - * AJAX callback for 'data'. + * Ajax callback for 'data'. */ function ajax_forms_test_advanced_commands_data_callback($form, $form_state) { $selector = '#data_div'; @@ -342,7 +341,7 @@ function ajax_forms_test_advanced_commands_data_callback($form, $form_state) { } /** - * AJAX callback for 'invoke'. + * Ajax callback for 'invoke'. */ function ajax_forms_test_advanced_commands_invoke_callback($form, $form_state) { $commands = array(); @@ -351,7 +350,7 @@ function ajax_forms_test_advanced_commands_invoke_callback($form, $form_state) { } /** - * AJAX callback for 'html'. + * Ajax callback for 'html'. */ function ajax_forms_test_advanced_commands_html_callback($form, $form_state) { $commands = array(); @@ -360,7 +359,7 @@ function ajax_forms_test_advanced_commands_html_callback($form, $form_state) { } /** - * AJAX callback for 'insert'. + * Ajax callback for 'insert'. */ function ajax_forms_test_advanced_commands_insert_callback($form, $form_state) { $commands = array(); @@ -369,7 +368,7 @@ function ajax_forms_test_advanced_commands_insert_callback($form, $form_state) { } /** - * AJAX callback for 'prepend'. + * Ajax callback for 'prepend'. */ function ajax_forms_test_advanced_commands_prepend_callback($form, $form_state) { $commands = array(); @@ -378,7 +377,7 @@ function ajax_forms_test_advanced_commands_prepend_callback($form, $form_state) } /** - * AJAX callback for 'remove'. + * Ajax callback for 'remove'. */ function ajax_forms_test_advanced_commands_remove_callback($form, $form_state) { $commands = array(); @@ -387,7 +386,7 @@ function ajax_forms_test_advanced_commands_remove_callback($form, $form_state) { } /** - * AJAX callback for 'restripe'. + * Ajax callback for 'restripe'. */ function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state) { $commands = array(); @@ -396,7 +395,7 @@ function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state) } /** - * AJAX callback for 'settings'. + * Ajax callback for 'settings'. */ function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) { $commands = array(); @@ -407,12 +406,12 @@ function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) /** * This form and its related submit and callback functions demonstrate - * not validating another form element when a single AJAX element is triggered. + * not validating another form element when a single Ajax element is triggered. * - * The "drivertext" element is an AJAX-enabled textfield, free-form. + * The "drivertext" element is an Ajax-enabled textfield, free-form. * The "required_field" element is a textfield marked required. * - * The correct behavior is that the AJAX-enabled drivertext element should + * The correct behavior is that the Ajax-enabled drivertext element should * be able to trigger without causing validation of the "required_field". */ function ajax_forms_test_validation_form($form, &$form_state) { @@ -451,7 +450,7 @@ function ajax_forms_test_validation_form_submit($form, $form_state) { } /** - * AJAX callback for the 'drivertext' element of the validation form. + * Ajax callback for the 'drivertext' element of the validation form. */ function ajax_forms_test_validation_form_callback($form, $form_state) { drupal_set_message("ajax_forms_test_validation_form_callback invoked"); diff --git a/modules/simpletest/tests/ajax_test.info b/modules/simpletest/tests/ajax_test.info index aeaadbbe5..1f5648242 100644 --- a/modules/simpletest/tests/ajax_test.info +++ b/modules/simpletest/tests/ajax_test.info @@ -1,4 +1,3 @@ -; $Id$ name = AJAX Test description = Support module for AJAX framework tests. package = Testing diff --git a/modules/simpletest/tests/ajax_test.module b/modules/simpletest/tests/ajax_test.module index 70f87f512..4148a0839 100644 --- a/modules/simpletest/tests/ajax_test.module +++ b/modules/simpletest/tests/ajax_test.module @@ -1,9 +1,8 @@ <?php -// $Id$ /** * @file - * Helper module for AJAX framework tests. + * Helper module for Ajax framework tests. */ /** @@ -45,7 +44,7 @@ function ajax_test_render() { } /** - * Menu callback; Returns AJAX element with #error property set. + * Menu callback; Returns Ajax element with #error property set. */ function ajax_test_error() { $message = ''; diff --git a/modules/simpletest/tests/batch.test b/modules/simpletest/tests/batch.test index b7bfc9bfb..d1c0e0b2f 100644 --- a/modules/simpletest/tests/batch.test +++ b/modules/simpletest/tests/batch.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/batch_test.callbacks.inc b/modules/simpletest/tests/batch_test.callbacks.inc index 8e03c0ba6..75e665533 100644 --- a/modules/simpletest/tests/batch_test.callbacks.inc +++ b/modules/simpletest/tests/batch_test.callbacks.inc @@ -1,6 +1,5 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/batch_test.info b/modules/simpletest/tests/batch_test.info index 301df517e..f3540978f 100644 --- a/modules/simpletest/tests/batch_test.info +++ b/modules/simpletest/tests/batch_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Batch API test" description = "Support module for Batch API tests." package = Testing diff --git a/modules/simpletest/tests/batch_test.module b/modules/simpletest/tests/batch_test.module index e1afa0427..1200e767d 100644 --- a/modules/simpletest/tests/batch_test.module +++ b/modules/simpletest/tests/batch_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test index 333f34b76..14c16a95b 100644 --- a/modules/simpletest/tests/bootstrap.test +++ b/modules/simpletest/tests/bootstrap.test @@ -1,5 +1,4 @@ <?php -// $Id$ class BootstrapIPAddressTestCase extends DrupalWebTestCase { diff --git a/modules/simpletest/tests/cache.test b/modules/simpletest/tests/cache.test index 0fc9fe298..43d1fa122 100644 --- a/modules/simpletest/tests/cache.test +++ b/modules/simpletest/tests/cache.test @@ -1,5 +1,4 @@ <?php -// $Id$ class CacheTestCase extends DrupalWebTestCase { protected $default_bin = 'cache'; diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index ca29e11f8..d618ddb00 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -1171,6 +1170,8 @@ class JavaScriptTestCase extends DrupalWebTestCase { $this->assertTrue(array_key_exists('misc/drupal.js', $javascript), t('Drupal.js is added when file is added.')); $this->assertTrue(array_key_exists('misc/collapse.js', $javascript), t('JavaScript files are correctly added.')); $this->assertEqual(base_path(), $javascript['settings']['data'][0]['basePath'], t('Base path JavaScript setting is correctly set.')); + url('', array('prefix' => &$prefix)); + $this->assertEqual(empty($prefix) ? '' : $prefix, $javascript['settings']['data'][1]['pathPrefix'], t('Path prefix JavaScript setting is correctly set.')); } /** @@ -1178,8 +1179,8 @@ class JavaScriptTestCase extends DrupalWebTestCase { */ function testAddSetting() { $javascript = drupal_add_js(array('drupal' => 'rocks', 'dries' => 280342800), 'setting'); - $this->assertEqual(280342800, $javascript['settings']['data'][1]['dries'], t('JavaScript setting is set correctly.')); - $this->assertEqual('rocks', $javascript['settings']['data'][1]['drupal'], t('The other JavaScript setting is set correctly.')); + $this->assertEqual(280342800, $javascript['settings']['data'][2]['dries'], t('JavaScript setting is set correctly.')); + $this->assertEqual('rocks', $javascript['settings']['data'][2]['drupal'], t('The other JavaScript setting is set correctly.')); } /** @@ -1209,6 +1210,7 @@ class JavaScriptTestCase extends DrupalWebTestCase { $javascript = drupal_get_js('header'); $this->assertTrue(strpos($javascript, 'basePath') > 0, t('Rendered JavaScript header returns basePath setting.')); $this->assertTrue(strpos($javascript, 'misc/jquery.js') > 0, t('Rendered JavaScript header includes jQuery.')); + $this->assertTrue(strpos($javascript, 'pathPrefix') > 0, t('Rendered JavaScript header returns pathPrefix setting.')); // Test whether drupal_add_js can be used to override a previous setting. $this->assertTrue(strpos($javascript, 'commonTestShouldAppear') > 0, t('Rendered JavaScript header returns custom setting.')); @@ -1522,6 +1524,56 @@ class DrupalRenderTestCase extends DrupalWebTestCase { } /** + * Test #attached functionality in children elements. + */ + function testDrupalRenderChildrenAttached() { + // The cache system is turned off for POST requests. + $request_method = $_SERVER['REQUEST_METHOD']; + $_SERVER['REQUEST_METHOD'] = 'GET'; + + // Create an element with a child and subchild. Each element loads a + // different JavaScript file using #attached. + $parent_js = drupal_get_path('module', 'user') . '/user.js'; + $child_js = drupal_get_path('module', 'forum') . '/forum.js'; + $subchild_js = drupal_get_path('module', 'book') . '/book.js'; + $element = array( + '#type' => 'fieldset', + '#cache' => array( + 'keys' => array('simpletest', 'drupal_render', 'children_attached'), + ), + '#attached' => array('js' => array($parent_js)), + '#title' => 'Parent', + ); + $element['child'] = array( + '#type' => 'fieldset', + '#attached' => array('js' => array($child_js)), + '#title' => 'Child', + ); + $element['child']['subchild'] = array( + '#attached' => array('js' => array($subchild_js)), + '#markup' => 'Subchild', + ); + + // Render the element and verify the presence of #attached JavaScript. + drupal_render($element); + $scripts = drupal_get_js(); + $this->assertTrue(strpos($scripts, $parent_js), t('The element #attached JavaScript was included.')); + $this->assertTrue(strpos($scripts, $child_js), t('The child #attached JavaScript was included.')); + $this->assertTrue(strpos($scripts, $subchild_js), t('The subchild #attached JavaScript was included.')); + + // Load the element from cache and verify the presence of the #attached + // JavaScript. + drupal_static_reset('drupal_add_js'); + $this->assertTrue(drupal_render_cache_get($element), t('The element was retrieved from cache.')); + $scripts = drupal_get_js(); + $this->assertTrue(strpos($scripts, $parent_js), t('The element #attached JavaScript was included when loading from cache.')); + $this->assertTrue(strpos($scripts, $child_js), t('The child #attached JavaScript was included when loading from cache.')); + $this->assertTrue(strpos($scripts, $subchild_js), t('The subchild #attached JavaScript was included when loading from cache.')); + + $_SERVER['REQUEST_METHOD'] = $request_method; + } + + /** * Test passing arguments to the theme function. */ function testDrupalRenderThemeArguments() { diff --git a/modules/simpletest/tests/common_test.css b/modules/simpletest/tests/common_test.css index 023eae62d..b86ceadb7 100644 --- a/modules/simpletest/tests/common_test.css +++ b/modules/simpletest/tests/common_test.css @@ -1,3 +1,2 @@ -/* $Id$ */ /* This file is for testing CSS file inclusion, no contents are necessary. */ diff --git a/modules/simpletest/tests/common_test.info b/modules/simpletest/tests/common_test.info index cc16c2551..aced983d2 100644 --- a/modules/simpletest/tests/common_test.info +++ b/modules/simpletest/tests/common_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Common Test" description = "Support module for Common tests." package = Testing diff --git a/modules/simpletest/tests/common_test.module b/modules/simpletest/tests/common_test.module index 449da4a97..9b6178804 100644 --- a/modules/simpletest/tests/common_test.module +++ b/modules/simpletest/tests/common_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/common_test.print.css b/modules/simpletest/tests/common_test.print.css index 023eae62d..b86ceadb7 100644 --- a/modules/simpletest/tests/common_test.print.css +++ b/modules/simpletest/tests/common_test.print.css @@ -1,3 +1,2 @@ -/* $Id$ */ /* This file is for testing CSS file inclusion, no contents are necessary. */ diff --git a/modules/simpletest/tests/common_test_info.txt b/modules/simpletest/tests/common_test_info.txt index 8ff8bd553..ae217b917 100644 --- a/modules/simpletest/tests/common_test_info.txt +++ b/modules/simpletest/tests/common_test_info.txt @@ -1,4 +1,3 @@ -; $Id$ ; Test parsing with a simple string. simple_string = A simple string diff --git a/modules/simpletest/tests/database_test.info b/modules/simpletest/tests/database_test.info index e357b30ed..7141235e1 100644 --- a/modules/simpletest/tests/database_test.info +++ b/modules/simpletest/tests/database_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Database Test" description = "Support module for Database layer tests." core = 7.x diff --git a/modules/simpletest/tests/database_test.install b/modules/simpletest/tests/database_test.install index 709ff8947..4dce2b19a 100644 --- a/modules/simpletest/tests/database_test.install +++ b/modules/simpletest/tests/database_test.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/database_test.module b/modules/simpletest/tests/database_test.module index 2b684409c..6fac31919 100644 --- a/modules/simpletest/tests/database_test.module +++ b/modules/simpletest/tests/database_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_query_alter(). diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index 243dbba31..c22d1fc5d 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Dummy class for fetching into a class. @@ -720,6 +719,21 @@ class DatabaseUpdateTestCase extends DatabaseTestCase { } /** + * Confirm updating to NULL. + */ + function testSimpleNullUpdate() { + $this->ensureSampleDataNull(); + $num_updated = db_update('test_null') + ->fields(array('age' => NULL)) + ->condition('name', 'Kermit') + ->execute(); + $this->assertIdentical($num_updated, 1, t('Updated 1 record.')); + + $saved_age = db_query('SELECT age FROM {test_null} WHERE name = :name', array(':name' => 'Kermit'))->fetchField(); + $this->assertNull($saved_age, t('Updated name successfully.')); + } + + /** * Confirm that we can update a multiple records successfully. */ function testMultiUpdate() { @@ -1311,6 +1325,27 @@ class DatabaseSelectTestCase extends DatabaseTestCase { } /** + * Test query COMMENT system against vulnerabilities. + */ + function testVulnerableComment() { + $query = db_select('test')->comment('Testing query comments */ SELECT nid FROM {node}; --'); + $name_field = $query->addField('test', 'name'); + $age_field = $query->addField('test', 'age', 'age'); + $result = $query->execute(); + + $num_records = 0; + foreach ($result as $record) { + $num_records++; + } + + $query = (string)$query; + $expected = "/* Testing query comments SELECT nid FROM {node}; -- */ SELECT test.name AS name, test.age AS age\nFROM \n{test} test"; + + $this->assertEqual($num_records, 4, t('Returned the correct number of rows.')); + $this->assertEqual($query, $expected, t('The flattened query contains the sanitised comment string.')); + } + + /** * Test basic conditionals on SELECT statements. */ function testSimpleSelectConditional() { @@ -1687,6 +1722,9 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase { /** * Test EXISTS subquery conditionals on SELECT statements. + * + * We essentially select all rows from the {test} table that have matching + * rows in the {test_people} table based on the shared name column. */ function testExistsSubquerySelect() { // Put George into {test_people}. @@ -1703,7 +1741,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase { // Subquery to {test_people}. $subquery = db_select('test_people', 'tp') ->fields('tp', array('name')) - ->condition('name', 'George'); + ->where('tp.name = t.name'); $query->exists($subquery); $result = $query->execute(); @@ -1714,6 +1752,9 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase { /** * Test NOT EXISTS subquery conditionals on SELECT statements. + * + * We essentially select all rows from the {test} table that don't have + * matching rows in the {test_people} table based on the shared name column. */ function testNotExistsSubquerySelect() { // Put George into {test_people}. @@ -1731,13 +1772,12 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase { // Subquery to {test_people}. $subquery = db_select('test_people', 'tp') ->fields('tp', array('name')) - ->condition('name', 'George'); + ->where('tp.name = t.name'); $query->notExists($subquery); - $result = $query->execute(); - // Ensure that we got the right record. - $record = $result->fetch(); - $this->assertFalse($record, t('NOT EXISTS query returned no results.')); + // Ensure that we got the right number of records. + $people = $query->execute()->fetchCol(); + $this->assertEqual(count($people), 3, t('NOT EXISTS query returned the correct results.')); } } diff --git a/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info index d367ad92f..085c33525 100644 --- a/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info +++ b/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Drupal system listing compatible test" description = "Support module for testing the drupal_system_listing function." package = Testing diff --git a/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module b/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module index 13bb990c4..b3d9bbc7f 100644 --- a/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module +++ b/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.module @@ -1,2 +1 @@ <?php -// $Id$ diff --git a/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info index a86bbca4b..8e5875e95 100644 --- a/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info +++ b/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Drupal system listing incompatible test" description = "Support module for testing the drupal_system_listing function." package = Testing diff --git a/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module b/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module index 13bb990c4..b3d9bbc7f 100644 --- a/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module +++ b/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.module @@ -1,2 +1 @@ <?php -// $Id$ diff --git a/modules/simpletest/tests/entity_cache_test.info b/modules/simpletest/tests/entity_cache_test.info index 01c6d5d06..405cefaa2 100644 --- a/modules/simpletest/tests/entity_cache_test.info +++ b/modules/simpletest/tests/entity_cache_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Entity cache test" description = "Support module for testing entity cache." package = Testing diff --git a/modules/simpletest/tests/entity_cache_test.module b/modules/simpletest/tests/entity_cache_test.module index b1daf683f..5ae9eccb1 100644 --- a/modules/simpletest/tests/entity_cache_test.module +++ b/modules/simpletest/tests/entity_cache_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/entity_cache_test_dependency.info b/modules/simpletest/tests/entity_cache_test_dependency.info index 7e9cdc704..f0dc7b621 100644 --- a/modules/simpletest/tests/entity_cache_test_dependency.info +++ b/modules/simpletest/tests/entity_cache_test_dependency.info @@ -1,4 +1,3 @@ -; $Id$ name = "Entity cache test dependency" description = "Support dependency module for testing entity cache." package = Testing diff --git a/modules/simpletest/tests/entity_cache_test_dependency.module b/modules/simpletest/tests/entity_cache_test_dependency.module index 1f9c1c3ba..73a11495f 100644 --- a/modules/simpletest/tests/entity_cache_test_dependency.module +++ b/modules/simpletest/tests/entity_cache_test_dependency.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/entity_crud_hook_test.info b/modules/simpletest/tests/entity_crud_hook_test.info index 5cc2ad96d..b37114d9a 100644 --- a/modules/simpletest/tests/entity_crud_hook_test.info +++ b/modules/simpletest/tests/entity_crud_hook_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Entity CRUD Hooks Test" description = "Support module for CRUD hook tests." core = 7.x diff --git a/modules/simpletest/tests/entity_crud_hook_test.module b/modules/simpletest/tests/entity_crud_hook_test.module index 12252d144..873a162ce 100644 --- a/modules/simpletest/tests/entity_crud_hook_test.module +++ b/modules/simpletest/tests/entity_crud_hook_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ // // Presave hooks diff --git a/modules/simpletest/tests/entity_crud_hook_test.test b/modules/simpletest/tests/entity_crud_hook_test.test index 17b9f23b1..3f18fc855 100644 --- a/modules/simpletest/tests/entity_crud_hook_test.test +++ b/modules/simpletest/tests/entity_crud_hook_test.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Test invocation of hooks when inserting, loading, updating or deleting an diff --git a/modules/simpletest/tests/entity_query.test b/modules/simpletest/tests/entity_query.test index 4a319d7f6..d28d5a35c 100644 --- a/modules/simpletest/tests/entity_query.test +++ b/modules/simpletest/tests/entity_query.test @@ -1,6 +1,5 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/error.test b/modules/simpletest/tests/error.test index fdaab2bb8..b1ec4b3f5 100644 --- a/modules/simpletest/tests/error.test +++ b/modules/simpletest/tests/error.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Tests Drupal error and exception handlers. @@ -25,21 +24,18 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase { '%type' => 'Notice', '!message' => 'Undefined variable: bananas', '%function' => 'error_test_generate_warnings()', - '%line' => 44, '%file' => drupal_realpath('modules/simpletest/tests/error_test.module'), ); $error_warning = array( '%type' => 'Warning', '!message' => 'Division by zero', '%function' => 'error_test_generate_warnings()', - '%line' => 46, '%file' => drupal_realpath('modules/simpletest/tests/error_test.module'), ); $error_user_notice = array( '%type' => 'User warning', '!message' => 'Drupal is awesome', '%function' => 'error_test_generate_warnings()', - '%line' => 48, '%file' => drupal_realpath('modules/simpletest/tests/error_test.module'), ); @@ -97,7 +93,7 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase { // varies from database to database. Check that the SQL string is displayed. $this->assertText($error_pdo_exception['%type'], t('Found %type in error page.', $error_pdo_exception)); $this->assertText($error_pdo_exception['!message'], t('Found !message in error page.', $error_pdo_exception)); - $error_details = t('in %function (line %line of %file)', $error_pdo_exception); + $error_details = t('in %function (line ', $error_pdo_exception); $this->assertRaw($error_details, t("Found '!message' in error page.", array('!message' => $error_details))); } @@ -105,16 +101,16 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase { * Helper function: assert that the error message is found. */ function assertErrorMessage(array $error) { - $message = t('%type: !message in %function (line %line of %file).', $error); - $this->assertRaw($message, t('Error !message found.', array('!message' => $message))); + $message = t('%type: !message in %function (line ', $error); + $this->assertRaw($message, t('Found error message: !message.', array('!message' => $message))); } /** * Helper function: assert that the error message is not found. */ function assertNoErrorMessage(array $error) { - $message = t('%type: !message in %function (line %line of %file).', $error); - $this->assertNoRaw($message, t('Error !message not found.', array('!message' => $message))); + $message = t('%type: !message in %function (line ', $error); + $this->assertNoRaw($message, t('Did not find error message: !message.', array('!message' => $message))); } } diff --git a/modules/simpletest/tests/error_test.info b/modules/simpletest/tests/error_test.info index 0486297cf..1764ae34f 100644 --- a/modules/simpletest/tests/error_test.info +++ b/modules/simpletest/tests/error_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Error test" description = "Support module for error and exception testing." package = Testing diff --git a/modules/simpletest/tests/error_test.module b/modules/simpletest/tests/error_test.module index 1e0830436..d062cb067 100644 --- a/modules/simpletest/tests/error_test.module +++ b/modules/simpletest/tests/error_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_menu(). diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test index c9577c6b2..dc12b1b73 100644 --- a/modules/simpletest/tests/file.test +++ b/modules/simpletest/tests/file.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/file_test.info b/modules/simpletest/tests/file_test.info index 69f9c1725..4edfceae6 100644 --- a/modules/simpletest/tests/file_test.info +++ b/modules/simpletest/tests/file_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "File test" description = "Support module for file handling tests." package = Testing diff --git a/modules/simpletest/tests/file_test.module b/modules/simpletest/tests/file_test.module index b509805d8..2865a1fa3 100644 --- a/modules/simpletest/tests/file_test.module +++ b/modules/simpletest/tests/file_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/filetransfer.test b/modules/simpletest/tests/filetransfer.test index 2e7b02f6e..905d23cab 100644 --- a/modules/simpletest/tests/filetransfer.test +++ b/modules/simpletest/tests/filetransfer.test @@ -1,5 +1,4 @@ <?php -// $Id$ class FileTranferTest extends DrupalWebTestCase { diff --git a/modules/simpletest/tests/filter_test.info b/modules/simpletest/tests/filter_test.info index db1ce6d4b..4b887ca99 100644 --- a/modules/simpletest/tests/filter_test.info +++ b/modules/simpletest/tests/filter_test.info @@ -1,4 +1,3 @@ -; $Id$ name = Filter test module description = Tests filter hooks and functions. package = Testing diff --git a/modules/simpletest/tests/filter_test.module b/modules/simpletest/tests/filter_test.module index fa3861646..2cebc7085 100644 --- a/modules/simpletest/tests/filter_test.module +++ b/modules/simpletest/tests/filter_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index a73ac16c2..e7ae9de3f 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -1132,13 +1131,13 @@ class FormsRebuildTestCase extends DrupalWebTestCase { } /** - * Tests that a form's action is retained after an AJAX submission. + * Tests that a form's action is retained after an Ajax submission. * - * The 'action' attribute of a form should not change after an AJAX submission - * followed by a non-AJAX submission, which triggers a validation error. + * The 'action' attribute of a form should not change after an Ajax submission + * followed by a non-Ajax submission, which triggers a validation error. */ function testPreserveFormActionAfterAJAX() { - // Create a multi-valued field for 'page' nodes to use for AJAX testing. + // Create a multi-valued field for 'page' nodes to use for Ajax testing. $field_name = 'field_ajax_test'; $field = array( 'field_name' => $field_name, @@ -1157,14 +1156,14 @@ class FormsRebuildTestCase extends DrupalWebTestCase { $this->web_user = $this->drupalCreateUser(array('create page content')); $this->drupalLogin($this->web_user); - // Get the form for adding a 'page' node. Submit an "add another item" AJAX + // Get the form for adding a 'page' node. Submit an "add another item" Ajax // submission and verify it worked by ensuring the updated page has two text // field items in the field for which we just added an item. $this->drupalGet('node/add/page'); $this->drupalPostAJAX(NULL, array(), array('field_ajax_test_add_more' => t('Add another item')), 'system/ajax', array(), array(), 'page-node-form'); $this->assert(count($this->xpath('//div[contains(@class, "field-name-field-ajax-test")]//input[@type="text"]')) == 2, t('AJAX submission succeeded.')); - // Submit the form with the non-AJAX "Save" button, leaving the title field + // Submit the form with the non-Ajax "Save" button, leaving the title field // blank to trigger a validation error, and ensure that a validation error // occurred, because this test is for testing what happens when a form is // re-rendered without being re-built, which is what happens when there's diff --git a/modules/simpletest/tests/form_test.file.inc b/modules/simpletest/tests/form_test.file.inc index 808863ede..f9197ead2 100644 --- a/modules/simpletest/tests/form_test.file.inc +++ b/modules/simpletest/tests/form_test.file.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -11,7 +10,7 @@ * hook_menu(). */ function form_test_load_include_menu($form, &$form_state) { - // Submit the form via AJAX. That way the FAPI has to care about including + // Submit the form via Ajax. That way the FAPI has to care about including // the file specified in hook_menu(). $ajax_wrapper_id = drupal_html_id('form-test-load-include-menu-ajax-wrapper'); $form['ajax_wrapper'] = array( @@ -43,7 +42,7 @@ function form_test_load_include_submit($form, $form_state) { function form_test_load_include_menu_ajax($form) { // We don't need to return anything, since #ajax['method'] is 'append', which // does not remove the original #ajax['wrapper'] element, and status messages - // are automatically added by the AJAX framework as long as there's a wrapper + // are automatically added by the Ajax framework as long as there's a wrapper // element to add them to. return ''; } diff --git a/modules/simpletest/tests/form_test.info b/modules/simpletest/tests/form_test.info index 16845f072..ac1d864d1 100644 --- a/modules/simpletest/tests/form_test.info +++ b/modules/simpletest/tests/form_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "FormAPI Test" description = "Support module for Form API tests." package = Testing diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module index f908c212f..00be7d2e6 100644 --- a/modules/simpletest/tests/form_test.module +++ b/modules/simpletest/tests/form_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/graph.test b/modules/simpletest/tests/graph.test index 36d91bf35..c190161b4 100644 --- a/modules/simpletest/tests/graph.test +++ b/modules/simpletest/tests/graph.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/http.php b/modules/simpletest/tests/http.php index 0c5f1eb78..a22938d9b 100644 --- a/modules/simpletest/tests/http.php +++ b/modules/simpletest/tests/http.php @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/https.php b/modules/simpletest/tests/https.php index ba618c151..b5ffab693 100644 --- a/modules/simpletest/tests/https.php +++ b/modules/simpletest/tests/https.php @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/image.test b/modules/simpletest/tests/image.test index b8c88e080..60599bee5 100644 --- a/modules/simpletest/tests/image.test +++ b/modules/simpletest/tests/image.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/image_test.info b/modules/simpletest/tests/image_test.info index ded61571a..a9ef05ab5 100644 --- a/modules/simpletest/tests/image_test.info +++ b/modules/simpletest/tests/image_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Image test" description = "Support module for image toolkit tests." package = Testing diff --git a/modules/simpletest/tests/image_test.module b/modules/simpletest/tests/image_test.module index 75c1b23ef..de640f0ba 100644 --- a/modules/simpletest/tests/image_test.module +++ b/modules/simpletest/tests/image_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/lock.test b/modules/simpletest/tests/lock.test index d9fc53f75..0b423ffdd 100644 --- a/modules/simpletest/tests/lock.test +++ b/modules/simpletest/tests/lock.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Tests for the lock system. diff --git a/modules/simpletest/tests/mail.test b/modules/simpletest/tests/mail.test index 48b61c3c7..8a7b152d9 100644 --- a/modules/simpletest/tests/mail.test +++ b/modules/simpletest/tests/mail.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Test the Drupal mailing system. diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test index c25240e99..5642fcee0 100644 --- a/modules/simpletest/tests/menu.test +++ b/modules/simpletest/tests/menu.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -35,6 +34,18 @@ class MenuRouterTestCase extends DrupalWebTestCase { } /** + * Tests page title of MENU_CALLBACKs. + */ + function testTitleMenuCallback() { + // Verify that the menu router item title is not visible. + $this->drupalGet(''); + $this->assertNoText(t('Menu Callback Title')); + // Verify that the menu router item title is output as page title. + $this->drupalGet('menu_callback_title'); + $this->assertText(t('Menu Callback Title')); + } + + /** * Test the theme callback when it is set to use an administrative theme. */ function testThemeCallbackAdministrative() { @@ -846,6 +857,64 @@ class MenuTreeDataTestCase extends DrupalUnitTestCase { } /** + * Menu tree output related tests. + */ +class MenuTreeOutputTestCase extends DrupalWebTestCase { + /** + * Dummy link structure acceptable for menu_tree_output(). + */ + var $tree_data = array( + '1'=> array( + 'link' => array( 'menu_name' => 'main-menu', 'mlid' => 1, 'hidden'=>0, 'has_children' => 1, 'title' => 'Item 1', 'in_active_trail' => 1, 'access'=>1, 'href' => 'a', 'localized_options' => array('attributes' => array('title' =>'')) ), + 'below' => array( + '2' => array('link' => array( 'menu_name' => 'main-menu', 'mlid' => 2, 'hidden'=>0, 'has_children' => 1, 'title' => 'Item 2', 'in_active_trail' => 1, 'access'=>1, 'href' => 'a/b', 'localized_options' => array('attributes' => array('title' =>'')) ), + 'below' => array( + '3' => array('link' => array( 'menu_name' => 'main-menu', 'mlid' => 3, 'hidden'=>0, 'has_children' => 0, 'title' => 'Item 3', 'in_active_trail' => 0, 'access'=>1, 'href' => 'a/b/c', 'localized_options' => array('attributes' => array('title' =>'')) ), + 'below' => array() ), + '4' => array('link' => array( 'menu_name' => 'main-menu', 'mlid' => 4, 'hidden'=>0, 'has_children' => 0, 'title' => 'Item 4', 'in_active_trail' => 0, 'access'=>1, 'href' => 'a/b/d', 'localized_options' => array('attributes' => array('title' =>'')) ), + 'below' => array() ) + ) + ) + ) + ), + '5' => array('link' => array( 'menu_name' => 'main-menu', 'mlid' => 5, 'hidden'=>1, 'has_children' => 0, 'title' => 'Item 5', 'in_active_trail' => 0, 'access'=>1, 'href' => 'e', 'localized_options' => array('attributes' => array('title' =>'')) ), 'below' => array( ) ), + '6' => array('link' => array( 'menu_name' => 'main-menu', 'mlid' => 6, 'hidden'=>0, 'has_children' => 0, 'title' => 'Item 6', 'in_active_trail' => 0, 'access'=>0, 'href' => 'f', 'localized_options' => array('attributes' => array('title' =>'')) ), 'below' => array( ) ), + '7' => array('link' => array( 'menu_name' => 'main-menu', 'mlid' => 7, 'hidden'=>0, 'has_children' => 0, 'title' => 'Item 7', 'in_active_trail' => 0, 'access'=>1, 'href' => 'g', 'localized_options' => array('attributes' => array('title' =>'')) ), 'below' => array( ) ) + ); + + public static function getInfo() { + return array( + 'name' => 'Menu tree output', + 'description' => 'Tests menu tree output functions.', + 'group' => 'Menu', + ); + } + + function setUp() { + parent::setUp(); + } + + /** + * Validate the generation of a proper menu tree output. + */ + function testMenuTreeData() { + $output = menu_tree_output($this->tree_data); + + // Validate that the - in main-menu is changed into an underscore + $this->assertEqual( $output['1']['#theme'], 'menu_link__main_menu', t('Hyphen is changed to a dash on menu_link')); + $this->assertEqual( $output['#theme_wrappers'][0], 'menu_tree__main_menu', t('Hyphen is changed to a dash on menu_tree wrapper')); + // Looking for child items in the data + $this->assertEqual( $output['1']['#below']['2']['#href'], 'a/b', t('Checking the href on a child item')); + $this->assertTrue( in_array('active-trail',$output['1']['#below']['2']['#attributes']['class']) , t('Checking the active trail class')); + // Validate that the hidden and no access items are missing + $this->assertFalse( isset($output['5']), t('Hidden item should be missing')); + $this->assertFalse( isset($output['6']), t('False access should be missing')); + // Item 7 is after a couple hidden items. Just to make sure that 5 and 6 are skipped and 7 still included + $this->assertTrue( isset($output['7']), t('Item after hidden items is present')); + } +} + +/** * Menu breadcrumbs related tests. */ class MenuBreadcrumbTestCase extends DrupalWebTestCase { diff --git a/modules/simpletest/tests/menu_test.info b/modules/simpletest/tests/menu_test.info index a9f519172..c1c39c103 100644 --- a/modules/simpletest/tests/menu_test.info +++ b/modules/simpletest/tests/menu_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Hook menu tests" description = "Support module for menu hook testing." package = Testing diff --git a/modules/simpletest/tests/menu_test.module b/modules/simpletest/tests/menu_test.module index 65d5fdaf5..3046a0416 100644 --- a/modules/simpletest/tests/menu_test.module +++ b/modules/simpletest/tests/menu_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -16,6 +15,13 @@ function menu_test_menu() { 'page callback' => 'node_save', 'menu_name' => menu_test_menu_name(), ); + // This item is of type MENU_CALLBACK with no parents to test title. + $items['menu_callback_title'] = array( + 'title' => 'Menu Callback Title', + 'page callback' => 'menu_test_callback', + 'type' => MENU_CALLBACK, + 'access arguments' => array('access content'), + ); // Use FALSE as 'title callback' to bypass t(). $items['menu_no_title_callback'] = array( 'title' => 'A title with @placeholder', diff --git a/modules/simpletest/tests/module.test b/modules/simpletest/tests/module.test index 711a739ab..f55c08af4 100644 --- a/modules/simpletest/tests/module.test +++ b/modules/simpletest/tests/module.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -212,6 +211,27 @@ class ModuleUnitTest extends DrupalWebTestCase { $uninstalled_modules = variable_get('test_module_uninstall_order', array()); $this->assertTrue(in_array('comment', $uninstalled_modules), t('Comment module is in the list of uninstalled modules.')); $this->assertFalse(in_array($profile, $uninstalled_modules), t('The installation profile is not in the list of uninstalled modules.')); + + // Enable forum module again, which should enable both the poll module and + // php module. But, this time do it with poll module declaring a dependency + // on a specific version of php module in its info file. Make sure that + // module_enable() still works. + variable_set('dependency_test', 'version dependency'); + drupal_static_reset('system_rebuild_module_data'); + $result = module_enable(array('forum')); + $this->assertTrue($result, t('module_enable() returns the correct value.')); + // Verify that the fake dependency chain was installed. + $this->assertTrue(module_exists('poll') && module_exists('php'), t('Dependency chain was installed by module_enable().')); + // Verify that the original module was installed. + $this->assertTrue(module_exists('forum'), t('Module installation with version dependencies succeeded.')); + // Finally, verify that the modules were enabled in the correct order. + $enable_order = variable_get('test_module_enable_order', array()); + $php_position = array_search('php', $enable_order); + $poll_position = array_search('poll', $enable_order); + $forum_position = array_search('forum', $enable_order); + $php_before_poll = $php_position !== FALSE && $poll_position !== FALSE && $php_position < $poll_position; + $poll_before_forum = $poll_position !== FALSE && $forum_position !== FALSE && $poll_position < $forum_position; + $this->assertTrue($php_before_poll && $poll_before_forum, t('Modules were enabled in the correct order by module_enable().')); } } diff --git a/modules/simpletest/tests/module_test.file.inc b/modules/simpletest/tests/module_test.file.inc index 72210d768..c0d3ec41e 100644 --- a/modules/simpletest/tests/module_test.file.inc +++ b/modules/simpletest/tests/module_test.file.inc @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/module_test.info b/modules/simpletest/tests/module_test.info index 8d0c4e85b..0a0f3c085 100644 --- a/modules/simpletest/tests/module_test.info +++ b/modules/simpletest/tests/module_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Module test" description = "Support module for module system testing." package = Testing diff --git a/modules/simpletest/tests/module_test.install b/modules/simpletest/tests/module_test.install index 5f8e76b70..4cc09df5a 100644 --- a/modules/simpletest/tests/module_test.install +++ b/modules/simpletest/tests/module_test.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/module_test.module b/modules/simpletest/tests/module_test.module index d3f46e2cb..d781350b3 100644 --- a/modules/simpletest/tests/module_test.module +++ b/modules/simpletest/tests/module_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_permission(). @@ -36,6 +35,20 @@ function module_test_system_info_alter(&$info, $file, $type) { $info['dependencies'][] = 'php'; } } + elseif (variable_get('dependency_test', FALSE) == 'version dependency') { + if ($file->name == 'forum') { + // Make the forum module depend on poll. + $info['dependencies'][] = 'poll'; + } + elseif ($file->name == 'poll') { + // Make poll depend on a specific version of php module. + $info['dependencies'][] = 'php (1.x)'; + } + elseif ($file->name == 'php') { + // Set php module to a version compatible with the above. + $info['version'] = '7.x-1.0'; + } + } if ($file->name == 'seven' && $type == 'theme') { $info['regions']['test_region'] = t('Test region'); } diff --git a/modules/simpletest/tests/password.test b/modules/simpletest/tests/password.test index 20e77f28d..e100c2ef6 100644 --- a/modules/simpletest/tests/password.test +++ b/modules/simpletest/tests/password.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/path.test b/modules/simpletest/tests/path.test index 7368cd1d4..0c8ecdac4 100644 --- a/modules/simpletest/tests/path.test +++ b/modules/simpletest/tests/path.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/registry.test b/modules/simpletest/tests/registry.test index 48829bd80..bcd8d4e0d 100644 --- a/modules/simpletest/tests/registry.test +++ b/modules/simpletest/tests/registry.test @@ -1,5 +1,4 @@ <?php -// $Id$ class RegistryParseFileTestCase extends DrupalWebTestCase { public static function getInfo() { diff --git a/modules/simpletest/tests/requirements1_test.info b/modules/simpletest/tests/requirements1_test.info index 0a1cf3a1f..ef3953517 100644 --- a/modules/simpletest/tests/requirements1_test.info +++ b/modules/simpletest/tests/requirements1_test.info @@ -1,4 +1,3 @@ -; $Id$ name = Requirements 1 Test description = "Tests that a module is not installed when it fails hook_requirements('install')." package = Core diff --git a/modules/simpletest/tests/requirements1_test.install b/modules/simpletest/tests/requirements1_test.install index 28b7fb666..651d911ab 100644 --- a/modules/simpletest/tests/requirements1_test.install +++ b/modules/simpletest/tests/requirements1_test.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_requirements(). diff --git a/modules/simpletest/tests/requirements1_test.module b/modules/simpletest/tests/requirements1_test.module index 20bfc0a35..e52266b2e 100644 --- a/modules/simpletest/tests/requirements1_test.module +++ b/modules/simpletest/tests/requirements1_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/requirements2_test.info b/modules/simpletest/tests/requirements2_test.info index bcf613c34..0cf86478e 100644 --- a/modules/simpletest/tests/requirements2_test.info +++ b/modules/simpletest/tests/requirements2_test.info @@ -1,4 +1,3 @@ -; $Id$ name = Requirements 2 Test description = "Tests that a module is not installed when the one it depends on fails hook_requirements('install)." dependencies[] = requirements1_test diff --git a/modules/simpletest/tests/requirements2_test.module b/modules/simpletest/tests/requirements2_test.module index 03eb94dd7..a4f430515 100644 --- a/modules/simpletest/tests/requirements2_test.module +++ b/modules/simpletest/tests/requirements2_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/schema.test b/modules/simpletest/tests/schema.test index 1dfa445ad..8945117cb 100644 --- a/modules/simpletest/tests/schema.test +++ b/modules/simpletest/tests/schema.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/session.test b/modules/simpletest/tests/session.test index a42adcf36..bc72e5c5e 100644 --- a/modules/simpletest/tests/session.test +++ b/modules/simpletest/tests/session.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/session_test.info b/modules/simpletest/tests/session_test.info index 2ae4b826b..327215661 100644 --- a/modules/simpletest/tests/session_test.info +++ b/modules/simpletest/tests/session_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Session test" description = "Support module for session data testing." package = Testing diff --git a/modules/simpletest/tests/session_test.module b/modules/simpletest/tests/session_test.module index 61aa3ae95..689ff099a 100644 --- a/modules/simpletest/tests/session_test.module +++ b/modules/simpletest/tests/session_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_menu(). diff --git a/modules/simpletest/tests/system.base.css b/modules/simpletest/tests/system.base.css index 6ac23b1d3..c14ae9b27 100644 --- a/modules/simpletest/tests/system.base.css +++ b/modules/simpletest/tests/system.base.css @@ -1,4 +1,3 @@ -/* $Id$ */ /** * This file is for testing CSS file override in diff --git a/modules/simpletest/tests/system_dependencies_test.info b/modules/simpletest/tests/system_dependencies_test.info index 55d8971b3..5b4bd106b 100644 --- a/modules/simpletest/tests/system_dependencies_test.info +++ b/modules/simpletest/tests/system_dependencies_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "System dependency test" description = "Support module for testing system dependencies." package = Testing diff --git a/modules/simpletest/tests/system_dependencies_test.module b/modules/simpletest/tests/system_dependencies_test.module index 13bb990c4..b3d9bbc7f 100644 --- a/modules/simpletest/tests/system_dependencies_test.module +++ b/modules/simpletest/tests/system_dependencies_test.module @@ -1,2 +1 @@ <?php -// $Id$ diff --git a/modules/simpletest/tests/system_test.info b/modules/simpletest/tests/system_test.info index f70a1a79f..c4ad53695 100644 --- a/modules/simpletest/tests/system_test.info +++ b/modules/simpletest/tests/system_test.info @@ -1,4 +1,3 @@ -; $Id$ name = System test description = Support module for system testing. package = Testing diff --git a/modules/simpletest/tests/system_test.module b/modules/simpletest/tests/system_test.module index 4d7042e72..76841fb6b 100644 --- a/modules/simpletest/tests/system_test.module +++ b/modules/simpletest/tests/system_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_menu(). diff --git a/modules/simpletest/tests/tablesort.test b/modules/simpletest/tests/tablesort.test new file mode 100644 index 000000000..9c068f861 --- /dev/null +++ b/modules/simpletest/tests/tablesort.test @@ -0,0 +1,166 @@ +<?php + +/** + * @file + * Various tablesort tests. + */ + +/** + * Test unicode handling features implemented in unicode.inc. + */ +class TableSortTest extends DrupalUnitTestCase { + + /** + * Storage for initial value of $_GET. + * + * @var array + */ + protected $GET = array(); + + public static function getInfo() { + return array( + 'name' => 'Tablesort', + 'description' => 'Tests table sorting.', + 'group' => 'System', + ); + } + + function setUp() { + // Save the original $_GET to be restored later. + $this->GET = $_GET; + + parent::setUp(); + } + + function tearDown() { + // Revert $_GET. + $_GET = $this->GET; + + parent::tearDown(); + } + + /** + * Test tablesort_init(). + */ + function testTableSortInit() { + + // Test simple table headers. + + $headers = array('foo', 'bar', 'baz'); + // Reset $_GET to prevent parameters from Simpletest and Batch API ending + // up in $ts['query']. + $_GET = array('q' => 'jahwohl'); + $expected_ts = array( + 'name' => 'foo', + 'sql' => '', + 'sort' => 'asc', + 'query' => array(), + ); + $ts = tablesort_init($headers); + $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->assertEqual($ts, $expected_ts, t('Simple table headers sorted correctly.')); + + // Test with simple table headers plus $_GET parameters that should _not_ + // override the default. + + $_GET = array( + 'q' => 'jahwohl', + // This should not override the table order because only complex + // headers are overridable. + 'order' => 'bar', + ); + $ts = tablesort_init($headers); + $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->assertEqual($ts, $expected_ts, t('Simple table headers plus non-overriding $_GET parameters sorted correctly.')); + + // Test with simple table headers plus $_GET parameters that _should_ + // override the default. + + $_GET = array( + 'q' => 'jahwohl', + 'sort' => 'DESC', + // Add an unrelated parameter to ensure that tablesort will include + // it in the links that it creates. + 'alpha' => 'beta', + ); + $expected_ts['sort'] = 'desc'; + $expected_ts['query'] = array('alpha' => 'beta'); + $ts = tablesort_init($headers); + $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->assertEqual($ts, $expected_ts, t('Simple table headers plus $_GET parameters sorted correctly.')); + + // Test complex table headers. + + $headers = array( + 'foo', + array( + 'data' => '1', + 'field' => 'one', + 'sort' => 'asc', + 'colspan' => 1, + ), + array( + 'data' => '2', + 'field' => 'two', + 'sort' => 'desc', + ), + ); + // Reset $_GET from previous assertion. + $_GET = array( + 'q' => 'jahwohl', + 'order' => '2', + ); + $ts = tablesort_init($headers); + $expected_ts = array( + 'name' => '2', + 'sql' => 'two', + 'sort' => 'desc', + 'query' => array(), + ); + $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->assertEqual($ts, $expected_ts, t('Complex table headers sorted correctly.')); + + // Test complex table headers plus $_GET parameters that should _not_ + // override the default. + + $_GET = array( + 'q' => 'jahwohl', + // This should not override the table order because this header does not + // exist. + 'order' => 'bar', + ); + $ts = tablesort_init($headers); + $expected_ts = array( + 'name' => '1', + 'sql' => 'one', + 'sort' => 'asc', + 'query' => array(), + ); + $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->assertEqual($ts, $expected_ts, t('Complex table headers plus non-overriding $_GET parameters sorted correctly.')); + unset($_GET['sort'], $_GET['order'], $_GET['alpha']); + + // Test complex table headers plus $_GET parameters that _should_ + // override the default. + + $_GET = array( + 'q' => 'jahwohl', + 'order' => '1', + 'sort' => 'ASC', + // Add an unrelated parameter to ensure that tablesort will include + // it in the links that it creates. + 'alpha' => 'beta', + ); + $expected_ts = array( + 'name' => '1', + 'sql' => 'one', + 'sort' => 'asc', + 'query' => array('alpha' => 'beta'), + ); + $ts = tablesort_init($headers); + $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE))))); + $this->assertEqual($ts, $expected_ts, t('Complex table headers plus $_GET parameters sorted correctly.')); + unset($_GET['sort'], $_GET['order'], $_GET['alpha']); + + } +} diff --git a/modules/simpletest/tests/taxonomy_test.info b/modules/simpletest/tests/taxonomy_test.info index eaa9c04f5..e5bb4f162 100644 --- a/modules/simpletest/tests/taxonomy_test.info +++ b/modules/simpletest/tests/taxonomy_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Taxonomy test module" description = "Tests functions and hooks not used in core". package = Testing diff --git a/modules/simpletest/tests/taxonomy_test.install b/modules/simpletest/tests/taxonomy_test.install index 420be1b78..d5c94da5f 100644 --- a/modules/simpletest/tests/taxonomy_test.install +++ b/modules/simpletest/tests/taxonomy_test.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/taxonomy_test.module b/modules/simpletest/tests/taxonomy_test.module index d524fb87c..aae13a2d4 100644 --- a/modules/simpletest/tests/taxonomy_test.module +++ b/modules/simpletest/tests/taxonomy_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test index d7d734bb2..d0ad77d78 100644 --- a/modules/simpletest/tests/theme.test +++ b/modules/simpletest/tests/theme.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/theme_test.info b/modules/simpletest/tests/theme_test.info index d3b8a7edf..72cd23bc1 100644 --- a/modules/simpletest/tests/theme_test.info +++ b/modules/simpletest/tests/theme_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "Theme test" description = "Support module for theme system testing." package = Testing diff --git a/modules/simpletest/tests/theme_test.module b/modules/simpletest/tests/theme_test.module index ff525ec34..160d192dd 100644 --- a/modules/simpletest/tests/theme_test.module +++ b/modules/simpletest/tests/theme_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Implements hook_menu(). diff --git a/modules/simpletest/tests/unicode.test b/modules/simpletest/tests/unicode.test index 6e39d11a4..47a4938fe 100644 --- a/modules/simpletest/tests/unicode.test +++ b/modules/simpletest/tests/unicode.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/update.test b/modules/simpletest/tests/update.test index c4d382847..966efff22 100644 --- a/modules/simpletest/tests/update.test +++ b/modules/simpletest/tests/update.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/update_test_1.info b/modules/simpletest/tests/update_test_1.info index a55878edf..d9764eee0 100644 --- a/modules/simpletest/tests/update_test_1.info +++ b/modules/simpletest/tests/update_test_1.info @@ -1,4 +1,3 @@ -; $Id$ name = "Update test" description = "Support module for update testing." package = Testing diff --git a/modules/simpletest/tests/update_test_1.install b/modules/simpletest/tests/update_test_1.install index ac69a358e..f4a86c7c4 100644 --- a/modules/simpletest/tests/update_test_1.install +++ b/modules/simpletest/tests/update_test_1.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/update_test_1.module b/modules/simpletest/tests/update_test_1.module index 13bb990c4..b3d9bbc7f 100644 --- a/modules/simpletest/tests/update_test_1.module +++ b/modules/simpletest/tests/update_test_1.module @@ -1,2 +1 @@ <?php -// $Id$ diff --git a/modules/simpletest/tests/update_test_2.info b/modules/simpletest/tests/update_test_2.info index a55878edf..d9764eee0 100644 --- a/modules/simpletest/tests/update_test_2.info +++ b/modules/simpletest/tests/update_test_2.info @@ -1,4 +1,3 @@ -; $Id$ name = "Update test" description = "Support module for update testing." package = Testing diff --git a/modules/simpletest/tests/update_test_2.install b/modules/simpletest/tests/update_test_2.install index e12b77b93..9c076ff6c 100644 --- a/modules/simpletest/tests/update_test_2.install +++ b/modules/simpletest/tests/update_test_2.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/update_test_2.module b/modules/simpletest/tests/update_test_2.module index 13bb990c4..b3d9bbc7f 100644 --- a/modules/simpletest/tests/update_test_2.module +++ b/modules/simpletest/tests/update_test_2.module @@ -1,2 +1 @@ <?php -// $Id$ diff --git a/modules/simpletest/tests/update_test_3.info b/modules/simpletest/tests/update_test_3.info index a55878edf..d9764eee0 100644 --- a/modules/simpletest/tests/update_test_3.info +++ b/modules/simpletest/tests/update_test_3.info @@ -1,4 +1,3 @@ -; $Id$ name = "Update test" description = "Support module for update testing." package = Testing diff --git a/modules/simpletest/tests/update_test_3.install b/modules/simpletest/tests/update_test_3.install index 195412327..c3f6b757c 100644 --- a/modules/simpletest/tests/update_test_3.install +++ b/modules/simpletest/tests/update_test_3.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/update_test_3.module b/modules/simpletest/tests/update_test_3.module index 13bb990c4..b3d9bbc7f 100644 --- a/modules/simpletest/tests/update_test_3.module +++ b/modules/simpletest/tests/update_test_3.module @@ -1,2 +1 @@ <?php -// $Id$ diff --git a/modules/simpletest/tests/upgrade/drupal-6.bare.database.php b/modules/simpletest/tests/upgrade/drupal-6.bare.database.php index 7e78e1b99..40c75627a 100644 --- a/modules/simpletest/tests/upgrade/drupal-6.bare.database.php +++ b/modules/simpletest/tests/upgrade/drupal-6.bare.database.php @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file @@ -7902,7 +7901,7 @@ db_insert('users')->fields(array( 'access' => '0', 'login' => '0', 'status' => '0', - 'timezone' => NULL, + 'timezone' => '-21600', 'language' => '', 'picture' => '', 'init' => '', @@ -7923,7 +7922,7 @@ db_insert('users')->fields(array( 'access' => '1277671612', 'login' => '1277671612', 'status' => '1', - 'timezone' => NULL, + 'timezone' => '-21600', 'language' => '', 'picture' => '', 'init' => 'admin@example.com', diff --git a/modules/simpletest/tests/upgrade/drupal-6.filled.database.php b/modules/simpletest/tests/upgrade/drupal-6.filled.database.php index 7afa04442..a91628136 100644 --- a/modules/simpletest/tests/upgrade/drupal-6.filled.database.php +++ b/modules/simpletest/tests/upgrade/drupal-6.filled.database.php @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/upgrade/drupal-6.forum.database.php b/modules/simpletest/tests/upgrade/drupal-6.forum.database.php new file mode 100644 index 000000000..07dfcb341 --- /dev/null +++ b/modules/simpletest/tests/upgrade/drupal-6.forum.database.php @@ -0,0 +1,261 @@ +<?php +// $Id$ + +/** + * Database additions for forum tests. + */ + +db_create_table('forum', array( + 'fields' => array( + 'nid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'vid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'tid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'nid' => array( + 'nid', + ), + 'tid' => array( + 'tid', + ), + ), + 'primary key' => array( + 'vid', + ), + 'module' => 'forum', + 'name' => 'forum', +)); +db_insert('forum')->fields(array( + 'nid', + 'vid', + 'tid', +)) +->values(array( + 'nid' => '51', + 'vid' => '61', + 'tid' => '81', +)) +->execute(); + +db_insert('node')->fields(array( + 'nid', + 'vid', + 'type', + 'language', + 'title', + 'uid', + 'status', + 'created', + 'changed', + 'comment', + 'promote', + 'moderate', + 'sticky', + 'tnid', + 'translate', +)) +->values(array( + 'nid' => '51', + 'vid' => '61', + 'type' => 'forum', + 'language' => '', + 'title' => 'Apples', + 'uid' => '1', + 'status' => '1', + 'created' => '1298363952', + 'changed' => '1298363952', + 'comment' => '2', + 'promote' => '0', + 'moderate' => '0', + 'sticky' => '0', + 'tnid' => '0', + 'translate' => '0', +)) +->execute(); + +db_insert('node_revisions')->fields(array( + 'nid', + 'vid', + 'uid', + 'title', + 'body', + 'teaser', + 'log', + 'timestamp', + 'format', +)) +->values(array( + 'nid' => '51', + 'vid' => '61', + 'uid' => '1', + 'title' => 'Apples', + 'body' => 'A fruit.', + 'teaser' => 'A fruit.', + 'log' => '', + 'timestamp' => '1298363952', + 'format' => '1', +)) +->execute(); + +db_insert('node_comment_statistics')->fields(array( + 'nid', + 'last_comment_timestamp', + 'last_comment_name', + 'last_comment_uid', + 'comment_count', +)) +->values(array( + 'nid' => '51', + 'last_comment_timestamp' => '1298363952', + 'last_comment_name' => NULL, + 'last_comment_uid' => '1', + 'comment_count' => '0', +)) +->execute(); + +db_insert('node_type')->fields(array( + 'type', + 'name', + 'module', + 'description', + 'help', + 'has_title', + 'title_label', + 'has_body', + 'body_label', + 'min_word_count', + 'custom', + 'modified', + 'locked', + 'orig_type', +)) +->values(array( + 'type' => 'forum', + 'name' => 'Forum topic', + 'module' => 'forum', + 'description' => 'A <em>forum topic</em> is the initial post to a new discussion thread within a forum.', + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Subject', + 'has_body' => '1', + 'body_label' => 'Body', + 'min_word_count' => '0', + 'custom' => '0', + 'modified' => '0', + 'locked' => '1', + 'orig_type' => 'forum', +)) +->execute(); + +db_update('system')->fields(array( + 'schema_version' => '6000', + 'status' => '1', +)) +->condition('filename', 'modules/forum/forum.module') +->execute(); + +db_insert('term_data')->fields(array( + 'tid', + 'vid', + 'name', + 'description', + 'weight', +)) +->values(array( + 'tid' => '81', + 'vid' => '101', + 'name' => 'Fruits', + 'description' => 'Fruits.', + 'weight' => '0', +)) +->execute(); + +db_insert('term_hierarchy')->fields(array( + 'tid', + 'parent', +)) +->values(array( + 'tid' => '81', + 'parent' => '0', +)) +->execute(); + +db_insert('term_node')->fields(array( + 'nid', + 'vid', + 'tid', +)) +->values(array( + 'nid' => '51', + 'vid' => '61', + 'tid' => '81', +)) +->execute(); + +db_insert('variable')->fields(array( + 'name', + 'value', +)) +->values(array( + 'name' => 'forum_nav_vocabulary', + 'value' => 's:3:"101";', +)) +->values(array( + 'name' => 'forum_containers', + 'value' => 'a:1:{i:0;s:3:"101";}', +)) +->execute(); + +db_insert('vocabulary')->fields(array( + 'vid', + 'name', + 'description', + 'help', + 'relations', + 'hierarchy', + 'multiple', + 'required', + 'tags', + 'module', + 'weight', +)) +->values(array( + 'vid' => '101', + 'name' => 'Upgrade test for forums', + 'description' => 'Vocabulary used for Forums. The name is changed from the default "Forums" so that the upgrade path may be tested.', + 'help' => '', + 'relations' => '1', + 'hierarchy' => '1', + 'multiple' => '0', + 'required' => '0', + 'tags' => '0', + 'module' => 'forum', + 'weight' => '-10', +)) +->execute(); + +db_insert('vocabulary_node_types')->fields(array( + 'vid', + 'type', +)) +->values(array( + 'vid' => '101', + 'type' => 'forum', +)) +->execute(); + diff --git a/modules/simpletest/tests/upgrade/drupal-6.locale.database.php b/modules/simpletest/tests/upgrade/drupal-6.locale.database.php index d4ea09f73..c8af67121 100644 --- a/modules/simpletest/tests/upgrade/drupal-6.locale.database.php +++ b/modules/simpletest/tests/upgrade/drupal-6.locale.database.php @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Database additions for locale tests. diff --git a/modules/simpletest/tests/upgrade/drupal-6.upload.database.php b/modules/simpletest/tests/upgrade/drupal-6.upload.database.php index 94733ed4c..493483f3d 100644 --- a/modules/simpletest/tests/upgrade/drupal-6.upload.database.php +++ b/modules/simpletest/tests/upgrade/drupal-6.upload.database.php @@ -1,5 +1,4 @@ <?php -// $Id$ db_insert('files')->fields(array( 'fid', diff --git a/modules/simpletest/tests/upgrade/upgrade.comment.test b/modules/simpletest/tests/upgrade/upgrade.comment.test index db899427b..5fcf0b4b2 100644 --- a/modules/simpletest/tests/upgrade/upgrade.comment.test +++ b/modules/simpletest/tests/upgrade/upgrade.comment.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Upgrade test for comment.module. diff --git a/modules/simpletest/tests/upgrade/upgrade.filter.test b/modules/simpletest/tests/upgrade/upgrade.filter.test index 732e757e7..86248b74c 100644 --- a/modules/simpletest/tests/upgrade/upgrade.filter.test +++ b/modules/simpletest/tests/upgrade/upgrade.filter.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Upgrade test for filter format identifiers. diff --git a/modules/simpletest/tests/upgrade/upgrade.forum.test b/modules/simpletest/tests/upgrade/upgrade.forum.test new file mode 100644 index 000000000..827988dab --- /dev/null +++ b/modules/simpletest/tests/upgrade/upgrade.forum.test @@ -0,0 +1,61 @@ +<?php +// $Id$ + +/** + * Upgrade test for forum.module. + */ +class ForumUpgradePathTestCase extends UpgradePathTestCase { + public static function getInfo() { + return array( + 'name' => 'Forum upgrade path', + 'description' => 'Upgrade path tests for the Forum module.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + // Path to the database dump files. + $this->databaseDumpFiles = array( + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php', + drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.forum.database.php', + ); + parent::setUp(); + + $this->uninstallModulesExcept(array('comment', 'forum', 'taxonomy')); + } + + /** + * Test a successful upgrade (no negotiation). + */ + public function testForumUpgrade() { + $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.')); + + // Work around http://drupal.org/node/931512 + $this->drupalPost('admin/structure/types/manage/forum/fields', array(), t('Save')); + + // The D6 database forum vocabulary contains the term "Fruits" with id 81. + $tid = 81; + $this->drupalGet("forum/$tid"); + + // There is one forum topic in Fruits, with the title "Apples". + $this->clickLink('Apples'); + $this->clickLink('Edit'); + + // Add a forum topic "Bananas" to the "Fruits" forum. + $edit = array( + 'title' => $title = 'Bananas', + 'body[' . LANGUAGE_NONE . '][0][value]' => $body = 'It is another fruit.', + ); + $this->drupalPost("node/add/forum/$tid", $edit, t('Save')); + $type = t('Forum topic'); + $this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), t('Forum topic was created')); + + // Retrieve node object, ensure that the topic was created and in the proper forum. + $node = $this->drupalGetNodeByTitle($title); + $this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title))); + $this->assertEqual($node->taxonomy_forums[LANGUAGE_NONE][0]['tid'], $tid, 'Saved forum topic was in the expected forum'); + + $this->drupalGet("forum/$tid"); + $this->assertText('Bananas'); + } +} diff --git a/modules/simpletest/tests/upgrade/upgrade.locale.test b/modules/simpletest/tests/upgrade/upgrade.locale.test index 66ea14e52..aec559de6 100644 --- a/modules/simpletest/tests/upgrade/upgrade.locale.test +++ b/modules/simpletest/tests/upgrade/upgrade.locale.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Upgrade test for locale.module. diff --git a/modules/simpletest/tests/upgrade/upgrade.node.test b/modules/simpletest/tests/upgrade/upgrade.node.test index d2366b7f7..163dbef5e 100644 --- a/modules/simpletest/tests/upgrade/upgrade.node.test +++ b/modules/simpletest/tests/upgrade/upgrade.node.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Upgrade test for node bodies. diff --git a/modules/simpletest/tests/upgrade/upgrade.poll.test b/modules/simpletest/tests/upgrade/upgrade.poll.test index 12aff8bd8..9bbbf90a4 100644 --- a/modules/simpletest/tests/upgrade/upgrade.poll.test +++ b/modules/simpletest/tests/upgrade/upgrade.poll.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Upgrade test for poll.module. diff --git a/modules/simpletest/tests/upgrade/upgrade.taxonomy.test b/modules/simpletest/tests/upgrade/upgrade.taxonomy.test index 92db17e48..dadb98e5a 100644 --- a/modules/simpletest/tests/upgrade/upgrade.taxonomy.test +++ b/modules/simpletest/tests/upgrade/upgrade.taxonomy.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Test taxonomy upgrades. diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test index 263baff48..8a3da8188 100644 --- a/modules/simpletest/tests/upgrade/upgrade.test +++ b/modules/simpletest/tests/upgrade/upgrade.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Perform end-to-end tests of the upgrade path. diff --git a/modules/simpletest/tests/upgrade/upgrade.upload.test b/modules/simpletest/tests/upgrade/upgrade.upload.test index a0402a38e..e3e1dc21e 100644 --- a/modules/simpletest/tests/upgrade/upgrade.upload.test +++ b/modules/simpletest/tests/upgrade/upgrade.upload.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Upgrade test for comment.module. diff --git a/modules/simpletest/tests/url_alter_test.info b/modules/simpletest/tests/url_alter_test.info index 0d1deb2fb..a8e9474e1 100644 --- a/modules/simpletest/tests/url_alter_test.info +++ b/modules/simpletest/tests/url_alter_test.info @@ -1,4 +1,3 @@ -; $Id$ name = Url_alter tests description = A support modules for url_alter hook testing. core = 7.x diff --git a/modules/simpletest/tests/url_alter_test.install b/modules/simpletest/tests/url_alter_test.install index 89454f37e..6e09ab583 100644 --- a/modules/simpletest/tests/url_alter_test.install +++ b/modules/simpletest/tests/url_alter_test.install @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Impelement hook_install(). diff --git a/modules/simpletest/tests/url_alter_test.module b/modules/simpletest/tests/url_alter_test.module index da6cd635b..e229ab986 100644 --- a/modules/simpletest/tests/url_alter_test.module +++ b/modules/simpletest/tests/url_alter_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ /** * @file diff --git a/modules/simpletest/tests/xmlrpc.test b/modules/simpletest/tests/xmlrpc.test index 5069fe246..1b5bff384 100644 --- a/modules/simpletest/tests/xmlrpc.test +++ b/modules/simpletest/tests/xmlrpc.test @@ -1,5 +1,4 @@ <?php -// $Id$ /** * Perform basic XML-RPC tests that do not require addition callbacks. @@ -43,6 +42,16 @@ class XMLRPCBasicTestCase extends DrupalWebTestCase { } /** + * Ensure that system.methodSignature returns an array of signatures. + */ + protected function testMethodSignature() { + $url = url(NULL, array('absolute' => TRUE)) . 'xmlrpc.php'; + $signature = xmlrpc($url, array('system.methodSignature' => array('system.listMethods'))); + $this->assert(is_array($signature) && !empty($signature) && is_array($signature[0]), + t('system.methodSignature returns an array of signature arrays.')); + } + + /** * Ensure that XML-RPC correctly handles invalid messages when parsing. */ protected function testInvalidMessageParsing() { diff --git a/modules/simpletest/tests/xmlrpc_test.info b/modules/simpletest/tests/xmlrpc_test.info index 773015d3e..bddfc95fd 100644 --- a/modules/simpletest/tests/xmlrpc_test.info +++ b/modules/simpletest/tests/xmlrpc_test.info @@ -1,4 +1,3 @@ -; $Id$ name = "XML-RPC Test" description = "Support module for XML-RPC tests according to the validator1 specification." package = Testing diff --git a/modules/simpletest/tests/xmlrpc_test.module b/modules/simpletest/tests/xmlrpc_test.module index f52afe325..db8f113b6 100644 --- a/modules/simpletest/tests/xmlrpc_test.module +++ b/modules/simpletest/tests/xmlrpc_test.module @@ -1,5 +1,4 @@ <?php -// $Id$ function xmlrpc_test_arrayOfStructsTest($array) { $sum = 0; |